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.
master
Vlad Zahorodnii 3 years ago
parent 3c2ca184e3
commit 811beb94e0

@ -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})

@ -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);
}

@ -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();
}

@ -170,62 +170,62 @@ void TestBuiltInEffectLoader::testSupported_data()
QTest::addColumn<KWin::CompositingType>("type");
QTest::addColumn<bool>("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<bool>("expected");
QTest::addColumn<KWin::CompositingType>("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<KWin::CompositingType>("type");
QTest::addColumn<KWin::LoadEffectFlags>("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()
{
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater>mockHandler(new MockEffectsHandler(KWin::XRenderCompositing));
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater>mockHandler(new MockEffectsHandler(KWin::QPainterCompositing));
KWin::BuiltInEffectLoader loader;
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);

@ -147,14 +147,14 @@ void TestPluginEffectLoader::testSupported_data()
QTest::addColumn<bool>("expected");
QTest::addColumn<KWin::CompositingType>("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<bool>("expected");
QTest::addColumn<KWin::CompositingType>("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<KWin::LoadEffectFlags>("loadFlags");
QTest::addColumn<bool>("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()

@ -142,7 +142,7 @@ void TestScriptedEffectLoader::testHasEffect()
QFETCH(QString, name);
QFETCH(bool, expected);
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater> mockHandler(new MockEffectsHandler(KWin::XRenderCompositing));
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater> 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<MockEffectsHandler, QScopedPointerDeleteLater> mockHandler(new MockEffectsHandler(KWin::XRenderCompositing));
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater> 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<MockEffectsHandler, QScopedPointerDeleteLater> mockHandler(new MockEffectsHandler(KWin::XRenderCompositing));
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater> 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<MockEffectsHandler, QScopedPointerDeleteLater> mockHandler(new MockEffectsHandler(KWin::XRenderCompositing));
QScopedPointer<MockEffectsHandler, QScopedPointerDeleteLater> 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

@ -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]

@ -69,7 +69,7 @@ effects can be activated.
</para>
<para>All effects which are not supported by the currently used compositing backend
are hidden by default (&eg; OpenGL effects when using XRender).
are hidden by default (&eg; OpenGL effects when using software renderer).
</para>
<para>Also all internal or helper effects are hidden by default. These are effects which replace

@ -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

@ -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

@ -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";

@ -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");

@ -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

@ -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();

@ -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;

@ -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)

@ -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);

@ -18,10 +18,6 @@
#include <kstandardaction.h>
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#endif
#include <KGlobalAccel>
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<MagnifierConfig>();
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 &region, 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<char*>("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<char*>("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));

@ -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<XRenderPicture> m_picture;
#endif
};
} // namespace

@ -13,11 +13,6 @@
#include <QAction>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/xcb.h>
#include <xcb/render.h>
#endif
#include <KConfigGroup>
#include <KGlobalAccel>
@ -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<xcb_render_pointfix_t> 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();

@ -12,7 +12,6 @@
#include <kwineffects.h>
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <KLocalizedString>
#include <QFont>
@ -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);

@ -23,10 +23,6 @@
#include <cmath>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/render.h>
#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, <strike>tess...</strike> 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 &region, ScreenPaintData& data)
{
effects->paintScreen(mask, region, data); // paint normal screen
@ -143,32 +112,7 @@ void MouseMarkEffect::paintScreen(int mask, const QRegion &region, 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);

@ -12,9 +12,6 @@
#include <kwineffects.h>
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
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;

@ -12,9 +12,6 @@
#include "resizeconfig.h"
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "kwinxrenderutils.h"
#endif
#include <KColorScheme>
@ -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<xcb_rectangle_t> 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);

