Commit graph

717 commits

Author SHA1 Message Date
Vlad Zahorodnii
be759b7d33 Use AbstractClient instead of XdgShellClient wherever possible
Summary:
Currently, we have only one shell client type - XdgShellClient. We use
it when we are dealing with Wayland clients. But it isn't really a good
idea because we may need to support shell surfaces other than xdg-shell
ones, for example input panel surfaces.

In order to make kwin more extensible, this change replaces all usages
of the XdgShellClient class with the AbstractClient class.

Test Plan: Existing tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27778
2020-03-04 09:57:13 +02:00
Roman Gilg
2c66e1f690 Remove orientation sensor
Summary:
This functionality will instead be implemented in KScreen such that manual and
automatic output rotation can be used and configured through a single UI in
unison together.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin, bshah, davidedmundson, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26036
2020-02-29 09:59:30 +05:30
Roman Gilg
7c70b344f5 [platforms/drm] Fix cursor output rotation
Summary:
The calculation of cursor position and orientation on outputs rotations other
than 0° and 180° was faulty.

This patch fixes both.

Test Plan: In live session cursor looks and moves as expected.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25909
2020-02-28 19:48:43 +05:30
David Edmundson
8ff01fa60c [platforms/drm] Rewrite rotation rendering to use MapTexture
Summary:
The previous code uses a fixed version of GSLS which does not match our suported GL targets. We need both, using kwin's existing MapTexture framework we can achieve the same thing in a better way with less code.

Test Plan:
Had some slight issues with the rotation, but everything appeared the same
as when I applied the patchset with the custom shader.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26371
2020-02-28 12:22:42 +00:00
Roman Gilg
8180662233 [platforms/drm] Introduce Gl post-process output rotations
Summary:
In case the hardware is not able to rotate the output for the configured
rotation value do this rotation in a post-process step.

For that rendering the current view into a separate framebuffer bound to a
texture that then gets sampled to the default framebuffer in an additional
rendering pass through a simple shader rotating it.

This allows us to leave the Effects system and internal model-view-projection
matrix untouched. The rotation in the post-processing step is isolated.

BUG: 389665
FIXED-IN: 5.18

Test Plan: With KScreen all rotations work.

Reviewers: #kwin

Subscribers: davidedmundson, PureTryOut, z3ntu, zzag, univerz, kwin

Tags: #kwin

Maniphest Tasks: T6106

Differential Revision: https://phabricator.kde.org/D25907
2020-02-28 12:22:42 +00:00
Roman Gilg
dfea5798f1 [platforms/drm] Add hardware transformation API
Summary:
Planes might be able to do transformations without compositing required.
When changing the current transform try this with the primary plane. If this
fails fall back to no transformation at all through hardware and communicate
the fact and other information through some getters.

Also adds an environment variable to never do hardware transformations.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25906
2020-02-28 12:22:42 +00:00
Daniel Vrátil
33a1777a5a
Decode full monitor vendor name from EDID using hwdata
Test Plan:
KScreen now shows "Dell Inc." instead of DEL and
"Eizo Nano Corporation" instead of ENC in output names, which
matches closer to what's written on my monitors.

Reviewers: graesslin, davidedmundson, #plasma

Reviewed By: davidedmundson, #plasma

Subscribers: apol, feverfew, ngraham, davidedmundson, mart, kwin, sebas

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D10041
2020-02-26 12:37:11 +01:00
Vlad Zahorodnii
b9cb1d0f1d Merge branch 'Plasma/5.18' 2020-02-21 13:57:14 +02:00
David Edmundson
39798bffb1 [plastik] Disable problematic text hints
Summary:
Use of "style: Text.Raised" combined with UTF-8 emoji characters
currently crashes deep in font rendering code.

A report has been submitted upstream:
https://bugreports.qt.io/browse/QTBUG-82311

Given this crash is surprisingly common, this patch removes the text
shadow. I normally would be against removing features, but this was a
subtle effect anyway and frankly just made things look blurry. I doubt
it'll be missed.

BUG: 417699
BUG: 413179

