From 760074270a9832ca4f9d6b6a766a9ae104e8391a Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 19 Jul 2021 11:26:54 +0200 Subject: [PATCH] kmsdrm: Properly zero-initialize CreateInfo structs As written, these contain undefined stack contents, which in practice causes crashes/hangs and/or triggers the validation layers (they complain about `pNext` and `flags` not being NULL). --- src/video/kmsdrm/SDL_kmsdrmvulkan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c index a47752948..b08a41e78 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -394,6 +394,8 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS, /* SDL (and DRM, if we look at drmModeModeInfo vrefresh) uses plain integer Hz for display mode refresh rate, but Vulkan expects higher precision. */ new_mode_parameters.refreshRate = window->fullscreen_mode.refresh_rate * 1000; + + SDL_zero(display_mode_create_info); display_mode_create_info.sType = VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR; display_mode_create_info.parameters = new_mode_parameters; result = vkCreateDisplayModeKHR(gpu, @@ -419,6 +421,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS, image_size.width = window->w; image_size.height = window->h; + SDL_zero(display_plane_surface_create_info); display_plane_surface_create_info.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR; display_plane_surface_create_info.displayMode = display_mode; /* For now, simply use the first plane. */