From 87caab24ca14b4b317112ae54b6d8f8d0e378840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 4 Feb 2015 13:47:36 +0100 Subject: [PATCH] Drop support for XFree86-VidModeExtension Was only used as fallback for older NVIDIA drivers. At the same time also drop the call to nvidia-settings which was also only used as a fallback for refresh rate detection. REVIEW: 122423 --- CMakeLists.txt | 7 ------- options.cpp | 47 ----------------------------------------------- useractions.cpp | 35 ----------------------------------- 3 files changed, 89 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e815af8b1..f3da09e41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,13 +496,6 @@ set(kwin_WAYLAND_EGL_LIBS Wayland::Egl ) -find_library(XF86VM_LIBRARY Xxf86vm) -if (XF86VM_LIBRARY) - set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY}) -else() - add_definitions(-DKWIN_NO_XF86VM) -endif() - if(KWIN_BUILD_ACTIVITIES) set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities) endif() diff --git a/options.cpp b/options.cpp index c9623fbadc..cdaa8518a9 100644 --- a/options.cpp +++ b/options.cpp @@ -33,12 +33,6 @@ along with this program. If not, see . #include "xcbutils.h" #include -#ifndef KWIN_HAVE_OPENGLES -#ifndef KWIN_NO_XF86VM -#include -#endif -#endif - #endif //KCMRULES namespace KWin @@ -51,47 +45,6 @@ int currentRefreshRate() int rate = -1; if (options->refreshRate() > 0) // use manually configured refresh rate rate = options->refreshRate(); -#ifndef KWIN_HAVE_OPENGLES - else if (GLPlatform::instance()->driver() == Driver_NVidia) { -#ifndef KWIN_NO_XF86VM - int major, event, error; - static const bool s_hasVidMode = XQueryExtension(display(), "XFree86-VidModeExtension", &major, &event, &error); - if (s_hasVidMode) { - XF86VidModeModeLine modeline; - int dotclock, vtotal; - if (XF86VidModeGetModeLine(display(), 0, &dotclock, &modeline)) { - vtotal = modeline.vtotal; - if (modeline.flags & 0x0010) // V_INTERLACE - dotclock *= 2; - if (modeline.flags & 0x0020) // V_DBLSCAN - vtotal *= 2; - if (modeline.htotal*vtotal) // BUG 313996 - rate = 1000*dotclock/(modeline.htotal*vtotal); // WTF was wikipedia 1998 when I nedded it? - qCDebug(KWIN_CORE) << "Vertical Refresh Rate (as detected by XF86VM): " << rate << "Hz"; - } - } - if (rate < 1) -#endif - { // modeline approach failed - QProcess nvidia_settings; - QStringList env = QProcess::systemEnvironment(); - env << QStringLiteral("LC_ALL=C"); - nvidia_settings.setEnvironment(env); - nvidia_settings.start(QStringLiteral("nvidia-settings"), QStringList() << QStringLiteral("-t") << QStringLiteral("-q") << QStringLiteral("RefreshRate"), QIODevice::ReadOnly); - nvidia_settings.waitForFinished(); - if (nvidia_settings.exitStatus() == QProcess::NormalExit) { - QString reply = QString::fromLocal8Bit(nvidia_settings.readAllStandardOutput()).split(QStringLiteral(" ")).first(); - bool ok; - float frate = QLocale::c().toFloat(reply, &ok); - if (!ok) - rate = -1; - else - rate = qRound(frate); - qCDebug(KWIN_CORE) << "Vertical Refresh Rate (as detected by nvidia-settings): " << rate << "Hz"; - } - } - } -#endif else if (Xcb::Extensions::self()->isRandrAvailable()) { Xcb::RandR::ScreenInfo screenInfo(rootWindow()); rate = screenInfo->rate; diff --git a/useractions.cpp b/useractions.cpp index 8db0cebfa0..7fa9e9fa86 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -49,10 +49,6 @@ along with this program. If not, see . #include #include -#ifndef KWIN_NO_XF86VM -#include -#endif -#include #include #include #include @@ -1861,37 +1857,6 @@ void Workspace::slotInvertScreen() if (succeeded) return; - //BEGIN XF86VidMode inversion - only works if optionally libXxf86vm is linked -#ifndef KWIN_NO_XF86VM - int size = 0; - // TODO: this doesn't work with screen numbers in twinview - probably relevant only for multihead? - const int scrn = 0; // active_screen - if (XF86VidModeGetGammaRampSize(display(), scrn, &size)) { - unsigned short *red, *green, *blue; - red = new unsigned short[size]; - green = new unsigned short[size]; - blue = new unsigned short[size]; - if (XF86VidModeGetGammaRamp(display(), scrn, size, red, green, blue)) { - qCDebug(KWIN_CORE) << "inverting screen using XF86VidModeSetGammaRamp"; - const int half = size / 2 + 1; - unsigned short swap; - for (int i = 0; i < half; ++i) { - swap = red[i]; red[i] = red[size - 1 - i]; red[size - 1 - i] = swap; - swap = green[i]; green[i] = green[size - 1 - i]; green[size - 1 - i] = swap; - swap = blue[i]; blue[i] = blue[size - 1 - i]; blue[size - 1 - i] = swap; - } - XF86VidModeSetGammaRamp(display(), scrn, size, red, green, blue); - succeeded = true; - } - delete [] red; - delete [] green; - delete [] blue; - } - - if (succeeded) - return; -#endif - //BEGIN effect plugin inversion - atm only works with OpenGL and has an overhead to it if (effects) { if (Effect *inverter = static_cast(effects)->provides(Effect::ScreenInversion)) {