File vulkan-Fix-compilation-on-older-platforms.patch of Package Mesa
diff --git a/meson.build b/meson.build
index 7d12af3d51..2683060827 100644
--- a/meson.build
+++ b/meson.build
@@ -1406,6 +1406,13 @@
endif
endif
+if with_any_vk
+ dep_drm_crt_sequence = dependency('libdrm', version : '>=' + _drm_crt_sequence_ver, required : false)
+ if dep_drm_crt_sequence.found()
+ pre_args += '-DVK_USE_DISPLAY_CONTROL'
+ endif
+endif
+
if get_option('gallium-extra-hud')
pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
endif
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index c36559f48e..e60b0d4773 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -98,7 +98,7 @@
Extension('VK_EXT_conditional_rendering', 1, True),
Extension('VK_EXT_conservative_rasterization', 1, 'device->rad_info.chip_class >= GFX9'),
Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
- Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+ Extension('VK_EXT_display_control', 1, 'VK_USE_DISPLAY_CONTROL'),
Extension('VK_EXT_debug_report', 9, True),
Extension('VK_EXT_depth_clip_enable', 1, True),
Extension('VK_EXT_depth_range_unrestricted', 1, True),
@@ -238,6 +238,13 @@ _TEMPLATE_C = Template(COPYRIGHT + """
# define ANDROID false
#endif
+#ifdef VK_USE_DISPLAY_CONTROL
+# undef VK_USE_DISPLAY_CONTROL
+# define VK_USE_DISPLAY_CONTROL true
+#else
+# define VK_USE_DISPLAY_CONTROL false
+#endif
+
#define RADV_HAS_SURFACE (VK_USE_PLATFORM_WAYLAND_KHR || \\
VK_USE_PLATFORM_XCB_KHR || \\
VK_USE_PLATFORM_XLIB_KHR || \\
diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c
index d8743a06e3..50713fb9d9 100644
--- a/src/amd/vulkan/radv_wsi_display.c
+++ b/src/amd/vulkan/radv_wsi_display.c
@@ -252,8 +252,7 @@ radv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device,
}
#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
-/* VK_EXT_display_control */
-
+#if VK_USE_DISPLAY_CONTROL
VkResult
radv_DisplayPowerControlEXT(VkDevice _device,
VkDisplayKHR display,
@@ -351,4 +350,4 @@ radv_GetSwapchainCounterEXT(VkDevice _device,
flag_bits,
value);
}
-
+#endif /* VK_USE_DISPLAY_CONTROL */
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index adc1d75898..defd153095 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -120,7 +120,7 @@
Extension('VK_EXT_debug_report', 8, True),
Extension('VK_EXT_depth_clip_enable', 1, True),
Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
- Extension('VK_EXT_display_control', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
+ Extension('VK_EXT_display_control', 1, 'VK_USE_DISPLAY_CONTROL'),
Extension('VK_EXT_display_surface_counter', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
Extension('VK_EXT_external_memory_dma_buf', 1, True),
Extension('VK_EXT_external_memory_host', 1, True),
diff --git a/src/intel/vulkan/anv_extensions_gen.py b/src/intel/vulkan/anv_extensions_gen.py
index a140c26745..914db7bd0e 100644
--- a/src/intel/vulkan/anv_extensions_gen.py
+++ b/src/intel/vulkan/anv_extensions_gen.py
@@ -120,6 +120,13 @@ _TEMPLATE_C = Template(COPYRIGHT + """
# define ANDROID false
#endif
+#ifdef VK_USE_DISPLAY_CONTROL
+# undef VK_USE_DISPLAY_CONTROL
+# define VK_USE_DISPLAY_CONTROL true
+#else
+# define VK_USE_DISPLAY_CONTROL false
+#endif
+
#define ANV_HAS_SURFACE (VK_USE_PLATFORM_WAYLAND_KHR || \\
VK_USE_PLATFORM_XCB_KHR || \\
VK_USE_PLATFORM_XLIB_KHR || \\
diff --git a/src/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c
index 3212c235ba..ab65bc6e1e 100644
--- a/src/intel/vulkan/anv_wsi_display.c
+++ b/src/intel/vulkan/anv_wsi_display.c
@@ -231,8 +231,7 @@ anv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device,
}
#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
-/* VK_EXT_display_control */
-
+#if VK_USE_DISPLAY_CONTROL
VkResult
anv_DisplayPowerControlEXT(VkDevice _device,
VkDisplayKHR display,
@@ -315,3 +314,4 @@ anv_GetSwapchainCounterEXT(VkDevice _device,
_device, &device->instance->physicalDevice.wsi_device,
swapchain, flag_bits, value);
}
+#endif /* VK_USE_DISPLAY_CONTROL */
\ No newline at end of file
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index ac932d4368..792489a166 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1131,7 +1131,9 @@ static drmEventContext event_context = {
.page_flip_handler2 = wsi_display_page_flip_handler2,
#endif
.vblank_handler = wsi_display_vblank_handler,
+#if DRM_EVENT_CONTEXT_VERSION >= 4
.sequence_handler = wsi_display_sequence_handler,
+#endif
};
static void *
@@ -1459,6 +1461,7 @@ static void wsi_display_fence_event_handler(struct wsi_display_fence *fence)
wsi_display_fence_check_free(fence);
}
+#if VK_USE_DISPLAY_CONTROL
static void
wsi_display_fence_destroy(struct wsi_fence *fence_wsi)
{
@@ -1551,6 +1554,7 @@ wsi_register_vblank_event(struct wsi_display_fence *fence,
}
}
}
+#endif /* VK_USE_DISPLAY_CONTROL */
/*
* Check to see if the kernel has no flip queued and if there's an image
@@ -2348,7 +2352,7 @@ wsi_get_randr_output_display(VkPhysicalDevice physical_device,
#endif
-/* VK_EXT_display_control */
+#if VK_USE_DISPLAY_CONTROL
VkResult
wsi_display_power_control(VkDevice device,
struct wsi_device *wsi_device,
@@ -2459,4 +2463,4 @@ wsi_get_swapchain_counter(VkDevice device,
return VK_SUCCESS;
}
-
+#endif /* VK_USE_DISPLAY_CONTROL */
diff --git a/src/vulkan/wsi/wsi_common_display.h b/src/vulkan/wsi/wsi_common_display.h
index 50d7f836a7..2e0f69505f 100644
--- a/src/vulkan/wsi/wsi_common_display.h
+++ b/src/vulkan/wsi/wsi_common_display.h
@@ -131,7 +131,7 @@ wsi_get_randr_output_display(VkPhysicalDevice physical_device,
#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
-/* VK_EXT_display_control */
+#if VK_USE_DISPLAY_CONTROL
VkResult
wsi_display_power_control(VkDevice device,
struct wsi_device *wsi_device,
@@ -159,5 +159,6 @@ wsi_get_swapchain_counter(VkDevice device,
VkSwapchainKHR swapchain,
VkSurfaceCounterFlagBitsEXT flag_bits,
uint64_t *value);
+#endif /* VK_USE_DISPLAY_CONTROL */
#endif