summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-06-21 22:36:45 +0200
committerChristian Gmeiner <[email protected]>2017-06-26 19:49:30 +0200
commit0ddcccac4f73f33e8d22368fa663e0991a704cc8 (patch)
tree75bc76d5a13f57c46aac1ed88329c1f806415ce1
parent31c3c440b5361299fc0529bcf049e9b271d4fab9 (diff)
etnaviv: add support for extended texture formats
Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Wladimir J. van der Laan <[email protected]>
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.c2
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.h1
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_screen.c3
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture.c8
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 7c243861c0d..e9cd1040b5a 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 549dfda6897..1170d79a6c1 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 6c0735e0fbf..a69aef09cdd 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 df77829078c..f973bcb77eb 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) |