Commit Graph

775 Commits (master)

Author SHA1 Message Date
Aleix Pol 13dcb46888 Remove unnecessary allocation in GLShader::setUniform(int, const QMatrix4x4 &)
We were creating a vector just to copy it over. We can pass the original
vector just as well.
2020-09-23 10:05:29 +00:00
Aleix Pol 26950a65a6 Have Toplevel::damage emit a QRegion
Instead of looping through the rects in the region, emit the region at
bulk. It reduces the amount of emissions we do and allows us to pack the
response accordingly.
2020-09-22 14:45:08 +02:00
Vlad Zahorodnii 79c667ea67 libkwineffects: Bump API version
The API version must be bumped because a new virtual method in the
EffectWindow class had been introduced that breaks BC.
2020-09-18 12:02:46 +03:00
Aleix Pol 651b0df30c Make WindowQuadList a QVector
In my last profiling session I did see a lot of WindowQuadList creation
cost. We know QList is a bit more expensive, so let's just use QVector.
2020-09-15 16:01:14 +00:00
Aleix Pol 474060a456 Improve loop implementations in WindowQuadList
Prefer for() to foreach(), as the latter is deprecated.
Prefer iterating QList using the iteration_expression for() loops,
rather than doing it by index.
2020-09-14 02:19:18 +00:00
Adrien Faveraux 788c65d260 Fix Build Warning 2020-08-26 19:24:02 +02:00
Vlad Zahorodnii 0dda9dc7d0 Use namespace kwin only in autotests
In kwin core, we prefer not to put `using namespace KWin` because it
makes defining forward declared classes more trickier.
2020-08-21 22:06:36 +00:00
David Redondo 2a9971fa08 Disable AnimationEffects when the screen is locked
BUG:425157
2020-08-10 09:34:15 +00:00
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Vlad Zahorodnii e7d02ad355 Introduce X11 default screen property in Application
This spares unnecessary looping through all available X11 screens.
2020-08-05 08:48:00 +00:00
Vlad Zahorodnii 19ad172584 Survive Xwayland crashes
If the Xwayland process crashes, it will bring down the entire session
together with itself. Obviously, we don't want that. At least, Wayland
clients should survive the crash.

This change refactors relevant X11 parts to handle Xwayland crashes in a
less fatal way.

In order to handle Xwayland crashes better, a pair of start() and stop()
methods had been introduced in the Xwayland class to allow starting and
stopping the Xwayland process at any moment.

If we detect that the Xwayland process has crashed, we will immediately
stop the Xwayland server, which in its turn will deactivate the socket
notifier and destroy all connected X11 clients. Unfortunately, a couple
of subtle changes in X11Client::releaseWindow() and Unmanaged::release()
had to be made to ensure that we are left with a valid state after the
Xwayland server has been stopped.
2020-08-05 08:48:00 +00:00
Niccolò Venerandi e41c5af676 Expose transientFor and only blur underneath when transientParent is dock 2020-08-02 10:25:28 +00:00
Aleix Pol 38eb72efe3 screencasting: integrate zkde_screencast_unstable_v1
Includes a PipeWire implementation that will send the relevant streams
to the processes that need them.
2020-07-23 13:14:22 +02:00
Aleix Pol 29a2b2a355 Make it possible to specify KWin::GLTexture mutability
Some features will rely on it and complain that GLTexture decided to use
glTexStorage
2020-07-23 13:14:22 +02:00
Aleix Pol ff65bec92c Introduce a GLTexture::toImage helper class 2020-07-23 13:14:22 +02:00
Aleix Pol e459c8bf54 No need to recalculate the matrix if yInverted doesn't change 2020-06-23 14:58:48 +02:00
Vlad Zahorodnii cb7a9456c0 [wayland] Rework Xcursor theme loading code
Currently in order to load an Xcursor theme, kwin uses libwayland api,
which looks really awkward because of the way how the compositor talks
to itself via the internal connection.

The main motivation behind this change is to limit the usage of kwayland
client api in kwin.
2020-06-18 07:14:58 +00:00
Aleix Pol 3a9d7a6e9d Port KWin to KWaylandServer
Summary: Away from KWayland::Server and KF5WaylandServer.

