etnaviv: rs: try to find exact format match first

For MSAA downsampling to work correctly, the RS engine needs to know
the exact format of the blit source/target. The compatible formats are
fine as long as the RS is only used as a tiler without doing any
conversion.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19066>
This commit is contained in:
Lucas Stach
2022-10-13 19:48:37 +02:00
committed by Marge Bot
parent 0ff96aaef3
commit ca96b3a409
2 changed files with 36 additions and 1 deletions
+7 -1
View File
@@ -632,7 +632,13 @@ etna_try_rs_blit(struct pipe_context *pctx,
if (blit_info->src.format != blit_info->dst.format)
return false;
uint32_t format = etna_compatible_rs_format(blit_info->dst.format);
/* try to find a exact format match first */
uint32_t format = translate_rs_format(blit_info->dst.format);
/* When not resolving MSAA, but only doing a layout conversion, we can get
* away with a fallback format of matching size.
*/
if (format == ETNA_NO_MATCH && msaa_xscale == 1 && msaa_yscale == 1)
format = etna_compatible_rs_format(blit_info->dst.format);
if (format == ETNA_NO_MATCH)
return false;
@@ -271,6 +271,35 @@ translate_ts_format(enum pipe_format fmt)
}
}
/* formats directly supported in the RS engine */
static inline uint32_t
translate_rs_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 RS_FORMAT_X4R4G4B4;
case PIPE_FORMAT_B4G4R4A4_UNORM:
return RS_FORMAT_A4R4G4B4;
case PIPE_FORMAT_B5G5R5X1_UNORM:
return RS_FORMAT_X1R5G5B5;
case PIPE_FORMAT_B5G5R5A1_UNORM:
return RS_FORMAT_A1R5G5B5;
case PIPE_FORMAT_B5G6R5_UNORM:
return RS_FORMAT_R5G6B5;
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_B8G8R8X8_SRGB:
case PIPE_FORMAT_R8G8B8X8_UNORM:
return RS_FORMAT_X8R8G8B8;
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8A8_SRGB:
case PIPE_FORMAT_R8G8B8A8_UNORM:
return RS_FORMAT_A8R8G8B8;
default:
return ETNA_NO_MATCH;
}
}
/* Return normalization flag for vertex element format */
static inline uint32_t
translate_vertex_format_normalize(enum pipe_format fmt)