mirror of https://github.com/encounter/SDL.git
[KMSDRM] Make the gbm_init flag a viddata member to avoid GBM re-init when several displays are connected.
This commit is contained in:
parent
e5821bf276
commit
281a7bdbb3
|
@ -532,7 +532,6 @@ void KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resource
|
||||||
|
|
||||||
/* Initialize some of the members of the new display's driverdata
|
/* Initialize some of the members of the new display's driverdata
|
||||||
to sane values. */
|
to sane values. */
|
||||||
dispdata->gbm_init = SDL_FALSE;
|
|
||||||
dispdata->modeset_pending = SDL_FALSE;
|
dispdata->modeset_pending = SDL_FALSE;
|
||||||
dispdata->cursor_bo = NULL;
|
dispdata->cursor_bo = NULL;
|
||||||
|
|
||||||
|
@ -787,7 +786,7 @@ KMSDRM_GBMInit (_THIS, SDL_DisplayData *dispdata)
|
||||||
ret = SDL_SetError("Couldn't create gbm device.");
|
ret = SDL_SetError("Couldn't create gbm device.");
|
||||||
}
|
}
|
||||||
|
|
||||||
dispdata->gbm_init = SDL_TRUE;
|
viddata->gbm_init = SDL_TRUE;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -811,7 +810,7 @@ KMSDRM_GBMDeinit (_THIS, SDL_DisplayData *dispdata)
|
||||||
viddata->drm_fd = -1;
|
viddata->drm_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispdata->gbm_init = SDL_FALSE;
|
viddata->gbm_init = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -955,6 +954,7 @@ KMSDRM_VideoInit(_THIS)
|
||||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
|
||||||
|
|
||||||
viddata->video_init = SDL_FALSE;
|
viddata->video_init = SDL_FALSE;
|
||||||
|
viddata->gbm_init = SDL_FALSE;
|
||||||
|
|
||||||
/* Get KMSDRM resources info and store what we need. Getting and storing
|
/* Get KMSDRM resources info and store what we need. Getting and storing
|
||||||
this info isn't a problem for VK compatibility.
|
this info isn't a problem for VK compatibility.
|
||||||
|
@ -1079,7 +1079,7 @@ KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !is_vulkan && dispdata->gbm_init ) {
|
if ( !is_vulkan && viddata->gbm_init ) {
|
||||||
|
|
||||||
/* Destroy the window display's cursor GBM BO. */
|
/* Destroy the window display's cursor GBM BO. */
|
||||||
KMSDRM_DestroyCursorBO(_this, SDL_GetDisplayForWindow(window));
|
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 (!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(),
|
/* After SDL_CreateWindow, most SDL2 programs will do SDL_CreateRenderer(),
|
||||||
which will in turn call GL_CreateRenderer() or GLES2_CreateRenderer().
|
which will in turn call GL_CreateRenderer() or GLES2_CreateRenderer().
|
||||||
|
|
|
@ -48,6 +48,11 @@ typedef struct SDL_VideoData
|
||||||
SDL_Window **windows;
|
SDL_Window **windows;
|
||||||
int max_windows;
|
int max_windows;
|
||||||
int num_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;
|
} SDL_VideoData;
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,8 +72,6 @@ typedef struct SDL_DisplayData
|
||||||
|
|
||||||
drmModeCrtc *saved_crtc; /* CRTC to restore on quit */
|
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,
|
/* 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,
|
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).
|
where we may not have an SDL_Cursor at all (so no SDL_Cursor driverdata).
|
||||||
|
|
Loading…
Reference in New Issue