[Mesa-dev] [PATCH 3/3] anv/x11: Destroy Present event context when destroying swapchain v2

Jason Ekstrand jason at jlekstrand.net
Thu Sep 1 05:06:57 UTC 2016


Seems reasonable.  I think you know more of what you're doing here than I
do anyway.

Acked-by: Jason Ekstrand <jason at jlekstrand.net>

On Fri, Jul 29, 2016 at 2:52 AM, Michel Dänzer <michel at daenzer.net> wrote:

> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Without this, the X server may accumulate stale Present event contexts
> if a client creates and destroys multiple swapchains using the same
> window.
>
> v2: Based on Chris Wilson's review:
> * Use xcb_present_select_input_checked so that protocol errors
>   generated by old X servers can be handled gracefully
> * Use xcb_discard_reply() instead of free(xcb_request_check())
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  src/intel/vulkan/anv_wsi_x11.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_wsi_x11.c b/src/intel/vulkan/anv_wsi_
> x11.c
> index 2895d6b..3e089b7 100644
> --- a/src/intel/vulkan/anv_wsi_x11.c
> +++ b/src/intel/vulkan/anv_wsi_x11.c
> @@ -734,11 +734,16 @@ x11_swapchain_destroy(struct anv_swapchain
> *anv_chain,
>                        const VkAllocationCallbacks *pAllocator)
>  {
>     struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
> +   xcb_void_cookie_t cookie;
>
>     for (uint32_t i = 0; i < chain->image_count; i++)
>        x11_image_finish(chain, pAllocator, &chain->images[i]);
>
>     xcb_unregister_for_special_event(chain->conn, chain->special_event);
> +   cookie = xcb_present_select_input_checked(chain->conn,
> chain->event_id,
> +                                             chain->window,
> +                                             XCB_PRESENT_EVENT_MASK_NO_
> EVENT);
> +   xcb_discard_reply(chain->conn, cookie.sequence);
>
>     anv_free2(&chain->base.device->alloc, pAllocator, chain);
>
> --
> 2.8.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160831/f0d3b3ef/attachment.html>


More information about the mesa-dev mailing list