Browse Source

[KMSDRM] For Vulkan, use a mode with the same exact size as the window, if possible, or create a new one.

Vanfanel 4 years ago
parent
commit
c13c3c37bd
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/video/kmsdrm/SDL_kmsdrmvulkan.c

+ 5 - 4
src/video/kmsdrm/SDL_kmsdrmvulkan.c

@@ -367,14 +367,15 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
     planes_props = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * plane_count);
     planes_props = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * plane_count);
     vkGetPhysicalDeviceDisplayPlanePropertiesKHR(gpu, &plane_count, planes_props);
     vkGetPhysicalDeviceDisplayPlanePropertiesKHR(gpu, &plane_count, planes_props);
 
 
-    /* Get a video mode equal or smaller than the window size. REMEMBER:
-       We have to get a small enough videomode for the window size,
+    /* 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,
        because videomode determines how big the scanout region is and we can't
        because videomode determines how big the scanout region is and we can't
        scanout a region bigger than the window (we would be reading past the
        scanout a region bigger than the window (we would be reading past the
        buffer, and Vulkan would give us a confusing VK_ERROR_SURFACE_LOST_KHR). */
        buffer, and Vulkan would give us a confusing VK_ERROR_SURFACE_LOST_KHR). */
     for (i = 0; i < mode_count; i++) {
     for (i = 0; i < mode_count; i++) {
-        if (modes_props[i].parameters.visibleRegion.width <= window->w &&
-            modes_props[i].parameters.visibleRegion.height <= window->h)
+        if (modes_props[i].parameters.visibleRegion.width == window->w &&
+            modes_props[i].parameters.visibleRegion.height == window->h)
         {
         {
             display_mode_props = modes_props[i];
             display_mode_props = modes_props[i];
             mode_found = SDL_TRUE;
             mode_found = SDL_TRUE;