diff options
author | Jonathan Marek <[email protected]> | 2019-06-20 11:53:05 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-06-29 21:49:50 -0400 |
commit | 89381191a96891a61a1f98102780669990b9f626 (patch) | |
tree | ec927bddd90bc381dc3ae138347903076e8fd75d /src/gallium | |
parent | a99a265b14b1db05ade75f0e2fe8e9e3b6d04358 (diff) |
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 <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_blt.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c b/src/gallium/drivers/etnaviv/etnaviv_blt.c index 1f13bbc31cd..42d1a4462d1 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_blt.c +++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c @@ -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]; |