etnaviv: blt: blit with the original format when possible
This fixes BGR565 blit: currently BGRA444 is used for the blit, but with swizzles from the original BGR565 format, so the 4 alpha bits are set to 1. We can't just use the swizzle from the 'compatible' format, since there are cases where BGR<->RGB swap needs to happen. We can avoid all this trouble by using the original formats and only falling back to the 'compatible' format when we need to. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
parent
a99a265b14
commit
89381191a9
|
@ -391,12 +391,16 @@ etna_try_blt_blit(struct pipe_context *pctx,
|
|||
|
||||
/* TODO: 1 byte per pixel formats aren't handled by etna_compatible_rs_format nor
|
||||
* translate_rs_format.
|
||||
* Also this should be smarter about format conversions; etna_compatible_rs_format
|
||||
* assumes all 2-byte pixel format are laid out as 4444, all 4-byte pixel formats
|
||||
* are 8888.
|
||||
*/
|
||||
unsigned src_format = etna_compatible_rs_format(blit_info->src.format);
|
||||
unsigned dst_format = etna_compatible_rs_format(blit_info->dst.format);
|
||||
unsigned src_format = blit_info->src.format;
|
||||
unsigned dst_format = blit_info->dst.format;
|
||||
|
||||
/* for a copy with same dst/src format, we can use a different format */
|
||||
if (translate_blt_format(src_format) == ETNA_NO_MATCH &&
|
||||
src_format == dst_format) {
|
||||
src_format = dst_format = etna_compatible_rs_format(src_format);
|
||||
}
|
||||
|
||||
if (translate_blt_format(src_format) == ETNA_NO_MATCH ||
|
||||
translate_blt_format(dst_format) == ETNA_NO_MATCH ||
|
||||
blit_info->scissor_enable ||
|
||||
|
@ -449,7 +453,7 @@ etna_try_blt_blit(struct pipe_context *pctx,
|
|||
op.src.tiling = src->layout;
|
||||
op.src.cache_mode = TS_CACHE_MODE_128; /* TODO: cache modes */
|
||||
const struct util_format_description *src_format_desc =
|
||||
util_format_description(blit_info->src.format);
|
||||
util_format_description(src_format);
|
||||
for (unsigned x=0; x<4; ++x)
|
||||
op.src.swizzle[x] = src_format_desc->swizzle[x];
|
||||
|
||||
|
@ -474,7 +478,7 @@ etna_try_blt_blit(struct pipe_context *pctx,
|
|||
op.dest.tiling = dst->layout;
|
||||
op.dest.cache_mode = TS_CACHE_MODE_128; /* TODO cache modes */
|
||||
const struct util_format_description *dst_format_desc =
|
||||
util_format_description(blit_info->dst.format);
|
||||
util_format_description(dst_format);
|
||||
for (unsigned x=0; x<4; ++x)
|
||||
op.dest.swizzle[x] = dst_format_desc->swizzle[x];
|
||||
|
||||
|
|
Loading…
Reference in New Issue