summaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-17 22:57:37 -0700
committerKeith Packard <keithp@keithp.com>2017-05-17 22:57:37 -0700
commitc7ec1f439b79a49f25067a52cdc15c6540a6f5b0 (patch)
treec2cabcf59c4975ba6a0ee9b597f0c9b9ca8a5290 /loader
parent0bbc015828bdb99e85e6731ce92428557902701f (diff)
Add VK_KEITHP_kms_display extension
This allows the application to provide an existing DRM device file descriptor into the vulkan drivers instead of having the driver open the device itself. There is additional information provided about the desired mode to set on the device; that will be used to apply a mode set on the first presentation request and to restore the mode after a VT switch has occurred. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'loader')
-rw-r--r--loader/CMakeLists.txt5
-rw-r--r--loader/extension_manual.c2
-rw-r--r--loader/loader.c3
-rw-r--r--loader/wsi.c23
-rw-r--r--loader/wsi.h5
5 files changed, 37 insertions, 1 deletions
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index d15f09cc..c8966ea3 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -30,6 +30,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
endif()
+ if (BUILD_KMS_SUPPORT)
+ add_definitions(-DVK_USE_PLATFORM_KMS_KEITHP)
+ include_directories(${KMS_INCLUDE_DIR})
+ endif()
+
if (BUILD_WSI_XLIB_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_XRANDR_EXT)
endif()
diff --git a/loader/extension_manual.c b/loader/extension_manual.c
index 6ddb9b09..209afd16 100644
--- a/loader/extension_manual.c
+++ b/loader/extension_manual.c
@@ -583,4 +583,4 @@ out:
}
return res;
-} \ No newline at end of file
+}
diff --git a/loader/loader.c b/loader/loader.c
index 48e90647..aa83ce2d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -4811,6 +4811,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) {
// For each ICD, query the number of physical devices, and then get an
// internal value for those physical devices.
for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) {
+ extern const VkKmsDisplayInfoKEITHP *globalDisplayInfo;
+ if (icd_term->dispatch.SetKmsDisplayInfoKEITHP)
+ res = icd_term->dispatch.SetKmsDisplayInfoKEITHP(icd_term->instance, globalDisplayInfo);
res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &icd_phys_dev_array[icd_idx].count, NULL);
if (VK_SUCCESS != res) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
diff --git a/loader/wsi.c b/loader/wsi.c
index 131ca518..93e9cd6f 100644
--- a/loader/wsi.c
+++ b/loader/wsi.c
@@ -1031,6 +1031,29 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo
}
#endif // VK_USE_PLATFORM_XLIB_KHR
+#if VK_USE_PLATFORM_KMS_KEITHP
+LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetKmsDisplayInfoKEITHP(VkInstance instance,
+ const VkKmsDisplayInfoKEITHP *pDisplayInfo)
+{
+ const VkLayerInstanceDispatchTable *disp;
+ disp = loader_get_instance_layer_dispatch(instance);
+ VkResult res;
+
+ res = disp->SetKmsDisplayInfoKEITHP(instance, pDisplayInfo);
+ return res;
+}
+
+const VkKmsDisplayInfoKEITHP *globalDisplayInfo;
+
+VKAPI_ATTR VkResult VKAPI_CALL terminator_SetKmsDisplayInfoKEITHP(VkInstance instance,
+ const VkKmsDisplayInfoKEITHP *pDisplayInfo)
+{
+ printf ("SetKmsDisplayInfoKEITHP\n");
+ globalDisplayInfo = pDisplayInfo;
+ return VK_SUCCESS;
+}
+#endif // VK_USE_PLATFORM_KMS_KEITHP
+
#ifdef VK_USE_PLATFORM_ANDROID_KHR
// Functions for the VK_KHR_android_surface extension:
diff --git a/loader/wsi.h b/loader/wsi.h
index 519a7aac..e681ae47 100644
--- a/loader/wsi.h
+++ b/loader/wsi.h
@@ -142,4 +142,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice dev
const VkAllocationCallbacks *pAllocator,
VkSwapchainKHR *pSwapchains);
+#ifdef VK_USE_PLATFORM_KMS_KEITHP
+VKAPI_ATTR VkResult VKAPI_CALL terminator_SetKmsDisplayInfoKEITHP(VkInstance instance,
+ const VkKmsDisplayInfoKEITHP *pDisplayInfo);
+#endif
+
#endif // WSI_H