Skip to content

Commit

Permalink
Import two post-2.0.12 fixes to kmsdrm_legacy:
Browse files Browse the repository at this point in the history
Fix build breakage without EGL:
https://hg.libsdl.org/SDL/rev/f2606fe53654e305ab9badb821d9d3afb7f92f49

Fix KMSDRM_CreateWindow segfault when starting L?VE2D engine (bug 5199)
https://hg.libsdl.org/SDL/rev/d2e69a78939463d9ff9448a5f4efd1e208bb97b0
  • Loading branch information
sezero committed Dec 15, 2020
1 parent f883928 commit 9940e71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c
Expand Up @@ -391,7 +391,9 @@ KMSDRM_LEGACY_CreateSurfaces(_THIS, SDL_Window * window)
Uint32 height = dispdata->mode.vdisplay;
Uint32 surface_fmt = GBM_FORMAT_XRGB8888;
Uint32 surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
#if SDL_VIDEO_OPENGL_EGL
EGLContext egl_context;
#endif

if (!KMSDRM_LEGACY_gbm_device_is_format_supported(viddata->gbm, surface_fmt, surface_flags)) {
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway.");
Expand Down Expand Up @@ -783,6 +785,7 @@ KMSDRM_LEGACY_CreateWindow(_THIS, SDL_Window * window)
}

/* Setup driver data for this window */
windata->viddata = viddata;
window->driverdata = windata;

if (KMSDRM_LEGACY_CreateSurfaces(_this, window)) {
Expand All @@ -792,8 +795,6 @@ KMSDRM_LEGACY_CreateWindow(_THIS, SDL_Window * window)
/* Add window to the internal list of tracked windows. Note, while it may
seem odd to support multiple fullscreen windows, some apps create an
extra window as a dummy surface when working with multiple contexts */
windata->viddata = viddata;

if (viddata->num_windows >= viddata->max_windows) {
int new_max_windows = viddata->max_windows + 1;
viddata->windows = (SDL_Window **)SDL_realloc(viddata->windows,
Expand Down

0 comments on commit 9940e71

Please sign in to comment.