From 0a23841a98dacad1fbc81f34479ce194e86fc99a Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Sat, 28 Oct 2017 17:24:58 +0200 Subject: [PATCH] etnaviv: add ext_texture_srgb support Following piglits are passing: - glean@texture_srgb - spec@ext_texture_srgb@fbo-srgb - spec@ext_texture_srgb@tex-srgb - spec@ext_texture_srgb@texwrap formats - spec@ext_texture_srgb@texwrap formats-s3tc Btw. this enables GL 2.1 :-) Signed-off-by: Christian Gmeiner Reviewed-by: Wladimir J. van der Laan --- src/gallium/drivers/etnaviv/etnaviv_format.c | 5 +++++ src/gallium/drivers/etnaviv/etnaviv_screen.c | 3 +++ src/gallium/drivers/etnaviv/etnaviv_texture.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c index a2e215b439c..ac9b2d13b98 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_format.c +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c @@ -165,6 +165,8 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { _T(B8G8R8A8_UNORM, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8), _T(B8G8R8X8_UNORM, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8), + _T(B8G8R8A8_SRGB, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8), + _T(B8G8R8X8_SRGB, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8), V_(R10G10B10A2_UNORM, UNSIGNED_INT_10_10_10_2, NONE), V_(R10G10B10A2_SNORM, INT_10_10_10_2, NONE), @@ -225,8 +227,11 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { _T(ETC1_RGB8, ETC1, SWIZ(X, Y, Z, W), NONE), _T(DXT1_RGB, DXT1, SWIZ(X, Y, Z, W), NONE), + _T(DXT1_SRGBA,DXT1, SWIZ(X, Y, Z, W), NONE), _T(DXT1_RGBA, DXT1, SWIZ(X, Y, Z, W), NONE), + _T(DXT3_SRGBA,DXT2_DXT3, SWIZ(X, Y, Z, W), NONE), _T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE), + _T(DXT5_SRGBA,DXT4_DXT5, SWIZ(X, Y, Z, W), NONE), _T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE), _T(ETC2_RGB8, EXT_NONE | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 009bc73c14a..4f55c2a96f6 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -482,6 +482,9 @@ gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt, if (fmt >= TEXTURE_FORMAT_DXT1 && fmt <= TEXTURE_FORMAT_DXT4_DXT5) supported = VIV_FEATURE(screen, chipFeatures, DXT_TEXTURE_COMPRESSION); + if (util_format_is_srgb(format)) + supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); + if (fmt & EXT_FORMAT) { supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0); diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index b8ebab60822..597390ae492 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -236,7 +236,8 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, VIVS_TE_SAMPLER_SIZE_HEIGHT(res->base.height0); sv->TE_SAMPLER_LOG_SIZE = VIVS_TE_SAMPLER_LOG_SIZE_WIDTH(etna_log2_fixp55(res->base.width0)) | - VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(res->base.height0)); + VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(res->base.height0)) | + COND(util_format_is_srgb(so->format), VIVS_TE_SAMPLER_LOG_SIZE_SRGB); /* Set up levels-of-detail */ for (int lod = 0; lod <= res->base.last_level; ++lod) { -- 2.30.2