0060-vulkan-wsi-Disable-use-of-VK_EXT_pci_bus_info.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From 2e1cdcd98f084bf62a2b1f4a8ecb77f3be8548db Mon Sep 17 00:00:00 2001
  2. From: brendan King <Brendan.King@imgtec.com>
  3. Date: Fri, 30 Jul 2021 15:34:13 +0100
  4. Subject: [PATCH] vulkan/wsi: Disable use of VK_EXT_pci_bus_info
  5. The VK_EXT_pci_bus_info related code has been wrapped in
  6. VULKAN_WSI_USE_PCI_BUS_INFO, effectively disabling it.
  7. Not all platforms support the VK_EXT_pci_bus_info extension.
  8. A better fix might be to pass another parameter to wsi_device_init,
  9. to indicate that the device is a PCI one.
  10. ---
  11. src/vulkan/wsi/wsi_common.c | 4 ++++
  12. src/vulkan/wsi/wsi_common.h | 2 ++
  13. src/vulkan/wsi/wsi_common_drm.c | 4 ++++
  14. 3 files changed, 10 insertions(+)
  15. diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
  16. index b1360ed..66d6683 100644
  17. --- a/src/vulkan/wsi/wsi_common.c
  18. +++ b/src/vulkan/wsi/wsi_common.c
  19. @@ -56,11 +56,15 @@ wsi_device_init(struct wsi_device *wsi,
  20. WSI_GET_CB(GetPhysicalDeviceQueueFamilyProperties);
  21. #undef WSI_GET_CB
  22. +#if defined(VULKAN_WSI_USE_PCI_BUS_INFO)
  23. wsi->pci_bus_info.sType =
  24. VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT;
  25. +#endif
  26. VkPhysicalDeviceProperties2 pdp2 = {
  27. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
  28. +#if defined(VULKAN_WSI_USE_PCI_BUS_INFO)
  29. .pNext = &wsi->pci_bus_info,
  30. +#endif
  31. };
  32. GetPhysicalDeviceProperties2(pdevice, &pdp2);
  33. diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
  34. index c2563c6..4a73366 100644
  35. --- a/src/vulkan/wsi/wsi_common.h
  36. +++ b/src/vulkan/wsi/wsi_common.h
  37. @@ -112,7 +112,9 @@ struct wsi_device {
  38. VkPhysicalDeviceMemoryProperties memory_props;
  39. uint32_t queue_family_count;
  40. +#if defined(VULKAN_WSI_USE_PCI_BUS_INFO)
  41. VkPhysicalDevicePCIBusInfoPropertiesEXT pci_bus_info;
  42. +#endif
  43. bool supports_modifiers;
  44. uint32_t maxImageDimension2D;
  45. diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
  46. index 6201891..49a78cf 100644
  47. --- a/src/vulkan/wsi/wsi_common_drm.c
  48. +++ b/src/vulkan/wsi/wsi_common_drm.c
  49. @@ -45,6 +45,7 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
  50. if (ret)
  51. return false;
  52. +#if defined(VULKAN_WSI_USE_PCI_BUS_INFO)
  53. bool match = false;
  54. switch (fd_device->bustype) {
  55. case DRM_BUS_PCI:
  56. @@ -57,6 +58,9 @@ wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd)
  57. default:
  58. break;
  59. }
  60. +#else
  61. + const bool match = true;
  62. +#endif
  63. drmFreeDevice(&fd_device);