All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: mesa-dev@lists.freedesktop.org
Cc: Keith Packard <keithp@keithp.com>, dri-devel@lists.freedesktop.org
Subject: [PATCH 09/21] radv: Add EXT_acquire_xlib_display to radv driver
Date: Tue, 13 Feb 2018 16:31:22 -0800	[thread overview]
Message-ID: <20180214003134.1552-10-keithp@keithp.com> (raw)
In-Reply-To: <20180214003134.1552-1-keithp@keithp.com>

This extension adds the ability to borrow an X RandR output for
temporary use directly by a Vulkan application to the radv driver.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/amd/vulkan/Makefile.am        |  7 +++++++
 src/amd/vulkan/meson.build        |  7 +++++++
 src/amd/vulkan/radv_extensions.py | 11 ++++++-----
 src/amd/vulkan/radv_wsi_display.c | 30 ++++++++++++++++++++++++++++++
 4 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index 061b8144b88..94ece06e99e 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -81,7 +81,14 @@ AM_CPPFLAGS += \
 	-DVK_USE_PLATFORM_DISPLAY_KHR
 
 VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES)
+endif
+
+if HAVE_XLIB_LEASE
+AM_CPPFLAGS += \
+	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
+	$(XCB_RANDR_CFLAGS)
 
+VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
 endif
 
 if HAVE_PLATFORM_X11
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index b7bb1075e7d..0b92a1763a1 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -119,6 +119,13 @@ if with_platform_display
   libradv_files += files('radv_wsi_display.c')
 endif
 
+if with_xlib_lease
+  radv_deps += dep_xcb_xrandr
+  radv_flags += [
+    '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT',
+  ]
+endif
+
 libvulkan_radeon = shared_library(
   'vulkan_radeon',
   [libradv_files, radv_entrypoints, radv_extensions_c, vk_format_table_c],
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index b04b9bf87b0..df3325d47d4 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -83,6 +83,7 @@ EXTENSIONS = [
     Extension('VK_KHR_xlib_surface',                      6, 'VK_USE_PLATFORM_XLIB_KHR'),
     Extension('VK_KHR_display',                          23, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+    Extension('VK_EXT_acquire_xlib_display',              1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
     Extension('VK_KHX_multiview',                         1, '!ANDROID'),
     Extension('VK_EXT_debug_report',                      9, True),
     Extension('VK_EXT_discard_rectangles',                1, True),
@@ -170,12 +171,12 @@ _TEMPLATE = Template(COPYRIGHT + """
 #include "vk_util.h"
 
 /* Convert the VK_USE_PLATFORM_* defines to booleans */
-%for platform in ['ANDROID', 'WAYLAND', 'XCB', 'XLIB', 'DISPLAY']:
-#ifdef VK_USE_PLATFORM_${platform}_KHR
-#   undef VK_USE_PLATFORM_${platform}_KHR
-#   define VK_USE_PLATFORM_${platform}_KHR true
+%for platform in ['ANDROID_KHR', 'WAYLAND_KHR', 'XCB_KHR', 'XLIB_KHR', 'DISPLAY_KHR', 'XLIB_XRANDR_EXT']:
+#ifdef VK_USE_PLATFORM_${platform}
+#   undef VK_USE_PLATFORM_${platform}
+#   define VK_USE_PLATFORM_${platform} true
 #else
-#   define VK_USE_PLATFORM_${platform}_KHR false
+#   define VK_USE_PLATFORM_${platform} false
 #endif
 %endfor
 
diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c
index deaf61ce0df..d7a5956ad97 100644
--- a/src/amd/vulkan/radv_wsi_display.c
+++ b/src/amd/vulkan/radv_wsi_display.c
@@ -152,3 +152,33 @@ radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device,
 				   &pdevice->wsi_device,
 				   display);
 }
+
+#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
+VkResult
+radv_AcquireXlibDisplayEXT(VkPhysicalDevice     physical_device,
+			   Display              *dpy,
+			   VkDisplayKHR         display)
+{
+	RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+	return wsi_acquire_xlib_display(physical_device,
+					&pdevice->wsi_device,
+					dpy,
+					display);
+}
+
+VkResult
+radv_GetRandROutputDisplayEXT(VkPhysicalDevice  physical_device,
+			      Display           *dpy,
+			      RROutput          output,
+			      VkDisplayKHR      *display)
+{
+	RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+	return wsi_get_randr_output_display(physical_device,
+					    &pdevice->wsi_device,
+					    dpy,
+					    output,
+					    display);
+}
+#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
-- 
2.15.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-02-14  0:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14  0:31 [PATCH 0/21] Add KHR_display through GOOGLE_display_timing [v2] Keith Packard
2018-02-14  0:31 ` [PATCH 01/21] vulkan: Add KHR_display extension using DRM Keith Packard
2018-02-24  0:43   ` Jason Ekstrand
2018-02-24  9:43     ` Daniel Stone
2018-03-07 20:28       ` [Mesa-dev] " Keith Packard
2018-03-07 20:15     ` Keith Packard
2018-02-14  0:31 ` [PATCH 02/21] anv: Add KHR_display extension to anv Keith Packard
2018-02-14  0:31 ` [PATCH 03/21] radv: Add KHR_display extension to radv Keith Packard
2018-02-14  0:31 ` [PATCH 04/21] vulkan: Add EXT_direct_mode_display Keith Packard
2018-02-14  0:31 ` [PATCH 05/21] anv: Add EXT_direct_mode_display to anv driver Keith Packard
2018-02-14  0:31 ` [PATCH 06/21] radv: Add EXT_direct_mode_display to radv driver Keith Packard
2018-02-14  0:31 ` [PATCH 07/21] vulkan: Add EXT_acquire_xlib_display Keith Packard
2018-02-14 12:13   ` [Mesa-dev] " Eric Engestrom
2018-02-15 20:26     ` Keith Packard
2018-02-14  0:31 ` [PATCH 08/21] anv: Add EXT_acquire_xlib_display to anv driver Keith Packard
2018-02-14  0:31 ` Keith Packard [this message]
2018-02-14  0:31 ` [PATCH 10/21] vulkan: Add VK_EXT_display_surface_counter [v3] Keith Packard
2018-02-14  0:31 ` [PATCH 11/21] anv: Add VK_EXT_display_surface_counter to anv driver [v4] Keith Packard
2018-02-14  0:31 ` [PATCH 12/21] radv: Add VK_EXT_display_surface_counter to radv driver Keith Packard
2018-02-14  0:31 ` [PATCH 13/21] vulkan: add VK_EXT_display_control [v3] Keith Packard
2018-02-14  0:31 ` [PATCH 14/21] anv: add VK_EXT_display_control to anv driver Keith Packard
2018-02-14  0:31 ` [PATCH 15/21] radv: add VK_EXT_display_control to radv driver Keith Packard
2018-02-14  0:31 ` [PATCH 16/21] vulkan: Define new VK_MESA_query_timestamp extension Keith Packard
2018-02-14  0:31 ` [PATCH 17/21] anv: Add new VK_MESA_query_timestamp extension to anv driver Keith Packard
2018-02-14  0:31 ` [PATCH 18/21] radv: Add new VK_MESA_query_timestamp extension to radv driver Keith Packard
2018-02-14  0:31 ` [PATCH 19/21] vulkan: Add VK_GOOGLE_display_timing extension (x11 and display backends) Keith Packard
2018-02-14  0:31 ` [PATCH 20/21] anv: Add VK_GOOGLE_display_timing extension to anv driver Keith Packard
2018-02-14  0:31 ` [PATCH 21/21] radv: Add VK_GOOGLE_display_timing extension to radv driver 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=20180214003134.1552-10-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.