summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorKeith Packard <[email protected]>2018-02-09 07:45:58 -0800
committerKeith Packard <[email protected]>2018-06-19 14:17:46 -0700
commit46090a642d54d58bbdb851ae62beb5c350101324 (patch)
treef96ff23010d1fefa7f8b67b6fe56812993345ee0 /src/intel
parent7ab1fffcd2a504024b16e408de329f7a94553ecc (diff)
anv: Add EXT_acquire_xlib_display to anv driver [v3]
This extension adds the ability to borrow an X RandR output for temporary use directly by a Vulkan application to the anv driver. v2: Simplify addition of VK_USE_PLATFORM_XLIB_XRANDR_KHR to vulkan_wsi_args Suggested-by: Eric Engestrom <[email protected]> v3: Add extension to list in alphabetical order Suggested-by: Jason Ekstrand <[email protected]> Signed-off-by: Keith Packard <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/Makefile.vulkan.am7
-rw-r--r--src/intel/vulkan/anv_entrypoints_gen.py5
-rw-r--r--src/intel/vulkan/anv_extensions.py1
-rw-r--r--src/intel/vulkan/anv_extensions_gen.py10
-rw-r--r--src/intel/vulkan/anv_wsi_display.c30
-rw-r--r--src/intel/vulkan/meson.build5
6 files changed, 52 insertions, 6 deletions
diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
index 9b7fbb74007..ae625695814 100644
--- a/src/intel/Makefile.vulkan.am
+++ b/src/intel/Makefile.vulkan.am
@@ -199,6 +199,13 @@ VULKAN_CPPFLAGS += \
VULKAN_SOURCES += $(VULKAN_WSI_DISPLAY_FILES)
endif
+if HAVE_XLIB_LEASE
+VULKAN_CPPFLAGS += \
+ -DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
+ $(XCB_RANDR_CFLAGS)
+VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
+endif
+
noinst_LTLIBRARIES += vulkan/libvulkan_common.la
vulkan_libvulkan_common_la_SOURCES = $(VULKAN_SOURCES)
vulkan_libvulkan_common_la_CFLAGS = $(VULKAN_CFLAGS)
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index 230671d36ae..db350698501 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -513,7 +513,10 @@ def get_entrypoints_defines(doc):
for extension in doc.findall('./extensions/extension[@platform]'):
platform = extension.attrib['platform']
- define = 'VK_USE_PLATFORM_' + platform.upper() + '_KHR'
+ ext = '_KHR'
+ if platform.upper() == 'XLIB_XRANDR':
+ ext = '_EXT'
+ define = 'VK_USE_PLATFORM_' + platform.upper() + ext
for entrypoint in extension.findall('./require/command'):
fullname = entrypoint.attrib['name']
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index ab0ab2c6a0a..2bba4ee4d2b 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -110,6 +110,7 @@ EXTENSIONS = [
Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'),
Extension('VK_KHR_multiview', 1, True),
Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+ Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
Extension('VK_EXT_debug_report', 8, True),
Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
Extension('VK_EXT_external_memory_dma_buf', 1, True),
diff --git a/src/intel/vulkan/anv_extensions_gen.py b/src/intel/vulkan/anv_extensions_gen.py
index a8b398f630d..a140c267452 100644
--- a/src/intel/vulkan/anv_extensions_gen.py
+++ b/src/intel/vulkan/anv_extensions_gen.py
@@ -103,12 +103,12 @@ _TEMPLATE_C = 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/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c
index b7f3ce0a68f..ed679e85e13 100644
--- a/src/intel/vulkan/anv_wsi_display.c
+++ b/src/intel/vulkan/anv_wsi_display.c
@@ -144,3 +144,33 @@ anv_ReleaseDisplayEXT(VkPhysicalDevice physical_device,
&pdevice->wsi_device,
display);
}
+
+#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
+VkResult
+anv_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device,
+ Display *dpy,
+ VkDisplayKHR display)
+{
+ ANV_FROM_HANDLE(anv_physical_device, pdevice, physical_device);
+
+ return wsi_acquire_xlib_display(physical_device,
+ &pdevice->wsi_device,
+ dpy,
+ display);
+}
+
+VkResult
+anv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device,
+ Display *dpy,
+ RROutput output,
+ VkDisplayKHR *display)
+{
+ ANV_FROM_HANDLE(anv_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 */
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
index 797473500ff..4b0652f757b 100644
--- a/src/intel/vulkan/meson.build
+++ b/src/intel/vulkan/meson.build
@@ -169,6 +169,11 @@ if with_platform_drm
libanv_files += files('anv_wsi_display.c')
endif
+if with_xlib_lease
+ anv_deps += dep_xcb_xrandr
+ anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
+endif
+
libanv_common = static_library(
'anv_common',
[libanv_files, anv_entrypoints, anv_extensions_c, anv_extensions_h],