diff --git a/CMakeLists.txt b/CMakeLists.txt index cce993a97c..4df17811f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,7 @@ endif() include_directories(${XKB_INCLUDE_DIR}) include_directories(${epoxy_INCLUDE_DIR}) +set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX}) # for things that are also used by kwin libraries configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h ) @@ -355,7 +356,6 @@ set(kwin_KDEINIT_SRCS scene_xrender.cpp scene_opengl.cpp scene_qpainter.cpp - glxbackend.cpp thumbnailitem.cpp lanczosfilter.cpp deleted.cpp @@ -392,6 +392,10 @@ set(kwin_KDEINIT_SRCS wayland_cursor_theme.cpp ) +if(HAVE_EPOXY_GLX) + set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} glxbackend.cpp) +endif() + if(KWIN_BUILD_TABBOX) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} diff --git a/cmake/modules/Findepoxy.cmake b/cmake/modules/Findepoxy.cmake index 61638595db..dfd8c3c707 100644 --- a/cmake/modules/Findepoxy.cmake +++ b/cmake/modules/Findepoxy.cmake @@ -5,6 +5,7 @@ # epoxy_LIBRARY - The libepoxy library # epoxy_INCLUDE_DIR - The libepoxy include dir # epoxy_DEFINITIONS - Compiler switches required for using libepoxy +# epoxy_HAS_GLX - Whether GLX support is available # Copyright (c) 2014 Fredrik Höglund # @@ -40,9 +41,16 @@ if (NOT WIN32) find_path(epoxy_INCLUDE_DIR NAMES epoxy/gl.h HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS}) find_library(epoxy_LIBRARY NAMES epoxy HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS}) + find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR}) + + if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND") + set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available") + else () + set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available") + endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(epoxy DEFAULT_MSG epoxy_LIBRARY epoxy_INCLUDE_DIR) - mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY) + mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY epoxy_HAS_GLX) endif() diff --git a/dbusinterface.cpp b/dbusinterface.cpp index 42087dca5f..6bc79f7608 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -241,7 +241,10 @@ void CompositorDBusInterface::suspend() QStringList CompositorDBusInterface::supportedOpenGLPlatformInterfaces() const { QStringList interfaces; - bool supportsGlx = (kwinApp()->operationMode() == Application::OperationModeX11); + bool supportsGlx = false; +#if HAVE_EPOXY_GLX + supportsGlx = (kwinApp()->operationMode() == Application::OperationModeX11); +#endif #ifdef KWIN_HAVE_OPENGLES supportsGlx = false; #endif diff --git a/glxbackend.cpp b/glxbackend.cpp index 0abb1e3169..5447bfe09d 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -22,8 +22,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -// TODO: cmake magic -#ifndef KWIN_HAVE_OPENGLES // own #include "glxbackend.h" // kwin @@ -870,4 +868,3 @@ OpenGLBackend *GlxTexture::backend() } } // namespace -#endif diff --git a/glxbackend.h b/glxbackend.h index 73595e619c..e27693f8ef 100644 --- a/glxbackend.h +++ b/glxbackend.h @@ -23,6 +23,7 @@ along with this program. If not, see . #include "x11eventfilter.h" #include +#include #include namespace KWin diff --git a/libkwineffects/kwinconfig.h.cmake b/libkwineffects/kwinconfig.h.cmake index a8586cc9b6..0ac607e7c7 100644 --- a/libkwineffects/kwinconfig.h.cmake +++ b/libkwineffects/kwinconfig.h.cmake @@ -19,5 +19,7 @@ /* KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available */ #cmakedefine KWIN_HAVE_XRENDER_COMPOSITING +#cmakedefine01 HAVE_EPOXY_GLX + #endif diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index b1842f4550..d0f2626d5e 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -45,6 +45,10 @@ along with this program. If not, see . #include +#if HAVE_EPOXY_GLX +#include +#endif + #define DEBUG_GLRENDERTARGET 0 #define MAKE_GL_VERSION(major, minor, release) ( ((major) << 16) | ((minor) << 8) | (release) ) @@ -77,7 +81,7 @@ int glTextureUnitsCount; // Functions void initGLX() { -#ifndef KWIN_HAVE_OPENGLES +#if HAVE_EPOXY_GLX // Get GLX version int major, minor; glXQueryVersion(display(), &major, &minor); diff --git a/libkwineffects/kwinglutils_funcs.cpp b/libkwineffects/kwinglutils_funcs.cpp index dfb673b7c0..ad141d5d01 100644 --- a/libkwineffects/kwinglutils_funcs.cpp +++ b/libkwineffects/kwinglutils_funcs.cpp @@ -21,6 +21,9 @@ along with this program. If not, see . #include "kwinglutils.h" #include +#if HAVE_EPOXY_GLX +#include +#endif // Resolves given function, using getProcAddress @@ -56,10 +59,12 @@ glGetnUniformfv_func glGetnUniformfv; typedef void (*glXFuncPtr)(); -#ifndef KWIN_HAVE_OPENGLES static glXFuncPtr getProcAddress(const char* name) { - glXFuncPtr ret = glXGetProcAddress((const GLubyte*) name); + glXFuncPtr ret = nullptr; +#if HAVE_EPOXY_GLX + ret = glXGetProcAddress((const GLubyte*) name); +#endif if (ret == nullptr) ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name); return ret; @@ -72,7 +77,6 @@ void glxResolveFunctions() else glXSwapIntervalMESA = nullptr; } -#endif void eglResolveFunctions() { diff --git a/libkwineffects/kwinglutils_funcs.h b/libkwineffects/kwinglutils_funcs.h index ba9dd46799..4b60a46abf 100644 --- a/libkwineffects/kwinglutils_funcs.h +++ b/libkwineffects/kwinglutils_funcs.h @@ -27,10 +27,6 @@ along with this program. If not, see . #include -#ifndef KWIN_HAVE_OPENGLES -#include -#endif - #include #include @@ -51,9 +47,7 @@ along with this program. If not, see . namespace KWin { -#ifndef KWIN_HAVE_OPENGLES void KWINGLUTILS_EXPORT glxResolveFunctions(); -#endif void KWINGLUTILS_EXPORT eglResolveFunctions(); diff --git a/options.cpp b/options.cpp index 00b1b85b76..424838fa0a 100644 --- a/options.cpp +++ b/options.cpp @@ -764,6 +764,10 @@ void Options::setGlPlatformInterface(OpenGLPlatformInterface interface) qCDebug(KWIN_CORE) << "Forcing EGL native interface for Wayland mode"; interface = EglPlatformInterface; } +#if !HAVE_EPOXY_GLX + qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled without GLX support"; + interface = EglPlatformInterface; +#endif #ifdef KWIN_HAVE_OPENGLES qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled against OpenGL ES"; interface = EglPlatformInterface; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 13714e3634..69e7ba571e 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -28,9 +28,9 @@ along with this program. If not, see . *********************************************************************/ #include "scene_opengl.h" #include "eglonxbackend.h" -#ifndef KWIN_HAVE_OPENGLES +#if HAVE_EPOXY_GLX #include "glxbackend.h" -#endif // KWIN_HAVE_OPENGLES +#endif #include "abstract_backend.h" #include "wayland_server.h" @@ -541,7 +541,7 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent) switch (platformInterface) { case GlxPlatformInterface: -#ifndef KWIN_HAVE_OPENGLES +#if HAVE_EPOXY_GLX backend = new GlxBackend(); #endif break; diff --git a/workspace.cpp b/workspace.cpp index 1a2129aec7..0d97f4a235 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1383,6 +1383,12 @@ QString Workspace::supportInformation() const support.append(yes); #else support.append(no); +#endif + support.append(QStringLiteral("HAVE_EPOXY_GLX: ")); +#if HAVE_EPOXY_GLX + support.append(yes); +#else + support.append(no); #endif support.append(QStringLiteral("\n"));