Signed-off-by: Louis-Francis Ratté-Boulianne <l...@collabora.com> --- src/vulkan/wsi/wsi_common_x11.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index ecdaf91434..d132541156 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -628,6 +628,8 @@ struct x11_image { struct x11_swapchain { struct wsi_swapchain base; + bool has_dma_fence; + xcb_connection_t * conn; xcb_window_t window; xcb_gc_t gc; @@ -639,6 +641,7 @@ struct x11_swapchain { uint64_t send_sbc; uint64_t last_present_msc; uint32_t stamp; + uint32_t present_capabilities; bool threaded; VkResult status; @@ -951,6 +954,32 @@ fail: return NULL; } +static void +wsi_x11_get_present_capabilities(struct x11_swapchain *chain) +{ + xcb_present_query_capabilities_cookie_t present_capabilities_cookie; + xcb_present_query_capabilities_reply_t *present_capabilities_reply; + + if (chain->present_capabilities) + return; + + present_capabilities_cookie = + xcb_present_query_capabilities(chain->conn, chain->window); + present_capabilities_reply = + xcb_present_query_capabilities_reply(chain->conn, + present_capabilities_cookie, + NULL); + + if (present_capabilities_reply) { + chain->present_capabilities = present_capabilities_reply->capabilities; + chain->has_dma_fence = chain->present_capabilities & + XCB_PRESENT_CAPABILITY_IDLE_FENCE; + free(present_capabilities_reply); + } else { + chain->present_capabilities = 0; + } +} + static VkResult x11_image_init(VkDevice device_h, struct x11_swapchain *chain, const VkSwapchainCreateInfoKHR *pCreateInfo, @@ -1011,6 +1040,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain, chain->depth, bpp, fd); xcb_discard_reply(chain->conn, cookie.sequence); + wsi_x11_get_present_capabilities(chain); + int fence_fd = xshmfence_alloc_shm(); if (fence_fd < 0) goto fail_pixmap; -- 2.13.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev