From 9940e71088d494b9a406812690f68147771c3345 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 16 Dec 2020 00:10:30 +0300 Subject: [PATCH] Import two post-2.0.12 fixes to kmsdrm_legacy: 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 --- src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c index a1e7c571b..666415dcd 100644 --- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c +++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c @@ -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."); @@ -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)) { @@ -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,