[Mesa-dev] [PATCH] dri2: add code to flush function of DRI2_Flush extension

Alan Hourihane alanh at fairlite.co.uk
Tue Aug 16 02:43:41 PDT 2011


On 08/16/11 10:26, Alan Hourihane wrote:
> On 08/16/11 10:05, Michel Dänzer wrote:
>> On Die, 2011-08-16 at 16:55 +0800, Cooper Yuan wrote:
>>> We still call flush method of DRI2_Flush extension in other functions
>>> of egl_dri2 driver. for example, dri2_copy_buffers(), because we
>>> expect all the rendering to this drawable have been flushed before
>>> copying the buffers.
>>>
>>>
>>> The code I added eventually invokes st->pipe->flush(), so I think it
>>> handles correctly, any concern?
>> The more I look at the patch, the more I'm convinced it's wrong.
>>
>> At least with GLX, there's no requirement for the drawable to have any
>> current context at SwapBuffers time. AFAICT this code will crash with a
>> null pointer dereference in that case.
>>
>> I really suspect the problem you were trying to address with this needs
>> to be addressed in EGL code. BTW, to get the same semantics as glFinish,
>> the flush would need to be called with a non-NULL last argument and the
>> returned fence waited for. 
> Actually, I think it's right, but just needs to check for a valid context
> first and do nothing if there isn't one.
>
> This matches the semantics of dri2_glx.c
>
Oh, but to clarify, yes, if EGL call itself expects glFinish semantics then
it will also need poking to wait for a fence after this flush.

Alan.


More information about the mesa-dev mailing list