Test Plan:
Made unit test for the crash in qmlscene
Fixed the issue there

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27488
2020-02-19 08:27:17 +00:00
l10n daemon script
91abcdbcfa SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-02-17 05:51:10 +01:00
l10n daemon script
78c0095a5d SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-02-11 05:59:16 +01:00
Arjen Hiemstra
665bff70e5 Merge branch 'Plasma/5.18' 2020-02-03 12:27:56 +01:00
Arjen Hiemstra
9b3d9e58a4 ScreenEdge: Do not use localtime for measuring duration
Summary:
QDateTime::fromMSecSinceEpoch uses Qt::LocalTime by default. This involves an
expensive localtime conversion. So instead force things to use UTC, as there
is no need for timezone information when tracking durations.

This is especially noticeable on Bedrock Linux, which uses a Fuse mounted
/etc, which is slower than a plain /etc and causes quite some slowdown there.
See https://github.com/bedrocklinux/bedrocklinux-userland/issues/140 for
details.

Test Plan: The screenedge unit test still passes.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: zzag, anthonyfieroni, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27114
2020-02-03 12:26:17 +01:00
Vlad Zahorodnii
74e04949d7 Merge branch 'Plasma/5.18' 2020-01-29 13:11:32 +02:00
Vlad Zahorodnii
35fe3cb6c5 Drop Toplevel::decorationRect()
Summary: It's identical to Toplevel::rect().

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26971
2020-01-29 12:58:54 +02:00
Vlad Zahorodnii
c36a5bf423 Merge branch 'Plasma/5.18' 2020-01-28 22:01:03 +02:00
Vlad Zahorodnii
68ef6bcd7a Rename X11Client::getSyncRequest() to X11Client::syncRequest()
Getter methods should not have "get" prefix.
2020-01-28 21:46:09 +02:00
Vlad Zahorodnii
a073a79a97 Merge branch 'Plasma/5.18' 2020-01-28 18:42:35 +02:00
Vlad Zahorodnii
bd52b6791e Schedule a decoration repaint when client is resized
Summary:
If a client has been resized, it doesn't necessarily mean that the
decoration theme will schedule full repaint of the window frame. In
OpenGL and Xrender scene, we have a little hack that forces a full
repaint of window borders. However, we don't have one in QPainter
scene which causes all sorts of weird looking artifacts when resizing
a server-side decorated client.

We could add yet another hack in the QPainter scene, but a better
approach to tackle this problem would be to make DecoratedClient
schedule a full repaint of the decoration. It makes code in scene
plugins more straightforward and prevents us from repeating the same
mistake again.

Test Plan:
No longer able to see invisible decoration borders when
using QPainter render backend.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26927
2020-01-28 18:42:17 +02:00
Vlad Zahorodnii
4d161bec48 Use less Toplevel::isClient()
Summary:
Prefer qobject_cast<> over Toplevel::isClient() because it's more type
safer and makes code a bit more readable.

Hopefully, one day we will be able to get rid of isClient() altogether.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26541
2020-01-23 11:55:54 +02:00
Vlad Zahorodnii
fb598c65b8 Provide a KWindowShadow implementation for internal clients
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T12496

Differential Revision: https://phabricator.kde.org/D26459
2020-01-22 02:21:36 +02:00
Vlad Zahorodnii
093133c411 [plugins/windowsystem] Use upstream KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE
Summary: The next release of Plasma depends on KF 5.66.

Reviewers: #kwin, dfaure

Reviewed By: dfaure

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26694
2020-01-19 15:52:29 +02:00
Roman Gilg
b8b9f78b37 Revert "[platforms/x11] Remove triple buffering detection"
This reverts commit ad892ce3a6.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:20 +01:00
Roman Gilg
a15624dcc5 Revert "[platforms/x11/standalone] Remove SGI swap control and video sync"
This reverts commit 285adc1950.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:15 +01:00
Roman Gilg
bcf64af49b Revert "Remove vsync detection and configurability"
This reverts commit b3a19f9e5b.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:12 +01:00
Roman Gilg
ac05dd01c8 Revert "[platforms/x11] Never block on retrace, always present after paint"
This reverts commit 8d13729031.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:08 +01:00
Roman Gilg
b972159ddf Revert "Add hasSwapEvent getter"
This reverts commit a55dee3bd3.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 10:00:03 +01:00
Roman Gilg
14702651b3 Revert "[platforms/x11/standalone] Use intel swap events by default"
This reverts commit e7da4d65ec.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 09:59:54 +01:00
Roman Gilg
a5c2f23e92 Revert "Flexible composite swap and timer events"
This reverts commit 1e3128b0db.