Test Plan: Builds, ran nested session

Reviewers: #kwin, #plasma, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, #plasma, davidedmundson, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29278
2020-04-30 12:56:08 +02:00
Vlad Zahorodnii a848490cae Revert "More for Qt 5.12"
This reverts commit 3e9f33bb3e.

Differential Revision: https://phabricator.kde.org/D29147
2020-04-24 10:19:17 +03:00
Méven Car 66898e7f46 Wayland: Allow to take single screen screenshots using scale factor without loss
Summary:
The screenshot made on screens with scale factor were downscaled by their scale factor making them blurry.
It prevents taking screenshots of missing Hidpi related bugs showing the issues under Wayland.

This fix the case of a single screenshot, but not the rest:
Multiscreen screenshot downscales the screen using scale factor.
Spectacle rectangular selection screenshot is broken as soon as some scale factor different than 1 is used on any screen.

Test Plan:
Under Wayland with a scale factor on a screen, take a screenshot using spectacle.
The output image is not downscaled and has the same size as the screen resolution.

No other change to any other screenshot mode, or under X.

Reviewers: davidedmundson, #kwin

Reviewed By: davidedmundson, #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29010
2020-04-20 16:12:26 +02:00
Vlad Zahorodnii 9755ef20e5 [kwineffects] Port GLPlatform to QRegularExpression
Test Plan: kwinglplatformtest still passes.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28320
2020-03-30 16:00:46 +03:00
Vlad Zahorodnii bdd6882767 [kwineffects] Drop KWIN_GL_DEBUG
Summary:
It has been broken for many years and no one has filed bug
reports about it (besides me).

BUG: 419285

Test Plan: Ran kwin with KWIN_GL_DEBUG and it still works.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28332
2020-03-27 12:29:24 +02:00
Aleix Pol 3e9f33bb3e More for Qt 5.12 2020-03-17 15:37:01 +01:00
Aleix Pol cca0e15b45 Fix compiler warnings
Summary: No need to keep them around for no reason.

Test Plan: Tested the plugins I thought could be affected. Have been using it for a couple of days without problems

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28062
2020-03-17 15:07:52 +01:00
Niccol Venerandi f9394d83f7 Move from Quad to Cubic
Summary: See https://invent.kde.org/websites/hig-kde-org/-/merge_requests/70

Reviewers: #kwin, ngraham

Reviewed By: ngraham

Subscribers: ngraham, zzag, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27827
2020-03-04 19:40:35 +01:00
Roman Gilg 9c398de683 [libkwineffects] Set original backend framebuffer for render targets
Summary:
KWin only renders into the default framebuffer, which is for example an EGL
surface.

To prepare a post-processing step with a different framebuffer allow the
framebuffer to be changable. For that KWin's current framebuffer must be
communicated to the GLRenderTarget class, which otherwise does not set it back
to KWin's current one when a render target is disabled again.

Test Plan: Compiles, with other patches for Gl based screen rotation

Reviewers: #kwin

Subscribers: fredrik, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25904
2020-02-28 12:22:42 +00:00
Vlad Zahorodnii 00f4f88f65 Expose frameGeometryChanged signal to effects
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26864
2020-02-12 10:52:26 +02:00
Vlad Zahorodnii dd96e444dd Merge branch 'Plasma/5.18' 2020-02-11 19:56:29 +02:00
Vlad Zahorodnii b94a78c47d [libkwineffects] Detect more AMD GPUs with GFX9 (Vega) chips
Summary: ASIC family names are taken from Mesa's source code.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27176
2020-02-11 19:56:18 +02:00
Vlad Zahorodnii 90489bde27 Merge branch 'Plasma/5.18' 2020-02-05 22:28:40 +02:00
Vlad Zahorodnii ab9a9c8428 [libkwineffects] Detect AMD Navi GPUs
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27168
2020-02-05 22:27:15 +02:00
David Edmundson 8cedb797f9 Port DesktopGrid QtQuickWindow to EffectQuickView
Summary:
Lots of red, does the same thing in a simplified way avoiding creating a
real window and having to hack round it.

