From 811beb94e0a7dd5666906b07a51a84efe5f1bb53 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 8 Jun 2021 21:38:43 +0300 Subject: [PATCH] Remove Xrender backend The Xrender backend was added at the time when OpenGL drivers were not particularly stable. Nowadays though, it's a totally different situation. The OpenGL render backend has been the default one for many years. It's quite stable, and it allows implementing many advanced features that other render backends don't. Many features are not tested with it during the development cycle; the only time when it is noticed is when changes in other parts of kwin break the build in the xrender backend. Effectively, the xrender backend is unmaintained nowadays. Given that the xrender backend is effectively unmaintained and our focus being shifted towards wayland, this change drops the xrender backend in favor of the opengl backend. Besides being de-facto unmaintained, another issue is that QtQuick does not support and most likely will never support the Xrender API. This poses a problem as we want thumbnail items to be natively integrated in the qtquick scene graph. --- CMakeLists.txt | 6 - .../libkwineffects/kwinglplatformtest.cpp | 2 +- autotests/mock_effectshandler.h | 3 - autotests/test_builtin_effectloader.cpp | 160 +-- autotests/test_plugin_effectloader.cpp | 22 +- autotests/test_scripted_effectloader.cpp | 10 +- data/org_kde_kwin.categories | 1 - doc/kwineffects/index.docbook | 2 +- .../kwin-5.23-remove-xrender-backend.py | 11 + kconf_update/kwin.upd | 6 + src/composite.cpp | 3 - src/dbusinterface.cpp | 2 - src/dbusinterface.h | 1 - src/effects.cpp | 5 - src/effects.h | 1 - src/effects/CMakeLists.txt | 8 - src/effects/desktopgrid/desktopgrid.cpp | 25 +- src/effects/magnifier/magnifier.cpp | 69 +- src/effects/magnifier/magnifier.h | 7 - src/effects/mouseclick/mouseclick.cpp | 69 +- src/effects/mouseclick/mouseclick.h | 2 - src/effects/mousemark/mousemark.cpp | 58 +- src/effects/mousemark/mousemark.h | 6 - src/effects/resize/resize.cpp | 19 +- src/effects/screenedge/screenedgeeffect.cpp | 50 - src/effects/screenedge/screenedgeeffect.h | 3 - src/effects/screenshot/screenshot.cpp | 50 +- src/effects/showfps/showfps.cpp | 133 +- src/effects/showfps/showfps.h | 3 - src/effects/showpaint/showpaint.cpp | 30 +- src/effects/showpaint/showpaint.h | 1 - src/effects/snaphelper/snaphelper.cpp | 63 +- src/effects/touchpoints/touchpoints.cpp | 70 +- src/effects/touchpoints/touchpoints.h | 1 - src/effects/trackmouse/trackmouse.cpp | 55 +- src/effects/trackmouse/trackmouse.h | 4 - src/effects/zoom/zoom.cpp | 39 - src/effects/zoom/zoom.h | 4 - src/kcmkwin/kwincompositing/compositing.ui | 17 +- .../kwincompositing_setting.kcfg | 9 - src/kcmkwin/kwincompositing/main.cpp | 16 +- src/kwin.kcfg | 3 - src/libkwineffects/CMakeLists.txt | 3 - src/libkwineffects/kwinconfig.h.cmake | 3 - src/libkwineffects/kwineffects.cpp | 25 - src/libkwineffects/kwineffects.h | 2 - src/libkwineffects/kwinglobals.h | 2 +- src/libkwineffects/kwinglplatform.cpp | 18 +- src/options.cpp | 21 +- src/options.h | 11 - src/platform.cpp | 7 - src/platform.h | 6 - src/platformsupport/scenes/CMakeLists.txt | 3 - .../scenes/xrender/CMakeLists.txt | 15 - .../platformxrendersurfacetexture_x11.cpp | 59 - .../platformxrendersurfacetexture_x11.h | 32 - .../scenes/xrender/xrenderbackend.cpp | 78 -- .../scenes/xrender/xrenderbackend.h | 103 -- .../platforms/x11/standalone/CMakeLists.txt | 5 - .../platforms/x11/standalone/x11_platform.cpp | 32 +- .../platforms/x11/standalone/x11_platform.h | 3 - .../x11/standalone/x11xrenderbackend.cpp | 153 --- .../x11/standalone/x11xrenderbackend.h | 48 - src/plugins/scenes/CMakeLists.txt | 3 - src/plugins/scenes/opengl/scene_opengl.cpp | 4 +- src/plugins/scenes/xrender/CMakeLists.txt | 24 - src/plugins/scenes/xrender/scene_xrender.cpp | 1150 ----------------- src/plugins/scenes/xrender/scene_xrender.h | 208 --- src/plugins/scenes/xrender/xrender.json | 83 -- src/scene.cpp | 8 - src/scene.h | 6 - src/workspace.cpp | 5 +- 72 files changed, 152 insertions(+), 3017 deletions(-) create mode 100644 kconf_update/kwin-5.23-remove-xrender-backend.py delete mode 100644 src/platformsupport/scenes/xrender/CMakeLists.txt delete mode 100644 src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.cpp delete mode 100644 src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.h delete mode 100644 src/platformsupport/scenes/xrender/xrenderbackend.cpp delete mode 100644 src/platformsupport/scenes/xrender/xrenderbackend.h delete mode 100644 src/plugins/platforms/x11/standalone/x11xrenderbackend.cpp delete mode 100644 src/plugins/platforms/x11/standalone/x11xrenderbackend.h delete mode 100644 src/plugins/scenes/xrender/CMakeLists.txt delete mode 100644 src/plugins/scenes/xrender/scene_xrender.cpp delete mode 100644 src/plugins/scenes/xrender/scene_xrender.h delete mode 100644 src/plugins/scenes/xrender/xrender.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 70eaef2d0e..8e03a2f0f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,7 +336,6 @@ include(CMakeDependentOption) option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) -option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF) cmake_dependent_option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON "KF5Runner_FOUND" OFF) cmake_dependent_option(KWIN_BUILD_CMS "Enable building of KWin with CMS" ON "lcms2_FOUND" OFF) @@ -346,11 +345,6 @@ set(KWIN_NAME "kwin") set(KWIN_INTERNAL_NAME_X11 "kwin_x11") set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland") -# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled -if (KWIN_BUILD_XRENDER_COMPOSITING) - set(KWIN_HAVE_XRENDER_COMPOSITING 1) -endif() - include_directories(${XKB_INCLUDE_DIR}) set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX}) diff --git a/autotests/libkwineffects/kwinglplatformtest.cpp b/autotests/libkwineffects/kwinglplatformtest.cpp index 63ba823ed2..b776cfc74b 100644 --- a/autotests/libkwineffects/kwinglplatformtest.cpp +++ b/autotests/libkwineffects/kwinglplatformtest.cpp @@ -171,7 +171,7 @@ void GLPlatformTest::testPriorDetect() QCOMPARE(gl->isLooseBinding(), false); QCOMPARE(gl->isGLES(), false); - QCOMPARE(gl->recommendedCompositor(), XRenderCompositing); + QCOMPARE(gl->recommendedCompositor(), QPainterCompositing); QCOMPARE(gl->preferBufferSubData(), false); QCOMPARE(gl->platformInterface(), NoOpenGLPlatformInterface); } diff --git a/autotests/mock_effectshandler.h b/autotests/mock_effectshandler.h index 391fa07542..e8f46ad773 100644 --- a/autotests/mock_effectshandler.h +++ b/autotests/mock_effectshandler.h @@ -220,9 +220,6 @@ public: int workspaceWidth() const override { return 0; } - long unsigned int xrenderBufferPicture() override { - return 0; - } xcb_connection_t *xcbConnection() const override { return QX11Info::connection(); } diff --git a/autotests/test_builtin_effectloader.cpp b/autotests/test_builtin_effectloader.cpp index 64a94644a3..5bfecdd54e 100644 --- a/autotests/test_builtin_effectloader.cpp +++ b/autotests/test_builtin_effectloader.cpp @@ -170,62 +170,62 @@ void TestBuiltInEffectLoader::testSupported_data() QTest::addColumn("type"); QTest::addColumn("animationsSupported"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; - QTest::newRow("blur") << QStringLiteral("blur") << false << xc << true; + QTest::newRow("blur") << QStringLiteral("blur") << false << qc << true; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("blur-GL") << QStringLiteral("blur") << false << oc << true; - QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << xc << true; + QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << qc << true; QTest::newRow("Colorpicker-GL") << QStringLiteral("colorpicker") << true << oc << true; - QTest::newRow("Contrast") << QStringLiteral("contrast") << false << xc << true; + QTest::newRow("Contrast") << QStringLiteral("contrast") << false << qc << true; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc << true; - QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << xc << true; - QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << xc << true; - QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << xc << true; + QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << qc << true; + QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << qc << true; + QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << qc << true; QTest::newRow("FallApart-GL") << QStringLiteral("fallapart") << true << oc << true; - QTest::newRow("Glide") << QStringLiteral("glide") << false << xc << true; + QTest::newRow("Glide") << QStringLiteral("glide") << false << qc << true; QTest::newRow("Glide-GL") << QStringLiteral("glide") << true << oc << true; QTest::newRow("Glide-GL-no-anim") << QStringLiteral("glide") << false << oc << false; - QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << xc << true; - QTest::newRow("Invert") << QStringLiteral("invert") << false << xc << true; + QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << qc << true; + QTest::newRow("Invert") << QStringLiteral("invert") << false << qc << true; QTest::newRow("Invert-GL") << QStringLiteral("invert") << true << oc << true; - QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << xc << true; - QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << xc << true; + QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << qc << true; + QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << qc << true; QTest::newRow("LookingGlass-GL") << QStringLiteral("lookingglass") << true << oc << true; - QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << xc << true; + QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << qc << true; QTest::newRow("MagicLamp-GL") << QStringLiteral("magiclamp") << true << oc << true; QTest::newRow("MagicLamp-GL-no-anim") << QStringLiteral("magiclamp") << false << oc << false; - QTest::newRow("Magnifier") << QStringLiteral("magnifier") << true << xc << true; - QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << xc << true; - QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << xc << true; - QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << xc << true; - QTest::newRow("Resize") << QStringLiteral("resize") << true << xc << true; - QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << xc << true; - QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << true << xc << true; - QTest::newRow("Sheet") << QStringLiteral("sheet") << false << xc << true; + QTest::newRow("Magnifier") << QStringLiteral("magnifier") << false << qc << false; + QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << qc << true; + QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << qc << true; + QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << qc << true; + QTest::newRow("Resize") << QStringLiteral("resize") << true << qc << true; + QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << qc << true; + QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << false << qc << false; + QTest::newRow("Sheet") << QStringLiteral("sheet") << false << qc << true; QTest::newRow("Sheet-GL") << QStringLiteral("sheet") << true << oc << true; QTest::newRow("Sheet-GL-no-anim") << QStringLiteral("sheet") << false << oc << false; - QTest::newRow("ShowFps") << QStringLiteral("showfps") << true << xc << true; - QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << xc << true; - QTest::newRow("Slide") << QStringLiteral("slide") << true << xc << true; - QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << xc << true; - QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << xc << true; - QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << xc << true; - QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << xc << true; + QTest::newRow("ShowFps") << QStringLiteral("showfps") << true << qc << true; + QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << qc << true; + QTest::newRow("Slide") << QStringLiteral("slide") << true << qc << true; + QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << qc << true; + QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << qc << true; + QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << qc << true; + QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << qc << true; QTest::newRow("StartupFeedback-GL") << QStringLiteral("startupfeedback") << true << oc << true; - QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << xc << true; - QTest::newRow("TouchPoints") << QStringLiteral("touchpoints") << true << xc << true; - QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << xc << true; - QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true << xc << true; - QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << xc << true; + QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << qc << true; + QTest::newRow("TouchPoints") << QStringLiteral("touchpoints") << true << qc << true; + QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << qc << true; + QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true << qc << true; + QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << qc << true; QTest::newRow("WobblyWindows-GL") << QStringLiteral("wobblywindows") << true << oc << true; QTest::newRow("WobblyWindows-GL-no-anim") << QStringLiteral("wobblywindows") << false << oc << false; - QTest::newRow("Zoom") << QStringLiteral("zoom") << true << xc << true; - QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << xc << true; - QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << xc << true; - QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << xc << true; + QTest::newRow("Zoom") << QStringLiteral("zoom") << true << qc << true; + QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << qc << true; + QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << qc << true; + QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << qc << true; } void TestBuiltInEffectLoader::testSupported() @@ -248,61 +248,61 @@ void TestBuiltInEffectLoader::testLoadEffect_data() QTest::addColumn("expected"); QTest::addColumn("type"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; - QTest::newRow("blur") << QStringLiteral("blur") << false << xc; + QTest::newRow("blur") << QStringLiteral("blur") << false << qc; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("blur-GL") << QStringLiteral("blur") << false << oc; - QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << xc; + QTest::newRow("Colorpicker") << QStringLiteral("colorpicker") << false << qc; QTest::newRow("Colorpicker-GL") << QStringLiteral("colorpicker") << true << oc; - QTest::newRow("Contrast") << QStringLiteral("contrast") << false << xc; + QTest::newRow("Contrast") << QStringLiteral("contrast") << false << qc; // fails for GL as it does proper tests on what's supported and doesn't just check whether it's GL QTest::newRow("Contrast-GL") << QStringLiteral("contrast") << false << oc; - QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << xc; - QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << xc; - QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << xc; + QTest::newRow("DesktopGrid") << QStringLiteral("desktopgrid") << true << qc; + QTest::newRow("DimInactive") << QStringLiteral("diminactive") << true << qc; + QTest::newRow("FallApart") << QStringLiteral("fallapart") << false << qc; QTest::newRow("FallApart-GL") << QStringLiteral("fallapart") << true << oc; - QTest::newRow("Glide") << QStringLiteral("glide") << false << xc; + QTest::newRow("Glide") << QStringLiteral("glide") << false << qc; QTest::newRow("Glide-GL") << QStringLiteral("glide") << true << oc; - QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << xc; - QTest::newRow("Invert") << QStringLiteral("invert") << false << xc; + QTest::newRow("HighlightWindow") << QStringLiteral("highlightwindow") << true << qc; + QTest::newRow("Invert") << QStringLiteral("invert") << false << qc; QTest::newRow("Invert-GL") << QStringLiteral("invert") << true << oc; - QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << xc; - QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << xc; + QTest::newRow("Kscreen") << QStringLiteral("kscreen") << true << qc; + QTest::newRow("LookingGlass") << QStringLiteral("lookingglass") << false << qc; QTest::newRow("LookingGlass-GL") << QStringLiteral("lookingglass") << true << oc; - QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << xc; + QTest::newRow("MagicLamp") << QStringLiteral("magiclamp") << false << qc; QTest::newRow("MagicLamp-GL") << QStringLiteral("magiclamp") << true << oc; - QTest::newRow("Magnifier") << QStringLiteral("magnifier") << true << xc; - QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << xc; - QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << xc; - QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << xc; - QTest::newRow("Resize") << QStringLiteral("resize") << true << xc; - QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << xc; - QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << true << xc; - QTest::newRow("Sheet") << QStringLiteral("sheet") << false << xc; + QTest::newRow("Magnifier") << QStringLiteral("magnifier") << false << qc; + QTest::newRow("MouseClick") << QStringLiteral("mouseclick") << true << qc; + QTest::newRow("MouseMark") << QStringLiteral("mousemark") << true << qc; + QTest::newRow("PresentWindows") << QStringLiteral("presentwindows") << true << qc; + QTest::newRow("Resize") << QStringLiteral("resize") << true << qc; + QTest::newRow("ScreenEdge") << QStringLiteral("screenedge") << true << qc; + QTest::newRow("ScreenShot") << QStringLiteral("screenshot") << false << qc; + QTest::newRow("Sheet") << QStringLiteral("sheet") << false << qc; QTest::newRow("Sheet-GL") << QStringLiteral("sheet") << true << oc; // TODO: Accesses EffectFrame and crashes // QTest::newRow("ShowFps") << QStringLiteral("showfps") << true << xc; - QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << xc; - QTest::newRow("Slide") << QStringLiteral("slide") << true << xc; - QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << xc; - QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << xc; - QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << xc; - QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << xc; + QTest::newRow("ShowPaint") << QStringLiteral("showpaint") << true << qc; + QTest::newRow("Slide") << QStringLiteral("slide") << true << qc; + QTest::newRow("SlideBack") << QStringLiteral("slideback") << true << qc; + QTest::newRow("SlidingPopups") << QStringLiteral("slidingpopups") << true << qc; + QTest::newRow("SnapHelper") << QStringLiteral("snaphelper") << true << qc; + QTest::newRow("StartupFeedback") << QStringLiteral("startupfeedback") << false << qc; // Tries to load shader and makes our test abort // QTest::newRow("StartupFeedback-GL") << QStringLiteral("startupfeedback") << true << oc; - QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << xc; - QTest::newRow("Touchpoints") << QStringLiteral("touchpoints") << true << xc; - QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << xc; + QTest::newRow("ThumbnailAside") << QStringLiteral("thumbnailaside") << true << qc; + QTest::newRow("Touchpoints") << QStringLiteral("touchpoints") << true << qc; + QTest::newRow("TrackMouse") << QStringLiteral("trackmouse") << true << qc; // TODO: Accesses EffectFrame and crashes // QTest::newRow("WindowGeometry") << QStringLiteral("windowgeometry") << true << xc; - QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << xc; + QTest::newRow("WobblyWindows") << QStringLiteral("wobblywindows") << false << qc; QTest::newRow("WobblyWindows-GL") << QStringLiteral("wobblywindows") << true << oc; - QTest::newRow("Zoom") << QStringLiteral("zoom") << true << xc; - QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << xc; - QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << xc; - QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << xc; + QTest::newRow("Zoom") << QStringLiteral("zoom") << true << qc; + QTest::newRow("Non Existing") << QStringLiteral("InvalidName") << false << qc; + QTest::newRow("Fade - Scripted") << QStringLiteral("fade") << false << qc; + QTest::newRow("Fade - Scripted + kwin4_effect") << QStringLiteral("kwin4_effect_fade") << false << qc; } void TestBuiltInEffectLoader::testLoadEffect() @@ -365,7 +365,7 @@ void TestBuiltInEffectLoader::testLoadBuiltInEffect_data() QTest::addColumn("type"); QTest::addColumn("loadFlags"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; const KWin::LoadEffectFlags checkDefault = KWin::LoadEffectFlag::Load | KWin::LoadEffectFlag::CheckDefaultFunction; @@ -375,21 +375,21 @@ void TestBuiltInEffectLoader::testLoadBuiltInEffect_data() // enabled by default, but not supported QTest::newRow("blur") << KWin::BuiltInEffect::Blur << QStringLiteral("blur") << false << oc << checkDefault; // enabled by default - QTest::newRow("HighlightWindow") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << true << xc << checkDefault; + QTest::newRow("HighlightWindow") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << true << qc << checkDefault; // supported but not enabled by default QTest::newRow("LookingGlass-GL") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << true << oc << checkDefault; // not enabled by default - QTest::newRow("MouseClick") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << xc << checkDefault; + QTest::newRow("MouseClick") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << qc << checkDefault; // Force an Effect which will load - QTest::newRow("MouseClick-Force") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << xc << forceFlags; + QTest::newRow("MouseClick-Force") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << true << qc << forceFlags; // Force an Effect which is not supported - QTest::newRow("LookingGlass-Force") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << false << xc << forceFlags; + QTest::newRow("LookingGlass-Force") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << false << qc << forceFlags; // Force the Effect as supported QTest::newRow("LookingGlass-Force-GL") << KWin::BuiltInEffect::LookingGlass << QStringLiteral("lookingglass") << true << oc << forceFlags; // Enforce no load of effect which is enabled by default - QTest::newRow("HighlightWindow-DontLoad") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << false << xc << dontLoadFlags; + QTest::newRow("HighlightWindow-DontLoad") << KWin::BuiltInEffect::HighlightWindow << QStringLiteral("highlightwindow") << false << qc << dontLoadFlags; // Enforce no load of effect which is not enabled by default, but enforced - QTest::newRow("MouseClick-DontLoad") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << false << xc << dontLoadFlags; + QTest::newRow("MouseClick-DontLoad") << KWin::BuiltInEffect::MouseClick << QStringLiteral("mouseclick") << false << qc << dontLoadFlags; } void TestBuiltInEffectLoader::testLoadBuiltInEffect() @@ -447,7 +447,7 @@ void TestBuiltInEffectLoader::testLoadBuiltInEffect() void TestBuiltInEffectLoader::testLoadAllEffects() { - QScopedPointermockHandler(new MockEffectsHandler(KWin::XRenderCompositing)); + QScopedPointermockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); KWin::BuiltInEffectLoader loader; KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index 2b1093739a..67c43a6603 100644 --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -147,14 +147,14 @@ void TestPluginEffectLoader::testSupported_data() QTest::addColumn("expected"); QTest::addColumn("type"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; - QTest::newRow("invalid") << QStringLiteral("blur") << false << xc; - QTest::newRow("fake - xrender") << QStringLiteral("fakeeffectplugin") << false << xc; + QTest::newRow("invalid") << QStringLiteral("blur") << false << qc; + QTest::newRow("fake - qpainter") << QStringLiteral("fakeeffectplugin") << false << qc; QTest::newRow("fake - opengl") << QStringLiteral("fakeeffectplugin") << true << oc; QTest::newRow("fake - CS") << QStringLiteral("fakeEffectPlugin") << true << oc; - QTest::newRow("version") << QStringLiteral("effectversion") << false << xc; + QTest::newRow("version") << QStringLiteral("effectversion") << false << qc; } void TestPluginEffectLoader::testSupported() @@ -175,14 +175,14 @@ void TestPluginEffectLoader::testLoadEffect_data() QTest::addColumn("expected"); QTest::addColumn("type"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; - QTest::newRow("invalid") << QStringLiteral("slide") << false << xc; - QTest::newRow("fake - xrender") << QStringLiteral("fakeeffectplugin") << false << xc; + QTest::newRow("invalid") << QStringLiteral("slide") << false << qc; + QTest::newRow("fake - qpainter") << QStringLiteral("fakeeffectplugin") << false << qc; QTest::newRow("fake - opengl") << QStringLiteral("fakeeffectplugin") << true << oc; QTest::newRow("fake - CS") << QStringLiteral("fakeEffectPlugin") << true << oc; - QTest::newRow("version") << QStringLiteral("effectversion") << false << xc; + QTest::newRow("version") << QStringLiteral("effectversion") << false << qc; } void TestPluginEffectLoader::testLoadEffect() @@ -246,7 +246,7 @@ void TestPluginEffectLoader::testLoadPluginEffect_data() QTest::addColumn("loadFlags"); QTest::addColumn("enabledByDefault"); - const KWin::CompositingType xc = KWin::XRenderCompositing; + const KWin::CompositingType qc = KWin::QPainterCompositing; const KWin::CompositingType oc = KWin::OpenGL2Compositing; const KWin::LoadEffectFlags checkDefault = KWin::LoadEffectFlag::Load | KWin::LoadEffectFlag::CheckDefaultFunction; @@ -254,7 +254,7 @@ void TestPluginEffectLoader::testLoadPluginEffect_data() const KWin::LoadEffectFlags dontLoadFlags = KWin::LoadEffectFlags(); // enabled by default, but not supported - QTest::newRow("fakeeffectplugin") << QStringLiteral("fakeeffectplugin") << false << xc << checkDefault << false; + QTest::newRow("fakeeffectplugin") << QStringLiteral("fakeeffectplugin") << false << qc << checkDefault << false; // enabled by default, check default false QTest::newRow("supported, check default error") << QStringLiteral("fakeeffectplugin") << false << oc << checkDefault << false; // enabled by default, check default true @@ -264,7 +264,7 @@ void TestPluginEffectLoader::testLoadPluginEffect_data() // enabled by default, check default true QTest::newRow("supported, check default, don't load") << QStringLiteral("fakeeffectplugin") << false << oc << dontLoadFlags << true; // incorrect version - QTest::newRow("Version") << QStringLiteral("effectversion") << false << xc << forceFlags << true; + QTest::newRow("Version") << QStringLiteral("effectversion") << false << qc << forceFlags << true; } void TestPluginEffectLoader::testLoadPluginEffect() diff --git a/autotests/test_scripted_effectloader.cpp b/autotests/test_scripted_effectloader.cpp index 24bbd16ec4..e9863cabe6 100644 --- a/autotests/test_scripted_effectloader.cpp +++ b/autotests/test_scripted_effectloader.cpp @@ -142,7 +142,7 @@ void TestScriptedEffectLoader::testHasEffect() QFETCH(QString, name); QFETCH(bool, expected); - QScopedPointer mockHandler(new MockEffectsHandler(KWin::XRenderCompositing)); + QScopedPointer mockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); KWin::ScriptedEffectLoader loader; QCOMPARE(loader.hasEffect(name), expected); @@ -217,7 +217,7 @@ void TestScriptedEffectLoader::testLoadEffect() QFETCH(QString, name); QFETCH(bool, expected); - QScopedPointer mockHandler(new MockEffectsHandler(KWin::XRenderCompositing)); + QScopedPointer mockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); KWin::ScriptedEffectLoader loader; KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); loader.setConfig(config); @@ -290,7 +290,7 @@ void TestScriptedEffectLoader::testLoadScriptedEffect() QFETCH(bool, expected); QFETCH(KWin::LoadEffectFlags, loadFlags); - QScopedPointer mockHandler(new MockEffectsHandler(KWin::XRenderCompositing)); + QScopedPointer mockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); KWin::ScriptedEffectLoader loader; KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); loader.setConfig(config); @@ -344,7 +344,7 @@ void TestScriptedEffectLoader::testLoadScriptedEffect() void TestScriptedEffectLoader::testLoadAllEffects() { - QScopedPointer mockHandler(new MockEffectsHandler(KWin::XRenderCompositing)); + QScopedPointer mockHandler(new MockEffectsHandler(KWin::QPainterCompositing)); KWin::ScriptedEffectLoader loader; KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); @@ -429,7 +429,7 @@ void TestScriptedEffectLoader::testLoadAllEffects() void TestScriptedEffectLoader::testCancelLoadAllEffects() { // this test verifies that no test gets loaded when the loader gets cleared - MockEffectsHandler mockHandler(KWin::XRenderCompositing); + MockEffectsHandler mockHandler(KWin::QPainterCompositing); KWin::ScriptedEffectLoader loader; // prepare the configuration to hard enable/disable the effects we want to load diff --git a/data/org_kde_kwin.categories b/data/org_kde_kwin.categories index 4f3428e740..dfc912053e 100644 --- a/data/org_kde_kwin.categories +++ b/data/org_kde_kwin.categories @@ -17,7 +17,6 @@ kwin_scripting KWin Scripting DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_SCRIPT aurorae KWin Aurorae Window Decoration Engine DEFAULT_SEVERITY [WARNING] IDENTIFIER [AURORAE] kwin_xkbcommon KWin xkbcommon integration DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_XKB] kwin_qpa_plugin KWin QtPlatformAbstraction plugin DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_QPA] -kwin_scene_xrender KWin XRender based compositor scene plugin DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_XRENDER] kwin_scene_qpainter KWin QPainter based compositor scene plugin DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_QPAINTER] kwin_scene_opengl KWin OpenGL based compositor scene plugins DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_OPENGL] kwin_screencast KWin Screen Cast Service DEFAULT_SEVERITY [WARNING] IDENTIFIER [KWIN_SCREENCAST] diff --git a/doc/kwineffects/index.docbook b/doc/kwineffects/index.docbook index c97be9e30f..a659e7d009 100644 --- a/doc/kwineffects/index.docbook +++ b/doc/kwineffects/index.docbook @@ -69,7 +69,7 @@ effects can be activated. All effects which are not supported by the currently used compositing backend -are hidden by default (⪚ OpenGL effects when using XRender). +are hidden by default (⪚ OpenGL effects when using software renderer). Also all internal or helper effects are hidden by default. These are effects which replace diff --git a/kconf_update/kwin-5.23-remove-xrender-backend.py b/kconf_update/kwin-5.23-remove-xrender-backend.py new file mode 100644 index 0000000000..3a81292bcc --- /dev/null +++ b/kconf_update/kwin-5.23-remove-xrender-backend.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import fileinput + +for line in fileinput.input(): + if not line.startswith("Backend="): + continue + value = line[len("Backend="):].strip() + if value != "XRender": + continue + print("# DELETE Backend") # will use the default compositing type diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index 54bb9e82b4..ef033cfb66 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -73,3 +73,9 @@ Id=remove-cubeslide-effect File=kwinrc Group=Plugins Script=kwin-5.23-remove-cubeslide.py,python3 + +# Remove Backend if it has a value of "XRender" +Id=remove-xrender-backend +File=kwinrc +Group=Compositing +Script=kwin-5.23-remove-xrender-backend.py,python3 diff --git a/src/composite.cpp b/src/composite.cpp index 039291067f..6eb0a94fdc 100644 --- a/src/composite.cpp +++ b/src/composite.cpp @@ -205,9 +205,6 @@ bool Compositor::setupStart() for (auto type : qAsConst(supportedCompositors)) { switch (type) { - case XRenderCompositing: - qCDebug(KWIN_CORE) << "Attempting to load the XRender scene"; - break; case OpenGLCompositing: case OpenGL2Compositing: qCDebug(KWIN_CORE) << "Attempting to load the OpenGL scene"; diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp index bf7fdb1600..5db107c2e6 100644 --- a/src/dbusinterface.cpp +++ b/src/dbusinterface.cpp @@ -277,8 +277,6 @@ QString CompositorDBusInterface::compositingType() const return QStringLiteral("none"); } switch (m_compositor->scene()->compositingType()) { - case XRenderCompositing: - return QStringLiteral("xrender"); case OpenGL2Compositing: if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { return QStringLiteral("gles"); diff --git a/src/dbusinterface.h b/src/dbusinterface.h index 850176b674..73e5e362cc 100644 --- a/src/dbusinterface.h +++ b/src/dbusinterface.h @@ -97,7 +97,6 @@ class CompositorDBusInterface : public QObject /** * The type of the currently used Scene: * @li @c none No Compositing - * @li @c xrender XRender * @li @c gl1 OpenGL 1 * @li @c gl2 OpenGL 2 * @li @c gles OpenGL ES 2 diff --git a/src/effects.cpp b/src/effects.cpp index 578f3b2740..aabb21b50a 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1347,11 +1347,6 @@ void EffectsHandlerImpl::unregisterTouchBorder(ElectricBorder border, QAction *a ScreenEdges::self()->unreserveTouch(border, action); } -unsigned long EffectsHandlerImpl::xrenderBufferPicture() -{ - return m_scene->xrenderBufferPicture(); -} - QPainter *EffectsHandlerImpl::scenePainter() { return m_scene->scenePainter(); diff --git a/src/effects.h b/src/effects.h index fc826d1db8..c0ef80613b 100644 --- a/src/effects.h +++ b/src/effects.h @@ -165,7 +165,6 @@ public: void registerTouchBorder(ElectricBorder border, QAction *action) override; void unregisterTouchBorder(ElectricBorder border, QAction *action) override; - unsigned long xrenderBufferPicture() override; QPainter* scenePainter() override; void reconfigure() override; QByteArray readRootProperty(long atom, long type, int format) const override; diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index 72f6a05c66..ea7d6a9f64 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -11,10 +11,6 @@ set(kwin_effect_OWN_LIBS kwineffects ) -if (KWIN_HAVE_XRENDER_COMPOSITING) - set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinxrenderutils) -endif() - set(kwin_effect_KDE_LIBS KF5::ConfigGui KF5::ConfigWidgets @@ -47,10 +43,6 @@ set(kwin_effect_XCB_LIBS XCB::XFIXES ) -if (KWIN_HAVE_XRENDER_COMPOSITING) - set(kwin_effect_XCB_LIBS ${kwin_effect_XCB_LIBS} XCB::RENDER) -endif() - set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinglutils) macro(KWIN4_ADD_EFFECT_BACKEND name) diff --git a/src/effects/desktopgrid/desktopgrid.cpp b/src/effects/desktopgrid/desktopgrid.cpp index e3bdd5fe73..153da09939 100644 --- a/src/effects/desktopgrid/desktopgrid.cpp +++ b/src/effects/desktopgrid/desktopgrid.cpp @@ -348,27 +348,12 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W d.multiplyOpacity(timeline.currentValue()); } - if (effects->compositingType() == XRenderCompositing) { - // More exact clipping as XRender displays the entire window instead of just the quad - QPointF screenPosF = scalePos(screenGeom.topLeft(), paintingDesktop).toPoint(); - QPoint screenPos( - qRound(screenPosF.x()), - qRound(screenPosF.y()) - ); - QSize screenSize( - qRound(interpolate(screenGeom.width(), scaledSize[screen].width(), progress)), - qRound(interpolate(screenGeom.height(), scaledSize[screen].height(), progress)) - ); - PaintClipper pc(effects->clientArea(ScreenArea, screen, 0) & QRect(screenPos, screenSize)); - effects->paintWindow(w, mask, region, d); - } else { - if (w->isDesktop() && timeline.currentValue() == 1.0) { - // desktop windows are not in a motion manager and can always be rendered with - // lanczos sampling except for animations - mask |= PAINT_WINDOW_LANCZOS; - } - effects->paintWindow(w, mask, effects->clientArea(ScreenArea, screen, 0), d); + if (w->isDesktop() && timeline.currentValue() == 1.0) { + // desktop windows are not in a motion manager and can always be rendered with + // lanczos sampling except for animations + mask |= PAINT_WINDOW_LANCZOS; } + effects->paintWindow(w, mask, effects->clientArea(ScreenArea, screen, 0), d); } } else effects->paintWindow(w, mask, region, data); diff --git a/src/effects/magnifier/magnifier.cpp b/src/effects/magnifier/magnifier.cpp index d1f55cdaa1..0feccdcad6 100644 --- a/src/effects/magnifier/magnifier.cpp +++ b/src/effects/magnifier/magnifier.cpp @@ -18,10 +18,6 @@ #include #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#endif #include namespace KWin @@ -36,9 +32,6 @@ MagnifierEffect::MagnifierEffect() , m_lastPresentTime(std::chrono::milliseconds::zero()) , m_texture(nullptr) , m_fbo(nullptr) -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - , m_pixmap(XCB_PIXMAP_NONE) -#endif { initConfig(); QAction* a; @@ -67,30 +60,14 @@ MagnifierEffect::~MagnifierEffect() { delete m_fbo; delete m_texture; - destroyPixmap(); // Save the zoom value. MagnifierConfig::setInitialZoom(target_zoom); MagnifierConfig::self()->save(); } -void MagnifierEffect::destroyPixmap() -{ -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() != XRenderCompositing) { - return; - } - m_picture.reset(); - if (m_pixmap != XCB_PIXMAP_NONE) { - xcb_free_pixmap(xcbConnection(), m_pixmap); - m_pixmap = XCB_PIXMAP_NONE; - } -#endif -} - bool MagnifierEffect::supported() { - return effects->compositingType() == XRenderCompositing || - (effects->isOpenGLCompositing() && GLRenderTarget::blitSupported()); + return effects->isOpenGLCompositing() && GLRenderTarget::blitSupported(); } void MagnifierEffect::reconfigure(ReconfigureFlags) @@ -122,7 +99,6 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, std::chrono::mill delete m_texture; m_fbo = nullptr; m_texture = nullptr; - destroyPixmap(); } } } @@ -201,48 +177,6 @@ void MagnifierEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintDa binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix()); vbo->render(GL_TRIANGLES); } - if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (m_pixmap == XCB_PIXMAP_NONE || m_pixmapSize != srcArea.size()) { - destroyPixmap(); - m_pixmap = xcb_generate_id(xcbConnection()); - m_pixmapSize = srcArea.size(); - xcb_create_pixmap(xcbConnection(), 32, m_pixmap, x11RootWindow(), m_pixmapSize.width(), m_pixmapSize.height()); - m_picture.reset(new XRenderPicture(m_pixmap, 32)); - } -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) - static const xcb_render_transform_t identity = { - DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - static xcb_render_transform_t xform = { - DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_SRC, effects->xrenderBufferPicture(), 0, *m_picture, - srcArea.x(), srcArea.y(), 0, 0, 0, 0, srcArea.width(), srcArea.height()); - xcb_flush(xcbConnection()); - xform.matrix11 = DOUBLE_TO_FIXED(1.0/zoom); - xform.matrix22 = DOUBLE_TO_FIXED(1.0/zoom); -#undef DOUBLE_TO_FIXED - xcb_render_set_picture_transform(xcbConnection(), *m_picture, xform); - xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("good"), 0, nullptr); - xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_SRC, *m_picture, 0, effects->xrenderBufferPicture(), - 0, 0, 0, 0, area.x(), area.y(), area.width(), area.height() ); - xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("fast"), 0, nullptr); - xcb_render_set_picture_transform(xcbConnection(), *m_picture, identity); - const xcb_rectangle_t rects[4] = { - { int16_t(area.x()+FRAME_WIDTH), int16_t(area.y()), uint16_t(area.width()-FRAME_WIDTH), uint16_t(FRAME_WIDTH)}, - { int16_t(area.right()-FRAME_WIDTH), int16_t(area.y()+FRAME_WIDTH), uint16_t(FRAME_WIDTH), uint16_t(area.height()-FRAME_WIDTH)}, - { int16_t(area.x()), int16_t(area.bottom()-FRAME_WIDTH), uint16_t(area.width()-FRAME_WIDTH), uint16_t(FRAME_WIDTH)}, - { int16_t(area.x()), int16_t(area.y()), uint16_t(FRAME_WIDTH), uint16_t(area.height()-FRAME_WIDTH)} - }; - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, effects->xrenderBufferPicture(), - preMultiply(QColor(0,0,0,255)), 4, rects); -#endif - } } } @@ -292,7 +226,6 @@ void MagnifierEffect::zoomOut() delete m_texture; m_fbo = nullptr; m_texture = nullptr; - destroyPixmap(); } } effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH)); diff --git a/src/effects/magnifier/magnifier.h b/src/effects/magnifier/magnifier.h index 00b3158297..f98cfd13e7 100644 --- a/src/effects/magnifier/magnifier.h +++ b/src/effects/magnifier/magnifier.h @@ -18,7 +18,6 @@ namespace KWin class GLRenderTarget; class GLTexture; -class XRenderPicture; class MagnifierEffect : public Effect @@ -51,7 +50,6 @@ private Q_SLOTS: Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers); void slotWindowDamaged(); - void destroyPixmap(); private: QRect magnifierArea(QPoint pos = cursorPos()) const; double zoom; @@ -61,11 +59,6 @@ private: QSize magnifier_size; GLTexture *m_texture; GLRenderTarget *m_fbo; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - xcb_pixmap_t m_pixmap; - QSize m_pixmapSize; - QScopedPointer m_picture; -#endif }; } // namespace diff --git a/src/effects/mouseclick/mouseclick.cpp b/src/effects/mouseclick/mouseclick.cpp index 349ec462d2..267f734178 100644 --- a/src/effects/mouseclick/mouseclick.cpp +++ b/src/effects/mouseclick/mouseclick.cpp @@ -13,11 +13,6 @@ #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#endif - #include #include @@ -247,9 +242,7 @@ void MouseClickEffect::drawCircle(const QColor& color, float cx, float cy, float { if (effects->isOpenGLCompositing()) drawCircleGl(color, cx, cy, r); - if (effects->compositingType() == XRenderCompositing) - drawCircleXr(color, cx, cy, r); - if (effects->compositingType() == QPainterCompositing) + else if (effects->compositingType() == QPainterCompositing) drawCircleQPainter(color, cx, cy, r); } @@ -294,66 +287,6 @@ void MouseClickEffect::drawCircleGl(const QColor& color, float cx, float cy, flo vbo->render(GL_LINE_LOOP); } -void MouseClickEffect::drawCircleXr(const QColor& color, float cx, float cy, float r) -{ -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (r <= m_lineWidth) - return; - - int num_segments = r+8; - float theta = 2.0 * 3.1415926 / num_segments; - float cos = cosf(theta); //precalculate the sine and cosine - float sin = sinf(theta); - float x[2] = {r, r-m_lineWidth}; - float y[2] = {0, 0}; - -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) - QVector strip; - strip.reserve(2*num_segments+2); - - xcb_render_pointfix_t point; - point.x = DOUBLE_TO_FIXED(x[1]+cx); - point.y = DOUBLE_TO_FIXED(y[1]+cy); - strip << point; - - for (int i = 0; i < num_segments; ++i) { - //apply the rotation matrix - const float h[2] = {x[0], x[1]}; - x[0] = cos * x[0] - sin * y[0]; - x[1] = cos * x[1] - sin * y[1]; - y[0] = sin * h[0] + cos * y[0]; - y[1] = sin * h[1] + cos * y[1]; - - point.x = DOUBLE_TO_FIXED(x[0]+cx); - point.y = DOUBLE_TO_FIXED(y[0]+cy); - strip << point; - - point.x = DOUBLE_TO_FIXED(x[1]+cx); - point.y = DOUBLE_TO_FIXED(y[1]+cy); - strip << point; - } - - const float h = x[0]; - x[0] = cos * x[0] - sin * y[0]; - y[0] = sin * h + cos * y[0]; - - point.x = DOUBLE_TO_FIXED(x[0]+cx); - point.y = DOUBLE_TO_FIXED(y[0]+cy); - strip << point; - - XRenderPicture fill = xRenderFill(color); - xcb_render_tri_strip(xcbConnection(), XCB_RENDER_PICT_OP_OVER, - fill, effects->xrenderBufferPicture(), 0, - 0, 0, strip.count(), strip.constData()); -#undef DOUBLE_TO_FIXED -#else - Q_UNUSED(color) - Q_UNUSED(cx) - Q_UNUSED(cy) - Q_UNUSED(r) -#endif -} - void MouseClickEffect::drawCircleQPainter(const QColor &color, float cx, float cy, float r) { QPainter *painter = effects->scenePainter(); diff --git a/src/effects/mouseclick/mouseclick.h b/src/effects/mouseclick/mouseclick.h index b81a97d5af..f5e5d96b31 100644 --- a/src/effects/mouseclick/mouseclick.h +++ b/src/effects/mouseclick/mouseclick.h @@ -12,7 +12,6 @@ #include #include -#include #include #include @@ -149,7 +148,6 @@ private: void repaint(); void drawCircleGl(const QColor& color, float cx, float cy, float r); - void drawCircleXr(const QColor& color, float cx, float cy, float r); void drawCircleQPainter(const QColor& color, float cx, float cy, float r); void paintScreenSetupGl(int mask, QRegion region, ScreenPaintData& data); void paintScreenFinishGl(int mask, QRegion region, ScreenPaintData& data); diff --git a/src/effects/mousemark/mousemark.cpp b/src/effects/mousemark/mousemark.cpp index 6975217ad0..69fd9dcd30 100644 --- a/src/effects/mousemark/mousemark.cpp +++ b/src/effects/mousemark/mousemark.cpp @@ -23,10 +23,6 @@ #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#endif - namespace KWin { @@ -72,33 +68,6 @@ void MouseMarkEffect::reconfigure(ReconfigureFlags) color.setAlphaF(1.0); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -void MouseMarkEffect::addRect(const QPoint &p1, const QPoint &p2, xcb_rectangle_t *r, xcb_render_color_t *c) -{ - r->x = qMin(p1.x(), p2.x()) - width_2; - r->y = qMin(p1.y(), p2.y()) - width_2; - r->width = qAbs(p1.x()-p2.x()) + 1 + width_2; - r->height = qAbs(p1.y()-p2.y()) + 1 + width_2; - // fast move -> large rect, tess... interpolate a line - if (r->width > 3*width/2 && r->height > 3*width/2) { - const int n = sqrt(r->width*r->width + r->height*r->height) / width; - xcb_rectangle_t *rects = new xcb_rectangle_t[n-1]; - const int w = p1.x() < p2.x() ? r->width : -r->width; - const int h = p1.y() < p2.y() ? r->height : -r->height; - for (int i = 1; i < n; ++i) { - rects[i-1].x = p1.x() + i*w/n; - rects[i-1].y = p1.y() + i*h/n; - rects[i-1].width = rects[i-1].height = width; - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, effects->xrenderBufferPicture(), *c, n - 1, rects); - delete [] rects; - r->x = p1.x(); - r->y = p1.y(); - r->width = r->height = width; - } -} -#endif - void MouseMarkEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData& data) { effects->paintScreen(mask, region, data); // paint normal screen @@ -143,32 +112,7 @@ void MouseMarkEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintDa glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); } - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if ( effects->compositingType() == XRenderCompositing) { - xcb_render_color_t c = preMultiply(color); - for (int i = 0; i < marks.count(); ++i) { - const int n = marks[i].count() - 1; - if (n > 0) { - xcb_rectangle_t *rects = new xcb_rectangle_t[n]; - for (int j = 0; j < marks[i].count()-1; ++j) { - addRect(marks[i][j], marks[i][j+1], &rects[j], &c); - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, effects->xrenderBufferPicture(), c, n, rects); - delete [] rects; - } - } - const int n = drawing.count() - 1; - if (n > 0) { - xcb_rectangle_t *rects = new xcb_rectangle_t[n]; - for (int i = 0; i < n; ++i) - addRect(drawing[i], drawing[i+1], &rects[i], &c); - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, effects->xrenderBufferPicture(), c, n, rects); - delete [] rects; - } - } -#endif - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { QPainter *painter = effects->scenePainter(); painter->save(); QPen pen(color); diff --git a/src/effects/mousemark/mousemark.h b/src/effects/mousemark/mousemark.h index e40e01472a..01577a279e 100644 --- a/src/effects/mousemark/mousemark.h +++ b/src/effects/mousemark/mousemark.h @@ -12,9 +12,6 @@ #include #include -#include - -struct xcb_render_color_t; namespace KWin { @@ -50,9 +47,6 @@ private: typedef QVector< QPoint > Mark; void drawMark(QPainter *painter, const Mark &mark); static Mark createArrow(QPoint arrow_start, QPoint arrow_end); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - void addRect(const QPoint &p1, const QPoint &p2, xcb_rectangle_t *r, xcb_render_color_t *c); -#endif QVector< Mark > marks; Mark drawing; QPoint arrow_start; diff --git a/src/effects/resize/resize.cpp b/src/effects/resize/resize.cpp index 3807117645..9831b39349 100644 --- a/src/effects/resize/resize.cpp +++ b/src/effects/resize/resize.cpp @@ -12,9 +12,6 @@ #include "resizeconfig.h" #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include "kwinxrenderutils.h" -#endif #include @@ -94,21 +91,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window vbo->setData(verts.count() / 2, 2, verts.data(), nullptr); vbo->render(GL_TRIANGLES); glDisable(GL_BLEND); - } - -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) { - QVector rects; - for (const QRect &r : paintRegion) { - xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())}; - rects << rect; - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_OVER, - effects->xrenderBufferPicture(), preMultiply(color, alpha), - rects.count(), rects.constData()); - } -#endif - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { QPainter *painter = effects->scenePainter(); painter->save(); color.setAlphaF(alpha); diff --git a/src/effects/screenedge/screenedgeeffect.cpp b/src/effects/screenedge/screenedgeeffect.cpp index 07662b7b16..3e5e14ee8b 100644 --- a/src/effects/screenedge/screenedgeeffect.cpp +++ b/src/effects/screenedge/screenedgeeffect.cpp @@ -10,17 +10,12 @@ // KWin #include #include -#include // KDE #include // Qt #include #include #include -// xcb -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#endif namespace KWin { @@ -102,33 +97,6 @@ void ScreenEdgeEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintD texture->render(infiniteRegion(), (*it)->geometry); texture->unbind(); glDisable(GL_BLEND); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - const QRect &rect = (*it)->geometry; - const QSize &size = (*it)->pictureSize; - int x = rect.x(); - int y = rect.y(); - int width = rect.width(); - int height = rect.height(); - switch ((*it)->border) { - case ElectricTopRight: - x = rect.x() + rect.width() - size.width(); - break; - case ElectricBottomRight: - x = rect.x() + rect.width() - size.width(); - y = rect.y() + rect.height() - size.height(); - break; - case ElectricBottomLeft: - y = rect.y() + rect.height() - size.height(); - break; - default: - // nothing - break; - } - xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, *(*it)->picture.data(), - xRenderBlendPicture(opacity), effects->xrenderBufferPicture(), - 0, 0, 0, 0, x, y, width, height); -#endif } else if (effects->compositingType() == QPainterCompositing) { QImage tmp((*it)->image->size(), QImage::Format_ARGB32_Premultiplied); tmp.fill(Qt::transparent); @@ -178,10 +146,6 @@ void ScreenEdgeEffect::edgeApproaching(ElectricBorder border, qreal factor, cons if (border == ElectricLeft || border == ElectricRight || border == ElectricTop || border == ElectricBottom) { if (effects->isOpenGLCompositing()) { (*it)->texture.reset(createEdgeGlow(border, geometry.size())); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - (*it)->picture.reset(createEdgeGlow(border, geometry.size())); -#endif } else if (effects->compositingType() == QPainterCompositing) { (*it)->image.reset(createEdgeGlow(border, geometry.size())); } @@ -224,20 +188,6 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR delete glow; return nullptr; } - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) { - glow->pictureSize = cornerGlowSize(border); - glow->picture.reset(createCornerGlow(border)); - } else { - glow->pictureSize = geometry.size(); - glow->picture.reset(createEdgeGlow(border, geometry.size())); - } - if (glow->picture.isNull()) { - delete glow; - return nullptr; - } -#endif } else if (effects->compositingType() == QPainterCompositing) { if (border == ElectricTopLeft || border == ElectricTopRight || border == ElectricBottomRight || border == ElectricBottomLeft) { glow->image.reset(createCornerGlow(border)); diff --git a/src/effects/screenedge/screenedgeeffect.h b/src/effects/screenedge/screenedgeeffect.h index 56544a4f7e..c9126573cc 100644 --- a/src/effects/screenedge/screenedgeeffect.h +++ b/src/effects/screenedge/screenedgeeffect.h @@ -54,9 +54,6 @@ class Glow public: QScopedPointer texture; QScopedPointer image; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - QScopedPointer picture; -#endif QSize pictureSize; qreal strength; QRect geometry; diff --git a/src/effects/screenshot/screenshot.cpp b/src/effects/screenshot/screenshot.cpp index 658b327640..20933d7cfc 100644 --- a/src/effects/screenshot/screenshot.cpp +++ b/src/effects/screenshot/screenshot.cpp @@ -17,11 +17,6 @@ #include -#if defined(KWIN_HAVE_XRENDER_COMPOSITING) -#include -#include -#endif - namespace KWin { @@ -79,35 +74,9 @@ static void convertFromGLImage(QImage &img, int w, int h) img = img.mirrored(); } -#if defined(KWIN_HAVE_XRENDER_COMPOSITING) -static void xImageCleanup(void *data) -{ - xcb_image_destroy(static_cast(data)); -} - -static QImage xPictureToImage(xcb_render_picture_t srcPic, const QRect &geometry) -{ - xcb_connection_t *c = effects->xcbConnection(); - xcb_pixmap_t xpix = xcb_generate_id(c); - xcb_create_pixmap(c, 32, xpix, effects->x11RootWindow(), geometry.width(), geometry.height()); - XRenderPicture pic(xpix, 32); - xcb_render_composite(c, XCB_RENDER_PICT_OP_SRC, srcPic, XCB_RENDER_PICTURE_NONE, pic, - geometry.x(), geometry.y(), 0, 0, 0, 0, geometry.width(), geometry.height()); - xcb_flush(c); - xcb_image_t *xImage = xcb_image_get(c, xpix, 0, 0, geometry.width(), geometry.height(), - ~0, XCB_IMAGE_FORMAT_Z_PIXMAP); - QImage img(xImage->data, xImage->width, xImage->height, xImage->stride, - QImage::Format_ARGB32_Premultiplied, xImageCleanup, xImage); - // TODO: byte order might need swapping - xcb_free_pixmap(c, xpix); - return img.copy(); -} -#endif - bool ScreenShotEffect::supported() { - return effects->compositingType() == XRenderCompositing || - (effects->isOpenGLCompositing() && GLRenderTarget::supported()); + return effects->isOpenGLCompositing() && GLRenderTarget::supported(); } ScreenShotEffect::ScreenShotEffect() @@ -285,17 +254,6 @@ void ScreenShotEffect::takeScreenShot(ScreenShotWindowData *screenshot) GLRenderTarget::popRenderTarget(); convertFromGLImage(img, img.width(), img.height()); } -#if defined(KWIN_HAVE_XRENDER_COMPOSITING) - if (effects->compositingType() == XRenderCompositing) { - setXRenderOffscreen(true); - effects->drawWindow(window, mask, QRegion(0, 0, geometry.width(), geometry.height()), d); - if (xRenderOffscreenTarget()) { - img = xPictureToImage(xRenderOffscreenTarget(), - QRect(0, 0, geometry.width(), geometry.height())); - } - setXRenderOffscreen(false); - } -#endif if (screenshot->flags & ScreenShotIncludeCursor) { grabPointerImage(img, geometry.x(), geometry.y()); @@ -420,12 +378,6 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry, qreal devicePixel convertFromGLImage(image, nativeSize.width(), nativeSize.height()); } -#if defined(KWIN_HAVE_XRENDER_COMPOSITING) - if (effects->compositingType() == XRenderCompositing) { - image = xPictureToImage(effects->xrenderBufferPicture(), geometry); - } -#endif - image.setDevicePixelRatio(devicePixelRatio); return image; } diff --git a/src/effects/showfps/showfps.cpp b/src/effects/showfps/showfps.cpp index 181c8490a5..f15145c750 100644 --- a/src/effects/showfps/showfps.cpp +++ b/src/effects/showfps/showfps.cpp @@ -15,10 +15,6 @@ #include #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#endif #include @@ -155,14 +151,7 @@ void ShowFpsEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData if (effects->isOpenGLCompositing()) { paintGL(fps, data.projectionMatrix()); glFinish(); // make sure all rendering is done - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) { - paintXrender(fps); - xcb_flush(xcbConnection()); // make sure all rendering is done - } -#endif - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { paintQPainter(fps); } m_noBenchmark->render(infiniteRegion(), 1.0, alpha); @@ -245,64 +234,6 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix) glDisable(GL_BLEND); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -/* - Differences between OpenGL and XRender: - - differently specified rectangles (X: width/height, O: x2,y2) - - XRender uses pre-multiplied alpha -*/ -void ShowFpsEffect::paintXrender(int fps) -{ - xcb_pixmap_t pixmap = xcb_generate_id(xcbConnection()); - xcb_create_pixmap(xcbConnection(), 32, pixmap, x11RootWindow(), FPS_WIDTH, MAX_TIME); - XRenderPicture p(pixmap, 32); - xcb_free_pixmap(xcbConnection(), pixmap); - xcb_render_color_t col; - col.alpha = int(alpha * 0xffff); - col.red = int(alpha * 0xffff); // white - col.green = int(alpha * 0xffff); - col.blue = int(alpha * 0xffff); - xcb_rectangle_t rect = {0, 0, FPS_WIDTH, MAX_TIME}; - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, 1, &rect); - col.red = 0; // blue - col.green = 0; - col.blue = int(alpha * 0xffff); - rect.y = MAX_TIME - fps; - rect.width = FPS_WIDTH; - rect.height = fps; - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, 1, &rect); - col.red = 0; // black - col.green = 0; - col.blue = 0; - QVector rects; - for (int i = 10; - i < MAX_TIME; - i += 10) { - xcb_rectangle_t rect = {0, int16_t(MAX_TIME - i), uint16_t(FPS_WIDTH), 1}; - rects << rect; - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, rects.count(), rects.constData()); - xcb_render_composite(xcbConnection(), alpha != 1.0 ? XCB_RENDER_PICT_OP_OVER : XCB_RENDER_PICT_OP_SRC, p, XCB_RENDER_PICTURE_NONE, - effects->xrenderBufferPicture(), 0, 0, 0, 0, x, y, FPS_WIDTH, MAX_TIME); - - - // Paint FPS graph - paintFPSGraph(x + FPS_WIDTH, y); - - // 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(xcbConnection(), 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 - void ShowFpsEffect::paintQPainter(int fps) { QPainter *painter = effects->scenePainter(); @@ -428,67 +359,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); vbo->render(GL_LINES); } - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) { - xcb_pixmap_t pixmap = xcb_generate_id(xcbConnection()); - xcb_create_pixmap(xcbConnection(), 32, pixmap, x11RootWindow(), values.count(), MAX_TIME); - XRenderPicture p(pixmap, 32); - xcb_free_pixmap(xcbConnection(), pixmap); - xcb_render_color_t col; - col.alpha = int(alpha * 0xffff); - - // Draw background - col.red = col.green = col.blue = int(alpha * 0xffff); // white - xcb_rectangle_t rect = {0, 0, uint16_t(values.count()), uint16_t(MAX_TIME)}; - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, 1, &rect); - - // Then the values - col.red = col.green = col.blue = int(alpha * 0x8000); // grey - for (int i = 0; i < values.count(); i++) { - int value = values[ i ]; - if (colorize) { - if (value <= 10) { - // green - col.red = 0; - col.green = int(alpha * 0xffff); - col.blue = 0; - } else if (value <= 20) { - // yellow - col.red = int(alpha * 0xffff); - col.green = int(alpha * 0xffff); - col.blue = 0; - } else if (value <= 50) { - // red - col.red = int(alpha * 0xffff); - col.green = 0; - col.blue = 0; - } else { - // black - col.red = 0; - col.green = 0; - col.blue = 0; - } - } - xcb_rectangle_t rect = {int16_t(values.count() - i), int16_t(MAX_TIME - value), 1, uint16_t(value)}; - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, 1, &rect); - } - - // Then the lines - col.red = col.green = col.blue = 0; // black - QVector rects; - Q_FOREACH (int h, lines) { - xcb_rectangle_t rect = {0, int16_t(MAX_TIME - h), uint16_t(values.count()), 1}; - rects << rect; - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_SRC, p, col, rects.count(), rects.constData()); - - // Finally render the pixmap onto screen - xcb_render_composite(xcbConnection(), alpha != 1.0 ? XCB_RENDER_PICT_OP_OVER : XCB_RENDER_PICT_OP_SRC, p, - XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(), 0, 0, 0, 0, x, y, values.count(), MAX_TIME); - } -#endif - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { QPainter *painter = effects->scenePainter(); painter->setPen(Qt::black); // First draw the lines diff --git a/src/effects/showfps/showfps.h b/src/effects/showfps/showfps.h index ec33fd36e0..859ae726f0 100644 --- a/src/effects/showfps/showfps.h +++ b/src/effects/showfps/showfps.h @@ -71,9 +71,6 @@ public: } private: void paintGL(int fps, const QMatrix4x4 &projectionMatrix); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - void paintXrender(int fps); -#endif void paintQPainter(int fps); void paintFPSGraph(int x, int y); void paintDrawSizeGraph(int x, int y); diff --git a/src/effects/showpaint/showpaint.cpp b/src/effects/showpaint/showpaint.cpp index ad8cc5afc8..6286ca876e 100644 --- a/src/effects/showpaint/showpaint.cpp +++ b/src/effects/showpaint/showpaint.cpp @@ -11,9 +11,6 @@ #include "showpaint.h" #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#endif #include #include @@ -53,13 +50,7 @@ void ShowPaintEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintDa effects->paintScreen(mask, region, data); if (effects->isOpenGLCompositing()) { paintGL(data.projectionMatrix()); - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) { - paintXrender(); - } -#endif - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { paintQPainter(); } if (++m_colorIndex == s_colors.count()) { @@ -100,25 +91,6 @@ void ShowPaintEffect::paintGL(const QMatrix4x4 &projection) glDisable(GL_BLEND); } -void ShowPaintEffect::paintXrender() -{ -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - xcb_render_color_t col; - const QColor &color = s_colors[m_colorIndex]; - col.alpha = int(s_alpha * 0xffff); - col.red = int(s_alpha * 0xffff * color.red() / 255); - col.green = int(s_alpha * 0xffff * color.green() / 255); - col.blue = int(s_alpha * 0xffff * color.blue() / 255); - QVector rects; - rects.reserve(m_painted.rectCount()); - for (const QRect &r : m_painted) { - xcb_rectangle_t rect = {int16_t(r.x()), int16_t(r.y()), uint16_t(r.width()), uint16_t(r.height())}; - rects << rect; - } - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_OVER, effects->xrenderBufferPicture(), col, rects.count(), rects.constData()); -#endif -} - void ShowPaintEffect::paintQPainter() { QColor color = s_colors[m_colorIndex]; diff --git a/src/effects/showpaint/showpaint.h b/src/effects/showpaint/showpaint.h index eac9a0f2b7..7e88204120 100644 --- a/src/effects/showpaint/showpaint.h +++ b/src/effects/showpaint/showpaint.h @@ -32,7 +32,6 @@ private Q_SLOTS: private: void paintGL(const QMatrix4x4 &projection); - void paintXrender(); void paintQPainter(); bool m_active = false; diff --git a/src/effects/snaphelper/snaphelper.cpp b/src/effects/snaphelper/snaphelper.cpp index bf802eced5..c966c3dfff 100644 --- a/src/effects/snaphelper/snaphelper.cpp +++ b/src/effects/snaphelper/snaphelper.cpp @@ -12,11 +12,6 @@ #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#endif - #include namespace KWin @@ -161,63 +156,7 @@ void SnapHelperEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintD glDisable(GL_BLEND); glLineWidth(1.0); - } - if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - for (int i = 0; i < effects->numScreens(); ++i) { - const QRect rect = effects->clientArea(ScreenArea, i, 0); - const int midX = rect.x() + rect.width() / 2; - const int midY = rect.y() + rect.height() / 2 ; - const int halfWidth = m_geometry.width() / 2; - const int halfHeight = m_geometry.height() / 2; - - xcb_rectangle_t rects[6]; - - // Center vertical line. - rects[0].x = rect.x() + rect.width() / 2 - s_lineWidth / 2; - rects[0].y = rect.y(); - rects[0].width = s_lineWidth; - rects[0].height = rect.height(); - - // Center horizontal line. - rects[1].x = rect.x(); - rects[1].y = rect.y() + rect.height() / 2 - s_lineWidth / 2; - rects[1].width = rect.width(); - rects[1].height = s_lineWidth; - - // Top edge of the window outline. - rects[2].x = midX - halfWidth - s_lineWidth / 2; - rects[2].y = midY - halfHeight - s_lineWidth / 2; - rects[2].width = 2 * halfWidth + s_lineWidth; - rects[2].height = s_lineWidth; - - // Right edge of the window outline. - rects[3].x = midX + halfWidth - s_lineWidth / 2; - rects[3].y = midY - halfHeight + s_lineWidth / 2; - rects[3].width = s_lineWidth; - rects[3].height = 2 * halfHeight - s_lineWidth; - - // Bottom edge of the window outline. - rects[4].x = midX - halfWidth - s_lineWidth / 2; - rects[4].y = midY + halfHeight - s_lineWidth / 2; - rects[4].width = 2 * halfWidth + s_lineWidth; - rects[4].height = s_lineWidth; - - // Left edge of the window outline. - rects[5].x = midX - halfWidth - s_lineWidth / 2; - rects[5].y = midY - halfHeight + s_lineWidth / 2; - rects[5].width = s_lineWidth; - rects[5].height = 2 * halfHeight - s_lineWidth; - - QColor color = s_lineColor; - color.setAlphaF(color.alphaF() * opacityFactor); - - xcb_render_fill_rectangles(xcbConnection(), XCB_RENDER_PICT_OP_OVER, effects->xrenderBufferPicture(), - preMultiply(color), 6, rects); - } -#endif - } - if (effects->compositingType() == QPainterCompositing) { + } else if (effects->compositingType() == QPainterCompositing) { QPainter *painter = effects->scenePainter(); painter->save(); QColor color = s_lineColor; diff --git a/src/effects/touchpoints/touchpoints.cpp b/src/effects/touchpoints/touchpoints.cpp index 1673c2e192..6965e6c9e9 100644 --- a/src/effects/touchpoints/touchpoints.cpp +++ b/src/effects/touchpoints/touchpoints.cpp @@ -13,12 +13,6 @@ #include #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#include -#endif - #include #include @@ -188,9 +182,7 @@ void TouchPointsEffect::drawCircle(const QColor& color, float cx, float cy, floa { if (effects->isOpenGLCompositing()) drawCircleGl(color, cx, cy, r); - if (effects->compositingType() == XRenderCompositing) - drawCircleXr(color, cx, cy, r); - if (effects->compositingType() == QPainterCompositing) + else if (effects->compositingType() == QPainterCompositing) drawCircleQPainter(color, cx, cy, r); } @@ -235,66 +227,6 @@ void TouchPointsEffect::drawCircleGl(const QColor& color, float cx, float cy, fl vbo->render(GL_LINE_LOOP); } -void TouchPointsEffect::drawCircleXr(const QColor& color, float cx, float cy, float r) -{ -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (r <= m_lineWidth) - return; - - int num_segments = r+8; - float theta = 2.0 * 3.1415926 / num_segments; - float cos = cosf(theta); //precalculate the sine and cosine - float sin = sinf(theta); - float x[2] = {r, r-m_lineWidth}; - float y[2] = {0, 0}; - -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) - QVector strip; - strip.reserve(2*num_segments+2); - - xcb_render_pointfix_t point; - point.x = DOUBLE_TO_FIXED(x[1]+cx); - point.y = DOUBLE_TO_FIXED(y[1]+cy); - strip << point; - - for (int i = 0; i < num_segments; ++i) { - //apply the rotation matrix - const float h[2] = {x[0], x[1]}; - x[0] = cos * x[0] - sin * y[0]; - x[1] = cos * x[1] - sin * y[1]; - y[0] = sin * h[0] + cos * y[0]; - y[1] = sin * h[1] + cos * y[1]; - - point.x = DOUBLE_TO_FIXED(x[0]+cx); - point.y = DOUBLE_TO_FIXED(y[0]+cy); - strip << point; - - point.x = DOUBLE_TO_FIXED(x[1]+cx); - point.y = DOUBLE_TO_FIXED(y[1]+cy); - strip << point; - } - - const float h = x[0]; - x[0] = cos * x[0] - sin * y[0]; - y[0] = sin * h + cos * y[0]; - - point.x = DOUBLE_TO_FIXED(x[0]+cx); - point.y = DOUBLE_TO_FIXED(y[0]+cy); - strip << point; - - XRenderPicture fill = xRenderFill(color); - xcb_render_tri_strip(xcbConnection(), XCB_RENDER_PICT_OP_OVER, - fill, effects->xrenderBufferPicture(), 0, - 0, 0, strip.count(), strip.constData()); -#undef DOUBLE_TO_FIXED -#else - Q_UNUSED(color) - Q_UNUSED(cx) - Q_UNUSED(cy) - Q_UNUSED(r) -#endif -} - void TouchPointsEffect::drawCircleQPainter(const QColor &color, float cx, float cy, float r) { QPainter *painter = effects->scenePainter(); diff --git a/src/effects/touchpoints/touchpoints.h b/src/effects/touchpoints/touchpoints.h index 13117c6c99..35cc23f048 100644 --- a/src/effects/touchpoints/touchpoints.h +++ b/src/effects/touchpoints/touchpoints.h @@ -59,7 +59,6 @@ private: float computeAlpha(int time, int ring); float computeRadius(int time, bool press, int ring); void drawCircleGl(const QColor& color, float cx, float cy, float r); - void drawCircleXr(const QColor& color, float cx, float cy, float r); void drawCircleQPainter(const QColor& color, float cx, float cy, float r); void paintScreenSetupGl(int mask, QRegion region, ScreenPaintData& data); void paintScreenFinishGl(int mask, QRegion region, ScreenPaintData& data); diff --git a/src/effects/trackmouse/trackmouse.cpp b/src/effects/trackmouse/trackmouse.cpp index 496528afc4..439d415b10 100644 --- a/src/effects/trackmouse/trackmouse.cpp +++ b/src/effects/trackmouse/trackmouse.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -36,11 +35,6 @@ TrackMouseEffect::TrackMouseEffect() { initConfig(); m_texture[0] = m_texture[1] = nullptr; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - m_picture[0] = m_picture[1] = nullptr; - if ( effects->compositingType() == XRenderCompositing) - m_angleBase = 1.57079632679489661923; // Pi/2 -#endif if ( effects->isOpenGLCompositing() || effects->compositingType() == QPainterCompositing) m_angleBase = 90.0; m_mousePolling = false; @@ -64,9 +58,6 @@ TrackMouseEffect::~TrackMouseEffect() effects->stopMousePolling(); for (int i = 0; i < 2; ++i) { delete m_texture[i]; m_texture[i] = nullptr; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - delete m_picture[i]; m_picture[i] = nullptr; -#endif } } @@ -132,35 +123,7 @@ void TrackMouseEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintD m_texture[i]->unbind(); } glDisable(GL_BLEND); - } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if ( effects->compositingType() == XRenderCompositing && m_picture[0] && m_picture[1]) { - float sine = sin(m_angle); - const float cosine = cos(m_angle); - for (int i = 0; i < 2; ++i) { - if (i) sine = -sine; - const float dx = m_size[i].width()/2.0; - const float dy = m_size[i].height()/2.0; - const xcb_render_picture_t picture = *m_picture[i]; -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) - xcb_render_transform_t xform = { - DOUBLE_TO_FIXED( cosine ), DOUBLE_TO_FIXED( -sine ), DOUBLE_TO_FIXED( dx - cosine*dx + sine*dy ), - DOUBLE_TO_FIXED( sine ), DOUBLE_TO_FIXED( cosine ), DOUBLE_TO_FIXED( dy - sine*dx - cosine*dy ), - DOUBLE_TO_FIXED( 0.0 ), DOUBLE_TO_FIXED( 0.0 ), DOUBLE_TO_FIXED( 1.0 ) - }; -#undef DOUBLE_TO_FIXED - xcb_render_set_picture_transform(xcbConnection(), picture, xform); - xcb_render_set_picture_filter(xcbConnection(), picture, 8, "bilinear", 0, nullptr); - const QRect &rect = m_lastRect[i]; - xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE, - effects->xrenderBufferPicture(), 0, 0, 0, 0, - qRound((rect.x()+rect.width()/2.0)*data.xScale() - rect.width()/2.0 + data.xTranslation()), - qRound((rect.y()+rect.height()/2.0)*data.yScale() - rect.height()/2.0 + data.yTranslation()), - rect.width(), rect.height()); - } - } -#endif - if (effects->compositingType() == QPainterCompositing && !m_image[0].isNull() && !m_image[1].isNull()) { + } else if (effects->compositingType() == QPainterCompositing && !m_image[0].isNull() && !m_image[1].isNull()) { QPainter *painter = effects->scenePainter(); const QPointF p = m_lastRect[0].topLeft() + QPoint(m_lastRect[0].width()/2.0, m_lastRect[0].height()/2.0); for (int i = 0; i < 2; ++i) { @@ -183,19 +146,11 @@ void TrackMouseEffect::postPaintScreen() bool TrackMouseEffect::init() { effects->makeOpenGLContextCurrent(); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (!(m_texture[0] || m_picture[0] || !m_image[0].isNull())) { - loadTexture(); - if (!(m_texture[0] || m_picture[0] || !m_image[0].isNull())) - return false; - } -#else if (!m_texture[0] || m_image[0].isNull()) { loadTexture(); if (!m_texture[0] || m_image[0].isNull()) return false; } -#endif m_lastRect[0].moveCenter(cursorPos()); m_lastRect[1].moveCenter(cursorPos()); m_angle = 0; @@ -278,14 +233,6 @@ void TrackMouseEffect::loadTexture() m_texture[i] = new GLTexture(img); m_lastRect[i].setSize(img.size()); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if ( effects->compositingType() == XRenderCompositing) { - QImage pixmap(f[i]); - m_picture[i] = new XRenderPicture(pixmap); - m_size[i] = pixmap.size(); - m_lastRect[i].setSize(pixmap.size()); - } -#endif if (effects->compositingType() == QPainterCompositing) { m_image[i] = QImage(f[i]); m_lastRect[i].setSize(m_image[i].size()); diff --git a/src/effects/trackmouse/trackmouse.h b/src/effects/trackmouse/trackmouse.h index 386635a125..cf96456a1c 100644 --- a/src/effects/trackmouse/trackmouse.h +++ b/src/effects/trackmouse/trackmouse.h @@ -55,10 +55,6 @@ private: float m_angle; float m_angleBase; GLTexture* m_texture[2]; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - QSize m_size[2]; - XRenderPicture *m_picture[2]; -#endif QAction* m_action; QImage m_image[2]; Qt::KeyboardModifiers m_modifiers; diff --git a/src/effects/zoom/zoom.cpp b/src/effects/zoom/zoom.cpp index b0687dcfdb..3b74e970c3 100644 --- a/src/effects/zoom/zoom.cpp +++ b/src/effects/zoom/zoom.cpp @@ -26,10 +26,6 @@ #include #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#include -#endif namespace KWin { @@ -168,9 +164,6 @@ void ZoomEffect::showCursor() // show the previously hidden mouse-pointer again and free the loaded texture/picture. effects->showCursor(); texture.reset(); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - xrenderPicture.reset(); -#endif isMouseHidden = false; } } @@ -185,10 +178,6 @@ void ZoomEffect::hideCursor() bool shouldHide = false; if (effects->isOpenGLCompositing()) { shouldHide = !texture.isNull(); - } else if (effects->compositingType() == XRenderCompositing) { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - shouldHide = !xrenderPicture.isNull(); -#endif } if (shouldHide) { effects->hideCursor(); @@ -210,10 +199,6 @@ void ZoomEffect::recreateTexture() texture.reset(new GLTexture(cursor.image())); texture->setWrapMode(GL_CLAMP_TO_EDGE); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) - xrenderPicture.reset(new XRenderPicture(cursor.image())); -#endif } else { qCDebug(KWINEFFECTS) << "Falling back to proportional mouse tracking!"; @@ -365,30 +350,6 @@ void ZoomEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData& d texture->unbind(); glDisable(GL_BLEND); } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (xrenderPicture) { -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) - static const xcb_render_transform_t xrenderIdentity = { - DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - if (mousePointer == MousePointerScale) { - xcb_render_set_picture_filter(xcbConnection(), *xrenderPicture, 4, const_cast("good"), 0, nullptr); - const xcb_render_transform_t xform = { - DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - xcb_render_set_picture_transform(xcbConnection(), *xrenderPicture, xform); - } - xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, *xrenderPicture, XCB_RENDER_PICTURE_NONE, - effects->xrenderBufferPicture(), 0, 0, 0, 0, rect.x(), rect.y(), rect.width(), rect.height()); - if (mousePointer == MousePointerScale) - xcb_render_set_picture_transform(xcbConnection(), *xrenderPicture, xrenderIdentity); -#undef DOUBLE_TO_FIXED - } -#endif } } diff --git a/src/effects/zoom/zoom.h b/src/effects/zoom/zoom.h index 48263409d1..887ccd7808 100644 --- a/src/effects/zoom/zoom.h +++ b/src/effects/zoom/zoom.h @@ -25,7 +25,6 @@ class ZoomAccessibilityIntegration; #endif class GLTexture; -class XRenderPicture; class ZoomEffect : public Effect @@ -120,9 +119,6 @@ private: QTime lastMouseEvent; QTime lastFocusEvent; QScopedPointer texture; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - QScopedPointer xrenderPicture; -#endif int imageWidth; int imageHeight; bool isMouseHidden; diff --git a/src/kcmkwin/kwincompositing/compositing.ui b/src/kcmkwin/kwincompositing/compositing.ui index 398043fa00..c2c84be575 100644 --- a/src/kcmkwin/kwincompositing/compositing.ui +++ b/src/kcmkwin/kwincompositing/compositing.ui @@ -28,8 +28,7 @@ OpenGL compositing (the default) has crashed KWin in the past. This was most likely due to a driver bug. If you think that you have meanwhile upgraded to a stable driver, -you can reset this protection but be aware that this might result in an immediate crash! -Alternatively, you might want to use the XRender backend instead. +you can reset this protection but be aware that this might result in an immediate crash! true @@ -159,20 +158,6 @@ Alternatively, you might want to use the XRender backend instead. - - - - - Crisp - - - - - Smooth (slower) - - - - diff --git a/src/kcmkwin/kwincompositing/kwincompositing_setting.kcfg b/src/kcmkwin/kwincompositing/kwincompositing_setting.kcfg index 7278d09b7a..6acc02e433 100644 --- a/src/kcmkwin/kwincompositing/kwincompositing_setting.kcfg +++ b/src/kcmkwin/kwincompositing/kwincompositing_setting.kcfg @@ -26,14 +26,6 @@ 2 - - Crisp - - - - - - true @@ -56,7 +48,6 @@ OpenGL - diff --git a/src/kcmkwin/kwincompositing/main.cpp b/src/kcmkwin/kwincompositing/main.cpp index 2dec410b9e..a1cade857a 100644 --- a/src/kcmkwin/kwincompositing/main.cpp +++ b/src/kcmkwin/kwincompositing/main.cpp @@ -37,7 +37,6 @@ public: enum CompositingTypeIndex { OPENGL31_INDEX = 0, OPENGL20_INDEX, - XRENDER_INDEX }; explicit KWinCompositingKCM(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); @@ -162,7 +161,6 @@ void KWinCompositingKCM::init() // compositing type m_form.backend->addItem(i18n("OpenGL 3.1"), CompositingTypeIndex::OPENGL31_INDEX); m_form.backend->addItem(i18n("OpenGL 2.0"), CompositingTypeIndex::OPENGL20_INDEX); - m_form.backend->addItem(i18n("XRender"), CompositingTypeIndex::XRENDER_INDEX); connect(m_form.backend, currentIndexChangedSignal, this, &KWinCompositingKCM::onBackendChanged); @@ -175,8 +173,8 @@ void KWinCompositingKCM::onBackendChanged() { const int currentType = m_form.backend->currentData().toInt(); - m_form.kcfg_glTextureFilter->setVisible(currentType != CompositingTypeIndex::XRENDER_INDEX); - m_form.kcfg_XRenderSmoothScale->setVisible(currentType == CompositingTypeIndex::XRENDER_INDEX); + m_form.kcfg_glTextureFilter->setVisible(currentType == CompositingTypeIndex::OPENGL31_INDEX || + currentType == CompositingTypeIndex::OPENGL20_INDEX); updateUnmanagedItemStatus(); } @@ -193,10 +191,6 @@ void KWinCompositingKCM::updateUnmanagedItemStatus() case CompositingTypeIndex::OPENGL20_INDEX: glCore = false; break; - case CompositingTypeIndex::XRENDER_INDEX: - backend = KWinCompositingSetting::EnumBackend::XRender; - glCore = false; - break; } const auto animationDuration = s_animationMultipliers[m_form.animationDurationFactor->value()]; @@ -242,8 +236,6 @@ void KWinCompositingKCM::load() } else { m_form.backend->setCurrentIndex(CompositingTypeIndex::OPENGL20_INDEX); } - } else { - m_form.backend->setCurrentIndex(CompositingTypeIndex::XRENDER_INDEX); } m_form.backend->setDisabled(m_settings->isBackendImmutable()); @@ -273,10 +265,6 @@ void KWinCompositingKCM::save() backend = KWinCompositingSetting::EnumBackend::OpenGL; glCore = false; break; - case CompositingTypeIndex::XRENDER_INDEX: - backend = KWinCompositingSetting::EnumBackend::XRender; - glCore = false; - break; } m_settings->setBackend(backend); m_settings->setGlCore(glCore); diff --git a/src/kwin.kcfg b/src/kwin.kcfg index f3c15583f6..99b2d5f50e 100644 --- a/src/kwin.kcfg +++ b/src/kwin.kcfg @@ -231,9 +231,6 @@ false - - false - 5 4 diff --git a/src/libkwineffects/CMakeLists.txt b/src/libkwineffects/CMakeLists.txt index 436551ef0c..86266f0b7f 100644 --- a/src/libkwineffects/CMakeLists.txt +++ b/src/libkwineffects/CMakeLists.txt @@ -58,9 +58,6 @@ target_link_libraries(kwineffects KF5::Declarative kwinglutils ) -if (KWIN_HAVE_XRENDER_COMPOSITING) - target_link_libraries(kwineffects PRIVATE kwinxrenderutils XCB::XFIXES) -endif() set_target_properties(kwineffects PROPERTIES VERSION ${KWINEFFECTS_VERSION} SOVERSION ${KWINEFFECTS_SOVERSION} diff --git a/src/libkwineffects/kwinconfig.h.cmake b/src/libkwineffects/kwinconfig.h.cmake index d457649472..0f65da0bdc 100644 --- a/src/libkwineffects/kwinconfig.h.cmake +++ b/src/libkwineffects/kwinconfig.h.cmake @@ -18,9 +18,6 @@ */ -/* KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available */ -#cmakedefine KWIN_HAVE_XRENDER_COMPOSITING - #cmakedefine01 HAVE_EPOXY_GLX #cmakedefine01 HAVE_DL_LIBRARY diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index b06d689b48..31dc8cf44d 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -12,9 +12,6 @@ #include "kwineffects.h" #include "config-kwin.h" -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include "kwinxrenderutils.h" -#endif #include #include @@ -28,10 +25,6 @@ #include -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include -#endif - #if defined(__SSE2__) # include #endif @@ -1376,20 +1369,10 @@ PaintClipper::Iterator::Iterator() data->index = -1; next(); // move to the first one } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (clip() && effects->compositingType() == XRenderCompositing) { - XFixesRegion region(paintArea()); - xcb_xfixes_set_picture_clip_region(connection(), effects->xrenderBufferPicture(), region, 0, 0); - } -#endif } PaintClipper::Iterator::~Iterator() { -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (clip() && effects->compositingType() == XRenderCompositing) - xcb_xfixes_set_picture_clip_region(connection(), effects->xrenderBufferPicture(), XCB_XFIXES_REGION_NONE, 0, 0); -#endif delete data; } @@ -1399,10 +1382,6 @@ bool PaintClipper::Iterator::isDone() return data->index == 1; // run once if (effects->isOpenGLCompositing()) return data->index >= data->region.rectCount(); // run once per each area -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) - return data->index == 1; // run once -#endif abort(); } @@ -1417,10 +1396,6 @@ QRect PaintClipper::Iterator::boundingRect() const return infiniteRegion(); if (effects->isOpenGLCompositing()) return *(data->region.begin() + data->index); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (effects->compositingType() == XRenderCompositing) - return data->region.boundingRect(); -#endif abort(); return infiniteRegion(); } diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 2b7378d158..d812cc62a7 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -73,7 +73,6 @@ class EffectScreen; class Effect; class WindowQuad; class GLShader; -class XRenderPicture; class WindowQuadList; class WindowPrePaintData; class WindowPaintData; @@ -1135,7 +1134,6 @@ public: * @return bool @c true in case of OpenGL based Compositor, @c false otherwise */ bool isOpenGLCompositing() const; - virtual unsigned long xrenderBufferPicture() = 0; /** * @brief Provides access to the QPainter which is rendering to the back buffer. * diff --git a/src/libkwineffects/kwinglobals.h b/src/libkwineffects/kwinglobals.h index d61479fef1..a2b64f4320 100644 --- a/src/libkwineffects/kwinglobals.h +++ b/src/libkwineffects/kwinglobals.h @@ -37,7 +37,7 @@ enum CompositingType { * use EffectsHandler::isOpenGLCompositing(). */ OpenGLCompositing = 1, - XRenderCompositing = 1<<1, + /* XRenderCompositing = 1<<1, */ QPainterCompositing = 1<< 2, OpenGL2Compositing = 1<<3 | OpenGLCompositing, }; diff --git a/src/libkwineffects/kwinglplatform.cpp b/src/libkwineffects/kwinglplatform.cpp index 792fe15138..b733eb0b56 100644 --- a/src/libkwineffects/kwinglplatform.cpp +++ b/src/libkwineffects/kwinglplatform.cpp @@ -708,7 +708,7 @@ QByteArray GLPlatform::chipClassToString8(ChipClass chipClass) GLPlatform::GLPlatform() : m_driver(Driver_Unknown), m_chipClass(UnknownChipClass), - m_recommendedCompositor(XRenderCompositing), + m_recommendedCompositor(QPainterCompositing), m_glVersion(0), m_glslVersion(0), m_mesaVersion(0), @@ -1030,11 +1030,11 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface) } if (m_chipClass < R300) { - // fallback to XRender for R100 and R200 - m_recommendedCompositor = XRenderCompositing; + // fallback to NoCompositing for R100 and R200 + m_recommendedCompositor = NoCompositing; } else if (m_chipClass < R600) { - // XRender due to NPOT limitations not supported by KWin's shaders - m_recommendedCompositor = XRenderCompositing; + // NoCompositing due to NPOT limitations not supported by KWin's shaders + m_recommendedCompositor = NoCompositing; } else { m_recommendedCompositor = OpenGL2Compositing; } @@ -1055,7 +1055,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface) } if (m_chipClass < NV40) { - m_recommendedCompositor = XRenderCompositing; + m_recommendedCompositor = NoCompositing; } else { m_recommendedCompositor = OpenGL2Compositing; } @@ -1073,7 +1073,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface) m_looseBinding = false; if (m_chipClass < I915) { - m_recommendedCompositor = XRenderCompositing; + m_recommendedCompositor = NoCompositing; } else { m_recommendedCompositor = OpenGL2Compositing; } @@ -1092,8 +1092,8 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface) if (isSoftwareEmulation()) { if (m_driver < Driver_Llvmpipe) { - // we recommend XRender - m_recommendedCompositor = XRenderCompositing; + // we recommend QPainter + m_recommendedCompositor = QPainterCompositing; // Software emulation does not provide GLSL m_limitedGLSL = m_supportsGLSL = false; } else { diff --git a/src/options.cpp b/src/options.cpp index 32a93cec6e..877862dee4 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -59,7 +59,6 @@ Options::Options(QObject *parent) , m_useCompositing(Options::defaultUseCompositing()) , m_hiddenPreviews(Options::defaultHiddenPreviews()) , m_glSmoothScale(Options::defaultGlSmoothScale()) - , m_xrenderSmoothScale(Options::defaultXrenderSmoothScale()) , m_glStrictBinding(Options::defaultGlStrictBinding()) , m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver()) , m_glCoreProfile(Options::defaultGLCoreProfile()) @@ -563,15 +562,6 @@ void Options::setGlSmoothScale(int glSmoothScale) Q_EMIT glSmoothScaleChanged(); } -void Options::setXrenderSmoothScale(bool xrenderSmoothScale) -{ - if (m_xrenderSmoothScale == xrenderSmoothScale) { - return; - } - m_xrenderSmoothScale = xrenderSmoothScale; - Q_EMIT xrenderSmoothScaleChanged(); -} - void Options::setGlStrictBinding(bool glStrictBinding) { if (m_glStrictBinding == glStrictBinding) { @@ -821,9 +811,7 @@ bool Options::loadCompositingConfig (bool force) bool useCompositing = false; CompositingType compositingMode = NoCompositing; QString compositingBackend = config.readEntry("Backend", "OpenGL"); - if (compositingBackend == QStringLiteral("XRender")) - compositingMode = XRenderCompositing; - else if (compositingBackend == "QPainter") + if (compositingBackend == "QPainter") compositingMode = QPainterCompositing; else compositingMode = OpenGLCompositing; @@ -835,11 +823,6 @@ bool Options::loadCompositingConfig (bool force) compositingMode = OpenGLCompositing; useCompositing = true; break; - case 'X': - qCDebug(KWIN_CORE) << "Compositing forced to XRender mode by environment variable"; - compositingMode = XRenderCompositing; - useCompositing = true; - break; case 'Q': qCDebug(KWIN_CORE) << "Compositing forced to QPainter mode by environment variable"; compositingMode = QPainterCompositing; @@ -899,8 +882,6 @@ void Options::reloadCompositingSettings(bool force) c = Options::defaultGlPreferBufferSwap(); setGlPreferBufferSwap(c); - m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false); - HiddenPreviews previews = Options::defaultHiddenPreviews(); // 4 - off, 5 - shown, 6 - always, other are old values int hps = config.readEntry("HiddenPreviews", 5); diff --git a/src/options.h b/src/options.h index ee47210535..c3bd7100f9 100644 --- a/src/options.h +++ b/src/options.h @@ -185,7 +185,6 @@ class KWIN_EXPORT Options : public QObject * -1 = auto */ Q_PROPERTY(int glSmoothScale READ glSmoothScale WRITE setGlSmoothScale NOTIFY glSmoothScaleChanged) - Q_PROPERTY(bool xrenderSmoothScale READ isXrenderSmoothScale WRITE setXrenderSmoothScale NOTIFY xrenderSmoothScaleChanged) Q_PROPERTY(bool glStrictBinding READ isGlStrictBinding WRITE setGlStrictBinding NOTIFY glStrictBindingChanged) /** * Whether strict binding follows the driver or has been overwritten by a user defined config value. @@ -571,10 +570,6 @@ public: int glSmoothScale() const { return m_glSmoothScale; } - // XRender - bool isXrenderSmoothScale() const { - return m_xrenderSmoothScale; - } // Settings that should be auto-detected bool isGlStrictBinding() const { @@ -663,7 +658,6 @@ public: void setUseCompositing(bool useCompositing); void setHiddenPreviews(int hiddenPreviews); void setGlSmoothScale(int glSmoothScale); - void setXrenderSmoothScale(bool xrenderSmoothScale); void setGlStrictBinding(bool glStrictBinding); void setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver); void setGLCoreProfile(bool glCoreProfile); @@ -747,9 +741,6 @@ public: static int defaultGlSmoothScale() { return 2; } - static bool defaultXrenderSmoothScale() { - return false; - } static bool defaultGlStrictBinding() { return true; } @@ -839,7 +830,6 @@ Q_SIGNALS: void useCompositingChanged(); void hiddenPreviewsChanged(); void glSmoothScaleChanged(); - void xrenderSmoothScaleChanged(); void glStrictBindingChanged(); void glStrictBindingFollowsDriverChanged(); void glCoreProfileChanged(); @@ -884,7 +874,6 @@ private: bool m_useCompositing; HiddenPreviews m_hiddenPreviews; int m_glSmoothScale; - bool m_xrenderSmoothScale; // Settings that should be auto-detected bool m_glStrictBinding; bool m_glStrictBindingFollowsDriver; diff --git a/src/platform.cpp b/src/platform.cpp index ecb41534bf..2368cc9081 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -84,13 +84,6 @@ QPainterBackend *Platform::createQPainterBackend() return nullptr; } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -XRenderBackend *Platform::createXRenderBackend() -{ - return nullptr; -} -#endif - Edge *Platform::createScreenEdge(ScreenEdges *edges) { return new Edge(edges); diff --git a/src/platform.h b/src/platform.h index 50a68670d9..413572bb28 100644 --- a/src/platform.h +++ b/src/platform.h @@ -41,9 +41,6 @@ class Scene; class ScreenEdges; class Session; class Toplevel; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -class XRenderBackend; -#endif class KWIN_EXPORT Outputs : public QVector { @@ -66,9 +63,6 @@ public: virtual bool initialize() = 0; virtual OpenGLBackend *createOpenGLBackend(); virtual QPainterBackend *createQPainterBackend(); -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - virtual XRenderBackend *createXRenderBackend(); -#endif virtual DmaBufTexture *createDmaBufTexture(const QSize &size) { Q_UNUSED(size); return nullptr; diff --git a/src/platformsupport/scenes/CMakeLists.txt b/src/platformsupport/scenes/CMakeLists.txt index 50a2aac8ca..6e560cbcda 100644 --- a/src/platformsupport/scenes/CMakeLists.txt +++ b/src/platformsupport/scenes/CMakeLists.txt @@ -1,5 +1,2 @@ add_subdirectory(qpainter) add_subdirectory(opengl) -if (KWIN_BUILD_XRENDER_COMPOSITING) - add_subdirectory(xrender) -endif() diff --git a/src/platformsupport/scenes/xrender/CMakeLists.txt b/src/platformsupport/scenes/xrender/CMakeLists.txt deleted file mode 100644 index 41f737bd5c..0000000000 --- a/src/platformsupport/scenes/xrender/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(xrenderbackend_SOURCES - platformxrendersurfacetexture_x11.cpp - xrenderbackend.cpp -) - -ecm_qt_declare_logging_category(xrenderbackend_SOURCES - HEADER logging.h - IDENTIFIER KWIN_XRENDER - CATEGORY_NAME kwin_scene_xrender - DEFAULT_SEVERITY Critical -) - -add_library(SceneXRenderBackend STATIC ${xrenderbackend_SOURCES}) -target_link_libraries(SceneXRenderBackend kwin Qt::Core Qt::Gui) -target_include_directories(SceneXRenderBackend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.cpp b/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.cpp deleted file mode 100644 index 85496c0d4d..0000000000 --- a/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - SPDX-FileCopyrightText: 2021 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "platformxrendersurfacetexture_x11.h" -#include "main.h" -#include "surfaceitem_x11.h" - -#include - -namespace KWin -{ - -PlatformXrenderSurfaceTextureX11::PlatformXrenderSurfaceTextureX11(SurfacePixmapX11 *pixmap) - : m_pixmap(pixmap) -{ -} - -PlatformXrenderSurfaceTextureX11::~PlatformXrenderSurfaceTextureX11() -{ - if (m_picture != XCB_RENDER_PICTURE_NONE) { - xcb_render_free_picture(kwinApp()->x11Connection(), m_picture); - } -} - -bool PlatformXrenderSurfaceTextureX11::isValid() const -{ - return m_picture != XCB_RENDER_PICTURE_NONE; -} - -xcb_render_picture_t PlatformXrenderSurfaceTextureX11::picture() const -{ - return m_picture; -} - -bool PlatformXrenderSurfaceTextureX11::create() -{ - if (m_picture != XCB_RENDER_PICTURE_NONE) { - return true; - } - - const xcb_pixmap_t pixmap = m_pixmap->pixmap(); - if (pixmap == XCB_PIXMAP_NONE) { - return false; - } - - xcb_render_pictformat_t format = XRenderUtils::findPictFormat(m_pixmap->visual()); - if (format == XCB_NONE) { - return false; - } - - m_picture = xcb_generate_id(kwinApp()->x11Connection()); - xcb_render_create_picture(kwinApp()->x11Connection(), m_picture, pixmap, format, 0, nullptr); - return true; -} - -} // namespace KWin diff --git a/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.h b/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.h deleted file mode 100644 index ced97a4d01..0000000000 --- a/src/platformsupport/scenes/xrender/platformxrendersurfacetexture_x11.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - SPDX-FileCopyrightText: 2021 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include "surfaceitem_x11.h" - -#include - -namespace KWin -{ - -class KWIN_EXPORT PlatformXrenderSurfaceTextureX11 : public PlatformSurfaceTexture -{ -public: - explicit PlatformXrenderSurfaceTextureX11(SurfacePixmapX11 *pixmap); - ~PlatformXrenderSurfaceTextureX11() override; - - bool isValid() const override; - - bool create(); - xcb_render_picture_t picture() const; - -private: - SurfacePixmapX11 *m_pixmap; - xcb_render_picture_t m_picture = XCB_RENDER_PICTURE_NONE; -}; - -} // namespace KWin diff --git a/src/platformsupport/scenes/xrender/xrenderbackend.cpp b/src/platformsupport/scenes/xrender/xrenderbackend.cpp deleted file mode 100644 index b9042f3e93..0000000000 --- a/src/platformsupport/scenes/xrender/xrenderbackend.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - SPDX-FileCopyrightText: 2009 Fredrik Höglund - SPDX-FileCopyrightText: 2013 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "xrenderbackend.h" -#include "logging.h" -#include "xcbutils.h" - -namespace KWin -{ - -XRenderBackend::XRenderBackend() - : m_buffer(XCB_RENDER_PICTURE_NONE) - , m_failed(false) -{ - if (!Xcb::Extensions::self()->isRenderAvailable()) { - setFailed("No XRender extension available"); - return; - } - if (!Xcb::Extensions::self()->isFixesRegionAvailable()) { - setFailed("No XFixes v3+ extension available"); - return; - } -} - -XRenderBackend::~XRenderBackend() -{ - if (m_buffer) { - xcb_render_free_picture(connection(), m_buffer); - } -} - -OverlayWindow *XRenderBackend::overlayWindow() -{ - return nullptr; -} - -void XRenderBackend::showOverlay() -{ -} - -xcb_render_picture_t XRenderBackend::buffer() const -{ - return m_buffer; -} - -void XRenderBackend::setBuffer(xcb_render_picture_t buffer) -{ - if (m_buffer != XCB_RENDER_PICTURE_NONE) { - xcb_render_free_picture(connection(), m_buffer); - } - m_buffer = buffer; -} - -bool XRenderBackend::isFailed() const -{ - return m_failed; -} - -void XRenderBackend::setFailed(const QString &reason) -{ - qCCritical(KWIN_XRENDER) << "Creating the XRender backend failed: " << reason; - m_failed = true; -} - -void XRenderBackend::screenGeometryChanged(const QSize &size) -{ - Q_UNUSED(size) -} - -} // namespace KWin diff --git a/src/platformsupport/scenes/xrender/xrenderbackend.h b/src/platformsupport/scenes/xrender/xrenderbackend.h deleted file mode 100644 index 6bfaae1503..0000000000 --- a/src/platformsupport/scenes/xrender/xrenderbackend.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include -#include - -#include - -namespace KWin -{ - -class OverlayWindow; - -/** - * @brief Backend for the SceneXRender to hold the compositing buffer and take care of buffer - * swapping. - * - * This class is intended as a small abstraction to support multiple compositing backends in the - * SceneXRender. - */ -class XRenderBackend -{ -public: - virtual ~XRenderBackend(); - virtual void present(int mask, const QRegion &damage) = 0; - - /** - * @brief Returns the OverlayWindow used by the backend. - * - * A backend does not have to use an OverlayWindow, this is mostly for the X world. - * In case the backend does not use an OverlayWindow it is allowed to return @c null. - * It's the task of the caller to check whether it is @c null. - * - * @return :OverlayWindow* - */ - virtual OverlayWindow *overlayWindow(); - /** - * @brief Shows the Overlay Window - * - * Default implementation does nothing. - */ - virtual void showOverlay(); - /** - * @brief React on screen geometry changes. - * - * Default implementation does nothing. Override if specific functionality is required. - * - * @param size The new screen size - */ - virtual void screenGeometryChanged(const QSize &size); - /** - * @brief The compositing buffer hold by this backend. - * - * The Scene composites the new frame into this buffer. - * - * @return xcb_render_picture_t - */ - xcb_render_picture_t buffer() const; - /** - * @brief Whether the creation of the Backend failed. - * - * The SceneXRender should test whether the Backend got constructed correctly. If this method - * returns @c true, the SceneXRender should not try to start the rendering. - * - * @return bool @c true if the creation of the Backend failed, @c false otherwise. - */ - bool isFailed() const; - -protected: - XRenderBackend(); - /** - * @brief A subclass needs to call this method once it created the compositing back buffer. - * - * @param buffer The buffer to use for compositing - * @return void - */ - void setBuffer(xcb_render_picture_t buffer); - /** - * @brief Sets the backend initialization to failed. - * - * This method should be called by the concrete subclass in case the initialization failed. - * The given @p reason is logged as a warning. - * - * @param reason The reason why the initialization failed. - */ - void setFailed(const QString &reason); - -private: - // Create the compositing buffer. The root window is not double-buffered, - // so it is done manually using this buffer, - xcb_render_picture_t m_buffer; - bool m_failed; -}; - -} // namespace KWin diff --git a/src/plugins/platforms/x11/standalone/CMakeLists.txt b/src/plugins/platforms/x11/standalone/CMakeLists.txt index 38b16fec68..fc17a5374d 100644 --- a/src/plugins/platforms/x11/standalone/CMakeLists.txt +++ b/src/plugins/platforms/x11/standalone/CMakeLists.txt @@ -33,11 +33,6 @@ if (HAVE_EPOXY_GLX) ) endif() -if (KWIN_BUILD_XRENDER_COMPOSITING) - target_sources(KWinX11Platform PRIVATE x11xrenderbackend.cpp) - target_link_libraries(KWinX11Platform SceneXRenderBackend) -endif() - if (HAVE_DL_LIBRARY) target_link_libraries(KWinX11Platform ${DL_LIBRARY}) endif() diff --git a/src/plugins/platforms/x11/standalone/x11_platform.cpp b/src/plugins/platforms/x11/standalone/x11_platform.cpp index c661191969..73ff872ab1 100644 --- a/src/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/src/plugins/platforms/x11/standalone/x11_platform.cpp @@ -12,9 +12,6 @@ #include "edge.h" #include "session.h" #include "windowselector.h" -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -#include "x11xrenderbackend.h" -#endif #include #include #if HAVE_EPOXY_GLX @@ -174,13 +171,6 @@ OpenGLBackend *X11StandalonePlatform::createOpenGLBackend() } } -#ifdef KWIN_HAVE_XRENDER_COMPOSITING -XRenderBackend *X11StandalonePlatform::createXRenderBackend() -{ - return new X11XRenderBackend(this); -} -#endif - Edge *X11StandalonePlatform::createScreenEdge(ScreenEdges *edges) { if (m_screenEdgesFilter.isNull()) { @@ -224,21 +214,14 @@ QString X11StandalonePlatform::compositingNotPossibleReason() const return i18n("OpenGL compositing (the default) has crashed KWin in the past.
" "This was most likely due to a driver bug." "

