Skip to content

Commit

Permalink
Merge commit '281a7bdbb32a2ba124f8a6f6f9555135fd529599' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 23, 2021
2 parents 4fa42ca + 281a7bd commit d27c6c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/video/kmsdrm/SDL_kmsdrmvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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().
Expand Down
7 changes: 5 additions & 2 deletions src/video/kmsdrm/SDL_kmsdrmvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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).
Expand Down

0 comments on commit d27c6c1

Please sign in to comment.