[Mesa-dev] [PATCH 5/5] st/mesa: use texture_barrier before CopyPixels blits where src == dst

Marek Olšák maraeo at gmail.com
Tue Jun 6 09:34:19 UTC 2017


On Tue, Jun 6, 2017 at 4:28 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 06/06/17 01:50 AM, Marek Olšák wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> radeonsi won't flush caches if set_framebuffer_state doesn't change
>> anything.
>> ---
>>  src/mesa/state_tracker/st_cb_drawpixels.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
>> index 33d10f6..0ef05ef 100644
>> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
>> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
>> @@ -1400,20 +1400,27 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
>>              st_window_rectangles_to_blit(ctx, &blit);
>>
>>           if (screen->is_format_supported(screen, blit.src.format,
>>                                           blit.src.resource->target,
>>                                           blit.src.resource->nr_samples,
>>                                           PIPE_BIND_SAMPLER_VIEW) &&
>>               screen->is_format_supported(screen, blit.dst.format,
>>                                           blit.dst.resource->target,
>>                                           blit.dst.resource->nr_samples,
>>                                           PIPE_BIND_RENDER_TARGET)) {
>> +            /* If src == dst, make sure src is coherent with recent dst
>> +             * updates.
>> +             */
>> +            if (blit.src.resource == blit.dst.resource &&
>> +                screen->get_param(screen, PIPE_CAP_TEXTURE_BARRIER))
>> +               pipe->texture_barrier(pipe, PIPE_TEXTURE_BARRIER_SAMPLER);
>> +
>>              pipe->blit(pipe, &blit);
>
> Maybe this should be handled within the pipe->blit hook? E.g., is this
> necessary when using the SDMA engine in radeonsi?

It's not necessary in that case, yet it's a CopyPixels optimization
not worth spending time on.

Marek


More information about the mesa-dev mailing list