From d93d989e5d65922c6467cf61874f71665856bf80 Mon Sep 17 00:00:00 2001 From: Valentine Burley Date: Fri, 17 May 2024 15:22:38 +0200 Subject: [PATCH] wsi: Guard DRM-dependent function implementations with HAVE_LIBDRM Adress an implicit function declaration error by ensuring that DRM-dependent functions are only compiled when HAVE_LIBDRM is set. Fixes: 59813ae468d ("wsi: Add common infrastructure for explicit sync") Signed-off-by: Valentine Burley Reviewed-by: Joshua Ashton Part-of: --- src/vulkan/wsi/wsi_common_drm.c | 4 ---- src/vulkan/wsi/wsi_common_wayland.c | 15 ++++++++++----- src/vulkan/wsi/wsi_common_x11.c | 16 ++++++++++------ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c index b80c1ba4f91..dc636735022 100644 --- a/src/vulkan/wsi/wsi_common_drm.c +++ b/src/vulkan/wsi/wsi_common_drm.c @@ -908,7 +908,6 @@ wsi_drm_wait_for_explicit_sync_release(struct wsi_swapchain *chain, uint64_t rel_timeout_ns, uint32_t *image_index) { -#ifdef HAVE_LIBDRM STACK_ARRAY(uint32_t, handles, image_count); STACK_ARRAY(uint64_t, points, image_count); STACK_ARRAY(uint32_t, indices, image_count); @@ -989,7 +988,4 @@ done: return rel_timeout_ns ? VK_TIMEOUT : VK_NOT_READY; else return VK_ERROR_OUT_OF_DATE_KHR; -#else - return VK_ERROR_FEATURE_NOT_PRESENT; -#endif } diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index f44bb5c901d..caa16743fc1 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -1893,11 +1893,16 @@ wsi_wl_swapchain_acquire_next_image_explicit(struct wsi_swapchain *wsi_chain, for (uint32_t i = 0; i < chain->base.image_count; i++) images[i] = &chain->images[i].base; - VkResult result = wsi_drm_wait_for_explicit_sync_release(wsi_chain, - wsi_chain->image_count, - images, - info->timeout, - image_index); + VkResult result; +#ifdef HAVE_LIBDRM + result = wsi_drm_wait_for_explicit_sync_release(wsi_chain, + wsi_chain->image_count, + images, + info->timeout, + image_index); +#else + result = VK_ERROR_FEATURE_NOT_PRESENT; +#endif STACK_ARRAY_FINISH(images); if (result == VK_SUCCESS) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 29b123e624e..c6afea8b958 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1240,12 +1240,16 @@ x11_wait_for_explicit_sync_release_submission(struct x11_swapchain *chain, for (uint32_t i = 0; i < chain->base.image_count; i++) images[i] = &chain->images[i].base; - VkResult result = - wsi_drm_wait_for_explicit_sync_release(&chain->base, - chain->base.image_count, - images, - rel_timeout_ns, - image_index); + VkResult result; +#ifdef HAVE_LIBDRM + result = wsi_drm_wait_for_explicit_sync_release(&chain->base, + chain->base.image_count, + images, + rel_timeout_ns, + image_index); +#else + result = VK_ERROR_FEATURE_NOT_PRESENT; +#endif STACK_ARRAY_FINISH(images); return result; }