If you think that you have meanwhile upgraded to a stable driver,
" - "you can reset this protection but be aware that this might result in an immediate crash!

" - "

Alternatively, you might want to use the XRender backend instead.

"); + "you can reset this protection but be aware that this might result in an immediate crash!

"); if (!Xcb::Extensions::self()->isCompositeAvailable() || !Xcb::Extensions::self()->isDamageAvailable()) { return i18n("Required X extensions (XComposite and XDamage) are not available."); } -#if !defined( KWIN_HAVE_XRENDER_COMPOSITING ) - if (!hasGlx()) - return i18n("GLX/OpenGL are not available and only OpenGL support is compiled."); -#else - if (!(hasGlx() - || (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()))) { - return i18n("GLX/OpenGL and XRender/XFixes are not available."); + if (!hasGlx()) { + return i18n("GLX/OpenGL is not available."); } -#endif return QString(); } @@ -262,16 +245,12 @@ bool X11StandalonePlatform::compositingPossible() const } if (hasGlx()) return true; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - if (Xcb::Extensions::self()->isRenderAvailable() && Xcb::Extensions::self()->isFixesAvailable()) - return true; -#endif if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { return true; } else if (qstrcmp(qgetenv("KWIN_COMPOSE"), "O2ES") == 0) { return true; } - qCDebug(KWIN_X11STANDALONE) << "No OpenGL or XRender/XFixes support"; + qCDebug(KWIN_X11STANDALONE) << "No OpenGL support"; return false; } @@ -457,9 +436,6 @@ QVector X11StandalonePlatform::supportedCompositors() const QVector compositors; #if HAVE_EPOXY_GLX compositors << OpenGLCompositing; -#endif -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - compositors << XRenderCompositing; #endif compositors << NoCompositing; return compositors; diff --git a/src/plugins/platforms/x11/standalone/x11_platform.h b/src/plugins/platforms/x11/standalone/x11_platform.h index 541eddd8f8..9e8bf92d52 100644 --- a/src/plugins/platforms/x11/standalone/x11_platform.h +++ b/src/plugins/platforms/x11/standalone/x11_platform.h @@ -38,9 +38,6 @@ public: Session *session() const override; OpenGLBackend *createOpenGLBackend() override; -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - XRenderBackend *createXRenderBackend() override; -#endif Edge *createScreenEdge(ScreenEdges *parent) override; void createPlatformCursor(QObject *parent = nullptr) override; bool requiresCompositing() const override; diff --git a/src/plugins/platforms/x11/standalone/x11xrenderbackend.cpp b/src/plugins/platforms/x11/standalone/x11xrenderbackend.cpp deleted file mode 100644 index 0e5194ee55..0000000000 --- a/src/plugins/platforms/x11/standalone/x11xrenderbackend.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - SPDX-FileCopyrightText: 2009 Fredrik Höglund - SPDX-FileCopyrightText: 2013 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "x11xrenderbackend.h" -#include "main.h" -#include "platform.h" -#include "overlaywindow.h" -#include "renderloop_p.h" -#include "scene.h" -#include "screens.h" -#include "softwarevsyncmonitor.h" -#include "utils.h" -#include "x11_platform.h" - -#include "kwinxrenderutils.h" - -namespace KWin -{ - -X11XRenderBackend::X11XRenderBackend(X11StandalonePlatform *backend) - : XRenderBackend() - , m_backend(backend) - , m_overlayWindow(backend->createOverlayWindow()) - , m_front(XCB_RENDER_PICTURE_NONE) - , m_format(0) -{ - // Fallback to software vblank events for now. Maybe use the Present extension or - // something to get notified when the overlay window is actually presented? - m_vsyncMonitor = SoftwareVsyncMonitor::create(this); - connect(backend->renderLoop(), &RenderLoop::refreshRateChanged, this, [this, backend]() { - m_vsyncMonitor->setRefreshRate(backend->renderLoop()->refreshRate()); - }); - m_vsyncMonitor->setRefreshRate(backend->renderLoop()->refreshRate()); - - connect(m_vsyncMonitor, &VsyncMonitor::vblankOccurred, this, &X11XRenderBackend::vblank); - - init(true); -} - -X11XRenderBackend::~X11XRenderBackend() -{ - // No completion events will be received for in-flight frames, this may lock the - // render loop. We need to ensure that the render loop is back to its initial state - // if the render backend is about to be destroyed. - RenderLoopPrivate::get(kwinApp()->platform()->renderLoop())->invalidate(); - - if (m_front) { - xcb_render_free_picture(connection(), m_front); - } - m_overlayWindow->destroy(); -} - -OverlayWindow *X11XRenderBackend::overlayWindow() -{ - return m_overlayWindow.data(); -} - -void X11XRenderBackend::showOverlay() -{ - if (m_overlayWindow->window()) { // show the window only after the first pass, since - m_overlayWindow->show(); // that pass may take long - } -} - -void X11XRenderBackend::init(bool createOverlay) -{ - if (m_front != XCB_RENDER_PICTURE_NONE) - xcb_render_free_picture(connection(), m_front); - bool haveOverlay = createOverlay ? m_overlayWindow->create() : (m_overlayWindow->window() != XCB_WINDOW_NONE); - if (haveOverlay) { - m_overlayWindow->setup(XCB_WINDOW_NONE); - ScopedCPointer attribs(xcb_get_window_attributes_reply(connection(), - xcb_get_window_attributes_unchecked(connection(), m_overlayWindow->window()), nullptr)); - if (!attribs) { - setFailed("Failed getting window attributes for overlay window"); - return; - } - m_format = XRenderUtils::findPictFormat(attribs->visual); - if (m_format == 0) { - setFailed("Failed to find XRender format for overlay window"); - return; - } - m_front = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), m_front, m_overlayWindow->window(), m_format, 0, nullptr); - } else { - // create XRender picture for the root window - m_format = XRenderUtils::findPictFormat(kwinApp()->x11DefaultScreen()->root_visual); - if (m_format == 0) { - setFailed("Failed to find XRender format for root window"); - return; // error - } - m_front = xcb_generate_id(connection()); - const uint32_t values[] = {XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS}; - xcb_render_create_picture(connection(), m_front, rootWindow(), m_format, XCB_RENDER_CP_SUBWINDOW_MODE, values); - } - createBuffer(); -} - -void X11XRenderBackend::createBuffer() -{ - xcb_pixmap_t pixmap = xcb_generate_id(connection()); - const auto displaySize = screens()->displaySize(); - xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displaySize.width(), displaySize.height()); - xcb_render_picture_t b = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), b, pixmap, m_format, 0, nullptr); - xcb_free_pixmap(connection(), pixmap); // The picture owns the pixmap now - setBuffer(b); -} - -void X11XRenderBackend::present(int mask, const QRegion &damage) -{ - m_vsyncMonitor->arm(); - - const auto displaySize = screens()->displaySize(); - if (mask & Scene::PAINT_SCREEN_REGION) { - // Use the damage region as the clip region for the root window - XFixesRegion frontRegion(damage); - xcb_xfixes_set_picture_clip_region(connection(), m_front, frontRegion, 0, 0); - // copy composed buffer to the root window - xcb_xfixes_set_picture_clip_region(connection(), buffer(), XCB_XFIXES_REGION_NONE, 0, 0); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, - m_front, 0, 0, 0, 0, 0, 0, displaySize.width(), displaySize.height()); - xcb_xfixes_set_picture_clip_region(connection(), m_front, XCB_XFIXES_REGION_NONE, 0, 0); - } else { - // copy composed buffer to the root window - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_SRC, buffer(), XCB_RENDER_PICTURE_NONE, - m_front, 0, 0, 0, 0, 0, 0, displaySize.width(), displaySize.height()); - } - - xcb_flush(connection()); -} - -void X11XRenderBackend::vblank(std::chrono::nanoseconds timestamp) -{ - RenderLoopPrivate *renderLoopPrivate = RenderLoopPrivate::get(m_backend->renderLoop()); - renderLoopPrivate->notifyFrameCompleted(timestamp); -} - -void X11XRenderBackend::screenGeometryChanged(const QSize &size) -{ - Q_UNUSED(size) - init(false); -} - -} // namespace KWin diff --git a/src/plugins/platforms/x11/standalone/x11xrenderbackend.h b/src/plugins/platforms/x11/standalone/x11xrenderbackend.h deleted file mode 100644 index 432ee89e93..0000000000 --- a/src/plugins/platforms/x11/standalone/x11xrenderbackend.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include "xrenderbackend.h" - -namespace KWin -{ - -class SoftwareVsyncMonitor; -class X11StandalonePlatform; - -/** - * @brief XRenderBackend using an X11 Overlay Window as compositing target. - */ -class X11XRenderBackend : public QObject, public XRenderBackend -{ - Q_OBJECT - -public: - explicit X11XRenderBackend(X11StandalonePlatform *backend); - ~X11XRenderBackend() override; - - void present(int mask, const QRegion &damage) override; - OverlayWindow *overlayWindow() override; - void showOverlay() override; - void screenGeometryChanged(const QSize &size) override; - -private: - void init(bool createOverlay); - void createBuffer(); - void vblank(std::chrono::nanoseconds timestamp); - - X11StandalonePlatform *m_backend; - SoftwareVsyncMonitor *m_vsyncMonitor; - QScopedPointer m_overlayWindow; - xcb_render_picture_t m_front; - xcb_render_pictformat_t m_format; -}; - -} // namespace KWin diff --git a/src/plugins/scenes/CMakeLists.txt b/src/plugins/scenes/CMakeLists.txt index 5c55688e87..1a52054539 100644 --- a/src/plugins/scenes/CMakeLists.txt +++ b/src/plugins/scenes/CMakeLists.txt @@ -1,5 +1,2 @@ add_subdirectory(opengl) add_subdirectory(qpainter) -if (KWIN_BUILD_XRENDER_COMPOSITING) - add_subdirectory(xrender) -endif() diff --git a/src/plugins/scenes/opengl/scene_opengl.cpp b/src/plugins/scenes/opengl/scene_opengl.cpp index dce9458b11..11173ae13c 100644 --- a/src/plugins/scenes/opengl/scene_opengl.cpp +++ b/src/plugins/scenes/opengl/scene_opengl.cpp @@ -466,8 +466,8 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent) } } if (!scene) { - if (GLPlatform::instance()->recommendedCompositor() == XRenderCompositing) { - qCCritical(KWIN_OPENGL) << "OpenGL driver recommends XRender based compositing. Falling back to XRender."; + if (GLPlatform::instance()->recommendedCompositor() == QPainterCompositing) { + qCCritical(KWIN_OPENGL) << "OpenGL driver recommends QPainter based compositing. Falling back to QPainter."; qCCritical(KWIN_OPENGL) << "To overwrite the detection use the environment variable KWIN_COMPOSE"; qCCritical(KWIN_OPENGL) << "For more information see https://community.kde.org/KWin/Environment_Variables#KWIN_COMPOSE"; } diff --git a/src/plugins/scenes/xrender/CMakeLists.txt b/src/plugins/scenes/xrender/CMakeLists.txt deleted file mode 100644 index 15a4439228..0000000000 --- a/src/plugins/scenes/xrender/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -set(SCENE_XRENDER_SRCS scene_xrender.cpp) - -include(ECMQtDeclareLoggingCategory) -ecm_qt_declare_logging_category( - SCENE_XRENDER_SRCS HEADER - logging.h - IDENTIFIER - KWIN_XRENDER - CATEGORY_NAME - kwin_scene_xrender - DEFAULT_SEVERITY - Critical -) - -add_library(KWinSceneXRender MODULE ${SCENE_XRENDER_SRCS}) -set_target_properties(KWinSceneXRender PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.scenes/") -target_link_libraries(KWinSceneXRender kwin kwinxrenderutils SceneXRenderBackend) - -install( - TARGETS - KWinSceneXRender - DESTINATION - ${KDE_INSTALL_PLUGINDIR}/org.kde.kwin.scenes/ -) diff --git a/src/plugins/scenes/xrender/scene_xrender.cpp b/src/plugins/scenes/xrender/scene_xrender.cpp deleted file mode 100644 index 7d27f34090..0000000000 --- a/src/plugins/scenes/xrender/scene_xrender.cpp +++ /dev/null @@ -1,1150 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - SPDX-FileCopyrightText: 2009 Fredrik Höglund - SPDX-FileCopyrightText: 2013 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "scene_xrender.h" -#include "platformxrendersurfacetexture_x11.h" -#include "utils.h" -#include "xrenderbackend.h" - -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - -#include "logging.h" -#include "toplevel.h" -#include "x11client.h" -#include "composite.h" -#include "deleted.h" -#include "effects.h" -#include "main.h" -#include "overlaywindow.h" -#include "platform.h" -#include "renderloop.h" -#include "screens.h" -#include "shadowitem.h" -#include "surfaceitem_x11.h" -#include "windowitem.h" -#include "xcbutils.h" -#include "decorations/decoratedclient.h" - -#include -#include - -#include - -#include -#include -#include - -namespace KWin -{ - -ScreenPaintData SceneXrender::screen_paint; - -#define DOUBLE_TO_FIXED(d) ((xcb_render_fixed_t) ((d) * 65536)) -#define FIXED_TO_DOUBLE(f) ((double) ((f) / 65536.0)) - -//**************************************** -// SceneXrender -//**************************************** - -SceneXrender* SceneXrender::createScene(QObject *parent) -{ - QScopedPointer backend(kwinApp()->platform()->createXRenderBackend()); - if (!backend || backend->isFailed()) { - return nullptr; - } - return new SceneXrender(backend.take(), parent); -} - -SceneXrender::SceneXrender(XRenderBackend *backend, QObject *parent) - : Scene(parent) - , m_backend(backend) -{ -} - -SceneXrender::~SceneXrender() -{ - SceneXrender::Window::cleanup(); - SceneXrender::EffectFrame::cleanup(); -} - -bool SceneXrender::initFailed() const -{ - return false; -} - -// the entry point for painting -void SceneXrender::paint(int screenId, const QRegion &damage, const QList &toplevels, - RenderLoop *renderLoop) -{ - painted_screen = screenId; - - createStackingOrder(toplevels); - - int mask = 0; - QRegion updateRegion, validRegion; - renderLoop->beginFrame(); - paintScreen(&mask, damage, QRegion(), &updateRegion, &validRegion, renderLoop); - renderLoop->endFrame(); - - m_backend->showOverlay(); - - m_backend->present(mask, updateRegion); - // do cleanup - clearStackingOrder(); -} - -void SceneXrender::paintGenericScreen(int mask, const ScreenPaintData &data) -{ - screen_paint = data; // save, transformations will be done when painting windows - Scene::paintGenericScreen(mask, data); -} - -void SceneXrender::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) -{ - PaintClipper::push(region); - KWin::Scene::paintDesktop(desktop, mask, region, data); - PaintClipper::pop(region); -} - -// fill the screen background -void SceneXrender::paintBackground(const QRegion ®ion) -{ - xcb_render_color_t col = { 0, 0, 0, 0xffff }; // black - const QVector &rects = Xcb::regionToRects(region); - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, xrenderBufferPicture(), col, rects.count(), rects.data()); -} - -Scene::Window *SceneXrender::createWindow(Toplevel *toplevel) -{ - return new Window(toplevel, this); -} - -Scene::EffectFrame *SceneXrender::createEffectFrame(EffectFrameImpl *frame) -{ - return new SceneXrender::EffectFrame(frame); -} - -Shadow *SceneXrender::createShadow(Toplevel *toplevel) -{ - return new SceneXRenderShadow(toplevel); -} - -DecorationRenderer *SceneXrender::createDecorationRenderer(Decoration::DecoratedClientImpl *client) -{ - return new SceneXRenderDecorationRenderer(client); -} - -PlatformSurfaceTexture *SceneXrender::createPlatformSurfaceTextureX11(SurfacePixmapX11 *pixmap) -{ - return new PlatformXrenderSurfaceTextureX11(pixmap); -} - -//**************************************** -// SceneXrender::Window -//**************************************** - -XRenderPicture *SceneXrender::Window::s_tempPicture = nullptr; -QRect SceneXrender::Window::temp_visibleRect; -XRenderPicture *SceneXrender::Window::s_fadeAlphaPicture = nullptr; - -SceneXrender::Window::Window(Toplevel* c, SceneXrender *scene) - : Scene::Window(c) - , m_scene(scene) -{ -} - -SceneXrender::Window::~Window() -{ -} - -void SceneXrender::Window::cleanup() -{ - delete s_tempPicture; - s_tempPicture = nullptr; - delete s_fadeAlphaPicture; - s_fadeAlphaPicture = nullptr; -} - -// Maps window coordinates to screen coordinates -QRect SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data, const QRect &rect) const -{ - QRect r = rect; - - if (mask & PAINT_WINDOW_TRANSFORMED) { - // Apply the window transformation - r.moveTo(r.x() * data.xScale() + data.xTranslation(), - r.y() * data.yScale() + data.yTranslation()); - r.setWidth(r.width() * data.xScale()); - r.setHeight(r.height() * data.yScale()); - } - - // Move the rectangle to the screen position - r.translate(x(), y()); - - if (mask & PAINT_SCREEN_TRANSFORMED) { - // Apply the screen transformation - r.moveTo(r.x() * screen_paint.xScale() + screen_paint.xTranslation(), - r.y() * screen_paint.yScale() + screen_paint.yTranslation()); - r.setWidth(r.width() * screen_paint.xScale()); - r.setHeight(r.height() * screen_paint.yScale()); - } - - return r; -} - -// Maps window coordinates to screen coordinates -QPoint SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data, const QPoint &point) const -{ - QPoint pt = point; - - if (mask & PAINT_WINDOW_TRANSFORMED) { - // Apply the window transformation - pt.rx() = pt.x() * data.xScale() + data.xTranslation(); - pt.ry() = pt.y() * data.yScale() + data.yTranslation(); - } - - // Move the point to the screen position - pt += QPoint(x(), y()); - - if (mask & PAINT_SCREEN_TRANSFORMED) { - // Apply the screen transformation - pt.rx() = pt.x() * screen_paint.xScale() + screen_paint.xTranslation(); - pt.ry() = pt.y() * screen_paint.yScale() + screen_paint.yTranslation(); - } - - return pt; -} - -QRect SceneXrender::Window::bufferToWindowRect(const QRect &rect) const -{ - return rect.translated(surfaceItem()->position()); -} - -QRegion SceneXrender::Window::bufferToWindowRegion(const QRegion ®ion) const -{ - return region.translated(surfaceItem()->position()); -} - -void SceneXrender::Window::prepareTempPixmap() -{ - const QSize oldSize = temp_visibleRect.size(); - temp_visibleRect = toplevel->visibleGeometry().translated(-toplevel->pos()); - if (s_tempPicture && (oldSize.width() < temp_visibleRect.width() || oldSize.height() < temp_visibleRect.height())) { - delete s_tempPicture; - s_tempPicture = nullptr; - scene_setXRenderOffscreenTarget(0); // invalidate, better crash than cause weird results for developers - } - if (!s_tempPicture) { - xcb_pixmap_t pix = xcb_generate_id(connection()); - xcb_create_pixmap(connection(), 32, pix, rootWindow(), temp_visibleRect.width(), temp_visibleRect.height()); - s_tempPicture = new XRenderPicture(pix, 32); - xcb_free_pixmap(connection(), pix); - } - const xcb_render_color_t transparent = {0, 0, 0, 0}; - const xcb_rectangle_t rect = {0, 0, uint16_t(temp_visibleRect.width()), uint16_t(temp_visibleRect.height())}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_tempPicture, transparent, 1, &rect); -} - -// paint the window -void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const WindowPaintData &data) -{ - QRegion region = _region; - setTransformedShape(QRegion()); // maybe nothing will be painted - // check if there is something to paint - bool opaque = isOpaque() && qFuzzyCompare(data.opacity(), 1.0); - /* HACK: It seems this causes painting glitches, disable temporarily - if (( mask & PAINT_WINDOW_OPAQUE ) ^ ( mask & PAINT_WINDOW_TRANSLUCENT )) - { // We are only painting either opaque OR translucent windows, not both - if ( mask & PAINT_WINDOW_OPAQUE && !opaque ) - return; // Only painting opaque and window is translucent - if ( mask & PAINT_WINDOW_TRANSLUCENT && opaque ) - return; // Only painting translucent and window is opaque - }*/ - // Intersect the clip region with the rectangle the window occupies on the screen - if (!(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED))) - region &= toplevel->visibleGeometry(); - - if (region.isEmpty()) - return; - SurfacePixmap *surfaceTexture = surfaceItem()->pixmap(); - if (!surfaceTexture || !surfaceTexture->isValid()) { - return; - } - PlatformXrenderSurfaceTextureX11 *platformSurfaceTexture = - static_cast(surfaceTexture->platformTexture()); - if (platformSurfaceTexture->picture() == XCB_RENDER_PICTURE_NONE) { - if (!platformSurfaceTexture->create()) { - qCWarning(KWIN_XRENDER, "Failed to create platform surface texture for window 0x%x", - window()->frameId()); - return; - } - } - xcb_render_picture_t pic = platformSurfaceTexture->picture(); - if (pic == XCB_RENDER_PICTURE_NONE) // The render format can be null for GL and/or Xv visuals - return; - surfaceItem()->resetDamage(); - // set picture filter - if (options->isXrenderSmoothScale()) { // only when forced, it's slow - if (mask & PAINT_WINDOW_TRANSFORMED) - filter = ImageFilterGood; - else if (mask & PAINT_SCREEN_TRANSFORMED) - filter = ImageFilterGood; - else - filter = ImageFilterFast; - } else - filter = ImageFilterFast; - // do required transformations - const QRect wr = mapToScreen(mask, data, QRect(0, 0, width(), height())); - QRect cr = QRect(toplevel->clientPos(), toplevel->clientSize()); // Content rect (in the buffer) - qreal xscale = 1; - qreal yscale = 1; - bool scaled = false; - - X11Client *client = dynamic_cast(toplevel); - Deleted *deleted = dynamic_cast(toplevel); - const QRect decorationRect = toplevel->rect(); - const DecorationItem *decorationItem = windowItem()->decorationItem(); - if (decorationItem) { - // decorated client - transformed_shape = decorationRect; - if (toplevel->shape()) { - // "xeyes" + decoration - transformed_shape -= bufferToWindowRect(cr); - transformed_shape += bufferToWindowRegion(surfaceItem()->shape()); - } - } else { - transformed_shape = bufferToWindowRegion(surfaceItem()->shape()); - } - if (shadowItem()) { - transformed_shape |= shadowItem()->shadow()->shadowRegion(); - } - - xcb_render_transform_t xform = { - DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - static const xcb_render_transform_t identity = { - DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - - if (mask & PAINT_WINDOW_TRANSFORMED) { - xscale = data.xScale(); - yscale = data.yScale(); - } - if (mask & PAINT_SCREEN_TRANSFORMED) { - xscale *= screen_paint.xScale(); - yscale *= screen_paint.yScale(); - } - if (!qFuzzyCompare(xscale, 1.0) || !qFuzzyCompare(yscale, 1.0)) { - scaled = true; - xform.matrix11 = DOUBLE_TO_FIXED(1.0 / xscale); - xform.matrix22 = DOUBLE_TO_FIXED(1.0 / yscale); - - // transform the shape for clipping in paintTransformedScreen() - QVector rects; - rects.reserve(transformed_shape.rectCount()); - for (const QRect &rect : transformed_shape) { - const QRect transformedRect( - qRound(rect.x() * xscale), - qRound(rect.y() * yscale), - qRound(rect.width() * xscale), - qRound(rect.height() * yscale) - ); - rects.append(transformedRect); - } - transformed_shape.setRects(rects.constData(), rects.count()); - } - - transformed_shape.translate(mapToScreen(mask, data, QPoint(0, 0))); - PaintClipper pcreg(region); // clip by the region to paint - PaintClipper pc(transformed_shape); // clip by window's shape - - const bool wantShadow = shadowItem() && !shadowItem()->shadow()->shadowRegion().isEmpty(); - - // In order to obtain a pixel perfect rescaling - // we need to blit the window content togheter with - // decorations in a temporary pixmap and scale - // the temporary pixmap at the end. - // We should do this only if there is scaling and - // the window has border - // This solves a number of glitches and on top of this - // it optimizes painting quite a bit - const bool blitInTempPixmap = xRenderOffscreen() || (data.crossFadeProgress() < 1.0 && !opaque) || - (scaled && (wantShadow || decorationItem)); - - xcb_render_picture_t renderTarget = m_scene->xrenderBufferPicture(); - if (blitInTempPixmap) { - if (scene_xRenderOffscreenTarget()) { - temp_visibleRect = toplevel->visibleGeometry().translated(-toplevel->pos()); - renderTarget = *scene_xRenderOffscreenTarget(); - } else { - prepareTempPixmap(); - renderTarget = *s_tempPicture; - } - } else { - xcb_render_set_picture_transform(connection(), pic, xform); - if (filter == ImageFilterGood) { - setPictureFilter(pic, KWin::Scene::ImageFilterGood); - } - - //BEGIN OF STUPID RADEON HACK - // This is needed to avoid hitting a fallback in the radeon driver. - // The Render specification states that sampling pixels outside the - // source picture results in alpha=0 pixels. This can be achieved by - // setting the border color to transparent black, but since the border - // color has the same format as the texture, it only works when the - // texture has an alpha channel. So the driver falls back to software - // when the repeat mode is RepeatNone, the picture has a non-identity - // transformation matrix, and doesn't have an alpha channel. - // Since we only scale the picture, we can work around this by setting - // the repeat mode to RepeatPad. - if (!window()->hasAlpha()) { - const uint32_t values[] = {XCB_RENDER_REPEAT_PAD}; - xcb_render_change_picture(connection(), pic, XCB_RENDER_CP_REPEAT, values); - } - //END OF STUPID RADEON HACK - } -#define MAP_RECT_TO_TARGET(_RECT_) \ - if (blitInTempPixmap) _RECT_.translate(-temp_visibleRect.topLeft()); else _RECT_ = mapToScreen(mask, data, _RECT_) - - //BEGIN deco preparations - bool noBorder = true; - xcb_render_picture_t left = XCB_RENDER_PICTURE_NONE; - xcb_render_picture_t top = XCB_RENDER_PICTURE_NONE; - xcb_render_picture_t right = XCB_RENDER_PICTURE_NONE; - xcb_render_picture_t bottom = XCB_RENDER_PICTURE_NONE; - QRect dtr, dlr, drr, dbr; - const SceneXRenderDecorationRenderer *renderer = nullptr; - if (decorationItem) { - renderer = static_cast(decorationItem->renderer()); - noBorder = false; - - if (client) { - client->layoutDecorationRects(dlr, dtr, drr, dbr); - } else if (deleted) { - deleted->layoutDecorationRects(dlr, dtr, drr, dbr); - } - } - if (renderer) { - left = renderer->picture(SceneXRenderDecorationRenderer::DecorationPart::Left); - top = renderer->picture(SceneXRenderDecorationRenderer::DecorationPart::Top); - right = renderer->picture(SceneXRenderDecorationRenderer::DecorationPart::Right); - bottom = renderer->picture(SceneXRenderDecorationRenderer::DecorationPart::Bottom); - } - if (!noBorder) { - MAP_RECT_TO_TARGET(dtr); - MAP_RECT_TO_TARGET(dlr); - MAP_RECT_TO_TARGET(drr); - MAP_RECT_TO_TARGET(dbr); - } - //END deco preparations - - //BEGIN shadow preparations - QRect stlr, str, strr, srr, sbrr, sbr, sblr, slr; - - if (wantShadow) { - SceneXRenderShadow *m_xrenderShadow = static_cast(shadowItem()->shadow()); - m_xrenderShadow->layoutShadowRects(str, strr, srr, sbrr, sbr, sblr, slr, stlr); - MAP_RECT_TO_TARGET(stlr); - MAP_RECT_TO_TARGET(str); - MAP_RECT_TO_TARGET(strr); - MAP_RECT_TO_TARGET(srr); - MAP_RECT_TO_TARGET(sbrr); - MAP_RECT_TO_TARGET(sbr); - MAP_RECT_TO_TARGET(sblr); - MAP_RECT_TO_TARGET(slr); - } - //BEGIN end preparations - - //BEGIN client preparations - QRect dr = cr; - if (blitInTempPixmap) { - dr.translate(-temp_visibleRect.topLeft()); - } else { - dr = mapToScreen(mask, data, bufferToWindowRect(dr)); // Destination rect - if (scaled) { - cr.moveLeft(cr.x() * xscale); - cr.moveTop(cr.y() * yscale); - } - } - - const int clientRenderOp = (opaque || blitInTempPixmap) ? XCB_RENDER_PICT_OP_SRC : XCB_RENDER_PICT_OP_OVER; - //END client preparations - -#undef MAP_RECT_TO_TARGET - - for (PaintClipper::Iterator iterator; !iterator.isDone(); iterator.next()) { - -#define RENDER_SHADOW_TILE(_TILE_, _RECT_) \ -xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, m_xrenderShadow->picture(SceneXRenderShadow::ShadowElement##_TILE_), \ - shadowAlpha, renderTarget, 0, 0, 0, 0, _RECT_.x(), _RECT_.y(), _RECT_.width(), _RECT_.height()) - - //shadow - if (wantShadow) { - SceneXRenderShadow *m_xrenderShadow = static_cast(shadowItem()->shadow()); - xcb_render_picture_t shadowAlpha = XCB_RENDER_PICTURE_NONE; - if (!opaque) { - shadowAlpha = xRenderBlendPicture(data.opacity()); - } - RENDER_SHADOW_TILE(TopLeft, stlr); - RENDER_SHADOW_TILE(Top, str); - RENDER_SHADOW_TILE(TopRight, strr); - RENDER_SHADOW_TILE(Left, slr); - RENDER_SHADOW_TILE(Right, srr); - RENDER_SHADOW_TILE(BottomLeft, sblr); - RENDER_SHADOW_TILE(Bottom, sbr); - RENDER_SHADOW_TILE(BottomRight, sbrr); - } -#undef RENDER_SHADOW_TILE - - // Paint the window contents - if (!(client && client->isShade())) { - xcb_render_picture_t clientAlpha = XCB_RENDER_PICTURE_NONE; - if (!opaque) { - clientAlpha = xRenderBlendPicture(data.opacity()); - } - xcb_render_composite(connection(), clientRenderOp, pic, clientAlpha, renderTarget, - cr.x(), cr.y(), 0, 0, dr.x(), dr.y(), dr.width(), dr.height()); - if (data.crossFadeProgress() < 1.0 && data.crossFadeProgress() > 0.0) { - SurfacePixmap *previous = surfaceItem()->previousPixmap(); - if (previous && previous != surfaceTexture) { - auto previousPlatformTexture = - static_cast(previous->platformTexture()); - - static xcb_render_color_t cFadeColor = {0, 0, 0, 0}; - cFadeColor.alpha = uint16_t((1.0 - data.crossFadeProgress()) * 0xffff); - if (!s_fadeAlphaPicture) { - s_fadeAlphaPicture = new XRenderPicture(xRenderFill(cFadeColor)); - } else { - xcb_rectangle_t rect = {0, 0, 1, 1}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_fadeAlphaPicture, cFadeColor , 1, &rect); - } - if (previous->size() != surfaceTexture->size()) { - xcb_render_transform_t xform2 = { - DOUBLE_TO_FIXED(FIXED_TO_DOUBLE(xform.matrix11) * previous->size().width() / surfaceTexture->size().width()), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(FIXED_TO_DOUBLE(xform.matrix22) * previous->size().height() / surfaceTexture->size().height()), DOUBLE_TO_FIXED(0), - DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) - }; - xcb_render_set_picture_transform(connection(), previousPlatformTexture->picture(), xform2); - } - - xcb_render_composite(connection(), opaque ? XCB_RENDER_PICT_OP_OVER : XCB_RENDER_PICT_OP_ATOP, - previousPlatformTexture->picture(), *s_fadeAlphaPicture, - renderTarget, - cr.x(), cr.y(), 0, 0, dr.x(), dr.y(), dr.width(), dr.height()); - - if (previous->size() != surfaceTexture->size()) { - xcb_render_set_picture_transform(connection(), - previousPlatformTexture->picture(), - identity); - } - } - } - if (!opaque) - transformed_shape = QRegion(); - } - - if (client || deleted) { - if (!noBorder) { - xcb_render_picture_t decorationAlpha = xRenderBlendPicture(data.opacity()); - auto renderDeco = [decorationAlpha, renderTarget](xcb_render_picture_t deco, const QRect &rect) { - if (deco == XCB_RENDER_PICTURE_NONE) { - return; - } - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, deco, decorationAlpha, renderTarget, - 0, 0, 0, 0, rect.x(), rect.y(), rect.width(), rect.height()); - }; - renderDeco(top, dtr); - renderDeco(left, dlr); - renderDeco(right, drr); - renderDeco(bottom, dbr); - } - } - - if (data.brightness() != 1.0) { - // fake brightness change by overlaying black - const float alpha = (1 - data.brightness()) * data.opacity(); - xcb_rectangle_t rect; - if (blitInTempPixmap) { - rect.x = -temp_visibleRect.left(); - rect.y = -temp_visibleRect.top(); - rect.width = width(); - rect.height = height(); - } else { - rect.x = wr.x(); - rect.y = wr.y(); - rect.width = wr.width(); - rect.height = wr.height(); - } - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER, renderTarget, - preMultiply(data.brightness() < 1.0 ? QColor(0,0,0,255*alpha) : QColor(255,255,255,-alpha*255)), - 1, &rect); - } - if (blitInTempPixmap) { - const QRect r = mapToScreen(mask, data, temp_visibleRect); - xcb_render_set_picture_transform(connection(), *s_tempPicture, xform); - setPictureFilter(*s_tempPicture, filter); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *s_tempPicture, - XCB_RENDER_PICTURE_NONE, m_scene->xrenderBufferPicture(), - 0, 0, 0, 0, r.x(), r.y(), r.width(), r.height()); - xcb_render_set_picture_transform(connection(), *s_tempPicture, identity); - } - } - if (scaled && !blitInTempPixmap) { - xcb_render_set_picture_transform(connection(), pic, identity); - if (filter == ImageFilterGood) - setPictureFilter(pic, KWin::Scene::ImageFilterFast); - if (!window()->hasAlpha()) { - const uint32_t values[] = {XCB_RENDER_REPEAT_NONE}; - xcb_render_change_picture(connection(), pic, XCB_RENDER_CP_REPEAT, values); - } - } - if (xRenderOffscreen()) - scene_setXRenderOffscreenTarget(*s_tempPicture); -} - -void SceneXrender::Window::setPictureFilter(xcb_render_picture_t pic, Scene::ImageFilterType filter) -{ - QByteArray filterName; - switch (filter) { - case KWin::Scene::ImageFilterFast: - filterName = QByteArray("fast"); - break; - case KWin::Scene::ImageFilterGood: - filterName = QByteArray("good"); - break; - } - xcb_render_set_picture_filter(connection(), pic, filterName.length(), filterName.constData(), 0, nullptr); -} - -void SceneXrender::screenGeometryChanged(const QSize &size) -{ - Scene::screenGeometryChanged(size); - m_backend->screenGeometryChanged(size); -} - -xcb_render_picture_t SceneXrender::xrenderBufferPicture() const -{ - return m_backend->buffer(); -} - -OverlayWindow *SceneXrender::overlayWindow() const -{ - return m_backend->overlayWindow(); -} - -//**************************************** -// SceneXrender::EffectFrame -//**************************************** - -XRenderPicture *SceneXrender::EffectFrame::s_effectFrameCircle = nullptr; - -SceneXrender::EffectFrame::EffectFrame(EffectFrameImpl* frame) - : Scene::EffectFrame(frame) -{ - m_picture = nullptr; - m_textPicture = nullptr; - m_iconPicture = nullptr; - m_selectionPicture = nullptr; -} - -SceneXrender::EffectFrame::~EffectFrame() -{ - delete m_picture; - delete m_textPicture; - delete m_iconPicture; - delete m_selectionPicture; -} - -void SceneXrender::EffectFrame::cleanup() -{ - delete s_effectFrameCircle; - s_effectFrameCircle = nullptr; -} - -void SceneXrender::EffectFrame::free() -{ - delete m_picture; - m_picture = nullptr; - delete m_textPicture; - m_textPicture = nullptr; - delete m_iconPicture; - m_iconPicture = nullptr; - delete m_selectionPicture; - m_selectionPicture = nullptr; -} - -void SceneXrender::EffectFrame::freeIconFrame() -{ - delete m_iconPicture; - m_iconPicture = nullptr; -} - -void SceneXrender::EffectFrame::freeTextFrame() -{ - delete m_textPicture; - m_textPicture = nullptr; -} - -void SceneXrender::EffectFrame::freeSelection() -{ - delete m_selectionPicture; - m_selectionPicture = nullptr; -} - -void SceneXrender::EffectFrame::crossFadeIcon() -{ - // TODO: implement me -} - -void SceneXrender::EffectFrame::crossFadeText() -{ - // TODO: implement me -} - -void SceneXrender::EffectFrame::render(const QRegion ®ion, double opacity, double frameOpacity) -{ - Q_UNUSED(region) - if (m_effectFrame->geometry().isEmpty()) { - return; // Nothing to display - } - - // Render the actual frame - if (m_effectFrame->style() == EffectFrameUnstyled) { - renderUnstyled(effects->xrenderBufferPicture(), m_effectFrame->geometry(), opacity * frameOpacity); - } else if (m_effectFrame->style() == EffectFrameStyled) { - if (!m_picture) { // Lazy creation - updatePicture(); - } - if (m_picture) { - qreal left, top, right, bottom; - m_effectFrame->frame().getMargins(left, top, right, bottom); // m_geometry is the inner geometry - QRect geom = m_effectFrame->geometry().adjusted(-left, -top, right, bottom); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_picture, - XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(), - 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); - } - } - if (!m_effectFrame->selection().isNull()) { - if (!m_selectionPicture) { // Lazy creation - const QPixmap pix = m_effectFrame->selectionFrame().framePixmap(); - if (!pix.isNull()) // don't try if there's no content - m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap().toImage()); - } - if (m_selectionPicture) { - const QRect geom = m_effectFrame->selection(); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_selectionPicture, - XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(), - 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); - } - } - - XRenderPicture fill = xRenderBlendPicture(opacity); - - // Render icon - if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) { - QPoint topLeft(m_effectFrame->geometry().x(), m_effectFrame->geometry().center().y() - m_effectFrame->iconSize().height() / 2); - - if (!m_iconPicture) // lazy creation - m_iconPicture = new XRenderPicture(m_effectFrame->icon().pixmap(m_effectFrame->iconSize()).toImage()); - QRect geom = QRect(topLeft, m_effectFrame->iconSize()); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_iconPicture, fill, - effects->xrenderBufferPicture(), - 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); - } - - // Render text - if (!m_effectFrame->text().isEmpty()) { - if (!m_textPicture) { // Lazy creation - updateTextPicture(); - } - - if (m_textPicture) { - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_textPicture, fill, effects->xrenderBufferPicture(), - 0, 0, 0, 0, m_effectFrame->geometry().x(), m_effectFrame->geometry().y(), - m_effectFrame->geometry().width(), m_effectFrame->geometry().height()); - } - } -} - -void SceneXrender::EffectFrame::renderUnstyled(xcb_render_picture_t pict, const QRect &rect, qreal opacity) -{ - const int roundness = 5; - const QRect area = rect.adjusted(-roundness, -roundness, roundness, roundness); - xcb_rectangle_t rects[3]; - // center - rects[0].x = area.left(); - rects[0].y = area.top() + roundness; - rects[0].width = area.width(); - rects[0].height = area.height() - roundness * 2; - // top - rects[1].x = area.left() + roundness; - rects[1].y = area.top(); - rects[1].width = area.width() - roundness * 2; - rects[1].height = roundness; - // bottom - rects[2].x = area.left() + roundness; - rects[2].y = area.top() + area.height() - roundness; - rects[2].width = area.width() - roundness * 2; - rects[2].height = roundness; - xcb_render_color_t color = {0, 0, 0, uint16_t(opacity * 0xffff)}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_OVER, pict, color, 3, rects); - - if (!s_effectFrameCircle) { - // create the circle - const int diameter = roundness * 2; - xcb_pixmap_t pix = xcb_generate_id(connection()); - xcb_create_pixmap(connection(), 32, pix, rootWindow(), diameter, diameter); - s_effectFrameCircle = new XRenderPicture(pix, 32); - xcb_free_pixmap(connection(), pix); - - // clear it with transparent - xcb_rectangle_t xrect = {0, 0, diameter, diameter}; - xcb_render_color_t tranparent = {0, 0, 0, 0}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_effectFrameCircle, tranparent, 1, &xrect); - - static const int num_segments = 80; - static const qreal theta = 2 * M_PI / qreal(num_segments); - static const qreal c = qCos(theta); //precalculate the sine and cosine - static const qreal s = qSin(theta); - qreal t; - - qreal x = roundness;//we start at angle = 0 - qreal y = 0; - - QVector points; - xcb_render_pointfix_t point; - point.x = DOUBLE_TO_FIXED(roundness); - point.y = DOUBLE_TO_FIXED(roundness); - points << point; - for (int ii = 0; ii <= num_segments; ++ii) { - point.x = DOUBLE_TO_FIXED(x + roundness); - point.y = DOUBLE_TO_FIXED(y + roundness); - points << point; - //apply the rotation matrix - t = x; - x = c * x - s * y; - y = s * t + c * y; - } - XRenderPicture fill = xRenderFill(Qt::black); - xcb_render_tri_fan(connection(), XCB_RENDER_PICT_OP_OVER, fill, *s_effectFrameCircle, - 0, 0, 0, points.count(), points.constData()); - } - // TODO: merge alpha mask with SceneXrender::Window::alphaMask - // alpha mask - xcb_pixmap_t pix = xcb_generate_id(connection()); - xcb_create_pixmap(connection(), 8, pix, rootWindow(), 1, 1); - XRenderPicture alphaMask(pix, 8); - xcb_free_pixmap(connection(), pix); - const uint32_t values[] = {true}; - xcb_render_change_picture(connection(), alphaMask, XCB_RENDER_CP_REPEAT, values); - color.alpha = int(opacity * 0xffff); - xcb_rectangle_t xrect = {0, 0, 1, 1}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, alphaMask, color, 1, &xrect); - - // TODO: replace by lambda -#define RENDER_CIRCLE(srcX, srcY, destX, destY) \ -xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *s_effectFrameCircle, alphaMask, \ - pict, srcX, srcY, 0, 0, destX, destY, roundness, roundness) - - RENDER_CIRCLE(0, 0, area.left(), area.top()); - RENDER_CIRCLE(0, roundness, area.left(), area.top() + area.height() - roundness); - RENDER_CIRCLE(roundness, 0, area.left() + area.width() - roundness, area.top()); - RENDER_CIRCLE(roundness, roundness, - area.left() + area.width() - roundness, area.top() + area.height() - roundness); -#undef RENDER_CIRCLE -} - -void SceneXrender::EffectFrame::updatePicture() -{ - delete m_picture; - m_picture = nullptr; - if (m_effectFrame->style() == EffectFrameStyled) { - const QPixmap pix = m_effectFrame->frame().framePixmap(); - if (!pix.isNull()) - m_picture = new XRenderPicture(pix.toImage()); - } -} - -void SceneXrender::EffectFrame::updateTextPicture() -{ - // Mostly copied from SceneOpenGL::EffectFrame::updateTextTexture() above - delete m_textPicture; - m_textPicture = nullptr; - - if (m_effectFrame->text().isEmpty()) { - return; - } - - // Determine position on texture to paint text - QRect rect(QPoint(0, 0), m_effectFrame->geometry().size()); - if (!m_effectFrame->icon().isNull() && !m_effectFrame->iconSize().isEmpty()) { - rect.setLeft(m_effectFrame->iconSize().width()); - } - - // If static size elide text as required - QString text = m_effectFrame->text(); - if (m_effectFrame->isStatic()) { - QFontMetrics metrics(m_effectFrame->text()); - text = metrics.elidedText(text, Qt::ElideRight, rect.width()); - } - - QPixmap pixmap(m_effectFrame->geometry().size()); - pixmap.fill(Qt::transparent); - QPainter p(&pixmap); - p.setFont(m_effectFrame->font()); - if (m_effectFrame->style() == EffectFrameStyled) { - p.setPen(m_effectFrame->styledTextColor()); - } else { - // TODO: What about no frame? Custom color setting required - p.setPen(Qt::white); - } - p.drawText(rect, m_effectFrame->alignment(), text); - p.end(); - m_textPicture = new XRenderPicture(pixmap.toImage()); -} - -SceneXRenderShadow::SceneXRenderShadow(Toplevel *toplevel) - :Shadow(toplevel) -{ - for (int i=0; iclient()->layoutDecorationRects(left, top, right, bottom); - - xcb_connection_t *c = connection(); - auto checkAndCreate = [this, c](int border, const QRect &rect) { - const QSize size = rect.size(); - if (m_sizes[border] != size) { - m_sizes[border] = size; - if (m_pixmaps[border] != XCB_PIXMAP_NONE) { - xcb_free_pixmap(c, m_pixmaps[border]); - } - delete m_pictures[border]; - if (!size.isEmpty()) { - m_pixmaps[border] = xcb_generate_id(connection()); - xcb_create_pixmap(connection(), 32, m_pixmaps[border], rootWindow(), size.width(), size.height()); - m_pictures[border] = new XRenderPicture(m_pixmaps[border], 32); - } else { - m_pixmaps[border] = XCB_PIXMAP_NONE; - m_pictures[border] = nullptr; - } - } - if (!m_pictures[border]) { - return; - } - // fill transparent - xcb_rectangle_t r = {0, 0, uint16_t(size.width()), uint16_t(size.height())}; - xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *m_pictures[border], preMultiply(Qt::transparent), 1, &r); - }; - - checkAndCreate(int(DecorationPart::Left), left); - checkAndCreate(int(DecorationPart::Top), top); - checkAndCreate(int(DecorationPart::Right), right); - checkAndCreate(int(DecorationPart::Bottom), bottom); -} - -xcb_render_picture_t SceneXRenderDecorationRenderer::picture(SceneXRenderDecorationRenderer::DecorationPart part) const -{ - Q_ASSERT(part != DecorationPart::Count); - XRenderPicture *picture = m_pictures[int(part)]; - if (!picture) { - return XCB_RENDER_PICTURE_NONE; - } - return *picture; -} - -#undef DOUBLE_TO_FIXED -#undef FIXED_TO_DOUBLE - -XRenderFactory::XRenderFactory(QObject *parent) - : SceneFactory(parent) -{ -} - -XRenderFactory::~XRenderFactory() = default; - -Scene *XRenderFactory::create(QObject *parent) const -{ - auto s = SceneXrender::createScene(parent); - if (s && s->initFailed()) { - delete s; - s = nullptr; - } - return s; -} - -} // namespace -#endif - - -void KWin::SceneXrender::paintCursor(const QRegion ®ion) -{ - Q_UNUSED(region) -} - -void KWin::SceneXrender::paintEffectQuickView(KWin::EffectQuickView *w) -{ - const QImage buffer = w->bufferAsImage(); - if (buffer.isNull()) { - return; - } - XRenderPicture picture(buffer); - xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE, - effects->xrenderBufferPicture(), - 0, 0, 0, 0, w->geometry().x(), w->geometry().y(), - w->geometry().width(), w->geometry().height()); -} diff --git a/src/plugins/scenes/xrender/scene_xrender.h b/src/plugins/scenes/xrender/scene_xrender.h deleted file mode 100644 index 896755b116..0000000000 --- a/src/plugins/scenes/xrender/scene_xrender.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2006 Lubos Lunak - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_SCENE_XRENDER_H -#define KWIN_SCENE_XRENDER_H - -#include "decorationitem.h" -#include "scene.h" -#include "shadow.h" - -#ifdef KWIN_HAVE_XRENDER_COMPOSITING - -namespace KWin -{ - -class XRenderBackend; - -class SceneXrender - : public Scene -{ - Q_OBJECT -public: - class EffectFrame; - ~SceneXrender() override; - bool initFailed() const override; - CompositingType compositingType() const override { - return XRenderCompositing; - } - void paint(int screenId, const QRegion &damage, const QList &windows, - RenderLoop *renderLoop) override; - Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override; - Shadow *createShadow(Toplevel *toplevel) override; - void screenGeometryChanged(const QSize &size) override; - xcb_render_picture_t xrenderBufferPicture() const override; - OverlayWindow *overlayWindow() const override; - DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *client) override; - PlatformSurfaceTexture *createPlatformSurfaceTextureX11(SurfacePixmapX11 *pixmap) override; - - bool animationsSupported() const override { - return true; - } - - static SceneXrender *createScene(QObject *parent); -protected: - Scene::Window *createWindow(Toplevel *toplevel) override; - void paintBackground(const QRegion ®ion) override; - void paintGenericScreen(int mask, const ScreenPaintData &data) override; - void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) override; - void paintCursor(const QRegion ®ion) override; - void paintEffectQuickView(EffectQuickView *w) override; -private: - explicit SceneXrender(XRenderBackend *backend, QObject *parent = nullptr); - static ScreenPaintData screen_paint; - class Window; - QScopedPointer m_backend; -}; - -class SceneXrender::Window : public Scene::Window -{ - Q_OBJECT - -public: - Window(Toplevel* c, SceneXrender *scene); - ~Window() override; - void performPaint(int mask, const QRegion ®ion, const WindowPaintData &data) override; - QRegion transformedShape() const; - void setTransformedShape(const QRegion& shape); - static void cleanup(); -private: - QRect mapToScreen(int mask, const WindowPaintData &data, const QRect &rect) const; - QPoint mapToScreen(int mask, const WindowPaintData &data, const QPoint &point) const; - QRect bufferToWindowRect(const QRect &rect) const; - QRegion bufferToWindowRegion(const QRegion ®ion) const; - void prepareTempPixmap(); - void setPictureFilter(xcb_render_picture_t pic, ImageFilterType filter); - SceneXrender *m_scene; - QRegion transformed_shape; - static QRect temp_visibleRect; - static XRenderPicture *s_tempPicture; - static XRenderPicture *s_fadeAlphaPicture; -}; - -class SceneXrender::EffectFrame - : public Scene::EffectFrame -{ -public: - EffectFrame(EffectFrameImpl* frame); - ~EffectFrame() override; - - void free() override; - void freeIconFrame() override; - void freeTextFrame() override; - void freeSelection() override; - void crossFadeIcon() override; - void crossFadeText() override; - void render(const QRegion ®ion, double opacity, double frameOpacity) override; - static void cleanup(); - -private: - void updatePicture(); - void updateTextPicture(); - void renderUnstyled(xcb_render_picture_t pict, const QRect &rect, qreal opacity); - - XRenderPicture* m_picture; - XRenderPicture* m_textPicture; - XRenderPicture* m_iconPicture; - XRenderPicture* m_selectionPicture; - static XRenderPicture* s_effectFrameCircle; -}; - -inline -QRegion SceneXrender::Window::transformedShape() const -{ - return transformed_shape; -} - -inline -void SceneXrender::Window::setTransformedShape(const QRegion& shape) -{ - transformed_shape = shape; -} - -/** - * @short XRender implementation of Shadow. - * - * This class extends Shadow by the elements required for XRender rendering. - * @author Jacopo De Simoi - */ -class SceneXRenderShadow - : public Shadow -{ -public: - explicit SceneXRenderShadow(Toplevel *toplevel); - using Shadow::ShadowElements; - using Shadow::ShadowElementTop; - using Shadow::ShadowElementTopRight; - using Shadow::ShadowElementRight; - using Shadow::ShadowElementBottomRight; - using Shadow::ShadowElementBottom; - using Shadow::ShadowElementBottomLeft; - using Shadow::ShadowElementLeft; - using Shadow::ShadowElementTopLeft; - using Shadow::ShadowElementsCount; - using Shadow::shadowPixmap; - ~SceneXRenderShadow() override; - - void layoutShadowRects(QRect& top, QRect& topRight, - QRect& right, QRect& bottomRight, - QRect& bottom, QRect& bottomLeft, - QRect& Left, QRect& topLeft); - xcb_render_picture_t picture(ShadowElements element) const; - -protected: - bool prepareBackend() override; -private: - XRenderPicture* m_pictures[ShadowElementsCount]; -}; - -class SceneXRenderDecorationRenderer : public DecorationRenderer -{ - Q_OBJECT -public: - enum class DecorationPart : int { - Left, - Top, - Right, - Bottom, - Count - }; - explicit SceneXRenderDecorationRenderer(Decoration::DecoratedClientImpl *client); - ~SceneXRenderDecorationRenderer() override; - - void render(const QRegion ®ion) override; - - xcb_render_picture_t picture(DecorationPart part) const; - -private: - void resizePixmaps(); - QSize m_sizes[int(DecorationPart::Count)]; - xcb_pixmap_t m_pixmaps[int(DecorationPart::Count)]; - xcb_gcontext_t m_gc; - XRenderPicture* m_pictures[int(DecorationPart::Count)]; -}; - -class KWIN_EXPORT XRenderFactory : public SceneFactory -{ - Q_OBJECT - Q_INTERFACES(KWin::SceneFactory) - Q_PLUGIN_METADATA(IID "org.kde.kwin.Scene" FILE "xrender.json") - -public: - explicit XRenderFactory(QObject *parent = nullptr); - ~XRenderFactory() override; - - Scene *create(QObject *parent = nullptr) const override; -}; - -} // namespace - -#endif - -#endif diff --git a/src/plugins/scenes/xrender/xrender.json b/src/plugins/scenes/xrender/xrender.json deleted file mode 100644 index 5cccbca56f..0000000000 --- a/src/plugins/scenes/xrender/xrender.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "CompositingType": 2, - "KPlugin": { - "Description": "KWin Compositor plugin rendering through XRender", - "Description[az]": "XRender avsitəsi ilə KWin birləşdirici əlavəsini formalaşdırmaq", - "Description[ca@valencia]": "Connector del Compositor de KWin que renderitza a través de XRender", - "Description[ca]": "Connector del Compositor del KWin que renderitza a través del XRender", - "Description[da]": "KWin-compositorplugin som renderer igennem XRender", - "Description[de]": "KWin-Compositor-Modul zum Rendern mit XRender", - "Description[el]": "Αποτύπωση πρσοθέτου συνθέτη KWin μέσω XRender", - "Description[en_GB]": "KWin Compositor plugin rendering through XRender", - "Description[es]": "Complemento compositor de KWin renderizando mediante XRender", - "Description[et]": "KWini komposiitori plugin renderdamiseks XRender'i abil", - "Description[eu]": "Kwin konposatzailearen plugina XRender bidez errendatzen", - "Description[fi]": "XRenderillä hahmontava KWin-koostajaliitännäinen", - "Description[fr]": "Module du compositeur KWin effectuant le rendu avec XRender", - "Description[gl]": "Complemento de compositor de KWin que renderiza a través de XRender.", - "Description[hu]": "KWin összeállító bővítmény XRender leképezéssel", - "Description[id]": "Plugin KWin Compositor perenderan melalui XRender", - "Description[it]": "Estensione del compositore di KWin per la resa tramite XRender", - "Description[ko]": "XRender로 렌더링하는 KWin 컴포지터 플러그인", - "Description[lt]": "KWin kompozitoriaus priedas atvaizdavimui per XRender", - "Description[nl]": "KWin-compositor-plug-in rendering via XRender", - "Description[nn]": "KWin-samansetjartillegg som brukar XRender", - "Description[pl]": "Wtyczka kompozytora KWin wyświetlająca przez XRender", - "Description[pt]": "'Plugin' de Composição do KWin com desenho via XRender", - "Description[pt_BR]": "Plugin do compositor KWin renderizando pelo XRender", - "Description[ru]": "Отрисовка подключаемым модулем компоновщика KWin через XRender", - "Description[sk]": "Renderovací plugin kompozítora KWin cez XRender", - "Description[sl]": "Izrisovanje vstavka upravljalnika skladnje KWin preko XRender-ja", - "Description[sr@ijekavian]": "К‑винов прикључак слагача за рендеровање кроз Икс‑рендер", - "Description[sr@ijekavianlatin]": "KWinov priključak slagača za renderovanje kroz XRender", - "Description[sr@latin]": "KWinov priključak slagača za renderovanje kroz XRender", - "Description[sr]": "К‑винов прикључак слагача за рендеровање кроз Икс‑рендер", - "Description[sv]": "Kwin sammansättningsinsticksprogram återger via XRender", - "Description[tr]": "XRender üzerinden KWin Dizgici eklentisi oluşturma", - "Description[uk]": "Додаток засобу композиції KWin для обробки з використанням XRender", - "Description[x-test]": "xxKWin Compositor plugin rendering through XRenderxx", - "Description[zh_CN]": "使用 XRender 渲染的 KWin 显示特效混合器插件", - "Description[zh_TW]": "透過 XRender 繪製 KWin 合成器附加元件", - "Id": "KWinSceneXRender", - "Name": "SceneXRender", - "Name[az]": "SceneXRender", - "Name[ca@valencia]": "SceneXRender", - "Name[ca]": "SceneXRender", - "Name[cs]": "SceneXRender", - "Name[da]": "SceneXRender", - "Name[de]": "SceneXRender", - "Name[el]": "SceneXRender", - "Name[en_GB]": "SceneXRender", - "Name[es]": "SceneXRender", - "Name[et]": "SceneXRender", - "Name[eu]": "SceneXRender", - "Name[fi]": "SceneXRender", - "Name[fr]": "SceneXRender", - "Name[gl]": "SceneXRender", - "Name[hu]": "SceneXRender", - "Name[id]": "SceneXRender", - "Name[it]": "SceneXRender", - "Name[ko]": "SceneXRender", - "Name[lt]": "SceneXRender", - "Name[nl]": "SceneXRender", - "Name[nn]": "SceneXRender", - "Name[pa]": "ਸੀਨ-ਐਕਸ-ਰੈਂਡਰ", - "Name[pl]": "XRender sceny", - "Name[pt]": "SceneXRender", - "Name[pt_BR]": "SceneXRender", - "Name[ro]": "SceneXRender", - "Name[ru]": "SceneXRender", - "Name[sk]": "SceneXRender", - "Name[sl]": "SceneXRender", - "Name[sr@ijekavian]": "Икс‑рендер-сцена", - "Name[sr@ijekavianlatin]": "XRender-scena", - "Name[sr@latin]": "XRender-scena", - "Name[sr]": "Икс‑рендер-сцена", - "Name[sv]": "Scen XRender", - "Name[tr]": "SceneXRender", - "Name[uk]": "SceneXRender", - "Name[x-test]": "xxSceneXRenderxx", - "Name[zh_CN]": "SceneXRender", - "Name[zh_TW]": "SceneXRender" - } -} diff --git a/src/scene.cpp b/src/scene.cpp index b7305c7ea7..ae6309063c 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -8,9 +8,6 @@ */ /* - The base class for compositing, implementing shared functionality - between the OpenGL and XRender backends. - Design: When compositing is turned on, XComposite extension is used to redirect @@ -715,11 +712,6 @@ QMatrix4x4 Scene::screenProjectionMatrix() const return QMatrix4x4(); } -xcb_render_picture_t Scene::xrenderBufferPicture() const -{ - return XCB_RENDER_PICTURE_NONE; -} - QPainter *Scene::scenePainter() const { return nullptr; diff --git a/src/scene.h b/src/scene.h index bc714424b2..aa82b27444 100644 --- a/src/scene.h +++ b/src/scene.h @@ -165,12 +165,6 @@ public: */ virtual bool animationsSupported() const = 0; - /** - * The render buffer used by an XRender based compositor scene. - * Default implementation returns XCB_RENDER_PICTURE_NONE - */ - virtual xcb_render_picture_t xrenderBufferPicture() const; - /** * The QPainter used by a QPainter based compositor scene. * Default implementation returns @c nullptr; diff --git a/src/workspace.cpp b/src/workspace.cpp index d1a5adc9f2..0760de36e5 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1725,15 +1725,12 @@ QString Workspace::supportInformation() const support.append(QStringLiteral("OpenGL 2 Shaders are used\n")); break; } - case XRenderCompositing: - support.append(QStringLiteral("Compositing Type: XRender\n")); - break; case QPainterCompositing: support.append("Compositing Type: QPainter\n"); break; case NoCompositing: default: - support.append(QStringLiteral("Something is really broken, neither OpenGL nor XRender is used")); + support.append(QStringLiteral("Something is really broken, neither OpenGL nor QPainter is used")); } support.append(QStringLiteral("\nLoaded Effects:\n")); support.append(QStringLiteral( "---------------\n"));