So that user graphics drivers can fill in LUID property.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winemac.drv/vulkan.c | 66 +++++++++++++++++++++++++----------- dlls/winevulkan/make_vulkan | 4 ++- dlls/winex11.drv/vulkan.c | 65 ++++++++++++++++++++++++----------- include/wine/vulkan_driver.h | 8 ++++- 4 files changed, 101 insertions(+), 42 deletions(-)
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index dd92231d3ea..d06b19b7a0c 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -85,6 +85,8 @@ static void (*pvkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocati static VkResult (*pvkEnumerateInstanceExtensionProperties)(const char *, uint32_t *, VkExtensionProperties *); static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); +static void (*pvkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); +static void (*pvkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); @@ -113,6 +115,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) }
#define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) goto fail; +#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f); LOAD_FUNCPTR(vkCreateInstance) LOAD_FUNCPTR(vkCreateSwapchainKHR) LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK) @@ -123,6 +126,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties) LOAD_FUNCPTR(vkGetDeviceProcAddr) LOAD_FUNCPTR(vkGetInstanceProcAddr) + LOAD_FUNCPTR(vkGetPhysicalDeviceProperties2) + LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceProperties2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR) @@ -444,6 +449,25 @@ static void *macdrv_vkGetInstanceProcAddr(VkInstance instance, const char *name) return pvkGetInstanceProcAddr(instance, name); }
+static void macdrv_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, + VkPhysicalDeviceProperties2 *properties) +{ + TRACE("%p, %p\n", phys_dev, properties); + + pvkGetPhysicalDeviceProperties2(phys_dev, properties); +} + +static void macdrv_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, + VkPhysicalDeviceProperties2 *properties) +{ + TRACE("%p, %p\n", phys_dev, properties); + + if (pvkGetPhysicalDeviceProperties2KHR) + pvkGetPhysicalDeviceProperties2KHR(phys_dev, properties); + else + pvkGetPhysicalDeviceProperties2(phys_dev, properties); +} + static VkResult macdrv_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) { @@ -560,26 +584,28 @@ static VkResult macdrv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
static const struct vulkan_funcs vulkan_funcs = { - macdrv_vkCreateInstance, - macdrv_vkCreateSwapchainKHR, - macdrv_vkCreateWin32SurfaceKHR, - macdrv_vkDestroyInstance, - macdrv_vkDestroySurfaceKHR, - macdrv_vkDestroySwapchainKHR, - macdrv_vkEnumerateInstanceExtensionProperties, - NULL, - macdrv_vkGetDeviceProcAddr, - macdrv_vkGetInstanceProcAddr, - NULL, - macdrv_vkGetPhysicalDeviceSurfaceCapabilities2KHR, - macdrv_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - macdrv_vkGetPhysicalDeviceSurfaceFormats2KHR, - macdrv_vkGetPhysicalDeviceSurfaceFormatsKHR, - macdrv_vkGetPhysicalDeviceSurfacePresentModesKHR, - macdrv_vkGetPhysicalDeviceSurfaceSupportKHR, - macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, - macdrv_vkGetSwapchainImagesKHR, - macdrv_vkQueuePresentKHR, + .p_vkCreateInstance = macdrv_vkCreateInstance, + .p_vkCreateSwapchainKHR = macdrv_vkCreateSwapchainKHR, + .p_vkCreateWin32SurfaceKHR = macdrv_vkCreateWin32SurfaceKHR, + .p_vkDestroyInstance = macdrv_vkDestroyInstance, + .p_vkDestroySurfaceKHR = macdrv_vkDestroySurfaceKHR, + .p_vkDestroySwapchainKHR = macdrv_vkDestroySwapchainKHR, + .p_vkEnumerateInstanceExtensionProperties = macdrv_vkEnumerateInstanceExtensionProperties, + .p_vkGetDeviceGroupSurfacePresentModesKHR = NULL, + .p_vkGetDeviceProcAddr = macdrv_vkGetDeviceProcAddr, + .p_vkGetInstanceProcAddr = macdrv_vkGetInstanceProcAddr, + .p_vkGetPhysicalDevicePresentRectanglesKHR = NULL, + .p_vkGetPhysicalDeviceProperties2 = macdrv_vkGetPhysicalDeviceProperties2, + .p_vkGetPhysicalDeviceProperties2KHR = macdrv_vkGetPhysicalDeviceProperties2KHR, + .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = macdrv_vkGetPhysicalDeviceSurfaceCapabilities2KHR, + .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = macdrv_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, + .p_vkGetPhysicalDeviceSurfaceFormats2KHR = macdrv_vkGetPhysicalDeviceSurfaceFormats2KHR, + .p_vkGetPhysicalDeviceSurfaceFormatsKHR = macdrv_vkGetPhysicalDeviceSurfaceFormatsKHR, + .p_vkGetPhysicalDeviceSurfacePresentModesKHR = macdrv_vkGetPhysicalDeviceSurfacePresentModesKHR, + .p_vkGetPhysicalDeviceSurfaceSupportKHR = macdrv_vkGetPhysicalDeviceSurfaceSupportKHR, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, + .p_vkGetSwapchainImagesKHR = macdrv_vkGetSwapchainImagesKHR, + .p_vkQueuePresentKHR = macdrv_vkQueuePresentKHR, };
static void *macdrv_get_vk_device_proc_addr(const char *name) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1dee769836f..36de61501cb 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -138,7 +138,7 @@ CORE_EXTENSIONS = [ # Functions part of our winevulkan graphics driver interface. # DRIVER_VERSION should be bumped on any change to driver interface # in FUNCTION_OVERRIDES -DRIVER_VERSION = 8 +DRIVER_VERSION = 9
# Table of functions for which we have a special implementation. # These are regular device / instance functions for which we need @@ -165,6 +165,8 @@ FUNCTION_OVERRIDES = { "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True}, + "vkGetPhysicalDeviceProperties2" : {"dispatch" : True, "driver" : True, "thunk" : True}, + "vkGetPhysicalDeviceProperties2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
# Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 4de82586906..c988b1a6b27 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -84,6 +84,8 @@ static VkResult (*pvkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKH static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); static VkResult (*pvkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); +static void (*pvkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); +static void (*pvkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); @@ -123,6 +125,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties); LOAD_FUNCPTR(vkGetDeviceProcAddr); LOAD_FUNCPTR(vkGetInstanceProcAddr); + LOAD_FUNCPTR(vkGetPhysicalDeviceProperties2); + LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceProperties2KHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR); LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR); @@ -459,6 +463,25 @@ static VkResult X11DRV_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice return pvkGetPhysicalDevicePresentRectanglesKHR(phys_dev, x11_surface->surface, count, rects); }
+static void X11DRV_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, + VkPhysicalDeviceProperties2 *properties) +{ + TRACE("%p, %p\n", phys_dev, properties); + + pvkGetPhysicalDeviceProperties2(phys_dev, properties); +} + +static void X11DRV_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, + VkPhysicalDeviceProperties2 *properties) +{ + TRACE("%p, %p\n", phys_dev, properties); + + if (pvkGetPhysicalDeviceProperties2KHR) + pvkGetPhysicalDeviceProperties2KHR(phys_dev, properties); + else + pvkGetPhysicalDeviceProperties2(phys_dev, properties); +} + static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) { @@ -603,26 +626,28 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
static const struct vulkan_funcs vulkan_funcs = { - X11DRV_vkCreateInstance, - X11DRV_vkCreateSwapchainKHR, - X11DRV_vkCreateWin32SurfaceKHR, - X11DRV_vkDestroyInstance, - X11DRV_vkDestroySurfaceKHR, - X11DRV_vkDestroySwapchainKHR, - X11DRV_vkEnumerateInstanceExtensionProperties, - X11DRV_vkGetDeviceGroupSurfacePresentModesKHR, - X11DRV_vkGetDeviceProcAddr, - X11DRV_vkGetInstanceProcAddr, - X11DRV_vkGetPhysicalDevicePresentRectanglesKHR, - X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR, - X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR, - X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR, - X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR, - X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR, - X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, - X11DRV_vkGetSwapchainImagesKHR, - X11DRV_vkQueuePresentKHR, + .p_vkCreateInstance = X11DRV_vkCreateInstance, + .p_vkCreateSwapchainKHR = X11DRV_vkCreateSwapchainKHR, + .p_vkCreateWin32SurfaceKHR = X11DRV_vkCreateWin32SurfaceKHR, + .p_vkDestroyInstance = X11DRV_vkDestroyInstance, + .p_vkDestroySurfaceKHR = X11DRV_vkDestroySurfaceKHR, + .p_vkDestroySwapchainKHR = X11DRV_vkDestroySwapchainKHR, + .p_vkEnumerateInstanceExtensionProperties = X11DRV_vkEnumerateInstanceExtensionProperties, + .p_vkGetDeviceGroupSurfacePresentModesKHR = X11DRV_vkGetDeviceGroupSurfacePresentModesKHR, + .p_vkGetDeviceProcAddr = X11DRV_vkGetDeviceProcAddr, + .p_vkGetInstanceProcAddr = X11DRV_vkGetInstanceProcAddr, + .p_vkGetPhysicalDevicePresentRectanglesKHR = X11DRV_vkGetPhysicalDevicePresentRectanglesKHR, + .p_vkGetPhysicalDeviceProperties2 = X11DRV_vkGetPhysicalDeviceProperties2, + .p_vkGetPhysicalDeviceProperties2KHR = X11DRV_vkGetPhysicalDeviceProperties2KHR, + .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR, + .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, + .p_vkGetPhysicalDeviceSurfaceFormats2KHR = X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR, + .p_vkGetPhysicalDeviceSurfaceFormatsKHR = X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR, + .p_vkGetPhysicalDeviceSurfacePresentModesKHR = X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR, + .p_vkGetPhysicalDeviceSurfaceSupportKHR = X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, + .p_vkGetSwapchainImagesKHR = X11DRV_vkGetSwapchainImagesKHR, + .p_vkQueuePresentKHR = X11DRV_vkQueuePresentKHR, };
static void *X11DRV_get_vk_device_proc_addr(const char *name) diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 90e5dd1804d..004ae8879ef 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -39,7 +39,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 8 +#define WINE_VULKAN_DRIVER_VERSION 9
struct vulkan_funcs { @@ -58,6 +58,8 @@ struct vulkan_funcs void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *); void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *); VkResult (*p_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); + void (*p_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); + void (*p_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); @@ -118,6 +120,10 @@ static inline void *get_vulkan_driver_instance_proc_addr( return vulkan_funcs->p_vkGetInstanceProcAddr; if (!strcmp(name, "GetPhysicalDevicePresentRectanglesKHR")) return vulkan_funcs->p_vkGetPhysicalDevicePresentRectanglesKHR; + if (!strcmp(name, "GetPhysicalDeviceProperties2")) + return vulkan_funcs->p_vkGetPhysicalDeviceProperties2; + if (!strcmp(name, "GetPhysicalDeviceProperties2KHR")) + return vulkan_funcs->p_vkGetPhysicalDeviceProperties2KHR; if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2KHR")) return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceCapabilities2KHR; if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR"))
HI Zhiyi,
On Jun 12, 2020, at 12:20 AM, Zhiyi Zhang zzhang@codeweavers.com wrote:
So that user graphics drivers can fill in LUID property.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/winemac.drv/vulkan.c | 66 +++++++++++++++++++++++++----------- dlls/winevulkan/make_vulkan | 4 ++- dlls/winex11.drv/vulkan.c | 65 ++++++++++++++++++++++++----------- include/wine/vulkan_driver.h | 8 ++++- 4 files changed, 101 insertions(+), 42 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1dee769836f..36de61501cb 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -138,7 +138,7 @@ CORE_EXTENSIONS = [ # Functions part of our winevulkan graphics driver interface. # DRIVER_VERSION should be bumped on any change to driver interface # in FUNCTION_OVERRIDES -DRIVER_VERSION = 8 +DRIVER_VERSION = 9
# Table of functions for which we have a special implementation. # These are regular device / instance functions for which we need @@ -165,6 +165,8 @@ FUNCTION_OVERRIDES = { "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
- "vkGetPhysicalDeviceProperties2" : {"dispatch" : True, "driver" : True, "thunk" : True},
- "vkGetPhysicalDeviceProperties2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
Just an idea: What if vkGetRandROutputDisplayEXT() and vkGetPhysicalDeviceProperties2() were called when discovering GPUs (like in xrandr14_get_gpus()), and the returned deviceUUID was stored in SetupAPI for each GPU. Then the Vulkan thunks would take the deviceUUID returned from the system driver, search SetupAPI for it, and get the corresponding GPU LUID. I’m not sure if it would be much simpler, but would avoid having to extend the driver interface.
# Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 4de82586906..c988b1a6b27 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -84,6 +84,8 @@ static VkResult (*pvkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKH static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); static VkResult (*pvkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); +static void (*pvkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); +static void (*pvkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); @@ -123,6 +125,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties); LOAD_FUNCPTR(vkGetDeviceProcAddr); LOAD_FUNCPTR(vkGetInstanceProcAddr);
- LOAD_FUNCPTR(vkGetPhysicalDeviceProperties2);
- LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceProperties2KHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR); LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR);
@@ -459,6 +463,25 @@ static VkResult X11DRV_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice return pvkGetPhysicalDevicePresentRectanglesKHR(phys_dev, x11_surface->surface, count, rects); }
+static void X11DRV_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev,
VkPhysicalDeviceProperties2 *properties)
+{
- TRACE("%p, %p\n", phys_dev, properties);
- pvkGetPhysicalDeviceProperties2(phys_dev, properties);
+}
+static void X11DRV_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev,
VkPhysicalDeviceProperties2 *properties)
+{
- TRACE("%p, %p\n", phys_dev, properties);
- if (pvkGetPhysicalDeviceProperties2KHR)
pvkGetPhysicalDeviceProperties2KHR(phys_dev, properties);
- else
pvkGetPhysicalDeviceProperties2(phys_dev, properties);
+}
static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) { @@ -603,26 +626,28 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
static const struct vulkan_funcs vulkan_funcs = {
- X11DRV_vkCreateInstance,
- X11DRV_vkCreateSwapchainKHR,
- X11DRV_vkCreateWin32SurfaceKHR,
- X11DRV_vkDestroyInstance,
- X11DRV_vkDestroySurfaceKHR,
- X11DRV_vkDestroySwapchainKHR,
- X11DRV_vkEnumerateInstanceExtensionProperties,
- X11DRV_vkGetDeviceGroupSurfacePresentModesKHR,
- X11DRV_vkGetDeviceProcAddr,
- X11DRV_vkGetInstanceProcAddr,
- X11DRV_vkGetPhysicalDevicePresentRectanglesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR,
- X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR,
- X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR,
- X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR,
- X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
- X11DRV_vkGetSwapchainImagesKHR,
- X11DRV_vkQueuePresentKHR,
- .p_vkCreateInstance = X11DRV_vkCreateInstance,
- .p_vkCreateSwapchainKHR = X11DRV_vkCreateSwapchainKHR,
- .p_vkCreateWin32SurfaceKHR = X11DRV_vkCreateWin32SurfaceKHR,
- .p_vkDestroyInstance = X11DRV_vkDestroyInstance,
- .p_vkDestroySurfaceKHR = X11DRV_vkDestroySurfaceKHR,
- .p_vkDestroySwapchainKHR = X11DRV_vkDestroySwapchainKHR,
- .p_vkEnumerateInstanceExtensionProperties = X11DRV_vkEnumerateInstanceExtensionProperties,
- .p_vkGetDeviceGroupSurfacePresentModesKHR = X11DRV_vkGetDeviceGroupSurfacePresentModesKHR,
- .p_vkGetDeviceProcAddr = X11DRV_vkGetDeviceProcAddr,
- .p_vkGetInstanceProcAddr = X11DRV_vkGetInstanceProcAddr,
- .p_vkGetPhysicalDevicePresentRectanglesKHR = X11DRV_vkGetPhysicalDevicePresentRectanglesKHR,
- .p_vkGetPhysicalDeviceProperties2 = X11DRV_vkGetPhysicalDeviceProperties2,
- .p_vkGetPhysicalDeviceProperties2KHR = X11DRV_vkGetPhysicalDeviceProperties2KHR,
- .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR,
- .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
- .p_vkGetPhysicalDeviceSurfaceFormats2KHR = X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR,
- .p_vkGetPhysicalDeviceSurfaceFormatsKHR = X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR,
- .p_vkGetPhysicalDeviceSurfacePresentModesKHR = X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR,
- .p_vkGetPhysicalDeviceSurfaceSupportKHR = X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR,
- .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
- .p_vkGetSwapchainImagesKHR = X11DRV_vkGetSwapchainImagesKHR,
- .p_vkQueuePresentKHR = X11DRV_vkQueuePresentKHR,
};
I'm in favor of C99 designated initializers but I don’t think I've seen them used anywhere else in Wine, are they allowed? If so, I think the change should go in a separate commit though.
Brendan
On 6/13/20 3:03 AM, Brendan Shanks wrote:
HI Zhiyi,
On Jun 12, 2020, at 12:20 AM, Zhiyi Zhang zzhang@codeweavers.com wrote:
So that user graphics drivers can fill in LUID property.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/winemac.drv/vulkan.c | 66 +++++++++++++++++++++++++----------- dlls/winevulkan/make_vulkan | 4 ++- dlls/winex11.drv/vulkan.c | 65 ++++++++++++++++++++++++----------- include/wine/vulkan_driver.h | 8 ++++- 4 files changed, 101 insertions(+), 42 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1dee769836f..36de61501cb 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -138,7 +138,7 @@ CORE_EXTENSIONS = [ # Functions part of our winevulkan graphics driver interface. # DRIVER_VERSION should be bumped on any change to driver interface # in FUNCTION_OVERRIDES -DRIVER_VERSION = 8 +DRIVER_VERSION = 9
# Table of functions for which we have a special implementation. # These are regular device / instance functions for which we need @@ -165,6 +165,8 @@ FUNCTION_OVERRIDES = { "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False, "driver" : False, "thunk" : False}, "vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
- "vkGetPhysicalDeviceProperties2" : {"dispatch" : True, "driver" : True, "thunk" : True},
- "vkGetPhysicalDeviceProperties2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
Just an idea: What if vkGetRandROutputDisplayEXT() and vkGetPhysicalDeviceProperties2() were called when discovering GPUs (like in xrandr14_get_gpus()), and the returned deviceUUID was stored in SetupAPI for each GPU. Then the Vulkan thunks would take the deviceUUID returned from the system driver, search SetupAPI for it, and get the corresponding GPU LUID. I’m not sure if it would be much simpler, but would avoid having to extend the driver interface.
Seems like a good idea. I will give it a try. Thanks.
# Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 4de82586906..c988b1a6b27 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -84,6 +84,8 @@ static VkResult (*pvkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKH static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); static VkResult (*pvkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); +static void (*pvkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); +static void (*pvkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); @@ -123,6 +125,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context) LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties); LOAD_FUNCPTR(vkGetDeviceProcAddr); LOAD_FUNCPTR(vkGetInstanceProcAddr);
- LOAD_FUNCPTR(vkGetPhysicalDeviceProperties2);
- LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceProperties2KHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilities2KHR); LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDeviceSurfaceFormats2KHR);
@@ -459,6 +463,25 @@ static VkResult X11DRV_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice return pvkGetPhysicalDevicePresentRectanglesKHR(phys_dev, x11_surface->surface, count, rects); }
+static void X11DRV_vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev,
VkPhysicalDeviceProperties2 *properties)
+{
- TRACE("%p, %p\n", phys_dev, properties);
- pvkGetPhysicalDeviceProperties2(phys_dev, properties);
+}
+static void X11DRV_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev,
VkPhysicalDeviceProperties2 *properties)
+{
- TRACE("%p, %p\n", phys_dev, properties);
- if (pvkGetPhysicalDeviceProperties2KHR)
pvkGetPhysicalDeviceProperties2KHR(phys_dev, properties);
- else
pvkGetPhysicalDeviceProperties2(phys_dev, properties);
+}
static VkResult X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities) { @@ -603,26 +626,28 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
static const struct vulkan_funcs vulkan_funcs = {
- X11DRV_vkCreateInstance,
- X11DRV_vkCreateSwapchainKHR,
- X11DRV_vkCreateWin32SurfaceKHR,
- X11DRV_vkDestroyInstance,
- X11DRV_vkDestroySurfaceKHR,
- X11DRV_vkDestroySwapchainKHR,
- X11DRV_vkEnumerateInstanceExtensionProperties,
- X11DRV_vkGetDeviceGroupSurfacePresentModesKHR,
- X11DRV_vkGetDeviceProcAddr,
- X11DRV_vkGetInstanceProcAddr,
- X11DRV_vkGetPhysicalDevicePresentRectanglesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR,
- X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR,
- X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR,
- X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR,
- X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR,
- X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
- X11DRV_vkGetSwapchainImagesKHR,
- X11DRV_vkQueuePresentKHR,
- .p_vkCreateInstance = X11DRV_vkCreateInstance,
- .p_vkCreateSwapchainKHR = X11DRV_vkCreateSwapchainKHR,
- .p_vkCreateWin32SurfaceKHR = X11DRV_vkCreateWin32SurfaceKHR,
- .p_vkDestroyInstance = X11DRV_vkDestroyInstance,
- .p_vkDestroySurfaceKHR = X11DRV_vkDestroySurfaceKHR,
- .p_vkDestroySwapchainKHR = X11DRV_vkDestroySwapchainKHR,
- .p_vkEnumerateInstanceExtensionProperties = X11DRV_vkEnumerateInstanceExtensionProperties,
- .p_vkGetDeviceGroupSurfacePresentModesKHR = X11DRV_vkGetDeviceGroupSurfacePresentModesKHR,
- .p_vkGetDeviceProcAddr = X11DRV_vkGetDeviceProcAddr,
- .p_vkGetInstanceProcAddr = X11DRV_vkGetInstanceProcAddr,
- .p_vkGetPhysicalDevicePresentRectanglesKHR = X11DRV_vkGetPhysicalDevicePresentRectanglesKHR,
- .p_vkGetPhysicalDeviceProperties2 = X11DRV_vkGetPhysicalDeviceProperties2,
- .p_vkGetPhysicalDeviceProperties2KHR = X11DRV_vkGetPhysicalDeviceProperties2KHR,
- .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilities2KHR,
- .p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR,
- .p_vkGetPhysicalDeviceSurfaceFormats2KHR = X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR,
- .p_vkGetPhysicalDeviceSurfaceFormatsKHR = X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR,
- .p_vkGetPhysicalDeviceSurfacePresentModesKHR = X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR,
- .p_vkGetPhysicalDeviceSurfaceSupportKHR = X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR,
- .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
- .p_vkGetSwapchainImagesKHR = X11DRV_vkGetSwapchainImagesKHR,
- .p_vkQueuePresentKHR = X11DRV_vkQueuePresentKHR,
};
I'm in favor of C99 designated initializers but I don’t think I've seen them used anywhere else in Wine, are they allowed? If so, I think the change should go in a separate commit though.
They are being used, for example, in wined3d_adapter_vk_ops in wined3d/adapter_vk.c.
Brendan