[Mesa-dev] [PATCH] st/mesa: always unconditionally revalidate main framebuffer after SwapBuffers

Marek Olšák maraeo at gmail.com
Wed Jul 26 16:41:46 UTC 2017


On Wed, Jul 26, 2017 at 4:00 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 25.07.2017 17:39, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> This fixes the black Feral launcher window.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101867
>> ---
>>   src/mesa/state_tracker/st_manager.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_manager.c
>> b/src/mesa/state_tracker/st_manager.c
>> index 834bcc9..ede5439 100644
>> --- a/src/mesa/state_tracker/st_manager.c
>> +++ b/src/mesa/state_tracker/st_manager.c
>> @@ -635,20 +635,26 @@ st_context_flush(struct st_context_iface *stctxi,
>> unsigned flags,
>>      st_flush(st, fence, pipe_flags);
>>        if ((flags & ST_FLUSH_WAIT) && fence) {
>>         st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
>>                                        PIPE_TIMEOUT_INFINITE);
>>         st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
>>      }
>>        if (flags & ST_FLUSH_FRONT)
>>         st_manager_flush_frontbuffer(st);
>> +
>> +   /* Enter st_validate_state in the next draw call to revalidate
>> +    * the framebuffer.
>> +    */
>> +   if (flags & ST_FLUSH_END_OF_FRAME)
>> +      st->gfx_shaders_may_be_dirty = true;
>
>
> Why does this help? Which piece of state is changed from under us without
> properly updating the dirty flags? Also, why not one of the
> framebuffer-related flags? And is this always needed, or only if
> ST_FLUSH_FRONT?

It's always needed.

We don't need to update any state. We just need to invoke
st_validate_state, so that st_manager_validate_framebuffers is
invoked, which will set other dirty flags if needed.

DRI3 changes the framebuffer after SwapBuffers, but we need to invoke
st_manager_validate_framebuffers to notice that.

"gfx_shaders_may_be_dirty = true;" makes sure that st_validate_state
will be invoked by the next draw call, and if nothing needs to be done
in st_validate_state, it will be no-op. All other dirty flags are
stronger than this, which is why we can't use them.

Marek


More information about the mesa-dev mailing list