See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html
2020-01-16 09:59:21 +01:00
Vlad Zahorodnii
b8368fdf6f [scenes/opengl] Merge window classes
Summary:
Legacy OpenGL 1 compositing backend had been dropped quite a while ago
so some of OpenGL scene classes can be merged back.

Test Plan: Compiles, windows are rendered as before.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26700
2020-01-16 01:13:04 +02:00
Vlad Zahorodnii
8e89308a33 [plugins/windowsystem] Fix compilation with no-deprecated build of KWindowSystem
Summary:
This change ensures that KWin can be built with a version of KWS that
doesn't have any deprecated stuff. I assume that no distro ships such
builds of KWS and it's only a developer thing.

I didn't backport KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE macro because
the next release of Plasma (5.18) depends on KF 5.66.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26642
2020-01-15 21:02:55 +02:00
Vlad Zahorodnii
55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
David Edmundson
212d87a32e [scenes/opengl] Remove outdated hack to reset vertex buffers
Summary:
Scene opengl has a callback for when we have a GL error. One of the
handlers for an error calls scheduleVboReInit the history shows it was a
forerunner to the GLX_NV_robustness_video_memory_purge but resetting
only one tiny part based on debug output.

When we get here we schedule a reset of the vertex buffer, via a timer.
When the timer is caled we have no idea what GL context was last
current, if it's not the currect context then the main scene
GLVertexBuffer will be deleted but not correctly re-initialised.

We have two very common crashes with a corrupted
GLVertexBuffer::streamingBuffer() which would match up perfectly.

Given that we now have a proper mechanism to reset the entire scene, we
don't need this timer based hack and resolve that problem.

BUG: 399499
BUG: 372305

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26556
2020-01-10 14:24:54 +00:00
Vlad Zahorodnii
af71763be5 [scene] Fix decoration texture bleeding
Summary:
Quite long time ago, window decorations were painted on real X11 windows.
The nicest thing about that approach is that we get both contents of the
client and the frame window at the same time. However, somewhere around
KDE 4.2 - 4.3 times, decoration rendering architecture had been changed
to what we have now.

I've mentioned the previous decoration rendering design because it didn't
have a problem that the new design has, namely the texture bleeding issue.

In the name of better performance, opengl scene puts all decoration parts
to an atlas. This is totally reasonable, however we must be super cautious
about things such as the GL_LINEAR filter.

The GL_LINEAR filter may need to sample a couple of neighboring texels
in order to produce the final texel value. However, since all decoration
parts now live in a single texture, we have to make sure that we don't
sample texels that belong to another decoration part.

This patch fixes the texture bleeding problem by padding each individual
decoration part in the atlas. There is another solution for this problem
though. We could render a window into an offscreen texture and then map
that texture on the transformed window geometry. This would work well and
we definitely need an offscreen rendering path in the opengl scene,
however it's not feasible at the moment since we need to break the window
quads API. Also, it would be great to have as less as possible stuff going
on between invocation of Scene::Window::performPaint() and getting the
corresponding pixel data on the screen.

There is a good chance that the new padding stuff may make you vomit. If
it does so, I'm all ears for the suggestions how to make the code more
nicer.

BUG: 257566
BUG: 360549
CCBUG: 412573
FIXED-IN: 5.18.0

Reviewers: #kwin

Subscribers: fredrik, kwin, fvogt

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25611
2020-01-09 15:13:07 +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
Roman Gilg
2632e4182c [platforms/drm] Allow running without outputs
Summary:
Set outputs enablement also when none outputs are present. This patch is
similar to earlier attempt at D17985.

BUG: 402827
BUG: 389551
BUG: 398680
BUG: 413758

Test Plan:
Starting without outputs, manual disconnects and DPMS changes. There is still
an issue when an output gets disconnected while the DPMS is off. But it's an
improvement already.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T10016

Differential Revision: https://phabricator.kde.org/D26511
2020-01-08 10:12:39 +01:00
l10n daemon script
ab85638946 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-01-04 06:12:32 +01:00
Roman Gilg
1e3128b0db Flexible composite swap and timer events
Summary:
The GLX backend might need a combination of swap and composite timer events for
continous painting.

The reason for that is that if the buffer age extension is not available we
fall back to copies in case not the whole screen is repainted.

The timer logic is adapted to make this possible in a lean way what cleans up
the Compositor class in several ways.

