All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: mesa-dev@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/7] vulkan: Add EXT_direct_mode_display
Date: Fri,  9 Feb 2018 20:45:11 -0800	[thread overview]
Message-ID: <20180210044516.16944-3-keithp@keithp.com> (raw)
In-Reply-To: <20180210044516.16944-1-keithp@keithp.com>

Add support for the EXT_direct_mode_display extension. This just
provides the vkReleaseDisplayEXT function.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/amd/vulkan/radv_extensions.py   |  1 +
 src/amd/vulkan/radv_wsi_display.c   | 11 +++++++++++
 src/intel/vulkan/anv_extensions.py  |  1 +
 src/intel/vulkan/anv_wsi_display.c  | 11 +++++++++++
 src/vulkan/wsi/wsi_common_display.c | 17 +++++++++++++++++
 src/vulkan/wsi/wsi_common_display.h |  5 +++++
 6 files changed, 46 insertions(+)

diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index 24cab8cbb39..f784681ff57 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -82,6 +82,7 @@ EXTENSIONS = [
     Extension('VK_KHR_xcb_surface',                       6, 'VK_USE_PLATFORM_XCB_KHR'),
     Extension('VK_KHR_xlib_surface',                      6, 'VK_USE_PLATFORM_XLIB_KHR'),
     Extension('VK_KHR_display',                           1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+    Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_KHX_multiview',                         1, '!ANDROID'),
     Extension('VK_EXT_debug_report',                      9, True),
     Extension('VK_EXT_discard_rectangles',                1, True),
diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c
index b0a4db0344b..0051f5ac865 100644
--- a/src/amd/vulkan/radv_wsi_display.c
+++ b/src/amd/vulkan/radv_wsi_display.c
@@ -141,3 +141,14 @@ radv_CreateDisplayPlaneSurfaceKHR(VkInstance                            _instanc
 
    return wsi_create_display_surface(_instance, alloc, create_info, surface);
 }
+
+VkResult
+radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device,
+                       VkDisplayKHR     display)
+{
+   RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+   return wsi_release_display(physical_device,
+                              &pdevice->wsi_device,
+                              display);
+}
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index 978a219e2b2..633e378e605 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -84,6 +84,7 @@ EXTENSIONS = [
     Extension('VK_KHR_xcb_surface',                       6, 'VK_USE_PLATFORM_XCB_KHR'),
     Extension('VK_KHR_xlib_surface',                      6, 'VK_USE_PLATFORM_XLIB_KHR'),
     Extension('VK_KHR_display',                           1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+    Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_KHX_multiview',                         1, True),
     Extension('VK_EXT_debug_report',                      8, True),
     Extension('VK_EXT_external_memory_dma_buf',           1, True),
diff --git a/src/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c
index 9b00d7f02e4..e6f67f7dec9 100644
--- a/src/intel/vulkan/anv_wsi_display.c
+++ b/src/intel/vulkan/anv_wsi_display.c
@@ -127,3 +127,14 @@ anv_CreateDisplayPlaneSurfaceKHR(VkInstance                            _instance
 
    return wsi_create_display_surface(_instance, alloc, create_info, surface);
 }
+
+VkResult
+anv_ReleaseDisplayEXT(VkPhysicalDevice physical_device,
+                       VkDisplayKHR     display)
+{
+   ANV_FROM_HANDLE(anv_physical_device, pdevice, physical_device);
+
+   return wsi_release_display(physical_device,
+                              &pdevice->wsi_device,
+                              display);
+}
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
-- 
2.15.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

  parent reply	other threads:[~2018-02-10  4:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10  4:45 [PATCH 0/7] vulkan: Add direct display extensions Keith Packard
2018-02-10  4:45 ` [PATCH 1/7] vulkan: Add KHR_display extension to anv and radv using DRM Keith Packard
2018-02-12 15:27   ` Eric Engestrom
2018-02-12 22:16     ` Keith Packard
2018-02-12 16:18   ` [Mesa-dev] " Emil Velikov
2018-02-12 23:12     ` Keith Packard
2018-02-14  1:10   ` Jason Ekstrand
2018-02-15 17:46     ` Keith Packard
2018-02-23 23:00       ` Jason Ekstrand
2018-02-23 23:43         ` Keith Packard
2018-02-24  0:51           ` Jason Ekstrand
2018-03-12 23:02             ` Keith Packard
2018-03-29  6:59   ` Mao, David
2018-03-29 15:05     ` Keith Packard
2018-02-10  4:45 ` Keith Packard [this message]
2018-02-10  4:45 ` [PATCH 3/7] vulkan: Add EXT_acquire_xlib_display Keith Packard
2018-02-13  0:16   ` Dylan Baker
2018-02-10  4:45 ` [PATCH 4/7] vulkan: Add VK_EXT_display_surface_counter [v4] Keith Packard
2018-02-10  4:45 ` [PATCH 5/7] vulkan: add VK_EXT_display_control [v4] Keith Packard
2018-02-10  4:45 ` [PATCH 6/7] vulkan: Add new VK_MESA_query_timestamp extension Keith Packard
2018-02-13  0:20   ` Dylan Baker
2018-02-13 10:49     ` [Mesa-dev] " Lionel Landwerlin
2018-02-13 21:11       ` Keith Packard
2018-02-10  4:45 ` [PATCH 7/7] vulkan: Add VK_GOOGLE_display_timing extension (x11 and display backends) Keith Packard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180210044516.16944-3-keithp@keithp.com \
    --to=keithp@keithp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mesa-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.