@ -10,17 +10,12 @@
// KWin
#include <kwinglutils.h>
#include <kwingltexture.h>
#include <kwinxrenderutils.h>
// KDE
#include <Plasma/Svg>
// Qt
#include <QTimer>
#include <QPainter>
#include <QVector4D>
// xcb
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/render.h>
#endif
namespace KWin {
@ -102,33 +97,6 @@ void ScreenEdgeEffect::paintScreen(int mask, const QRegion &region, 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<GLTexture>(border, geometry.size()));
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
(*it)->picture.reset(createEdgeGlow<XRenderPicture>(border, geometry.size()));
#endif
} else if (effects->compositingType() == QPainterCompositing) {
(*it)->image.reset(createEdgeGlow<QImage>(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<XRenderPicture>(border));
} else {
glow->pictureSize = geometry.size();
glow->picture.reset(createEdgeGlow<XRenderPicture>(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<QImage>(border));

@ -54,9 +54,6 @@ class Glow
public:
QScopedPointer<GLTexture> texture;
QScopedPointer<QImage> image;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
QScopedPointer<XRenderPicture> picture;
#endif
QSize pictureSize;
qreal strength;
QRect geometry;

@ -17,11 +17,6 @@
#include <QPainter>
#if defined(KWIN_HAVE_XRENDER_COMPOSITING)
#include <kwinxrenderutils.h>
#include <xcb/xcb_image.h>
#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<xcb_image_t *>(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;
}

@ -15,10 +15,6 @@
#include <kwinconfig.h>
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#endif
#include <KLocalizedString>
@ -155,14 +151,7 @@ void ShowFpsEffect::paintScreen(int mask, const QRegion &region, 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<xcb_rectangle_t> 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<int> values, QList<int> 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<xcb_rectangle_t> 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

@ -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);

@ -11,9 +11,6 @@
#include "showpaint.h"
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/render.h>
#endif
#include <KGlobalAccel>
#include <KLocalizedString>
@ -53,13 +50,7 @@ void ShowPaintEffect::paintScreen(int mask, const QRegion &region, 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<xcb_rectangle_t> 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];

@ -32,7 +32,6 @@ private Q_SLOTS:
private:
void paintGL(const QMatrix4x4 &projection);
void paintXrender();
void paintQPainter();
bool m_active = false;

@ -12,11 +12,6 @@
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#endif
#include <QPainter>
namespace KWin
@ -161,63 +156,7 @@ void SnapHelperEffect::paintScreen(int mask, const QRegion &region, 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;

@ -13,12 +13,6 @@
#include <QAction>
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/xcb.h>
#include <xcb/render.h>
#endif
#include <KConfigGroup>
#include <KGlobalAccel>
@ -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<xcb_render_pointfix_t> 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();

@ -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);

@ -21,7 +21,6 @@
#include <kwinconfig.h>
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <KGlobalAccel>
#include <KLocalizedString>
@ -36,11 +35,6 @@ TrackMouseEffect::TrackMouseEffect()
{
initConfig<TrackMouseConfig>();
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 &region, 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());

@ -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;

@ -26,10 +26,6 @@
#include <KLocalizedString>
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#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 &region, 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<char*>("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
}
}

@ -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<GLTexture> texture;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
QScopedPointer<XRenderPicture> xrenderPicture;
#endif
int imageWidth;
int imageHeight;
bool isMouseHidden;

@ -28,8 +28,7 @@
<string>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.</string>
you can reset this protection but be aware that this might result in an immediate crash!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -159,20 +158,6 @@ Alternatively, you might want to use the XRender backend instead.</string>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="kcfg_XRenderSmoothScale">
<item>
<property name="text">
<string>Crisp</string>
</property>
</item>
<item>
<property name="text">
<string>Smooth (slower)</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="kcfg_glTextureFilter">
<item>

@ -26,14 +26,6 @@
<default>2</default>
</entry>
<entry name="XRenderSmoothScale" type="Enum">
<default>Crisp</default>
<choices>
<choice name="Crisp" value="false" />
<choice name="Smooth" value="true" />
</choices>
</entry>
<entry name="Enabled" type="Bool">
<default>true</default>
</entry>
@ -56,7 +48,6 @@
<default>OpenGL</default>
<choices>
<choice name="OpenGL" />
<choice name="XRender" />
</choices>
</entry>

@ -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);

@ -231,9 +231,6 @@
<entry name="GLLegacy" type="Bool">
<default>false</default>
</entry>
<entry name="XRenderSmoothScale" type="Bool">
<default>false</default>
</entry>
<entry name="HiddenPreviews" type="Int">
<default>5</default>
<min>4</min>

