[Mesa-dev] [PATCH 3/4] radeonsi: Catch more cases that can't be handled by si_dma_copy_buffer/tile

Marek Olšák maraeo at gmail.com
Wed Oct 1 08:27:19 PDT 2014


On Wed, Oct 1, 2014 at 4:13 PM, Grigori Goronzy <greg at chown.ath.cx> wrote:
> On 30.09.2014 05:58, Michel Dänzer wrote:
>> diff --git a/src/gallium/drivers/radeonsi/si_dma.c b/src/gallium/drivers/radeonsi/si_dma.c
>> index ff64722..643ce3f 100644
>> --- a/src/gallium/drivers/radeonsi/si_dma.c
>> +++ b/src/gallium/drivers/radeonsi/si_dma.c
>> @@ -251,7 +251,9 @@ void si_dma_copy(struct pipe_context *ctx,
>>       }
>>
>>       if (src->format != dst->format || src_box->depth > 1 ||
>> -         rdst->dirty_level_mask != 0) {
>> +         rdst->dirty_level_mask != 0 ||
>> +         rdst->cmask.size || rdst->fmask.size ||
>> +         rsrc->cmask.size || rsrc->fmask.size) {
>>               goto fallback;
>>       }
>
> Does the existence of the cmask alone really matter? We shouldn't copy
> from or to fast cleared surfaces, but this change will disable DMA
> copies even if the fast clear has been eliminated. Isn't that handled
> elsewhere already?

Here's some clarification on FMASK and CMASK.

If FMASK is present, DMA cannot be used, because textures with FMASK
cannot be fully decompressed and only shaders know how to read them.
Also, FMASK is only used with MSAA, so if the code falls back to 3D
when nr_samples > 1, you don't need to check if FMASK is present.

If (tex->dirty_level_mask & (1 << level)) is 0 and the surface doesn't
have FMASK, then CMASK has no effect and DMA can be used. If
(tex->dirty_level_mask & (1 << level)) is non-zero, then color
decompression must be done for that level before using DMA.

If rdst needs color decompression, it's better to use the 3D engine
for the texture to stay compressed and that's why the code falls back
to 3D if "rdst->dirty_level_mask != 0".

If rsrc needs color decompression, it's better to decompress it and
use DMA. I think that's what the code did, but I don't remember it
anymore.

Marek


More information about the mesa-dev mailing list