From 57b353ec6a76c41539a74e82fa7e43fdcfbf2410 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 16 May 2022 09:50:26 +0200 Subject: [PATCH] vulkan/wsi: unbreak win32-support There's no unistd.h on Windows, let's not include it unconditionally. But we also don't want to deal with DRM modifiers or DMABUFs on Windows, so let's also ifdef out the rest of that stuff. Fixes: a8b009aed6b ("vulkan/wsi: fix missing unistd include") Fixes: c72ff19a9ef ("vulkan/wsi: Close file descriptors in wsi_destroy_image") Reviewed-By: Yonggang Luo Acked-by: Boris Brezillon Part-of: --- src/vulkan/wsi/wsi_common.c | 8 ++++++++ src/vulkan/wsi/wsi_common_private.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index dd193d83601..0b48f16a0b2 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -38,7 +38,10 @@ #include #include #include + +#ifndef _WIN32 #include +#endif VkResult wsi_device_init(struct wsi_device *wsi, @@ -477,7 +480,10 @@ wsi_create_image(const struct wsi_swapchain *chain, VkResult result; memset(image, 0, sizeof(*image)); + +#ifndef _WIN32 image->dma_buf_fd = -1; +#endif result = wsi->CreateImage(chain->device, &info->create, &chain->alloc, &image->image); @@ -512,8 +518,10 @@ wsi_destroy_image(const struct wsi_swapchain *chain, { const struct wsi_device *wsi = chain->wsi; +#ifndef _WIN32 if (image->dma_buf_fd >= 0) close(image->dma_buf_fd); +#endif if (image->buffer.blit_cmd_buffers) { for (uint32_t i = 0; i < wsi->queue_family_count; i++) { diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index ae0b196b3aa..b5198d45b0b 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -74,12 +74,16 @@ struct wsi_image { VkCommandBuffer *blit_cmd_buffers; } buffer; +#ifndef _WIN32 uint64_t drm_modifier; +#endif int num_planes; uint32_t sizes[4]; uint32_t offsets[4]; uint32_t row_pitches[4]; +#ifndef _WIN32 int dma_buf_fd; +#endif }; struct wsi_swapchain {