@ -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}

@ -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

@ -12,9 +12,6 @@
#include "kwineffects.h"
#include "config-kwin.h"
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "kwinxrenderutils.h"
#endif
#include <QVariant>
#include <QTimeLine>
@ -28,10 +25,6 @@
#include <KWaylandServer/surface_interface.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/xfixes.h>
#endif
#if defined(__SSE2__)
# include <emmintrin.h>
#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();
}

@ -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.
*

@ -37,7 +37,7 @@ enum CompositingType {
* use EffectsHandler::isOpenGLCompositing().
*/
OpenGLCompositing = 1,
XRenderCompositing = 1<<1,
/* XRenderCompositing = 1<<1, */
QPainterCompositing = 1<< 2,
OpenGL2Compositing = 1<<3 | OpenGLCompositing,
};

@ -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 {

@ -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);

@ -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;

@ -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);

@ -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<AbstractOutput*>
{
@ -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;

@ -1,5 +1,2 @@
add_subdirectory(qpainter)
add_subdirectory(opengl)
if (KWIN_BUILD_XRENDER_COMPOSITING)
add_subdirectory(xrender)
endif()

@ -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})

@ -1,59 +0,0 @@
/*
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "platformxrendersurfacetexture_x11.h"
#include "main.h"
#include "surfaceitem_x11.h"
#include <kwinxrenderutils.h>
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

@ -1,32 +0,0 @@
/*
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "surfaceitem_x11.h"
#include <xcb/render.h>
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

@ -1,78 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
SPDX-FileCopyrightText: 2009 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
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

@ -1,103 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QRegion>
#include <QSize>
#include <xcb/render.h>
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

@ -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()

@ -12,9 +12,6 @@
#include "edge.h"
#include "session.h"
#include "windowselector.h"
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "x11xrenderbackend.h"
#endif
#include <config-kwin.h>
#include <kwinconfig.h>
#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("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"
"This was most likely due to a driver bug."
"<p>If you think that you have meanwhile upgraded to a stable driver,<br>"
"you can reset this protection but <b>be aware that this might result in an immediate crash!</b></p>"
"<p>Alternatively, you might want to use the XRender backend instead.</p>");
"you can reset this protection but <b>be aware that this might result in an immediate crash!</b></p>");
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<CompositingType> X11StandalonePlatform::supportedCompositors() const
QVector<CompositingType> compositors;
#if HAVE_EPOXY_GLX
compositors << OpenGLCompositing;
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
compositors << XRenderCompositing;
#endif
compositors << NoCompositing;
return compositors;

@ -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;

@ -1,153 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
SPDX-FileCopyrightText: 2009 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
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<xcb_get_window_attributes_reply_t> 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

@ -1,48 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
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<OverlayWindow> m_overlayWindow;
xcb_render_picture_t m_front;
xcb_render_pictformat_t m_format;
};
} // namespace KWin

@ -1,5 +1,2 @@
add_subdirectory(opengl)
add_subdirectory(qpainter)
if (KWIN_BUILD_XRENDER_COMPOSITING)
add_subdirectory(xrender)
endif()

@ -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";
}

@ -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/
)

File diff suppressed because it is too large Load Diff

@ -1,208 +0,0 @@
/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
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<Toplevel *> &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 &region) override;
void paintGenericScreen(int mask, const ScreenPaintData &data) override;
void paintDesktop(int desktop, int mask, const QRegion &region, ScreenPaintData &data) override;
void paintCursor(const QRegion &region) override;
void paintEffectQuickView(EffectQuickView *w) override;
private:
explicit SceneXrender(XRenderBackend *backend, QObject *parent = nullptr);
static ScreenPaintData screen_paint;
class Window;
QScopedPointer<XRenderBackend> m_backend;
};
class SceneXrender::Window : public Scene::Window
{
Q_OBJECT
public:
Window(Toplevel* c, SceneXrender *scene);
~Window() override;
void performPaint(int mask, const QRegion &region, 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 &region) 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 &region, 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 <wilderkde@gmail.org>
*/
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 &region) 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

@ -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"
}
}

@ -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;

@ -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;

@ -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"));

Loading…
Cancel
Save