[Mesa-dev] [PATCH 1/3] loader/dri3: Destroy Present event context when destroying drawable

Michel Dänzer michel at daenzer.net
Fri Jul 29 09:55:09 UTC 2016


On 28.07.2016 18:41, Chris Wilson wrote:
> On Thu, Jul 28, 2016 at 06:34:44PM +0900, Michel Dänzer wrote:
>> From: Michel Dänzer <michel.daenzer at amd.com>
>>
>> Without this, the X server may accumulate stale Present event contexts
>> if a client ends up creating and destroying DRI drawables for the same
>> window.
>>
>> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
>> ---
>>  src/loader/loader_dri3_helper.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
>> index 896f225..7f08846 100644
>> --- a/src/loader/loader_dri3_helper.c
>> +++ b/src/loader/loader_dri3_helper.c
>> @@ -118,8 +118,14 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw)
>>           dri3_free_render_buffer(draw, draw->buffers[i]);
>>     }
>>  
>> -   if (draw->special_event)
>> +   if (draw->special_event) {
>> +      xcb_void_cookie_t cookie =
>> +         xcb_present_select_input(draw->conn, draw->eid, draw->drawable,
>> +                                  XCB_PRESENT_EVENT_MASK_NO_EVENT);
>> +
> 
> This throws an error on old Xorg (presuming you've fixed it to work
> now), so
> 
> 	cookie = xcb_present_select_input_checked(...);
> 	xcb_discard_reply(c, cookie.sequence);

Well, I meant to use the

	cookie = xcb_present_select_input_checked(...);
	free(xcb_request_check(..., cookie));

idiom as in patch 2 to deal with that, but I obviously botched it up in
patch 1 & 3. Thanks for catching my mistake, and for pointing out
xcb_discard_reply, which is presumably more efficient. v2 patches posted.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list