From a53fd9b0897fc88a28974cef5317039e23ac3939 Mon Sep 17 00:00:00 2001 From: Ella Stanforth Date: Sun, 12 Dec 2021 22:39:55 +0000 Subject: [PATCH] vulkan: Allow RegisterDisplayEventEXT before first page flip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Tapani Pälli Part-of: --- src/vulkan/wsi/wsi_common_display.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 1bc1dc742f8..4b3a02ba844 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -1701,6 +1701,17 @@ wsi_register_vblank_event(struct wsi_display_fence *fence, if (wsi->fd < 0) return VK_ERROR_INITIALIZATION_FAILED; + /* A display event may be registered before the first page flip at which + * point crtc_id will be 0. If this is the case we setup the connector + * here to allow drmCrtcQueueSequence to succeed. + */ + if (!connector->crtc_id) { + VkResult ret = wsi_display_setup_connector(connector, + connector->current_mode); + if (ret != VK_SUCCESS) + return VK_ERROR_INITIALIZATION_FAILED; + } + for (;;) { int ret = drmCrtcQueueSequence(wsi->fd, connector->crtc_id, flags,