Module: Mesa Branch: main Commit: 7c8a5f6e377a6210700177568b372e8108eaba96 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c8a5f6e377a6210700177568b372e8108eaba96
Author: Mike Blumenkrantz <[email protected]> Date: Tue Feb 21 08:40:23 2023 -0500 vulkan/wsi: switch to using an options struct for last param this makes adding values easier since the drivers won't need to be updated Acked-by: Daniel Stone <[email protected]> Reviewed-by: Gert Wollny <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21447> --- src/amd/vulkan/radv_wsi.c | 2 +- src/broadcom/vulkan/v3dv_wsi.c | 3 ++- src/freedreno/vulkan/tu_wsi.c | 2 +- src/gallium/frontends/lavapipe/lvp_wsi.c | 3 ++- src/imagination/vulkan/pvr_wsi.c | 2 +- src/intel/vulkan/anv_wsi.c | 2 +- src/intel/vulkan_hasvk/anv_wsi.c | 2 +- src/microsoft/vulkan/dzn_wsi.c | 3 ++- src/panfrost/vulkan/panvk_wsi.c | 2 +- src/virtio/vulkan/vn_wsi.c | 2 +- src/vulkan/wsi/wsi_common.c | 4 ++-- src/vulkan/wsi/wsi_common.h | 6 +++++- 12 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 0661d01aa6d..ecfee143e73 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -92,7 +92,7 @@ radv_init_wsi(struct radv_physical_device *physical_device) VkResult result = wsi_device_init(&physical_device->wsi_device, radv_physical_device_to_handle(physical_device), radv_wsi_proc_addr, &physical_device->instance->vk.alloc, - physical_device->master_fd, &physical_device->instance->dri_options, false); + physical_device->master_fd, &physical_device->instance->dri_options, &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/broadcom/vulkan/v3dv_wsi.c b/src/broadcom/vulkan/v3dv_wsi.c index bea9ab289aa..70df881c88a 100644 --- a/src/broadcom/vulkan/v3dv_wsi.c +++ b/src/broadcom/vulkan/v3dv_wsi.c @@ -54,7 +54,8 @@ v3dv_wsi_init(struct v3dv_physical_device *physical_device) v3dv_physical_device_to_handle(physical_device), v3dv_wsi_proc_addr, &physical_device->vk.instance->alloc, - physical_device->master_fd, NULL, false); + physical_device->master_fd, NULL, + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/freedreno/vulkan/tu_wsi.c b/src/freedreno/vulkan/tu_wsi.c index cf09cf9b649..877a49221c3 100644 --- a/src/freedreno/vulkan/tu_wsi.c +++ b/src/freedreno/vulkan/tu_wsi.c @@ -40,7 +40,7 @@ tu_wsi_init(struct tu_physical_device *physical_device) &physical_device->instance->vk.alloc, physical_device->master_fd, &physical_device->instance->dri_options, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/gallium/frontends/lavapipe/lvp_wsi.c b/src/gallium/frontends/lavapipe/lvp_wsi.c index 2305d6f267f..835bd646de2 100644 --- a/src/gallium/frontends/lavapipe/lvp_wsi.c +++ b/src/gallium/frontends/lavapipe/lvp_wsi.c @@ -39,7 +39,8 @@ lvp_init_wsi(struct lvp_physical_device *physical_device) lvp_physical_device_to_handle(physical_device), lvp_wsi_proc_addr, &physical_device->vk.instance->alloc, - -1, NULL, true); + -1, NULL, + &(struct wsi_device_options){.sw_device = true}); if (result != VK_SUCCESS) return result; diff --git a/src/imagination/vulkan/pvr_wsi.c b/src/imagination/vulkan/pvr_wsi.c index 65650e1a86c..8376c3df1f1 100644 --- a/src/imagination/vulkan/pvr_wsi.c +++ b/src/imagination/vulkan/pvr_wsi.c @@ -52,7 +52,7 @@ VkResult pvr_wsi_init(struct pvr_physical_device *pdevice) &pdevice->vk.instance->alloc, pdevice->master_fd, NULL, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 1130e266192..8260b130879 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -47,7 +47,7 @@ anv_init_wsi(struct anv_physical_device *physical_device) &physical_device->instance->vk.alloc, physical_device->master_fd, &physical_device->instance->dri_options, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/intel/vulkan_hasvk/anv_wsi.c b/src/intel/vulkan_hasvk/anv_wsi.c index 5e98673e275..2cd65232912 100644 --- a/src/intel/vulkan_hasvk/anv_wsi.c +++ b/src/intel/vulkan_hasvk/anv_wsi.c @@ -47,7 +47,7 @@ anv_init_wsi(struct anv_physical_device *physical_device) &physical_device->instance->vk.alloc, physical_device->master_fd, &physical_device->instance->dri_options, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/microsoft/vulkan/dzn_wsi.c b/src/microsoft/vulkan/dzn_wsi.c index 5036d2c2aa3..c66e2c74c62 100644 --- a/src/microsoft/vulkan/dzn_wsi.c +++ b/src/microsoft/vulkan/dzn_wsi.c @@ -97,7 +97,8 @@ dzn_wsi_init(struct dzn_physical_device *physical_device) dzn_physical_device_to_handle(physical_device), dzn_wsi_proc_addr, &physical_device->vk.instance->alloc, - -1, NULL, sw); + -1, NULL, + &(struct wsi_device_options){.sw_device = sw}); if (result != VK_SUCCESS) return result; diff --git a/src/panfrost/vulkan/panvk_wsi.c b/src/panfrost/vulkan/panvk_wsi.c index d48f9d2d2c9..e62f39b9332 100644 --- a/src/panfrost/vulkan/panvk_wsi.c +++ b/src/panfrost/vulkan/panvk_wsi.c @@ -47,7 +47,7 @@ panvk_wsi_init(struct panvk_physical_device *physical_device) panvk_wsi_proc_addr, &physical_device->instance->vk.alloc, physical_device->master_fd, NULL, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c index 1a86ba2bc41..0acacb23b52 100644 --- a/src/virtio/vulkan/vn_wsi.c +++ b/src/virtio/vulkan/vn_wsi.c @@ -81,7 +81,7 @@ vn_wsi_init(struct vn_physical_device *physical_dev) VkResult result = wsi_device_init( &physical_dev->wsi_device, vn_physical_device_to_handle(physical_dev), vn_wsi_proc_addr, alloc, -1, &physical_dev->instance->dri_options, - false); + &(struct wsi_device_options){.sw_device = false}); if (result != VK_SUCCESS) return result; diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index f010972be1c..8a6f6557fbe 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -65,7 +65,7 @@ wsi_device_init(struct wsi_device *wsi, const VkAllocationCallbacks *alloc, int display_fd, const struct driOptionCache *dri_options, - bool sw_device) + const struct wsi_device_options *device_options) { const char *present_mode; UNUSED VkResult result; @@ -79,7 +79,7 @@ wsi_device_init(struct wsi_device *wsi, wsi->instance_alloc = *alloc; wsi->pdevice = pdevice; wsi->supports_scanout = true; - wsi->sw = sw_device || (WSI_DEBUG & WSI_DEBUG_SW); + wsi->sw = device_options->sw_device || (WSI_DEBUG & WSI_DEBUG_SW); wsi->wants_linear = (WSI_DEBUG & WSI_DEBUG_LINEAR) != 0; #define WSI_GET_CB(func) \ PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func) diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index bea1bcd3dbc..b357354c202 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -255,6 +255,10 @@ struct wsi_device { typedef PFN_vkVoidFunction (VKAPI_PTR *WSI_FN_GetPhysicalDeviceProcAddr)(VkPhysicalDevice physicalDevice, const char* pName); +struct wsi_device_options { + bool sw_device; +}; + VkResult wsi_device_init(struct wsi_device *wsi, VkPhysicalDevice pdevice, @@ -262,7 +266,7 @@ wsi_device_init(struct wsi_device *wsi, const VkAllocationCallbacks *alloc, int display_fd, const struct driOptionCache *dri_options, - bool sw_device); + const struct wsi_device_options *device_options); void wsi_device_finish(struct wsi_device *wsi,