Test Plan: Tested on X11 (with/without swap events, buffer age enabled)  and Wayland.

Reviewers: #kwin

Subscribers: hurikhan77, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26216
2019-12-30 14:29:46 +01:00
Laurent Montel
45177bb29b Remove deprecated method
Summary: Remove some deprecated method

Reviewers: zzag

Reviewed By: zzag

Subscribers: davidedmundson, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25735
2019-12-23 14:09:02 +01:00
David Edmundson
ad285840dc Merge branch 'Plasma/5.17' 2019-12-14 16:09:32 +01:00
David Edmundson
1a13015d2d Possible fix for KDecoration crash in systemsettings
Summary:
I could never reproduce the crash, but we know from gdb that it's from
the decorationSettings object

We are setting the same QObject instance as a context property in
multiple contexts at once. This is already slightly odd especially from the POV of
Qt's internal property cache.

Given we want one object to be exposed to all contexts, we can expose it
to the parent context only once and achieve the same result in a simpler
way.

BUG: 411166

Test Plan:
Verified opening and closing system settings still worked for me.
I could never reproduce the original crash.

Reviewers: #kwin, ngraham

Reviewed By: ngraham

Subscribers: ngraham, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25913
2019-12-14 16:08:16 +01:00
Vlad Zahorodnii
8ab727766a [scenes/xrender] Correctly render client-side decorated clients
Summary:
The buffer shape is in buffer-local coordinates and must be mapped to
window coordinates. After that, we are free to map it to the global screen
coordinates.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25733
2019-12-12 14:39:25 +02:00
Roman Gilg
e7da4d65ec [platforms/x11/standalone] Use intel swap events by default
Summary:
Activate intel swap events by default if available. They were hidden behind an
environmental variable because of some critical release blocking issue years
ago.

Manual testing indicates that there are no issues anymore with this extension.
Since it allows us to use swap events with MESA drivers for optimized repaints
enable swap events by default again.

For now leave a modified environment variable to switch back to using no swap
events easily.

CCBUG: 342582

Test Plan: i915

Reviewers: #kwin

Subscribers: zzag, broulik, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D25300
2019-12-12 01:57:21 +01:00
Roman Gilg
a55dee3bd3 Add hasSwapEvent getter
Summary:
Add a small getter to query information internally if the backend supports
swap events. Defaults to true as it is the default in the GBM Wayland backend.

Test Plan: i915

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D25298
2019-12-12 01:25:36 +01:00
Roman Gilg
7eafab7304 [platforms/drm] Return when property found
When initializing a property we loop through the drmModeObjectProperties
object and search for the property by its name.

Once found we create the Property object and there should be not another one
with the same name afterwards. In any case we would leak memory. Therefore just
directly return once the property was found.

This gives us the added benefit that we can put out a warning in case the
property was not found in the loop, what should not happen with the properties
we use.
2019-12-11 18:38:21 +01:00
Roman Gilg
daa1cf9402 [platforms/drm] Align plane type enum with kernel
This is just a code cosmetic change to have the same values internally like the
kernel for the type enum. In the logic there should not be a difference since
the enum values are mapped at runtime.
2019-12-11 18:19:41 +01:00
Roman Gilg
cec4e57b52 [platforms/drm] Do plane and object chore
Summary:
This cleans up some of the code, moves and deletes superfluous functions,
improves in-code docs and runtime warnings.

Test Plan: On vt.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25867
2019-12-11 18:05:35 +01:00
Roman Gilg
33bcc43fdf [scenes/opengl] Remove glDrawBuffer call
Summary:
According to Gl 3.2 (page 501) and 4.5 (page 204) specs the initial state of
the default framebuffer is already BACK. Therefore we do not need to set it
explicitly.

When we draw in the future to alternative framebuffers which do not have back
buffers this call is fatal.

Test Plan: No tearing on Wayland, tearing as before on X11.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25868
2019-12-11 15:47:26 +01:00
Roman Gilg
fde3b1f6bb [platforms/drm] Do EglGbmBackend chore
Summary:
This is a small overhaul of the EglGbmBackend. Functions are restructured,
white space added and variables renamed for better readability and style
aligned with Frameworks Coding Style.

Test Plan: Session starts.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25830
2019-12-10 11:00:59 +01:00
l10n daemon script
cab72500b5 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2019-12-10 09:23:03 +01:00