[PATCH 1/4] etnaviv: add support for extended texture formats

Wladimir J. van der Laan laanwj at gmail.com
Thu Jun 22 12:11:55 UTC 2017


On Wed, Jun 21, 2017 at 10:36:45PM +0200, Christian Gmeiner wrote:
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>

Reviewed-by: Wladimir J. van der Laan <laanwj at gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c  | 2 +-
>  src/gallium/drivers/etnaviv/etnaviv_format.h  | 1 +
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 3 +++
>  src/gallium/drivers/etnaviv/etnaviv_texture.c | 8 +++++---
>  4 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index 7c24386..e9cd104 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -231,7 +231,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>  uint32_t
>  translate_texture_format(enum pipe_format fmt)
>  {
> -   /* XXX with TEXTURE_FORMAT_EXT and swizzle on newer chips we can
> +   /* XXX with swizzle on newer chips we can
>      * support much more */
>     if (!formats[fmt].present)
>        return ETNA_NO_MATCH;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h b/src/gallium/drivers/etnaviv/etnaviv_format.h
> index 549dfda..1170d79 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
> @@ -31,6 +31,7 @@
>  #include <stdint.h>
>  
>  #define ETNA_NO_MATCH (~0)
> +#define EXT_FORMAT (1 << 31)
>  
>  uint32_t
>  translate_texture_format(enum pipe_format fmt);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 6c0735e..a69aef0 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -467,6 +467,9 @@ gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt)
>     if (fmt >= TEXTURE_FORMAT_DXT1 && fmt <= TEXTURE_FORMAT_DXT4_DXT5)
>        return VIV_FEATURE(screen, chipFeatures, DXT_TEXTURE_COMPRESSION);
>  
> +   if (fmt & EXT_FORMAT)
> +      return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
> +
>     return true;
>  }
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> index df77829..f973bcb 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> @@ -161,6 +161,8 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
>     struct etna_sampler_view *sv = CALLOC_STRUCT(etna_sampler_view);
>     struct etna_resource *res = etna_resource(prsc);
>     struct etna_context *ctx = etna_context(pctx);
> +   const uint32_t format = translate_texture_format(so->format);
> +   const bool ext = !!(format & EXT_FORMAT);
>  
>     if (!sv)
>        return NULL;
> @@ -191,8 +193,7 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
>     sv->base.context = pctx;
>  
>     /* merged with sampler state */
> -   sv->TE_SAMPLER_CONFIG0 =
> -      VIVS_TE_SAMPLER_CONFIG0_FORMAT(translate_texture_format(sv->base.format));
> +   sv->TE_SAMPLER_CONFIG0 = COND(!ext, VIVS_TE_SAMPLER_CONFIG0_FORMAT(format));
>     sv->TE_SAMPLER_CONFIG0_MASK = 0xffffffff;
>  
>     switch (sv->base.target) {
> @@ -215,7 +216,8 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
>        return NULL;
>     }
>  
> -   sv->TE_SAMPLER_CONFIG1 = VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_R(so->swizzle_r) |
> +   sv->TE_SAMPLER_CONFIG1 = COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
> +                            VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_R(so->swizzle_r) |
>                              VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_G(so->swizzle_g) |
>                              VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_B(so->swizzle_b) |
>                              VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A(so->swizzle_a) |
> -- 
> 2.9.4
> 


More information about the etnaviv mailing list