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:
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:
- Actually use double layered compositing, previously both layers were
of type HWC_FRAMEBUFFER, instead of 2nd layer being
HWC_FRAMEBUFFER_TARGET. Thanks to @NotKit on telegram for pointing this
out.
- Use sourceCropf instead of sourceCrop, as sourceCrop is legacy option.
Test Plan: have to test on actual device, but test_hwcomposer does have similar code.
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8587
Summary:
This change hooks up the bits for changing the mode when a request to
change mode from kscreen is received. This includes:
* setting new mode in DrmOutput
* creating new buffers in SceneQPainter backend
* creating new GbmSurface in SceneOpenGL backend
Room for improvement:
* detect whether the new mode works and go back to old one if it fails
Test Plan:
Started both a QPainter/OpenGL session. Used kcmshell5 kscreen
to modify the resolution. Saw that it got applied, maximized a window to
verify it's correct. Changed back to original resolution. Verified it looked
good by maximizing a window.
Reviewers: #kwin, #plasma, subdiff, sebas
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8398
Summary:
We want to translate by the monitor position, so that needs to be
the negative of the position.
But Kwin/KScreen treats 0 as the top of all monitors. GL treats 0 as
bottom, so that all needs inverting.
Hence this should be a positive y value for the viewport.
BUG: 386099
BUG: 385655
Test Plan:
Had two monitors
Side by side was - fine
Stacked vertically - still fine
Modded X code to extend in y instead of x.
3 monitors worked fine.
Nested wayland only seems to support one screen?
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8479
Summary:
there is no need for createOutput to be static, make it non-static,
this also fixes the build failure introduced in commit
02d3daf28a.
Test Plan: builds
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8430
Summary:
On Wayland we have the sync disabled as it doesn't work properly. This
allows us to also move the sync event handling into the X11 standalone
platform.
The code is slightly refactored: instead of passing the event to each
Client, we search for the matching Client. For that the SyncAlaram struct
is added to public section of Client. The method to handle the sync
doesn't need the event any more and is moved from events.cpp to
client.cpp.
Test Plan:
Run Xephyr+kwin_x11, resized a window and verified through
gdb breakpoint that the sync still works
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D7942
Summary:
Allows to share the implementation in a better way and is a requirement
to get the Screen implementation in the QPA plugin to be based on
KWin::Screens instead of KWayland::Output.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8344
Summary:
So far KWin does not know which Compositors the platform actually
supports. This results in KWin happily trying to use the OpenGL
compositor on fbdev or the QPainter compositor on hwcomposer although
that is obviously going to fail as the platform doesn't support this.
By adding a pure virtual method all Platforms can define what they
support. In a later step the Compositor can use this to create an
appropriate scene and also perform proper fallback handling in case the
scene creation fails.
Test Plan: Compiles
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8316
Summary:
The Platform API is extended by a call to create the EffectsHandler. In
X11 standalone Platform a new EffectsHandlerImplX11 is added which
contains the X11 only parts of the EffectsHandler, such as grabbing the
X keyboard and the X11 mouse interception window.
The EffectsHandlerImpl gains some virtual methods for the parts which
are now done in the X11 specific implementation. In return we get rid of
lots of if-else structures checking for the operation mode.
Test Plan: Only compile tested.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7955
Summary:
In 47343fb we made GBM buffer shared.
What we wanted to do was:
Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
Call the gbm_surface*() on that operator
Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT
What we did:
Cast the std::shared_ptr<GBMSurface> to a gbm_surface* then cast that
to void*.
This is just a garbage value and it crashes in Mesa when we do our first
paint.
I've replaced that with an explicit method then we can use shared_ptr's
-> operator rather than get() which does the right thing in a readable
way.
Test Plan:
It crashed after rebasing to master (for Aleix too)
No longer crashes
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8251
Summary:
In 47343fb we made GBM buffer shared.
What we wanted to do was:
Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
Call the gbm_surface*() on that operator
Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT
What we did:
Cast the std::shared_ptr<GBMSurface> to a gbm_surface* then cast that
to void*.
This is just a garbage value and it crashes in Mesa when we do our first
paint.
I've replaced that with an explicit method then we can use shared_ptr's
-> operator rather than get() which does the right thing in a readable
way.
Test Plan:
It crashed after rebasing to master (for Aleix too)
No longer crashes
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8251
Summary:
The gbm_surface is owned by the EglGbmBackend, but it's not the only one
using it. The DrmSurfaceBuffer is also using it and needs it to destroy
the gbm_bo. Now this can become a problem in the following situation:
* a page flip is still pending
* the EglGbmBackend destroys the gbm_surface
-> when the page flip happens the DrmSurfaceBuffer will try to destroy
the gbm_bo and crash as the gbm_surface is no longer valid. This
situation can happen when switching screens or when switching compositing
backend (OpenGL 2 -> OpenGL 3).
To address this problem a class GbmSurface is added which wrapps the
gbm_surface pointer. The EglGbmBackend creates and holds a shared pointer
to the GbmSurface and passes that one to the DrmSurfaceBuffer. So when
cleaning up the gbm_surface only the shared pointer is reset and in case
the DrmSurfaceBuffer still needs it, it can access it without problems.
BUG: 385372
FIXED-IN: 5.11.0
Test Plan: Not yet
Reviewers: #kwin, #plasma, subdiff
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8152
Summary:
Unfortunately a rather large change which required more refactoring than
initially expected. The main problem was that some parts needed to go
into platformsupport so that the platform plugins can link them. Due to
the rather monolithic nature of scene_opengl.h a few changes were
required:
* SceneOpenGL::Texture -> SceneOpenGLTexture
* SceneOpenGL::TexturePrivate -> SceneOpenGLTexturePrivate
* texture based code into dedicated files
* SwapProfiler code into dedicated files
* SwapProfiler only used in x11 variants
* Safety checks for OpenGL scene moved into the new plugin
* signal declared in SceneOpenGL moved to Scene, so that we don't need
to include SceneOpenGL in composite
Test Plan: Nested OpenGL compositor works
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7740
Summary:
A dedicated X11EventFilter is added and created from the X11Cursor in
case we have XFixes. This means some more X11 specific code is now only
on X11.
Test Plan: Only compile tested.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7843
If the system has a virtual device and KWin is run on virtual platform
we can assume the user intended that KWin should use the virtual device
and not a render node of the system.
This might fix the random test failures on build.kde.org (T6546).
Summary:
Only needed for kwin_x11 variant (required for the non-composited
Outline). As that's nowadays in the x11 platform, we can move the
complete XRenderUtils support into the platform. Thus KWin core does
no longer require to link it.
Test Plan: Compiles
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7760
Summary:
After changing the output configuration, the client expects that it is informed
whether or not a new configuration has been applied (or failed). This was ommitted
so far, meaning that clients wouldn't know what happened in kwin.
Since we don't track if a setting failed yet, send the applied() signal regardless.
CCBUG:384733
Test Plan: Verified that the signal arrived in libkscreen after changing scale of an output
Reviewers: graesslin, davidedmundson
Reviewed By: davidedmundson
Subscribers: kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7910
Summary:
In the DRM plugin the cursor is currently is drawn at the native size
given.
Therefore we don't want to scale the icon offset as that leads to it
being drawn every so slightly off-sync.
BUG: 384769
Fixed-in: 5.11.0
Test Plan:
Kate now selects lines based on the middle of the cursor, not the top left.
I'd previously gotten so used to it, I hadn't realised it was actually a bug :/
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7868
No idea why the code compiles on my system. This change is based on the
output on build.kde.org.
CMakeFiles/testXRandRScreens.dir/__/plugins/platforms/x11/standalone/screens_xrandr.cpp.o:
In function `KWin::XRandRScreens::event(xcb_generic_event_t*)':
/home/jenkins/workspace/Plasma kwin kf5-qt5 SUSEQt5.9/plugins/platforms/x11/standalone/screens_xrandr.cpp:210:
undefined reference to `KWin::Options::currentRefreshRate()'
...
Summary:
The code in events.cpp was problematic as it was called in a Wayland
session. So KWin changed outputs, this gets mirrored to XWayland and
then KWin reacted on the XRandR event and might have even changed the
refresh rate due to that - bad idea.
This change moves the code into the already existing X11EventFilter for
XRandR events in XRandRScreens.
Test Plan: Run kwin_x11 in gdb on Xephyr, breakpoint in new code and triggered XRandR event
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7654
Summary:
Several of the subclasses are already derived from QObject.
The main reason is that the class should be moved out of KWin core in
order to move the OpenGL scene into a plugin. As Compositor calls into
the AbstractEglBackend to unbind the wayland display this creates a
problem which is easily solved by turning the AbstractEglBackend into a
QObject and connect to the signal emitted by the Compositor.
Test Plan: Compiles
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7669
Summary:
By moving the functionality into the Platform API we can also implement
support on other platforms which support this in general (e.g. DRM once
Roman's color adjustment patches landed).
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D7447
Summary:
Not needed except for X11/non-composited usage, so should be in the
plugin instead of core.
Platform API is extended to create a decoration renderer.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D7444
This change is similar to D7232 and moves the scene_qpainter into a
dedicated plugin. Compared to the XRender case it's more complicated as
the platform plugins need to implement a platform specific backend.
The base implementation for this part used to be in scene_qpainter. As
the idea is to completly move it away from KWin core it would be point
less to still have the backend definition in KWin core, but it cannot
be in the scene plugin as otherwise all platforms need to link the
plugin.
To solve this a new platformsupport subdirectory is added which contains
the scene platform backend as a static library. For the OpenGL scene such
a static library will also be required.
Test Plan: SceneQPainter test still passes, nested compositor still works
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D7259
Summary:
KWin::displayWidth and KWin::displayHeight are bound to X11 which
doesn't make much sense on X11. In addition KWin internally knows
the overall display dimensions through the Screens singleton class.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D1798