From e393a31a44d6046e34641bee7630c454a335b343 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Sat, 2 Feb 2019 21:47:54 +0100 Subject: X11: fix usage of required configuration values Before has Kodi checked only the EGL_NATIVE_VISUAL_ID and ignored others. With this was e.g. on a some addons the needed EGL_DEPTH_SIZE not available. This separates a part of IsSuitableVisual (...) into a separate function (SuitableCheck (...)) which is checked by GetEGLConfig and takes the necessary configuration from the list. --- xbmc/windowing/X11/GLContextEGL.cpp | 24 ++++++++++++++++-------- xbmc/windowing/X11/GLContextEGL.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/xbmc/windowing/X11/GLContextEGL.cpp b/xbmc/windowing/X11/GLContextEGL.cpp index 80670a15f0..5a07916728 100644 --- a/xbmc/windowing/X11/GLContextEGL.cpp +++ b/xbmc/windowing/X11/GLContextEGL.cpp @@ -335,18 +335,22 @@ void CGLContextEGL::Detach() bool CGLContextEGL::IsSuitableVisual(XVisualInfo *vInfo) { EGLConfig config = GetEGLConfig(m_eglDisplay, vInfo); + return config != EGL_NO_CONFIG; +} + +bool CGLContextEGL::SuitableCheck(EGLDisplay eglDisplay, EGLConfig config) +{ if (config == EGL_NO_CONFIG) - { - CLog::Log(LOGERROR, "Failed to determine egl config for visual info"); return false; - } - EGLint value; - if (!eglGetConfigAttrib(m_eglDisplay, config, EGL_RED_SIZE, &value) || value < 8) + EGLint value; + if (!eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &value) || value < 8) + return false; + if (!eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &value) || value < 8) return false; - if (!eglGetConfigAttrib(m_eglDisplay, config, EGL_GREEN_SIZE, &value) || value < 8) + if (!eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &value) || value < 8) return false; - if (!eglGetConfigAttrib(m_eglDisplay, config, EGL_BLUE_SIZE, &value) || value < 8) + if (!eglGetConfigAttrib(eglDisplay, config, EGL_DEPTH_SIZE, &value) || value < 24) return false; return true; @@ -382,13 +386,17 @@ EGLConfig CGLContextEGL::GetEGLConfig(EGLDisplay eglDisplay, XVisualInfo *vInfo) } for (EGLint i = 0; i < numConfigs; ++i) { + if (!SuitableCheck(eglDisplay, eglConfigs[i])) + continue; + EGLint value; if (!eglGetConfigAttrib(eglDisplay, eglConfigs[i], EGL_NATIVE_VISUAL_ID, &value)) { CLog::Log(LOGERROR, "Failed to query EGL_NATIVE_VISUAL_ID for egl config."); break; } - if (value == (EGLint)vInfo->visualid) { + if (value == (EGLint)vInfo->visualid) + { eglConfig = eglConfigs[i]; break; } diff --git a/xbmc/windowing/X11/GLContextEGL.h b/xbmc/windowing/X11/GLContextEGL.h index 80ad06050a..ba4431318b 100644 --- a/xbmc/windowing/X11/GLContextEGL.h +++ b/xbmc/windowing/X11/GLContextEGL.h @@ -35,6 +35,7 @@ public: EGLConfig m_eglConfig; protected: bool IsSuitableVisual(XVisualInfo *vInfo); + bool SuitableCheck(EGLDisplay eglDisplay, EGLConfig config); EGLConfig GetEGLConfig(EGLDisplay eglDisplay, XVisualInfo *vInfo); PFNEGLGETSYNCVALUESCHROMIUMPROC eglGetSyncValuesCHROMIUM = nullptr; PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = nullptr; -- cgit v1.2.3