Summary:
The addition of the test infrastructure is motivated by the regressions
caused by adding mode switching and transformation support.
A contributing factor to these regression is the fact that the DRM
platform does not have any tests. It is difficult to test this code as
it needs to work with hardware, thus we cannot use the real DRM library.
Instead we need to use mocking.
This change sets up some first basic tests with the help of a mockDrm
library. In order to better test the code as units the Drm classes are
slightly refactored. Most importantly the dependency to DrmBackend is
removed wherever possible and replaced by a simple int fd which is mostly
the only element used by the classes.
This first test introduces basic testing of a DrmObject. It is intended
to extend this to at least also test DrmPlane as a central piece of our
Drm platform plugin. This will also extend the tests of DrmObject.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D8776
Summary:
We need to keep the DrmOutput object to still have the
WaylandOutputDevice.
Screens currently start off enabled as before.
In order to keep KWin to have a correct index based list of screens we
need to store a second vector of currently enabled outputs for the
screens interface.
Test Plan:
Had dual screens.
Disabled/Enabled each one through the kscreen KCM
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: ngraham, luebking, broulik, graesslin, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8796
Mesa's glXChooseFBConfig will not return any sRGB capable fbconfig when it
is not explicitly asked for. On some systems, the only ARGB32 visual is
paired with an sRGB capable fbconfig, so application windows using ARGB32
visuals would fail to display.
BUG: 387159
FIXED-IN: 5.11.4
Summary:
The takeDevice method calls dup, but that syscall removes the O_CLOEXEC flag
as a side-effect. This resulted in all child processes of kwin_wayland having
an open file descriptor for those devices.
Test Plan:
Looked at the open FDs of the startplasma script. Before, all
/dev/input/eventX files and /dev/dri/card0 were open. Now, none of those
are part of /proc/PID/fd/
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D8887
Summary:
In some cases, it's possible that libinput wrote device added events to
the file descriptor before the connection to handle those events was
in-place. This resulted in a compositor without any input devices.
Test Plan:
Ran a wayland session. In about 60% of all cases, no input was
possible. kwin_libinput showed the enumeration of all devices correctly,
but KWin::LibInput::Context did not have any m_devices.
After this change, this did not appear anymore.
Reviewers: #plasma, graesslin, davidedmundson
Reviewed By: #plasma, graesslin, davidedmundson
Subscribers: anthonyfieroni, ngraham, kwin, #kwin, plasma-devel
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8888
Summary: Fixes the build with D8705
Test Plan: Just adds includes, I wonder if it should go into Plasma/5.8 and /5.11 too
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: graesslin, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8706
Summary:
Commit 5d9027b110 introduced a regression in TabBox by using the generic
framework inside KWin to test for same application. What I did not
consider was that the code in TabBox was "broken by design". It didn't
use the generic check as that is too strict and considers windows from
different processes as not belonging to the same application. But this
is not wanted in the case of TabBox.
On the other hand the change itself is an improvement to also support
Wayland in a better way and not have special handling situations. Thus
just reverting would not help.
Instead this change addresses the problem by extending the internal API
and to allow more adjustements. So far there was already an
"active_hack" boolean flag. This is extended to proper flags with an
additional flag to allow cross application checks.
The checks in Client which would filter out different applications check
for this flag and are skipped if set. In addition ShellClient also adds
support for this flag and compares for the desktop file name.
Thus we get in TabBox the same behavior as before with the advantage of
having a better shared code base working on both X11 and Wayland.
BUG: 386043
FIXED-IN: 5.11.4
Test Plan:
Started two kwrite processes on X11, clicked new in one of them,
used Alt+` and verified that there are three windows shown.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8661
Summary:
This is a tiny refactor so that DrmOutput can have WaylandOutput
dynamically
deleted and recreated at runtime as we disable outptuts.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8794
Summary:
con->setOutput and crtc->setOutput is called in Output::~Output so this
is doing it twice redundantly.
More importantly Output::~Output calls crtc->blank(), which means we
need a valid CRTC object there.
Test Plan: Compiles
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: bshah, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8779
Summary:
On X11 modifier+mouse button on the window decoration triggers the
"special" handling thus as unrestricted move instead of passing the click
to the decoration. Of course on Wayland we want to have the same
functionality.
BUG: 386708
FIXED-IN: 5.11.4
Test Plan: New test case added. PointerInputTest still passes.
Reviewers: #kwin, #plasma, broulik
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8758
Summary:
So far ShellClient did not support that the user can set a window to
fullscreen. This was omitted in the initial implementation as WlShell
doesn't support passing the state back to the surface.
With XdgShell this problem doesn't exist any more and we can implement
it. The implementation is mostly based on the one for Client and
adjusted for the Wayland world.
Test Plan:
New test cases and manual testing (send kate and kwrite to
fullscreen through alt+f3 menu)
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8169
Summary: So far only updated the Clients, now also ShellClient.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8095
Summary:
The AMS code accesses elements in a vector which might not be valid. This
change refactors the code to be more robust, especially the DrmPlane,
which started to crash after adding transformation support.
BUG: 386490
Reviewers: #kwin, #plasma, fvogt, subdiff
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8752
Summary:
This change introduces an OrientationSensor class which wraps a
QOrientationSensor. The OrientationSensor is hold by Screens and gets
enabled if Screens knows about an internal (e.g. LVDS) display which
supports rotation. In addition the OrientationSensor holds an KSni to
enable/disable the automatic rotation support.
The drm platform plugin is adjusted to make use of the OrientationSensor.
The API is defined in a way that this can also be implemented on other
platforms supporting rotation. Most important are hwcomposer and X11
standalone. The latter should be straight forward as rotation is provided
through XRandR. The former needs addition for rotation support first.
Test Plan: Rotated my Yoga 12
Reviewers: #kwin, #plasma, sebas
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D8699
Summary:
The idea behind getting the supported transformations is to tell KScreen
which transformations are actually supported and thus not even allow the
user select a setting which is not supported.
Reviewers: #kwin, #plasma, subdiff
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8645
Summary:
While KWin gained support for changing modes it did not yet forward it
to the Wayland OutputInterface. This change implements this missing todo
by finding the matching mode and marking it as current.
Test Plan: Run kinfocenter to verify the current mode is properly set.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8578
Summary: Mostly so DRM can report if it has AMS or not
Test Plan:
Ran on my DRM setup, printed debug.
Spawned nested compositor, printed debug on that
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8702
Summary:
This change fixes the hotspot calculation by introducing a dedicated
matrix to map the hotspot.
To better test the hotspot a small test application is added. The app
renders a red point at the cursor position and uses a cross for cursor
with the hotspot position being transparent. So if KWin renders the
cursor at the correct position a red point is visible in the center of
the cross. The test app supports several cursor hotspot positions:
* center (default)
* top left
* top right
* bottom right
* bottom left
To switch between the variants press the space key.
Test Plan:
Rotated screen, used test app to verify the hotspot is
correct. Also scaled display, still correct
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8668
Summary:
So far all outputs shared the same dumb buffer for the cursor image.
This doesn't work any more when screen rotation is enabled. For rotated
screens the cursor image per output is different. On some it might be
rotated, on some not.
To solve this problem the dumb buffers are moved from the DrmBackend to
the DrmOutput. The DrmOutput now creates the cursor images itself and
can rotate them if needed. Thus we get nicely transformed cursors.
Test Plan: Rotated screens, moved cursor around, image properly rotated
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8664
Summary:
If KWin/Wayland starts up with the QPainter compositor we force software
rendering in QtQuick. It doesn't make sense to try to use the OpenGL
renderer as that normally just results in an abort when trying to create
the QOpenGLContext.
Test Plan:
Run KWin with KWIN_COMPOSE=Q, tried to quick tile a window and
used Alt+Tab. Worked fine, didn't crash anymore.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8663
Summary:
This is meant to address Bug 372114. The problem here is that the KConfig
object (and its derivatives), that the freeze detection thread needs to
record the freeze, are not thread safe. When it happens that the main
thread is in fact not frozen, it is possible that the two stomp on each
other's KConfig object.
The solution applied here is to use the KSharedConfig::openConfig
function, which is thread safe, on the freeze detection thread. As was
mentioned by Martin Flöser in the discussion, the thread needs to obey
the name of the main config file of KWin, which can change in the future.
As a secondary issue, this patch also turns off KCrash reporting for
aborts due to a freeze being detected. IMO it is not very user friendly
to still show a crash report to the user, even after this bug is fixed,
for the deliberate SIGABRT. Maybe a less intrusive notification could be
used to tell the user why effects are suddenly disabled?
I've been using kwin with this change for several weeks now and it makes
the restarts of kwin due to freezes unobtrusive. However, most (I would
say almost all) of these freezes are actually instances where the system
is being slow after eg. screen resolution is changed.
BUG: 372114
FIXED-IN: 5.11.3
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: ngraham, graesslin, anthonyfieroni, cfeck, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8356
Summary:
This change refactors the way how the cursor position on a screen is
calculated. It is changed to a matrix multiplication with the
adjustments for the rotated screen just being additional steps added to
the matrix.
With this calculation I got correct positions for all variants of
scaled, rotated and differently positioned outputs.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8627
Summary:
When KWin successfully presents a new mode, it stores the current state
as the last working mode. If a new modeset is requested and the atomic
test fails, all is undone and reverted to this last knowing mode.
Currently included are:
* the mode
* global position
* transformation
This is only done on a modeset not when going to DPMS.
Test Plan:
Selected the not working vertical rotation and nothing bad
happened.
Reviewers: #kwin, #plasma, subdiff
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8602
Summary:
This change hooks up the drm plane rotate with the rotation requests
from KScreen. Our requests support more than what KScreen exposes in the
UI, that is all the flipped variants. I do not really understand what
the flip means, so this is not implemented yet.
Furthermore this only implements the visual rotation and not the input
rotation. This means mouse movement and touch input is currently broken
on a rotated screen.
Please note that the hardware I used seems to not support the vertical
rotation. I'm not sure whether my code works. On my system it just
results in atomic commit errors and we need to go back to a previous
working state. This is not yet implemented. I need to test the vertical
rotation on my notebook, which should (in theory) support it.
Reviewers: #kwin, #plasma, subdiff, sebas
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8594
Summary:
A preparation step to support rotation of outputs. The idea is to rotate
using DRM directly and not add it to the compositors. With this change
and a small hack to try it, I was able to rotate the screen.
Reviewers: #kwin, #plasma, subdiff
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8582
Summary:
Under wayland we support high DPI putting by putting a separation
between the logical co-ordinate system and the resolution of rendered
assets.
When a window is on a high DPI screen, we should render at the higher
resolution.
Like the window scaling this handles any combination of a 2x scaled
decoration being rendered on a 1x screen or vice versa.
---
This patch is a bit different from the other scaling stuff. We have to
generate the quads *before* we have an updated texture with the new
scale. This means the scale isn't attached to the buffer like elsewhere.
That's why I added a property in TopLevel so there's still one canonical
source and things can't get out of sync.
BUG: 384765
Test Plan:
Crystal clear breeze and oxygen decos on my @2x display
Drag windows to attached @1x display, things still look OK when across 2
screens
Changing the scale of a screen updated the decos instantly
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8600
Summary:
Loads settings on whether QtQuick uses GL or software rendering
Aurorae needed a fix. The rest "just works" with up-to-date plasma framework.
Test Plan:
Alt tabbed
Showed an OSD
Grepped kwin's QML for any custom shaders.
(which is the only part that doesn't work here)
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8040
Summary:
For software QtQuick rendering we want to create a pixmap buffer and
render our contents in there.
m_rendercontrol->grab does this, but also covers the GL side in pretty
much the same way that we were currently doing.
In doing so I found a bug in Qt, that's submitted upstream, and also worked round.
Test Plan:
Tested with forced software mode, could see an Aurorae decorations
Tested without (so normal code), could see an Aurorae decorations
Tested wayland on nvidia with software rendering, didn't freeze
Whether we then end up using GL, painter or xrender rendering is irrelevant
(but I tested two of them anyway)
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: graesslin, apol, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8039