diff options
Diffstat (limited to 'games/RetroArch/kms.patch')
-rw-r--r-- | games/RetroArch/kms.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/games/RetroArch/kms.patch b/games/RetroArch/kms.patch new file mode 100644 index 000000000000..28ebb1e15e43 --- /dev/null +++ b/games/RetroArch/kms.patch @@ -0,0 +1,65 @@ +From 5898f3e5d22b930a1050a59b61e98ecd07dd6977 Mon Sep 17 00:00:00 2001 +From: orbea <orbea@fredslev.dk> +Date: Thu, 6 Dec 2018 08:31:01 -0800 +Subject: [PATCH] Fix KMS with OpenGL. + +All credit for this patch goes to dtsarr. + +Fixes https://github.com/libretro/RetroArch/issues/7119 +--- + gfx/common/egl_common.c | 41 ++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 40 insertions(+), 1 deletion(-) + +diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c +index f3c579af21..ee7bca84b6 100644 +--- a/gfx/common/egl_common.c ++++ b/gfx/common/egl_common.c +@@ -329,8 +329,47 @@ bool egl_init_context(egl_ctx_data_t *egl, + + RARCH_LOG("[EGL]: EGL version: %d.%d\n", *major, *minor); + +- if (!eglChooseConfig(egl->dpy, attrib_ptr, &egl->config, 1, n) || *n != 1) ++ EGLint count = 0; ++ EGLint matched = 0; ++ EGLConfig *configs; ++ int config_index = -1; ++ ++ if (!eglGetConfigs(egl->dpy, NULL, 0, &count) || count < 1) ++ { ++ RARCH_ERR("[EGL]: No cofigs to choose from.\n"); ++ return false; ++ } ++ ++ configs = malloc(count * sizeof *configs); ++ if (!configs) return false; ++ ++ if (!eglChooseConfig(egl->dpy, attrib_ptr, configs, count, &matched) || !matched) ++ { ++ RARCH_ERR("[EGL]: No EGL configs with appropriate attributes.\n"); + return false; ++ } ++ ++ int i; ++ EGLint id; ++ ++ for (i = 0; i < count; ++i) ++ { ++ if (!eglGetConfigAttrib(egl->dpy, configs[i], EGL_NATIVE_VISUAL_ID, &id)) ++ continue; ++ ++ if (id == GBM_FORMAT_XRGB8888) break; ++ } ++ ++ if (id != GBM_FORMAT_XRGB8888) ++ { ++ RARCH_ERR("[EGL]: No EGL configs with format XRGB8888\n"); ++ return false; ++ } ++ ++ config_index = i; ++ if (config_index != -1) egl->config = configs[config_index]; ++ ++ free(configs); + + egl->major = g_egl_major; + egl->minor = g_egl_minor; |