From 6a819cabe8d8f445ccb44dcb172e0922dbe016db Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Sep 2019 14:42:15 -0700 Subject: mesa: Replace MESA_FORMAT_L8A8/A8L8 UNORM/SNORM/SRGB with an array format. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The array format is what the GL API wants (fixing texbos on big-endian), and matches directly to gallium's corresponding array format. The only driver exposing A8L8 was radeon/r200 in big-endian, where the HW's underlying format was trying to read as array and we needed to flip things around to make our packed format come out right (note that while the radeon format tables had both AL and LA, ChooseTextureFormat would only pick one of them based on endianness). v2: Don't make r200/radeon use endian swaps. v3: Rebase on dropping the r200 _be/_le format table removal patch v4: reword commit message to explain why we can drop both formats from radeon. Reviewed-by: Marek Olšák (v1) --- src/mesa/drivers/dri/common/dri_util.c | 4 +++- src/mesa/drivers/dri/i915/i830_texstate.c | 2 +- src/mesa/drivers/dri/i915/i915_context.c | 2 +- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- src/mesa/drivers/dri/i965/brw_surface_formats.c | 4 ++-- src/mesa/drivers/dri/nouveau/nv04_surface.c | 12 ++++-------- src/mesa/drivers/dri/r200/r200_tex.h | 6 ++---- src/mesa/drivers/dri/radeon/radeon_tex.h | 3 +-- src/mesa/drivers/dri/radeon/radeon_texture.c | 9 +++------ src/mesa/drivers/dri/radeon/radeon_texture.h | 1 - 10 files changed, 18 insertions(+), 27 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 55abacd6714..28a01d33405 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -936,10 +936,12 @@ static const struct { .image_format = __DRI_IMAGE_FORMAT_GR88, .mesa_format = MESA_FORMAT_R8G8_UNORM, }, +#ifdef PIPE_ARCH_LITTLE_ENDIAN { .image_format = __DRI_IMAGE_FORMAT_GR88, - .mesa_format = MESA_FORMAT_L8A8_UNORM, + .mesa_format = MESA_FORMAT_LA_UNORM8, }, +#endif { .image_format = __DRI_IMAGE_FORMAT_SABGR8, .mesa_format = MESA_FORMAT_R8G8B8A8_SRGB, diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 83cd7336ec1..d8f1026b818 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -47,7 +47,7 @@ translate_texture_format(GLuint mesa_format) return MAPSURF_8BIT | MT_8BIT_L8; case MESA_FORMAT_I_UNORM8: return MAPSURF_8BIT | MT_8BIT_I8; - case MESA_FORMAT_L8A8_UNORM: + case MESA_FORMAT_LA_UNORM8: return MAPSURF_16BIT | MT_16BIT_AY88; case MESA_FORMAT_B5G6R5_UNORM: return MAPSURF_16BIT | MT_16BIT_RGB565; diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 64843020127..2e19e57ae6c 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -118,7 +118,7 @@ intel_init_texture_formats(struct gl_context *ctx) if (intel->gen == 3) ctx->TextureFormatSupported[MESA_FORMAT_A_UNORM8] = true; ctx->TextureFormatSupported[MESA_FORMAT_I_UNORM8] = true; - ctx->TextureFormatSupported[MESA_FORMAT_L8A8_UNORM] = true; + ctx->TextureFormatSupported[MESA_FORMAT_LA_UNORM8] = true; /* Depth and stencil */ if (intel->gen == 3) { diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index f653f441ad8..544aaa72097 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -48,7 +48,7 @@ translate_texture_format(mesa_format mesa_format, GLenum DepthMode) return MAPSURF_8BIT | MT_8BIT_I8; case MESA_FORMAT_A_UNORM8: return MAPSURF_8BIT | MT_8BIT_A8; - case MESA_FORMAT_L8A8_UNORM: + case MESA_FORMAT_LA_UNORM8: return MAPSURF_16BIT | MT_16BIT_AY88; case MESA_FORMAT_B5G6R5_UNORM: return MAPSURF_16BIT | MT_16BIT_RGB565; diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index 059b2f4bb62..6127ed8a490 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -47,7 +47,7 @@ brw_isl_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_B5G6R5_UNORM] = ISL_FORMAT_B5G6R5_UNORM, [MESA_FORMAT_B4G4R4A4_UNORM] = ISL_FORMAT_B4G4R4A4_UNORM, [MESA_FORMAT_B5G5R5A1_UNORM] = ISL_FORMAT_B5G5R5A1_UNORM, - [MESA_FORMAT_L8A8_UNORM] = ISL_FORMAT_L8A8_UNORM, + [MESA_FORMAT_LA_UNORM8] = ISL_FORMAT_L8A8_UNORM, [MESA_FORMAT_LA_UNORM16] = ISL_FORMAT_L16A16_UNORM, [MESA_FORMAT_A_UNORM8] = ISL_FORMAT_A8_UNORM, [MESA_FORMAT_A_UNORM16] = ISL_FORMAT_A16_UNORM, @@ -69,7 +69,7 @@ brw_isl_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_B8G8R8X8_SRGB] = ISL_FORMAT_B8G8R8X8_UNORM_SRGB, [MESA_FORMAT_R_SRGB8] = ISL_FORMAT_L8_UNORM_SRGB, [MESA_FORMAT_L_SRGB8] = ISL_FORMAT_L8_UNORM_SRGB, - [MESA_FORMAT_L8A8_SRGB] = ISL_FORMAT_L8A8_UNORM_SRGB, + [MESA_FORMAT_LA_SRGB8] = ISL_FORMAT_L8A8_UNORM_SRGB, [MESA_FORMAT_SRGB_DXT1] = ISL_FORMAT_BC1_UNORM_SRGB, [MESA_FORMAT_SRGBA_DXT1] = ISL_FORMAT_BC1_UNORM_SRGB, [MESA_FORMAT_SRGBA_DXT3] = ISL_FORMAT_BC2_UNORM_SRGB, diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c index b1f0ea0a983..7fb2de15683 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_surface.c +++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c @@ -50,8 +50,7 @@ swzsurf_format(mesa_format format) case MESA_FORMAT_B5G5R5A1_UNORM: case MESA_FORMAT_A1B5G5R5_UNORM: case MESA_FORMAT_A1R5G5B5_UNORM: - case MESA_FORMAT_L8A8_UNORM: - case MESA_FORMAT_A8L8_UNORM: + case MESA_FORMAT_LA_UNORM8: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: case MESA_FORMAT_Z_UNORM16: @@ -89,8 +88,7 @@ surf2d_format(mesa_format format) case MESA_FORMAT_B5G5R5A1_UNORM: case MESA_FORMAT_A1B5G5R5_UNORM: case MESA_FORMAT_A1R5G5B5_UNORM: - case MESA_FORMAT_L8A8_UNORM: - case MESA_FORMAT_A8L8_UNORM: + case MESA_FORMAT_LA_UNORM8: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: case MESA_FORMAT_Z_UNORM16: @@ -128,8 +126,7 @@ rect_format(mesa_format format) case MESA_FORMAT_B5G5R5A1_UNORM: case MESA_FORMAT_A1B5G5R5_UNORM: case MESA_FORMAT_A1R5G5B5_UNORM: - case MESA_FORMAT_L8A8_UNORM: - case MESA_FORMAT_A8L8_UNORM: + case MESA_FORMAT_LA_UNORM8: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: case MESA_FORMAT_Z_UNORM16: @@ -167,8 +164,7 @@ sifm_format(mesa_format format) case MESA_FORMAT_B5G5R5A1_UNORM: case MESA_FORMAT_A1B5G5R5_UNORM: case MESA_FORMAT_A1R5G5B5_UNORM: - case MESA_FORMAT_L8A8_UNORM: - case MESA_FORMAT_A8L8_UNORM: + case MESA_FORMAT_LA_UNORM8: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: case MESA_FORMAT_Z_UNORM16: diff --git a/src/mesa/drivers/dri/r200/r200_tex.h b/src/mesa/drivers/dri/r200/r200_tex.h index 14f5e71fadf..c13998df03b 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.h +++ b/src/mesa/drivers/dri/r200/r200_tex.h @@ -73,10 +73,9 @@ static const struct tx_table tx_table_be[] = [ MESA_FORMAT_A4R4G4B4_UNORM ] = { R200_TXFORMAT_ARGB4444 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B5G5R5A1_UNORM ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A1R5G5B5_UNORM ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8A8_UNORM ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8L8_UNORM ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_L_UNORM8 ] = { R200_TXFORMAT_I8, 0 }, + [ MESA_FORMAT_LA_UNORM8 ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_I_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_YCBCR ] = { R200_TXFORMAT_YVYU422, R200_YUV_TO_RGB }, [ MESA_FORMAT_YCBCR_REV ] = { R200_TXFORMAT_VYUY422, R200_YUV_TO_RGB }, @@ -103,10 +102,9 @@ static const struct tx_table tx_table_le[] = [ MESA_FORMAT_A4R4G4B4_UNORM ] = { R200_TXFORMAT_ARGB4444 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B5G5R5A1_UNORM ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A1R5G5B5_UNORM ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8A8_UNORM ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8L8_UNORM ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_L_UNORM8 ] = { R200_TXFORMAT_I8, 0 }, + [ MESA_FORMAT_LA_UNORM8 ] = { R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_I_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_YCBCR ] = { R200_TXFORMAT_YVYU422, R200_YUV_TO_RGB }, [ MESA_FORMAT_YCBCR_REV ] = { R200_TXFORMAT_VYUY422, R200_YUV_TO_RGB }, diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.h b/src/mesa/drivers/dri/radeon/radeon_tex.h index 37c2fa0dc2f..a698040617e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.h +++ b/src/mesa/drivers/dri/radeon/radeon_tex.h @@ -72,8 +72,7 @@ static const struct tx_table tx_table[] = [ MESA_FORMAT_A4R4G4B4_UNORM ] = { RADEON_TXFORMAT_ARGB4444 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B5G5R5A1_UNORM ] = { RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A1R5G5B5_UNORM ] = { RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8A8_UNORM ] = { RADEON_TXFORMAT_AI88 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8L8_UNORM ] = { RADEON_TXFORMAT_AI88 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_LA_UNORM8 ] = { RADEON_TXFORMAT_AI88 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A_UNORM8 ] = { RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_L_UNORM8 ] = { RADEON_TXFORMAT_I8, 0 }, [ MESA_FORMAT_I_UNORM8 ] = { RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index f2d435a375f..bd03b9110d2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -359,7 +359,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, #if defined(RADEON_R200) /* r200: can't use a8 format since interpreting hw I8 as a8 would result in wrong rgb values (same as alpha value instead of 0). */ - return _radeon_texformat_al88; + return MESA_FORMAT_LA_UNORM8; #else return MESA_FORMAT_A_UNORM8; #endif @@ -381,7 +381,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return _radeon_texformat_al88; + return MESA_FORMAT_LA_UNORM8; case GL_INTENSITY: case GL_INTENSITY4: @@ -464,7 +464,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_SLUMINANCE_ALPHA: case GL_SLUMINANCE8_ALPHA8: case GL_COMPRESSED_SLUMINANCE_ALPHA: - return MESA_FORMAT_L8A8_SRGB; + return MESA_FORMAT_LA_SRGB8; case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return MESA_FORMAT_SRGB_DXT1; @@ -596,7 +596,6 @@ mesa_format _radeon_texformat_argb8888 = MESA_FORMAT_NONE; mesa_format _radeon_texformat_rgb565 = MESA_FORMAT_NONE; mesa_format _radeon_texformat_argb4444 = MESA_FORMAT_NONE; mesa_format _radeon_texformat_argb1555 = MESA_FORMAT_NONE; -mesa_format _radeon_texformat_al88 = MESA_FORMAT_NONE; /*@}*/ @@ -609,7 +608,6 @@ radeonInitTextureFormats(void) _radeon_texformat_rgb565 = MESA_FORMAT_B5G6R5_UNORM; _radeon_texformat_argb4444 = MESA_FORMAT_B4G4R4A4_UNORM; _radeon_texformat_argb1555 = MESA_FORMAT_B5G5R5A1_UNORM; - _radeon_texformat_al88 = MESA_FORMAT_L8A8_UNORM; } else { _radeon_texformat_rgba8888 = MESA_FORMAT_R8G8B8A8_UNORM; @@ -617,7 +615,6 @@ radeonInitTextureFormats(void) _radeon_texformat_rgb565 = MESA_FORMAT_R5G6B5_UNORM; _radeon_texformat_argb4444 = MESA_FORMAT_A4R4G4B4_UNORM; _radeon_texformat_argb1555 = MESA_FORMAT_A1R5G5B5_UNORM; - _radeon_texformat_al88 = MESA_FORMAT_A8L8_UNORM; } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 286b2a20a30..8342796aa6c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -38,7 +38,6 @@ extern mesa_format _radeon_texformat_argb8888; extern mesa_format _radeon_texformat_rgb565; extern mesa_format _radeon_texformat_argb4444; extern mesa_format _radeon_texformat_argb1555; -extern mesa_format _radeon_texformat_al88; extern void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, -- cgit v1.2.3