From 3c593f4357e75c31695baa5ac74d8f9102b9bef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 3 Aug 2013 16:17:57 +0200 Subject: [PATCH 1/7] remove nvidiahack lib 1. it apparently is ineffective 2. if it was effective, it's current behavior would be not exactly helpful (sets __GL_YIELD to NOTHING, causing busy waits on doublebuffer swapping) 3. it does for sure pollute the doublebuffer/usleep detection (setenv is set to override), ie. the overehad detection code gets a different opinion on __GL_YIELD than libGL REVIEW: 111858 CCBUG: 322060 --- CMakeLists.txt | 14 -------------- nvidiahack.cpp | 52 -------------------------------------------------- 2 files changed, 66 deletions(-) delete mode 100644 nvidiahack.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d9cae32a5..1e78bfcf82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,8 +313,6 @@ if(OPENGL_FOUND) if (DL_LIBRARY) target_link_libraries(kdeinit_kwin ${DL_LIBRARY}) endif() - # must be after opengl, to be initialized first by the linker - target_link_libraries(kdeinit_kwin kwinnvidiahack) elseif(OPENGLES_FOUND) target_link_libraries(kdeinit_kwin ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES}) set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES") @@ -333,18 +331,6 @@ if(OPENGLES_FOUND) install(TARGETS kwin_gles ${INSTALL_TARGETS_DEFAULT_ARGS} ) endif() -########### next target ############### - -set( kwinnvidiahack_LIB_SRCS - nvidiahack.cpp ) - - -kde4_add_library(kwinnvidiahack SHARED ${kwinnvidiahack_LIB_SRCS}) - -set_target_properties(kwinnvidiahack PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) -set_target_properties(kwinnvidiahack PROPERTIES OUTPUT_NAME ${KWIN_NAME}nvidiahack) -install(TARGETS kwinnvidiahack ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) - ########### install files ############### install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg ) diff --git a/nvidiahack.cpp b/nvidiahack.cpp deleted file mode 100644 index fe5737acda..0000000000 --- a/nvidiahack.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2007 Lubos Lunak - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -// krazy:skip - -/* - - The only purpose of this file is to be later in the link order than - (nvidia's) libGL, thus being initialized by the dynamic linker before it, - allowing it to set __GL_YIELD=NOTHING soon enough for libGL to notice it. - -*/ - -#include -#include - -class kwinnvidiahack -{ -public: - kwinnvidiahack(); -}; - -kwinnvidiahack::kwinnvidiahack() -{ - const char* env = getenv("KWIN_NVIDIA_HACK"); -#if 1 // turned on by default - if (env == NULL || env[ 0 ] != '0') - setenv("__GL_YIELD", "NOTHING", true); -#else // turned off by default - if (env != NULL && env[ 0 ] != '0') - setenv("__GL_YIELD", "NOTHING", true); -#endif -} - -kwinnvidiahack kwinnvidiahackinst; From 93ef0226bae8d651d01b34cc1c5057fd9a919145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 23 Jun 2013 13:43:36 +0200 Subject: [PATCH 2/7] add configRequest rule update REVIEW: 111193 --- data/CMakeLists.txt | 4 ++-- data/kwin_translate_confrequest_rule.sh | 14 ++++++++++++++ data/kwin_translate_confrequest_rule.upd | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 data/kwin_translate_confrequest_rule.sh create mode 100644 data/kwin_translate_confrequest_rule.upd diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 322c27d750..4a7f97a2e5 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -59,9 +59,9 @@ install( TARGETS kwin_update_settings_411 DESTINATION ${LIB_INSTALL_DIR}/kconf_u install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules ) install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} ) -install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd +install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd kwin_translate_confrequest_rule.upd kwin_update_411.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh kwin_translate_confrequest_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin ) diff --git a/data/kwin_translate_confrequest_rule.sh b/data/kwin_translate_confrequest_rule.sh new file mode 100755 index 0000000000..62587a4e93 --- /dev/null +++ b/data/kwin_translate_confrequest_rule.sh @@ -0,0 +1,14 @@ +#!/bin/sh +COUNT=`kreadconfig --file kwinrulesrc --group General --key count` +if [ -z "$COUNT" ]; then + exit 0 # nothing to do for us +fi + +# can you imaging how *much* faster sed is? +# it's however less reliable (installation, ini config, etc.) + +for i in `seq 1 $COUNT`; do + if [ "`kreadconfig --file kwinrulesrc --group $i --key ignoregeometryrule`" = "2" ]; then + kwriteconfig --file kwinrulesrc --group $i --key ignoregeometryrule "3" + fi +done \ No newline at end of file diff --git a/data/kwin_translate_confrequest_rule.upd b/data/kwin_translate_confrequest_rule.upd new file mode 100644 index 0000000000..edbd271109 --- /dev/null +++ b/data/kwin_translate_confrequest_rule.upd @@ -0,0 +1,2 @@ +Id=Kwin-4.11 +Script=kwin_translate_confrequest_rule.sh \ No newline at end of file From 37279504cbf460ea86c633cf7dfd936e301051a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 3 Aug 2013 22:13:14 +0200 Subject: [PATCH 3/7] bind unredirection change to unredirection update when the option changes, the compositor needs to update the state as it will later not act (in the disabled case) and should to reflect the option change. REVIEW: 111867 BUG: 322633 FIXED-IN: 4.11 --- composite.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composite.cpp b/composite.cpp index f5de2fb66d..097d08500f 100644 --- a/composite.cpp +++ b/composite.cpp @@ -98,6 +98,7 @@ Compositor::Compositor(QObject* workspace) connect(&unredirectTimer, SIGNAL(timeout()), SLOT(delayedCheckUnredirect())); connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart())); connect(workspace, SIGNAL(configChanged()), SLOT(slotConfigChanged())); + connect(options, SIGNAL(unredirectFullscreenChanged()), SLOT(delayedCheckUnredirect())); unredirectTimer.setSingleShot(true); compositeResetTimer.setSingleShot(true); nextPaintReference.invalidate(); // Initialize the timer @@ -705,7 +706,7 @@ void Compositor::checkUnredirect(bool force) void Compositor::delayedCheckUnredirect() { - if (!hasScene() || m_scene->overlayWindow()->window() == None || !options->isUnredirectFullscreen()) + if (!hasScene() || m_scene->overlayWindow()->window() == None || !(options->isUnredirectFullscreen() || sender() == options)) return; ToplevelList list; bool changed = forceUnredirectCheck; @@ -1072,7 +1073,8 @@ void Toplevel::addWorkspaceRepaint(const QRect& r2) bool Toplevel::updateUnredirectedState() { assert(compositing()); - bool should = shouldUnredirect() && !unredirectSuspend && !shape() && !hasAlpha() && opacity() == 1.0 && + bool should = options->isUnredirectFullscreen() && shouldUnredirect() && !unredirectSuspend && + !shape() && !hasAlpha() && opacity() == 1.0 && !static_cast(effects)->activeFullScreenEffect(); if (should == unredirect) return false; From 18f8493dee7aa3399b182c1c344f8fb379ba4e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 3 Aug 2013 18:52:56 +0200 Subject: [PATCH 4/7] no layer repaints for the window geometry labels insufficient since there can be windows/content on top of the moved window and the labels are painted on top of the scene BUG: 318390 FIXED-IN: 4.11 REVIEW: 111861 --- effects/windowgeometry/windowgeometry.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/effects/windowgeometry/windowgeometry.cpp b/effects/windowgeometry/windowgeometry.cpp index 26a15d142f..fca5bda351 100644 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -145,7 +145,7 @@ void WindowGeometry::slotWindowStepUserMovedResized(EffectWindow *w, const QRect { if (iAmActivated && iAmActive && w == myResizeWindow) { if (myExtraDirtyArea.isValid()) - w->addLayerRepaint(myExtraDirtyArea); + effects->addRepaint(myExtraDirtyArea); myExtraDirtyArea = QRect(); @@ -197,11 +197,9 @@ void WindowGeometry::slotWindowStepUserMovedResized(EffectWindow *w, const QRect myExtraDirtyArea |= myMeasure[1]->geometry(); myExtraDirtyArea |= myMeasure[2]->geometry(); myExtraDirtyArea.adjust(-6,-6,6,6); - if (w->expandedGeometry().contains(myExtraDirtyArea)) - myExtraDirtyArea = QRect(); if (myExtraDirtyArea.isValid()) - w->addLayerRepaint(myExtraDirtyArea); + effects->addRepaint(myExtraDirtyArea); } } From e9e73f113413753331350ad4a1d09ecb715ab4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 4 Aug 2013 14:50:25 +0200 Subject: [PATCH 5/7] add XRenderPicture(QImage) constructor was implicitly present for QPixmap::toImage REVIEW: 111878 --- libkwineffects/kwinxrenderutils.cpp | 10 +++++++--- libkwineffects/kwinxrenderutils.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libkwineffects/kwinxrenderutils.cpp b/libkwineffects/kwinxrenderutils.cpp index 85f0d0fd22..cfd3bc5859 100644 --- a/libkwineffects/kwinxrenderutils.cpp +++ b/libkwineffects/kwinxrenderutils.cpp @@ -109,11 +109,15 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth) XRenderPicture::XRenderPicture(const QPixmap &pix) { - if (!Extensions::nonNativePixmaps()) { + if (Extensions::nonNativePixmaps()) { + XRenderPicture(pix.toImage()); + } else { d = new XRenderPictureData(createPicture(pix.handle(), pix.depth())); - return; } - QImage img(pix.toImage()); +} + +XRenderPicture::XRenderPicture(const QImage &img) +{ const int depth = img.depth(); xcb_pixmap_t xpix = xcb_generate_id(connection()); xcb_create_pixmap(connection(), depth, xpix, rootWindow(), img.width(), img.height()); diff --git a/libkwineffects/kwinxrenderutils.h b/libkwineffects/kwinxrenderutils.h index f2ad1c3317..a02028d766 100644 --- a/libkwineffects/kwinxrenderutils.h +++ b/libkwineffects/kwinxrenderutils.h @@ -70,6 +70,7 @@ public: explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); // TODO: Qt5 - replace QPixmap by QImage to make it more obvious that it uses PutImage explicit XRenderPicture(const QPixmap &pix); + explicit XRenderPicture(const QImage &img); XRenderPicture(xcb_pixmap_t pix, int depth); operator xcb_render_picture_t(); private: From 971fe0107cd783e76fb21ca392f8012d88ff797f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 4 Aug 2013 14:50:38 +0200 Subject: [PATCH 6/7] support fps counter text on xrender BUG: 323006 FIXED-IN: 4.11 REVIEW: 111878 --- effects/showfps/showfps.cpp | 40 +++++++++++++++++++++++-------------- effects/showfps/showfps.h | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp index 0439941b23..1ab7d57f6d 100644 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -232,7 +232,18 @@ void ShowFpsEffect::paintGL(int fps) paintDrawSizeGraph(x, y); // Paint FPS numerical value - paintFPSText(fps); + if (fpsTextRect.isValid()) { + delete fpsText; + fpsText = new GLTexture(fpsTextImage(fps)); + fpsText->bind(); + ShaderBinder binder(ShaderManager::SimpleShader); + if (effects->compositingType() == OpenGL2Compositing) { + binder.shader()->setUniform("offset", QVector2D(0, 0)); + } + fpsText->render(QRegion(fpsTextRect), fpsTextRect); + fpsText->unbind(); + effects->addRepaint(fpsTextRect); + } // Paint paint sizes glDisable(GL_BLEND); @@ -284,6 +295,15 @@ void ShowFpsEffect::paintXrender(int fps) // Paint amount of rendered pixels graph paintDrawSizeGraph(x + FPS_WIDTH + MAX_TIME, y); + + // Paint FPS numerical value + if (fpsTextRect.isValid()) { + QImage textImg(fpsTextImage(fps)); + XRenderPicture textPic(textImg); + xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, textPic, XCB_RENDER_PICTURE_NONE, + effects->xrenderBufferPicture(), 0, 0, 0, 0, fpsTextRect.x(), fpsTextRect.y(), textImg.width(), textImg.height()); + effects->addRepaint(fpsTextRect); + } } #endif @@ -450,26 +470,16 @@ void ShowFpsEffect::postPaintScreen() effects->addRepaint(fps_rect); } -void ShowFpsEffect::paintFPSText(int fps) +QImage ShowFpsEffect::fpsTextImage(int fps) { - if (!fpsTextRect.isValid()) - return; QImage im(100, 100, QImage::Format_ARGB32); - im.fill(0); + im.fill(Qt::transparent); QPainter painter(&im); painter.setFont(textFont); painter.setPen(textColor); painter.drawText(QRect(0, 0, 100, 100), textAlign, QString::number(fps)); - delete fpsText; - fpsText = new GLTexture(im); - fpsText->bind(); - ShaderBinder binder(ShaderManager::SimpleShader); - if (effects->compositingType() == OpenGL2Compositing) { - binder.shader()->setUniform("offset", QVector2D(0, 0)); - } - fpsText->render(QRegion(fpsTextRect), fpsTextRect); - fpsText->unbind(); - effects->addRepaint(fpsTextRect); + painter.end(); + return im; } } // namespace diff --git a/effects/showfps/showfps.h b/effects/showfps/showfps.h index 5f46d0c5d5..3c30c39be0 100644 --- a/effects/showfps/showfps.h +++ b/effects/showfps/showfps.h @@ -80,7 +80,7 @@ private: void paintFPSGraph(int x, int y); void paintDrawSizeGraph(int x, int y); void paintGraph(int x, int y, QList values, QList lines, bool colorize); - void paintFPSText(int fps); + QImage fpsTextImage(int fps); QTime t; enum { NUM_PAINTS = 100 }; // remember time needed to paint this many paints int paints[ NUM_PAINTS ]; // time needed to paint From 76f7ee6bffb2a8324a23efc99c3f4f162118154e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 28 Jul 2013 21:44:55 +0200 Subject: [PATCH 7/7] write back unsupported (kwin-intel) unredirection to have a minimal hint on "this does not work" REVIEW: 111772 CCBUG: 252817 --- options.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/options.cpp b/options.cpp index 8f6a21f474..52b082a57e 100644 --- a/options.cpp +++ b/options.cpp @@ -656,6 +656,9 @@ void Options::setUnredirectFullscreen(bool unredirectFullscreen) if (m_unredirectFullscreen == unredirectFullscreen) { return; } + if (GLPlatform::instance()->driver() == Driver_Intel) { // write back the value + KConfigGroup(KGlobal::config(), "Compositing").writeEntry("UnredirectFullscreen", false); + } m_unredirectFullscreen = unredirectFullscreen; emit unredirectFullscreenChanged(); }