Merge commit '281a7bdbb32a2ba124f8a6f6f9555135fd529599' into main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index bee26ba..f2979ba 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -532,7 +532,6 @@ void KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resource
/* Initialize some of the members of the new display's driverdata
to sane values. */
- dispdata->gbm_init = SDL_FALSE;
dispdata->modeset_pending = SDL_FALSE;
dispdata->cursor_bo = NULL;
@@ -787,7 +786,7 @@ KMSDRM_GBMInit (_THIS, SDL_DisplayData *dispdata)
ret = SDL_SetError("Couldn't create gbm device.");
}
- dispdata->gbm_init = SDL_TRUE;
+ viddata->gbm_init = SDL_TRUE;
return ret;
}
@@ -811,7 +810,7 @@ KMSDRM_GBMDeinit (_THIS, SDL_DisplayData *dispdata)
viddata->drm_fd = -1;
}
- dispdata->gbm_init = SDL_FALSE;
+ viddata->gbm_init = SDL_FALSE;
}
void
@@ -955,6 +954,7 @@ KMSDRM_VideoInit(_THIS)
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
viddata->video_init = SDL_FALSE;
+ viddata->gbm_init = SDL_FALSE;
/* Get KMSDRM resources info and store what we need. Getting and storing
this info isn't a problem for VK compatibility.
@@ -1079,7 +1079,7 @@ KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
return;
}
- if ( !is_vulkan && dispdata->gbm_init ) {
+ if ( !is_vulkan && viddata->gbm_init ) {
/* Destroy the window display's cursor GBM BO. */
KMSDRM_DestroyCursorBO(_this, SDL_GetDisplayForWindow(window));
@@ -1158,7 +1158,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */
- if (!(dispdata->gbm_init)) {
+ if (!(viddata->gbm_init)) {
/* After SDL_CreateWindow, most SDL2 programs will do SDL_CreateRenderer(),
which will in turn call GL_CreateRenderer() or GLES2_CreateRenderer().
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
index 713df9a..f6f8410 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -48,6 +48,11 @@ typedef struct SDL_VideoData
SDL_Window **windows;
int max_windows;
int num_windows;
+
+ /* Even if we have several displays, we only have to
+ open 1 FD and create 1 gbm device. */
+ SDL_bool gbm_init;
+
} SDL_VideoData;
@@ -67,8 +72,6 @@ typedef struct SDL_DisplayData
drmModeCrtc *saved_crtc; /* CRTC to restore on quit */
- SDL_bool gbm_init;
-
/* DRM & GBM cursor stuff lives here, not in an SDL_Cursor's driverdata struct,
because setting/unsetting up these is done on window creation/destruction,
where we may not have an SDL_Cursor at all (so no SDL_Cursor driverdata).