[04/21] vulkan: Add EXT_direct_mode_display
diff mbox

Message ID 20180214003134.1552-5-keithp@keithp.com
State New
Headers show

Commit Message

Keith Packard Feb. 14, 2018, 12:31 a.m. UTC
Add support for the EXT_direct_mode_display extension. This just
provides the vkReleaseDisplayEXT function.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/vulkan/wsi/wsi_common_display.c | 17 +++++++++++++++++
 src/vulkan/wsi/wsi_common_display.h |  5 +++++
 2 files changed, 22 insertions(+)

Patch
diff mbox

diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index 2732b1dd721..5c123e6465e 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1366,3 +1366,20 @@  wsi_display_finish_wsi(struct wsi_device *wsi_device,
       vk_free(alloc, wsi);
    }
 }
+
+/*
+ * Implement vkReleaseDisplay
+ */
+VkResult
+wsi_release_display(VkPhysicalDevice            physical_device,
+                    struct wsi_device           *wsi_device,
+                    VkDisplayKHR                display)
+{
+   struct wsi_display           *wsi = (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
+
+   if (wsi->master_fd >= 0 && wsi->master_fd != wsi->render_fd) {
+      close(wsi->master_fd);
+      wsi->master_fd = -1;
+   }
+   return VK_SUCCESS;
+}
diff --git a/src/vulkan/wsi/wsi_common_display.h b/src/vulkan/wsi/wsi_common_display.h
index b414a226293..5fbb6925e4a 100644
--- a/src/vulkan/wsi/wsi_common_display.h
+++ b/src/vulkan/wsi/wsi_common_display.h
@@ -69,4 +69,9 @@  wsi_create_display_surface(VkInstance instance,
                            const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
                            VkSurfaceKHR *pSurface);
 
+VkResult
+wsi_release_display(VkPhysicalDevice            physical_device,
+                    struct wsi_device           *wsi_device,
+                    VkDisplayKHR                display);
+
 #endif