Test Plan: Click add and remove, remove button disables appropriately

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: meven, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26381
2020-01-22 13:16:45 +00:00
Vlad Zahorodnii 55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
David Edmundson d1cfcf4c97 Avoid texture bleed rendering X11 window
Summary:
We currently see a gap on transformed windows between the window and the
top decoration.

This is partly the atlas bleed on the decoration, and partly a bleed on
the window content itself.

On X11, the window we composite is the frame window - which is a larger
texture containing a transparent border where the frame normally would
be. When we sample with a linear filter we include these texels. Hence
GL_CLAMP_TO_EDGE doesn't work.

Vlad's patch to composite the correct window, not the frame was my
preferred approach, but we had to revert it as it caused an issue with
xwayland :(

Half pixel correction nearly worked, but caused blurry fonts.

This patch resolves it in the fragment shader used by effects doing
transforms. We pass the real texture geometry of the window to the
client with a half pixel correction. Any samples outside the outer half
pixel are then clamped within bounds.

Arguably a hack, but solves the problem in a comparatively
non-invasive way.

BUG: 360549
BUG: 257566

Test Plan:
X11:
Using Vlad's atlas padding for decoration
Slowed animations, wobbled a dark window over a light background
No artifacts

Wayland:
This isn't needed. Now tested that everything still renders the same.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, jgrulich, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25737
2020-01-09 13:03:48 +00:00
Laurent Montel d3cbacd451 convert endl to \n (in qt5.15 it's Qt:: namespaced) 2019-12-31 07:44:21 +01:00
Vlad Zahorodnii 28b3b8f0d0 [libkwineffects] Expose frame and buffer geometry to effects
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T10867

Differential Revision: https://phabricator.kde.org/D24459
2019-11-27 14:12:30 +02:00
Yuri Chornoivan a853e3370a Fix minor typos 2019-11-26 19:48:29 +02:00
Vlad Zahorodnii 639441f10b Merge branch 'Plasma/5.17' 2019-11-18 12:27:17 +02:00
Vlad Zahorodnii 270009ed6a Merge branch 'Plasma/5.12' into Plasma/5.17 2019-11-18 12:26:21 +02:00
Vlad Zahorodnii 1d362d38fd [libkwineffects] Restore GL_DRAW_FRAMEBUFFER binding in GLTexture::clear
Summary:
If an effect renders a window into an offscreen texture, it's very important
that the window ends up in the offscreen render target rather than the default
framebuffer object. However, that might be not the case if the OpenGL
decoration renderer needs to create a texture atlas since the renderer calls
GLTexture::clear() method, which might clobber the current GL_DRAW_FRAMEBUFFER
binding.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25365
2019-11-18 12:25:14 +02:00
David Edmundson aedc9e62e6 [effects] Forward wheel events
Summary:
Effects::checkInputWindowEvent(QWheelEvent *e) existed but it was not
hooked up to anything and would never be called.

This patch adds the relevant handling in the wayland filter, X filter so
the existing method gets called.

EffectQuickView is updated to handle wheel events.

Test Plan:
Used a ListView via an EffectQuickView in an effect.
I can now scroll with the mouse.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25292
2019-11-14 12:50:45 +00:00
David Edmundson 20a202b11a [libkwineffects] Construct correct mouse event when forwarding to QtQuickView
Summary:
Original code (copied from Aurorae) created a QMouseEvent for
QHoverEvents. Whilst it apparently worked, it's technically wrong.

It's safer to have an explicit type check given we come from a downcast
QEvent* and then build the correct event.

Test Plan: Hovered some icons

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25207
2019-11-14 12:50:29 +00:00
David Edmundson e4ac215fcb [effects] Add effect to hold the desktop window static after plasmashell quits
Summary:
When a plasma session quits, the order of plasmashell and clients quitting is undetermined.

This looks bad as our desktop background disappears quite early. Rather than changing the real order, we can have kwin reference the last pixmap of any desktop and hold on to it.

Lasting till the compositor quits means it stays on the X frontbuffer till X quits and the experience is seamless.

Test Plan: Logged out (with relevant other ksmserver patches)

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24864
2019-11-01 17:14:55 +00:00
David Edmundson ec610fd7ed Port one of session management connections state to a custom API
Summary:
Currently kwin opens a second ICE connection to ksmserver in order to
tell the state of kwin's whether we're logging out and saving clients or
not.

This requires that kwin launches after ksmserver to have the connection
which is a dependency I want to break.

Practically this code is already ksmserver specific as it relies on some
custom code that sends the first saveState request to kwin first.

Instead we can replace it with a bespoke IPC over DBus and siplify the
code both end. This will allow several other future enhancements that we
want with regards to handling the session state, as well as make an
effort platform agnostic session management, as well as cleaning up some
complex code.

Ksmserver calls into kwin, rather than having kwin watch ksmserver state
to allow us make sure it's race free.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: romangg, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24862
2019-11-01 17:14:42 +00:00
Albert Astals Cid e144748c7a Add some const &
Summary:
Won't make things go much faster since everything that was
being passed by value is refcounted but still const & is a bit faster
than refcounting

For shared pointers instead of adding const & we move them into the
destination variable saving some cpu usage but at the same time making
clear the pointer is being stored by not being const &

Reviewers: zzag

Reviewed By: zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25022
2019-10-30 19:23:01 +01:00
Martin Flöser 92197242ce Add support for virgl in GLPlatform
Summary:
This change adds detection support for virgl (Mesa gallium virtio guest driver).
Results in proper detection in supportInformation and debug console.

Test Plan: Modified test passes, run KWin_Wayland in kvm with virgl and verified supportInformation

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25056
2019-10-29 20:57:02 +01:00
Vlad Zahorodnii f93875535c Update my last name 2019-09-29 17:03:25 +03:00
David Edmundson 40b0296d5c [libkwineffects] Introduce API to easily show a QtQuick scene in an effect
Summary:
EffectQuickView/Scene is a convenient class to render a QtQuick
scenegraph into an effect.

Current methods (such as present windows) involve creating an underlying
platform window which is expensive, causes a headache to filter out
again in the rest of the code, and only works as an overlay.

The new class exposes things more natively to an effect where we don't
mess with real windows, we can perform the painting anywhere in the view
and we don't have issues with hiding/closing.

QtQuick has both software and hardware accelerated modes, and kwin also
has 3 render backends. Every combination is supported.

* When used in OpenGL mode for both, we render into an FBO export the
texture ID then it's up to the effect to render that into a scene.

* When using software QtQuick rendering we blit into an image, upload
that into a KWinGLTexture which serves as an abstraction layer and
render that into the scene.

* When using GL for QtQuick and XRender/QPainter in kwin everything is
rendered into the internal FBO, blit and exported as an image.

* When using software rendering for both an image gets passed directly.

Mouse and keyboard events can be forwarded, only if the effect
intercepts them.

The class is meant to be generic enough that we can remove all the
QtQuick code from Aurorae.

The intention is also to replace EffectFrameImpl using this backend and
we can kill all of the EffectFrame code throughout the scenes.

The close button in present windows will also be ported to this,
simplifiying that code base.

Classes that handle the rendering and handling QML are intentionally
split so that in the future we can have a declarative effects API create
overlays from within the same context. Similar to how one can
instantiate windows from a typical QML scene.

Notes:
I don't like how I pass the kwin GL context from the backends into the
effect, but I need something that works with the library separation. It
also currently has wayland problem if I create a QOpenGLContext before
the QPA is set up with a scene - but I don't have anything better?

I know for the EffectFrame we need an API to push things through the
effects stack to handle blur/invert etc. Will deal with that when we
port the EffectFrame.

Test Plan: Used in an effect

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24215
2019-09-27 16:11:05 +01:00
Kai Uwe Broulik 321e17ab68 [EffectWindow] Expose PID to effects
Differential Revision: https://phabricator.kde.org/D24222
2019-09-26 14:54:33 +02:00