aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2017-09-19 08:12:54 +0200
committerGitHub <noreply@github.com>2017-09-19 08:12:54 +0200
commit6d1882d520adcdc285e0c08127776ccc71e255d0 (patch)
treefdcd30f6fe6d991cfa87c38839106fbe4c7b0f54
parentc48468128e63bf55c0ec270c6a2cbe24e0d14e30 (diff)
parentf2ca8d0d9fecfbedcab60519d0bed2975081d793 (diff)
Merge pull request #12219 from lrusak/glx-cleanup
[X11] factor out glx support
-rw-r--r--cmake/platform/linux/x11.cmake4
-rw-r--r--cmake/scripts/linux/ArchSetup.cmake4
-rwxr-xr-xsystem/settings/settings.xml2
-rw-r--r--xbmc/Application.cpp2
-rw-r--r--xbmc/settings/DisplaySettings.cpp6
-rw-r--r--xbmc/settings/SettingConditions.cpp3
-rw-r--r--xbmc/windowing/X11/CMakeLists.txt11
-rw-r--r--xbmc/windowing/X11/GLContextEGL.cpp47
-rw-r--r--xbmc/windowing/X11/GLContextEGL.h1
-rw-r--r--xbmc/windowing/X11/WinSystemX11GLContext.cpp43
-rw-r--r--xbmc/windowing/X11/WinSystemX11GLContext.h6
11 files changed, 52 insertions, 77 deletions
diff --git a/cmake/platform/linux/x11.cmake b/cmake/platform/linux/x11.cmake
index edea24de48..656fd66572 100644
--- a/cmake/platform/linux/x11.cmake
+++ b/cmake/platform/linux/x11.cmake
@@ -1,2 +1,2 @@
-set(PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM GLX)
-set(PLATFORM_OPTIONAL_DEPS VAAPI VDPAU)
+set(PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM)
+set(PLATFORM_OPTIONAL_DEPS VAAPI VDPAU GLX)
diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake
index 74018d0e76..fb350f88f9 100644
--- a/cmake/scripts/linux/ArchSetup.cmake
+++ b/cmake/scripts/linux/ArchSetup.cmake
@@ -80,3 +80,7 @@ if(ENABLE_GBM)
set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU" FORCE)
set(ENABLE_VAAPI OFF CACHE BOOL "Disabling VAAPI" FORCE)
endif()
+
+if(ENABLE_VDPAU)
+ set(ENABLE_GLX ON CACHE BOOL "Enabling GLX" FORCE)
+endif()
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index cd12dfdc56..6d10a4d632 100755
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -2117,7 +2117,7 @@
<setting id="videoscreen.monitor" type="string" label="246" help="">
<requirement>
<or>
- <condition>HAS_GLX</condition>
+ <condition>HAVE_X11</condition>
<condition>HAVE_WAYLAND</condition>
</or>
</requirement>
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 4b4af2ca55..424c0f30b7 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -285,7 +285,7 @@ CApplication::CApplication(void)
{
TiXmlBase::SetCondenseWhiteSpace(false);
-#ifdef HAS_GLX
+#ifdef HAVE_X11
XInitThreads();
#endif
}
diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp
index 1abc964535..c14e1febc9 100644
--- a/xbmc/settings/DisplaySettings.cpp
+++ b/xbmc/settings/DisplaySettings.cpp
@@ -326,7 +326,7 @@ bool CDisplaySettings::OnSettingChanging(std::shared_ptr<const CSetting> setting
return true;
}
-#if defined(HAS_GLX)
+#if defined(HAVE_X11)
else if (settingId == CSettings::SETTING_VIDEOSCREEN_BLANKDISPLAYS)
{
g_Windowing.UpdateResolutions();
@@ -727,7 +727,7 @@ void CDisplaySettings::SettingOptionsScreensFiller(SettingConstPtr setting, std:
if (g_advancedSettings.m_canWindowed && g_Windowing.CanDoWindowed())
list.push_back(std::make_pair(g_localizeStrings.Get(242), DM_WINDOWED));
-#if defined(HAS_GLX) || defined(HAVE_WAYLAND)
+#if defined(HAVE_X11) || defined(HAVE_WAYLAND)
list.push_back(std::make_pair(g_localizeStrings.Get(244), 0));
#else
@@ -778,7 +778,7 @@ void CDisplaySettings::SettingOptionsPreferredStereoscopicViewModesFiller(Settin
void CDisplaySettings::SettingOptionsMonitorsFiller(SettingConstPtr setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data)
{
-#if defined(HAS_GLX)
+#if defined(HAVE_X11)
std::vector<std::string> monitors;
g_Windowing.GetConnectedOutputs(&monitors);
std::string currentMonitor = CServiceBroker::GetSettings().GetString(CSettings::SETTING_VIDEOSCREEN_MONITOR);
diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp
index 456d37a4cb..d7cb995e63 100644
--- a/xbmc/settings/SettingConditions.cpp
+++ b/xbmc/settings/SettingConditions.cpp
@@ -294,9 +294,6 @@ void CSettingConditions::Initialize()
#ifdef HAS_GL
m_simpleConditions.insert("has_gl");
#endif
-#ifdef HAS_GLX
- m_simpleConditions.insert("has_glx");
-#endif
#ifdef HAS_GLES
m_simpleConditions.insert("has_gles");
#endif
diff --git a/xbmc/windowing/X11/CMakeLists.txt b/xbmc/windowing/X11/CMakeLists.txt
index ab13817839..965a06d580 100644
--- a/xbmc/windowing/X11/CMakeLists.txt
+++ b/xbmc/windowing/X11/CMakeLists.txt
@@ -1,23 +1,26 @@
set(SOURCES GLContextEGL.cpp
- GLContextGLX.cpp
GLContext.cpp
OSScreenSaverX11.cpp
WinEventsX11.cpp
WinSystemX11.cpp
WinSystemX11GLContext.cpp
XRandR.cpp
- VideoSyncGLX.cpp
VideoSyncDRM.cpp)
set(HEADERS GLContext.h
GLContextEGL.h
- GLContextGLX.h
OSScreenSaverX11.h
WinEventsX11.h
WinSystemX11.h
WinSystemX11GLContext.h
XRandR.h
- VideoSyncGLX.h
VideoSyncDRM.h)
+if(GLX_FOUND)
+ list(APPEND SOURCES GLContextGLX.cpp
+ VideoSyncGLX.cpp)
+ list(APPEND HEADERS GLContextGLX.h
+ VideoSyncGLX.h)
+endif()
+
core_add_library(windowing_X11)
diff --git a/xbmc/windowing/X11/GLContextEGL.cpp b/xbmc/windowing/X11/GLContextEGL.cpp
index 68045f952c..db4f30d312 100644
--- a/xbmc/windowing/X11/GLContextEGL.cpp
+++ b/xbmc/windowing/X11/GLContextEGL.cpp
@@ -363,50 +363,3 @@ void CGLContextEGL::QueryExtensions()
CLog::Log(LOGDEBUG, "EGL_EXTENSIONS:%s", m_extensions.c_str());
}
-
-XVisualInfo* CGLContextEGL::GetVisual()
-{
- GLint att[] =
- {
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_BUFFER_SIZE, 32,
- EGL_DEPTH_SIZE, 24,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
-
- if (m_eglDisplay == EGL_NO_DISPLAY)
- {
- m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)m_dpy);
- if (m_eglDisplay == EGL_NO_DISPLAY)
- {
- CLog::Log(LOGERROR, "failed to get egl display\n");
- return NULL;
- }
- if (!eglInitialize(m_eglDisplay, NULL, NULL))
- {
- CLog::Log(LOGERROR, "failed to initialize egl display\n");
- return NULL;
- }
- }
-
- EGLint numConfigs;
- EGLConfig eglConfig = 0;
- if (!eglChooseConfig(m_eglDisplay, att, &eglConfig, 1, &numConfigs) || numConfigs == 0) {
- CLog::Log(LOGERROR, "Failed to choose a config %d\n", eglGetError());
- }
- m_eglConfig=eglConfig;
-
- XVisualInfo x11_visual_info_template;
- if (!eglGetConfigAttrib(m_eglDisplay, m_eglConfig, EGL_NATIVE_VISUAL_ID, (EGLint*)&x11_visual_info_template.visualid)) {
- CLog::Log(LOGERROR, "Failed to query native visual id\n");
- }
- int num_visuals;
- return XGetVisualInfo(m_dpy,
- VisualIDMask,
- &x11_visual_info_template,
- &num_visuals);
-}
diff --git a/xbmc/windowing/X11/GLContextEGL.h b/xbmc/windowing/X11/GLContextEGL.h
index c0dbcfdb37..ae2ea88c67 100644
--- a/xbmc/windowing/X11/GLContextEGL.h
+++ b/xbmc/windowing/X11/GLContextEGL.h
@@ -35,7 +35,6 @@ public:
void SetVSync(bool enable) override;
void SwapBuffers() override;
void QueryExtensions() override;
- XVisualInfo* GetVisual();
EGLDisplay m_eglDisplay;
EGLSurface m_eglSurface;
EGLContext m_eglContext;
diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.cpp b/xbmc/windowing/X11/WinSystemX11GLContext.cpp
index 3936f423a0..bddfbd2ce7 100644
--- a/xbmc/windowing/X11/WinSystemX11GLContext.cpp
+++ b/xbmc/windowing/X11/WinSystemX11GLContext.cpp
@@ -23,7 +23,6 @@
#include <X11/Xutil.h>
#include "WinSystemX11GLContext.h"
-#include "GLContextGLX.h"
#include "GLContextEGL.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
@@ -33,7 +32,12 @@
#include <vector>
#include "Application.h"
#include "VideoSyncDRM.h"
+
+#ifdef HAS_GLX
#include "VideoSyncGLX.h"
+#include "GLContextGLX.h"
+#endif // HAS_GLX
+
#include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h"
#include "cores/VideoPlayer/Process/X11/ProcessInfoX11.h"
#include "cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h"
@@ -50,7 +54,7 @@ void CWinSystemX11GLContext::PresentRenderImpl(bool rendered)
{
if (rendered)
m_pGLContext->SwapBuffers();
-
+
if (m_delayDispReset && m_dispResetTimer.IsTimePast())
{
m_delayDispReset = false;
@@ -74,6 +78,7 @@ bool CWinSystemX11GLContext::IsExtSupported(const char* extension)
return m_pGLContext->IsExtSupported(extension);
}
+#ifdef HAS_GLX
GLXWindow CWinSystemX11GLContext::GetWindow() const
{
return static_cast<CGLContextGLX*>(m_pGLContext)->m_glxWindow;
@@ -83,6 +88,7 @@ GLXContext CWinSystemX11GLContext::GetGlxContext() const
{
return static_cast<CGLContextGLX*>(m_pGLContext)->m_glxContext;
}
+#endif // HAS_GLX
EGLDisplay CWinSystemX11GLContext::GetEGLDisplay() const
{
@@ -177,18 +183,20 @@ bool CWinSystemX11GLContext::DestroyWindow()
XVisualInfo* CWinSystemX11GLContext::GetVisual()
{
- GLint att[] =
- {
- GLX_RGBA,
- GLX_RED_SIZE, 8,
- GLX_GREEN_SIZE, 8,
- GLX_BLUE_SIZE, 8,
- GLX_ALPHA_SIZE, 8,
- GLX_DEPTH_SIZE, 24,
- GLX_DOUBLEBUFFER,
- None
- };
- return glXChooseVisual(m_dpy, m_nScreen, att);
+ int count = 0;
+ XVisualInfo vTemplate;
+ XVisualInfo *visual = nullptr;
+
+ int vMask = VisualScreenMask | VisualDepthMask | VisualClassMask | VisualBitsPerRGBMask;
+
+ vTemplate.screen = m_nScreen;
+ vTemplate.depth = 24;
+ vTemplate.c_class = TrueColor;
+ vTemplate.bits_per_rgb = 8;
+
+ visual = XGetVisualInfo(m_dpy, vMask, &vTemplate, &count);
+
+ return visual;
}
#if defined (HAVE_LIBVA)
@@ -236,9 +244,11 @@ bool CWinSystemX11GLContext::RefreshGLContext(bool force)
#endif
return success;
}
- delete m_pGLContext;
}
+#ifdef HAS_GLX
+ delete m_pGLContext;
+
// fallback for vdpau
m_pGLContext = new CGLContextGLX(m_dpy);
success = m_pGLContext->Refresh(force, m_nScreen, m_glWindow, m_newGlContext);
@@ -249,6 +259,7 @@ bool CWinSystemX11GLContext::RefreshGLContext(bool force)
CRendererVDPAU::Register();
#endif
}
+#endif // HAS_GLX
return success;
}
@@ -260,10 +271,12 @@ std::unique_ptr<CVideoSync> CWinSystemX11GLContext::GetVideoSync(void *clock)
{
pVSync.reset(new CVideoSyncDRM(clock));
}
+#ifdef HAS_GLX
else if (dynamic_cast<CGLContextGLX*>(m_pGLContext))
{
pVSync.reset(new CVideoSyncGLX(clock));
}
+#endif // HAS_GLX
return pVSync;
}
diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.h b/xbmc/windowing/X11/WinSystemX11GLContext.h
index 4debaff3fa..405ac09771 100644
--- a/xbmc/windowing/X11/WinSystemX11GLContext.h
+++ b/xbmc/windowing/X11/WinSystemX11GLContext.h
@@ -21,7 +21,11 @@
#pragma once
#include "WinSystemX11.h"
+
+#ifdef HAS_GLX
#include "GL/glx.h"
+#endif // HAS_GLX
+
#include "EGL/egl.h"
#include "rendering/gl/RenderSystemGL.h"
#include "utils/GlobalsHandling.h"
@@ -44,8 +48,10 @@ public:
// videosync
std::unique_ptr<CVideoSync> GetVideoSync(void *clock) override;
+#ifdef HAS_GLX
GLXWindow GetWindow() const;
GLXContext GetGlxContext() const;
+#endif // HAS_GLX
EGLDisplay GetEGLDisplay() const;
EGLSurface GetEGLSurface() const;
EGLContext GetEGLContext() const;