From 8f55f48337ada68b07cbc8277178453e595d20a4 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Mon, 23 Sep 2024 23:00:14 -0500
Subject: [PATCH] kmsdrm: Move property initialization a bit further down
KMSDRM_GBMInit() must be called first to set drm_fd and gbm_dev.
---
src/video/kmsdrm/SDL_kmsdrmvideo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index dbc5bd4af264d..1202fdab04e85 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1562,11 +1562,6 @@ bool KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
windata->viddata = viddata;
window->internal = windata;
- SDL_PropertiesID props = SDL_GetWindowProperties(window);
- SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex);
- SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER, viddata->drm_fd);
- SDL_SetPointerProperty(props, SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER, viddata->gbm_dev);
-
// Do we want a double buffering scheme to get low video lag?
windata->double_buffer = false;
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, false)) {
@@ -1670,6 +1665,11 @@ bool KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
// If we have just created a Vulkan window, establish that we are in Vulkan mode now.
viddata->vulkan_mode = is_vulkan;
+ SDL_PropertiesID props = SDL_GetWindowProperties(window);
+ SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex);
+ SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER, viddata->drm_fd);
+ SDL_SetPointerProperty(props, SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER, viddata->gbm_dev);
+
/* Focus on the newly created window.
SDL_SetMouseFocus() also takes care of calling KMSDRM_ShowCursor() if necessary. */
SDL_SetMouseFocus(window);