|
|
@@ -156,6 +156,19 @@ char const * const *KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
|
|
return extensionsForKMSDRM;
|
|
|
}
|
|
|
|
|
|
+static int SDLCALL display_mode_comparator(const void *a_opaque, const void *b_opaque)
|
|
|
+{
|
|
|
+ const VkDisplayModePropertiesKHR *a = a_opaque;
|
|
|
+ const VkDisplayModePropertiesKHR *b = b_opaque;
|
|
|
+
|
|
|
+ if (a->parameters.refreshRate > b->parameters.refreshRate)
|
|
|
+ return -1;
|
|
|
+ else if (a->parameters.refreshRate < b->parameters.refreshRate)
|
|
|
+ return 1;
|
|
|
+ else
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/***********************************************************************/
|
|
|
// First thing to know is that we don't call vkCreateInstance() here.
|
|
|
// Instead, programs using SDL and Vulkan create their Vulkan instance
|
|
|
@@ -342,6 +355,9 @@ bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
|
|
display,
|
|
|
&mode_count, mode_props);
|
|
|
|
|
|
+ /* Sort the modes so that larger refresh rates come first. */
|
|
|
+ SDL_qsort(mode_props, mode_count, sizeof(*mode_props), display_mode_comparator);
|
|
|
+
|
|
|
/* Get a video mode equal to the window size among the predefined ones,
|
|
|
if possible.
|
|
|
REMEMBER: We have to get a small enough videomode for the window size,
|