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: a8b009aed6 ("vulkan/wsi: fix missing unistd include")
Fixes: c72ff19a9e ("vulkan/wsi: Close file descriptors in wsi_destroy_image")

Reviewed-By: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16373>
This commit is contained in:
Erik Faye-Lund 2022-05-16 09:50:26 +02:00 committed by Marge Bot
parent 5c90eb1c53
commit 57b353ec6a
2 changed files with 12 additions and 0 deletions

View File

@ -38,7 +38,10 @@
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef _WIN32
#include <unistd.h>
#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++) {

View File

@ -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 {