From 66411521ea9394132c6067f5b676dc2751f21d6c Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Mon, 1 Jul 2019 16:42:50 -0400 Subject: [PATCH] etnaviv: combine translate_ts_sampler_format/translate_msaa_format Both translate the same thing, so just add the missing cases into one. Signed-off-by: Jonathan Marek Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_format.c | 160 ++++++++---------- src/gallium/drivers/etnaviv/etnaviv_rs.c | 6 +- src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_state.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_texture.c | 4 +- .../drivers/etnaviv/etnaviv_translate.h | 13 +- 6 files changed, 92 insertions(+), 95 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c index 7758c4cf4f5..8eae4944850 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_format.c +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c @@ -40,7 +40,6 @@ struct etna_format { unsigned vtx; unsigned tex; unsigned rs; - unsigned ts; boolean present; const unsigned char tex_swiz[4]; }; @@ -64,23 +63,21 @@ struct etna_format { } /* vertex + texture */ -#define VT(pipe, vtxfmt, texfmt, texswiz, rsfmt, tsfmt) \ +#define VT(pipe, vtxfmt, texfmt, texswiz, rsfmt) \ [PIPE_FORMAT_##pipe] = { \ .vtx = FE_DATA_TYPE_##vtxfmt, \ .tex = TEXTURE_FORMAT_##texfmt, \ .rs = RS_FORMAT_##rsfmt, \ - .ts = COMPRESSION_FORMAT_##tsfmt, \ .present = 1, \ .tex_swiz = texswiz, \ } /* texture-only */ -#define _T(pipe, fmt, swiz, rsfmt, tsfmt) \ +#define _T(pipe, fmt, swiz, rsfmt) \ [PIPE_FORMAT_##pipe] = { \ .vtx = ETNA_NO_MATCH, \ .tex = TEXTURE_FORMAT_##fmt, \ .rs = RS_FORMAT_##rsfmt, \ - .ts = COMPRESSION_FORMAT_##tsfmt, \ .present = 1, \ .tex_swiz = swiz, \ } @@ -96,16 +93,16 @@ struct etna_format { static struct etna_format formats[PIPE_FORMAT_COUNT] = { /* 8-bit */ - VT(R8_UNORM, UNSIGNED_BYTE, L8, SWIZ(X, 0, 0, 1), NONE, NONE), + VT(R8_UNORM, UNSIGNED_BYTE, L8, SWIZ(X, 0, 0, 1), NONE), V_(R8_SNORM, BYTE, NONE), V_(R8_UINT, UNSIGNED_BYTE, NONE), V_(R8_SINT, BYTE, NONE), V_(R8_USCALED, UNSIGNED_BYTE, NONE), V_(R8_SSCALED, BYTE, NONE), - _T(A8_UNORM, A8, SWIZ(X, Y, Z, W), NONE, NONE), - _T(L8_UNORM, L8, SWIZ(X, Y, Z, W), NONE, NONE), - _T(I8_UNORM, I8, SWIZ(X, Y, Z, W), NONE, NONE), + _T(A8_UNORM, A8, SWIZ(X, Y, Z, W), NONE), + _T(L8_UNORM, L8, SWIZ(X, Y, Z, W), NONE), + _T(I8_UNORM, I8, SWIZ(X, Y, Z, W), NONE), /* 16-bit */ V_(R16_UNORM, UNSIGNED_SHORT, NONE), @@ -116,17 +113,17 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { V_(R16_SSCALED, SHORT, NONE), V_(R16_FLOAT, HALF_FLOAT, NONE), - _T(B4G4R4A4_UNORM, A4R4G4B4, SWIZ(X, Y, Z, W), A4R4G4B4, A4R4G4B4), - _T(B4G4R4X4_UNORM, X4R4G4B4, SWIZ(X, Y, Z, W), X4R4G4B4, A4R4G4B4), + _T(B4G4R4A4_UNORM, A4R4G4B4, SWIZ(X, Y, Z, W), A4R4G4B4), + _T(B4G4R4X4_UNORM, X4R4G4B4, SWIZ(X, Y, Z, W), X4R4G4B4), - _T(L8A8_UNORM, A8L8, SWIZ(X, Y, Z, W), NONE, NONE), + _T(L8A8_UNORM, A8L8, SWIZ(X, Y, Z, W), NONE), - _T(Z16_UNORM, D16, SWIZ(X, Y, Z, W), A4R4G4B4, D16), - _T(B5G6R5_UNORM, R5G6B5, SWIZ(X, Y, Z, W), R5G6B5, R5G6B5), - _T(B5G5R5A1_UNORM, A1R5G5B5, SWIZ(X, Y, Z, W), A1R5G5B5, A1R5G5B5), - _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5, A1R5G5B5), + _T(Z16_UNORM, D16, SWIZ(X, Y, Z, W), A4R4G4B4), + _T(B5G6R5_UNORM, R5G6B5, SWIZ(X, Y, Z, W), R5G6B5), + _T(B5G5R5A1_UNORM, A1R5G5B5, SWIZ(X, Y, Z, W), A1R5G5B5), + _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5), - VT(R8G8_UNORM, UNSIGNED_BYTE, EXT_G8R8 | EXT_FORMAT, SWIZ(X, Y, 0, 1), NONE, NONE), + VT(R8G8_UNORM, UNSIGNED_BYTE, EXT_G8R8 | EXT_FORMAT, SWIZ(X, Y, 0, 1), NONE), V_(R8G8_SNORM, BYTE, NONE), V_(R8G8_UINT, UNSIGNED_BYTE, NONE), V_(R8G8_SINT, BYTE, NONE), @@ -161,26 +158,26 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { V_(A8B8G8R8_UNORM, UNSIGNED_BYTE, NONE), - VT(R8G8B8A8_UNORM, UNSIGNED_BYTE, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8, A8R8G8B8), + VT(R8G8B8A8_UNORM, UNSIGNED_BYTE, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8), V_(R8G8B8A8_SNORM, BYTE, A8B8G8R8), - _T(R8G8B8X8_UNORM, X8B8G8R8, SWIZ(X, Y, Z, W), X8B8G8R8, X8R8G8B8), + _T(R8G8B8X8_UNORM, X8B8G8R8, SWIZ(X, Y, Z, W), X8B8G8R8), V_(R8G8B8A8_UINT, UNSIGNED_BYTE, A8B8G8R8), V_(R8G8B8A8_SINT, BYTE, A8B8G8R8), V_(R8G8B8A8_USCALED, UNSIGNED_BYTE, A8B8G8R8), V_(R8G8B8A8_SSCALED, BYTE, A8B8G8R8), - _T(B8G8R8A8_UNORM, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8, A8R8G8B8), - _T(B8G8R8X8_UNORM, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8, X8R8G8B8), - _T(B8G8R8A8_SRGB, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8, A8R8G8B8), - _T(B8G8R8X8_SRGB, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8, X8R8G8B8), + _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), V_(R10G10B10A2_USCALED, UNSIGNED_INT_10_10_10_2, NONE), V_(R10G10B10A2_SSCALED, INT_10_10_10_2, NONE), - _T(X8Z24_UNORM, D24X8, SWIZ(X, Y, Z, W), A8R8G8B8, D24X8), - _T(S8_UINT_Z24_UNORM, D24X8, SWIZ(X, Y, Z, W), A8R8G8B8, D24S8), + _T(X8Z24_UNORM, D24X8, SWIZ(X, Y, Z, W), A8R8G8B8), + _T(S8_UINT_Z24_UNORM, D24X8, SWIZ(X, Y, Z, W), A8R8G8B8), /* 48-bit */ V_(R16G16B16_UNORM, UNSIGNED_SHORT, NONE), @@ -230,60 +227,60 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { V_(R32G32B32A32_FIXED, FIXED, NONE), /* compressed */ - _T(ETC1_RGB8, ETC1, SWIZ(X, Y, Z, W), NONE, NONE), - - _T(DXT1_RGB, DXT1, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT1_SRGBA,DXT1, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT1_RGBA, DXT1, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT3_SRGBA,DXT2_DXT3, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT5_SRGBA,DXT4_DXT5, SWIZ(X, Y, Z, W), NONE, NONE), - _T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE, NONE), - - _T(ETC2_RGB8, EXT_NONE | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), /* Extd. format NONE doubles as ETC2_RGB8 */ - _T(ETC2_SRGB8, EXT_NONE | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_RGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_SRGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_RGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_SRGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_R11_UNORM, EXT_R11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_R11_SNORM, EXT_SIGNED_R11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_RG11_UNORM, EXT_RG11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ETC2_RG11_SNORM, EXT_SIGNED_RG11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - - _T(ASTC_4x4, ASTC_RGBA_4x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_5x4, ASTC_RGBA_5x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_5x5, ASTC_RGBA_5x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_6x5, ASTC_RGBA_6x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_6x6, ASTC_RGBA_6x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x5, ASTC_RGBA_8x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x6, ASTC_RGBA_8x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x8, ASTC_RGBA_8x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x5, ASTC_RGBA_10x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x6, ASTC_RGBA_10x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x8, ASTC_RGBA_10x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x10, ASTC_RGBA_10x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_12x10, ASTC_RGBA_12x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_12x12, ASTC_RGBA_12x12 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - - _T(ASTC_4x4_SRGB, ASTC_SRGB8_ALPHA8_4x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_5x4_SRGB, ASTC_SRGB8_ALPHA8_5x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_5x5_SRGB, ASTC_SRGB8_ALPHA8_5x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_6x5_SRGB, ASTC_SRGB8_ALPHA8_6x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_6x6_SRGB, ASTC_SRGB8_ALPHA8_6x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x5_SRGB, ASTC_SRGB8_ALPHA8_8x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x6_SRGB, ASTC_SRGB8_ALPHA8_8x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_8x8_SRGB, ASTC_SRGB8_ALPHA8_8x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x5_SRGB, ASTC_SRGB8_ALPHA8_10x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x6_SRGB, ASTC_SRGB8_ALPHA8_10x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x8_SRGB, ASTC_SRGB8_ALPHA8_10x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_10x10_SRGB, ASTC_SRGB8_ALPHA8_10x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_12x10_SRGB, ASTC_SRGB8_ALPHA8_12x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), - _T(ASTC_12x12_SRGB, ASTC_SRGB8_ALPHA8_12x12 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE, NONE), + _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 */ + _T(ETC2_SRGB8, EXT_NONE | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_RGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_SRGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_RGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_SRGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_R11_UNORM, EXT_R11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_R11_SNORM, EXT_SIGNED_R11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_RG11_UNORM, EXT_RG11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ETC2_RG11_SNORM, EXT_SIGNED_RG11_EAC | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), + + _T(ASTC_4x4, ASTC_RGBA_4x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_5x4, ASTC_RGBA_5x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_5x5, ASTC_RGBA_5x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_6x5, ASTC_RGBA_6x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_6x6, ASTC_RGBA_6x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x5, ASTC_RGBA_8x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x6, ASTC_RGBA_8x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x8, ASTC_RGBA_8x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x5, ASTC_RGBA_10x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x6, ASTC_RGBA_10x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x8, ASTC_RGBA_10x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x10, ASTC_RGBA_10x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_12x10, ASTC_RGBA_12x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_12x12, ASTC_RGBA_12x12 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + + _T(ASTC_4x4_SRGB, ASTC_SRGB8_ALPHA8_4x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_5x4_SRGB, ASTC_SRGB8_ALPHA8_5x4 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_5x5_SRGB, ASTC_SRGB8_ALPHA8_5x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_6x5_SRGB, ASTC_SRGB8_ALPHA8_6x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_6x6_SRGB, ASTC_SRGB8_ALPHA8_6x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x5_SRGB, ASTC_SRGB8_ALPHA8_8x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x6_SRGB, ASTC_SRGB8_ALPHA8_8x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_8x8_SRGB, ASTC_SRGB8_ALPHA8_8x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x5_SRGB, ASTC_SRGB8_ALPHA8_10x5 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x6_SRGB, ASTC_SRGB8_ALPHA8_10x6 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x8_SRGB, ASTC_SRGB8_ALPHA8_10x8 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_10x10_SRGB, ASTC_SRGB8_ALPHA8_10x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_12x10_SRGB, ASTC_SRGB8_ALPHA8_12x10 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), + _T(ASTC_12x12_SRGB, ASTC_SRGB8_ALPHA8_12x12 | ASTC_FORMAT, SWIZ(X, Y, Z, W), NONE), /* YUV */ - _T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2, NONE), - _T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE, NONE), + _T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2), + _T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE), }; uint32_t @@ -361,12 +358,3 @@ translate_vertex_format_type(enum pipe_format fmt) return formats[fmt].vtx; } - -uint32_t -translate_ts_sampler_format(enum pipe_format fmt) -{ - if (!formats[fmt].present) - return ETNA_NO_MATCH; - - return formats[fmt].ts; -} diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c b/src/gallium/drivers/etnaviv/etnaviv_rs.c index 631fced1e37..01e97b2080d 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_rs.c +++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c @@ -655,10 +655,10 @@ etna_try_rs_blit(struct pipe_context *pctx, goto manual; if (src->base.nr_samples > 1) { - uint32_t msaa_format = translate_msaa_format(src_format); - assert(msaa_format != ETNA_NO_MATCH); + uint32_t ts_format = translate_ts_format(src_format); + assert(ts_format != ETNA_NO_MATCH); ts_mem_config |= VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION | - VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(msaa_format); + VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(ts_format); } /* Always flush color and depth cache together before resolving. This works diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 48b1d9dd646..ec6f3021001 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -413,7 +413,7 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen, * must have MSAA'able format. */ if (sample_count > 1) { if (translate_samples_to_xyscale(sample_count, NULL, NULL, NULL) && - translate_msaa_format(format) != ETNA_NO_MATCH) { + translate_ts_format(format) != ETNA_NO_MATCH) { allowed |= PIPE_BIND_RENDER_TARGET; } } else { diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index f2460be834e..1cefed0a130 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -182,7 +182,7 @@ etna_set_framebuffer_state(struct pipe_context *pctx, if (cbuf->base.texture->nr_samples > 1) { ts_mem_config |= VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION | - VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(translate_msaa_format(cbuf->base.format)); + VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(translate_ts_format(cbuf->base.format)); } nr_samples_color = cbuf->base.texture->nr_samples; diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index 6965ee001ea..9bf63ec34c4 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -86,7 +86,7 @@ etna_configure_sampler_ts(struct etna_sampler_ts *sts, struct pipe_sampler_view sts->mode = lev->ts_mode; sts->TS_SAMPLER_CONFIG = VIVS_TS_SAMPLER_CONFIG_ENABLE | - VIVS_TS_SAMPLER_CONFIG_COMPRESSION_FORMAT(translate_ts_sampler_format(rsc->base.format)); + VIVS_TS_SAMPLER_CONFIG_COMPRESSION_FORMAT(translate_ts_format(rsc->base.format)); sts->TS_SAMPLER_CLEAR_VALUE = lev->clear_value; sts->TS_SAMPLER_CLEAR_VALUE2 = lev->clear_value; /* To handle 64-bit formats this needs a different value */ sts->TS_SAMPLER_STATUS_BASE.bo = rsc->ts_bo; @@ -123,7 +123,7 @@ etna_can_use_sampler_ts(struct pipe_sampler_view *view, int num) return VIV_FEATURE(screen, chipMinorFeatures2, TEXTURE_TILED_READ) && num < VIVS_TS_SAMPLER__LEN && rsc->base.target != PIPE_BUFFER && - translate_ts_sampler_format(rsc->base.format) != ETNA_NO_MATCH && + translate_ts_format(rsc->base.format) != ETNA_NO_MATCH && view->u.tex.first_level == 0 && MIN2(view->u.tex.last_level, rsc->base.last_level) == 0 && rsc->levels[0].ts_valid; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_translate.h b/src/gallium/drivers/etnaviv/etnaviv_translate.h index eea359fc9c5..99822715411 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_translate.h +++ b/src/gallium/drivers/etnaviv/etnaviv_translate.h @@ -276,12 +276,11 @@ translate_depth_format(enum pipe_format fmt) /* render target format for MSAA */ static inline uint32_t -translate_msaa_format(enum pipe_format fmt) +translate_ts_format(enum pipe_format fmt) { /* Note: Pipe format convention is LSB to MSB, VIVS is MSB to LSB */ switch (fmt) { case PIPE_FORMAT_B4G4R4X4_UNORM: - return COMPRESSION_FORMAT_A4R4G4B4; case PIPE_FORMAT_B4G4R4A4_UNORM: return COMPRESSION_FORMAT_A4R4G4B4; case PIPE_FORMAT_B5G5R5X1_UNORM: @@ -291,9 +290,19 @@ translate_msaa_format(enum pipe_format fmt) case PIPE_FORMAT_B5G6R5_UNORM: return COMPRESSION_FORMAT_R5G6B5; case PIPE_FORMAT_B8G8R8X8_UNORM: + case PIPE_FORMAT_B8G8R8X8_SRGB: + case PIPE_FORMAT_R8G8B8X8_UNORM: return COMPRESSION_FORMAT_X8R8G8B8; case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_B8G8R8A8_SRGB: + case PIPE_FORMAT_R8G8B8A8_UNORM: return COMPRESSION_FORMAT_A8R8G8B8; + case PIPE_FORMAT_S8_UINT_Z24_UNORM: + return COMPRESSION_FORMAT_D24S8; + case PIPE_FORMAT_X8Z24_UNORM: + return COMPRESSION_FORMAT_D24X8; + case PIPE_FORMAT_Z16_UNORM: + return COMPRESSION_FORMAT_D16; /* MSAA with YUYV not supported */ default: return ETNA_NO_MATCH; -- 2.30.2