Module: Mesa Branch: main Commit: a53fd9b0897fc88a28974cef5317039e23ac3939 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a53fd9b0897fc88a28974cef5317039e23ac3939
Author: Ella Stanforth <[email protected]> Date: Sun Dec 12 22:39:55 2021 +0000 vulkan: Allow RegisterDisplayEventEXT before first page flip Reviewed-by: Tapani Pälli <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14685> --- 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,
