Commit graph

413 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
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
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
68ef6bcd7a Rename X11Client::getSyncRequest() to X11Client::syncRequest()
Getter methods should not have "get" prefix.
2020-01-28 21:46:09 +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
55b4912004 Update my email address 2020-01-14 18:17:18 +02: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
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
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
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
Roman Gilg
47306865a7 [platforms/drm] Refactor updateTransform
Summary:
Small intermediate refactor. For now just do the normal rotation when a flipped
transform is requested. In the future we might want to provide the possibility
to flip the output image.

Test Plan: Compiles

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25649
2019-12-01 13:11:16 +01:00
Andreas Hartmetz
f3a9daaa4f Fix build: remove call to removed method
This backend absolutely does not make sense to use on anything
resembling a "desktop computer" as bshah explained to me. Still, I
somehow have the corresponding optional dependencies installed and
so I triggered the problem.

Reviewed-By: bshah
2019-11-28 14:57:44 +01:00
Roman Gilg
3dd36e41f0 [platforms/drm] Improve rotation debug 2019-11-27 22:30:32 +01:00
Roman Gilg
e827d0a8ee Use Transform enum internally
Summary:
Instead of using Qt::ScreenOrientation use an enum class that is directly
mapped to KWayland's transformation enums. This simplifies the code.

Test Plan: Compiles and transformations work as before.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Maniphest Tasks: T11670

Differential Revision: https://phabricator.kde.org/D25558
2019-11-27 21:08:20 +01:00
Vlad Zahorodnii
84d75cb567 [x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.

KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.

When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.

Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.

Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.

Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.

BUG: 390550
FIXED-IN: 5.18.0

Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: cblack, trmdi, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24660
2019-11-27 14:12:30 +02:00
Roman Gilg
b7dbe0e88a Set orientation from DRM on fallback
Summary:
In case of a failed atomic commit the previous mode should be fallen back to.
For orientation provide again a setter that DRM backend can use to set the
transform back to the last working one.

Test Plan: Compiles, fallback works, cursor still messed up somewhat (scaling issue?).

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Maniphest Tasks: T11670

Differential Revision: https://phabricator.kde.org/D25507
2019-11-26 22:33:59 +01:00
Roman Gilg
6bfa931f2b Associate output transforms and orientations
Summary:
We use internally Qt:ScreenOrientation for representing output transforms.

This is not ideal since the values do not map directly to Wayland transform
values, but we can make it work by using OR combinations of
Qt:ScreenOrientations.

Do this for now and see if we should not better introduce an internal enum
mapped directly.

Additionally the OR combinations need to be handled in the drm backend at
various places accordingly as well (see TODOs).

Test Plan: Compiles

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11670

Differential Revision: https://phabricator.kde.org/D25505
2019-11-26 22:29:40 +01:00
Roman Gilg
523967b3ac Set transform in AbstractWaylandOutput
Summary:
Move the Wayland output device and output transform calls from DRM backend
to AbstractWaylandOutput. This leaves still some loose ends that need to be
tied up later. On failed commit we want to fall back to last working state
and orientation getter in general needs some more refactoring.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11670

Differential Revision: https://phabricator.kde.org/D25504
2019-11-26 22:24:58 +01:00
Yuri Chornoivan
a853e3370a Fix minor typos 2019-11-26 19:48:29 +02:00
Yuri Chornoivan
84244a7cf6 Use URL with transport encryption 2019-11-26 19:39:20 +02:00
David Edmundson
c22546868d [effects] fix mouse wheel detection 2019-11-15 14:10:03 +00:00
David Edmundson
cb7022150d [effects] Fix build on old Qt 2019-11-14 14:19:40 +00: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
Roman Gilg
8d13729031 [platforms/x11] Never block on retrace, always present after paint
Summary:
Compositing in X11 was done time shifted, meaning that we paint first, then
wait one vblank interval length and present on prepareRenderingFrame the
previous paint result. This is supposed to make sure we don't miss the vblank
and in case of block till retrace be able to continue issuing commands and
only shortly before next vblank present.

This is counter-intuitiv, not how we do it on Wayland or even on MESA with X.
The reason seems to be that the GLX backend was in the beginning written
against Nvidia proprietary driver which needed this but nowadays even this
driver defaults to non-blocking behavior on buffer swap.

Therefore remove this legacy anomaly fully and directly present after paint.
We then wait one refresh cycle and in the future can optimize this by delaying
the paint and present till shortly before vsync.

Test Plan: kwin_x11 tested on i915 and Nvidia proprietary driver.

Reviewers: #kwin

Subscribers: zzag, alexeymin, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D23514
2019-11-14 09:03:44 +01:00
Roman Gilg
b3a19f9e5b Remove vsync detection and configurability
Summary:
Selecting not to vsync does not make sense for an X11 compositor. In the end
we want clients to be able to present async if they want to but the compositor
is supposed to send swaps with vsync to the XServer in order to not generate
tearing artifacts.

There was also a detection logic which did some questionable things in case
vsync was not available. I don't think this is necessary at all since we can
just always run a timer to present with or without vsync.

Test Plan: kwin_x11 tested on i915.

Reviewers: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D23511
2019-11-14 08:55:08 +01:00
Roman Gilg
285adc1950 [platforms/x11/standalone] Remove SGI swap control and video sync
Summary:
Current hardware should suppport either GLX_EXT_swap_control or
GLX_MESA_swap_control. To simplify code remove the usage of SGI extensions.

Test Plan: kwin_x11 tested on i915.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D23510
2019-11-14 08:48:11 +01:00
Roman Gilg
ad892ce3a6 [platforms/x11] Remove triple buffering detection
Summary:
It is not clear what the advantage of triple buffering is for KWin. An X11
compositor is meant to swap buffers once every monitor cycle. For that triple
buffering is not necessary.

The functionality is not maintained, does not reliably work as displayed by
the existence of an environment variable to force some behavior, pollutes
our code and every compositing-related problem that might be mitigated with
triple buffering should find a simpler and more fitting solution with other
means.

There is one caveat which is if we shall block for retrace. We set it
currently according to the result of the swap profiler and in the most common
case with double buffering it is set to true. But on Nvidia systems this might
be actual the wrong behavior. Instead of trying to work around this ignore
the issue for now and move the overall architecture to something less complex
by presenting after paint how we do it in the Wayland DRM backend and with
double buffering on GLX (although this is at the moment also borken because
we actually present then twice).

Test Plan: kwin_x11 tested on i915.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, fredrik, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D23504
2019-11-14 08:38:36 +01:00
Roman Gilg
b89b1d8166 [platforms/wayland] Use xdg-shell stable protocol
Summary:
We support the stable xdg-shell protocol nowadays. So use this one instead of
version 6 unstable.

Test Plan:
Runs with other recent patches in KWin nested. In Weston nested session still
not yet working.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25129
2019-11-03 19:30:08 +01:00
Roman Gilg
9c0501eb8f [platforms/wayland] Always ack configure
Summary:
Per protocol a zero-size can be sent indicating that the client should resize
its surface to its liking. For now change the code such that it at least sends
the ack-configure back and leaves the current size untouched.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25128
2019-11-03 19:28:44 +01:00
Roman Gilg
932a1160f5 [platforms/wayland] Do an initial xdg-surface commit
Summary:
After setting the xdg-surface role an initial commit must be sent per
protocol description.

This fixes Wayland nested session after commit 84de8d135d made this
requirement explicit.

Test Plan: Launched Wayland nested session.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25127
2019-11-03 19:27:13 +01:00
Roman Gilg
929866b1a0 Merge branch 'Plasma/5.17' 2019-10-22 11:29:03 +02:00
Roman Gilg
0d67a0b48a Fix non-atomic output init
Summary:
The initial blank needs to happen after the output device has been
initialized to get the current mode size.

Also we can't assert in legacy mode on the page flip pending since
a page flip can also be the result of a CRTC blank using a different.

BUG: 412684
FIXED-IN: 5.17.1

Test Plan: Full Plasma session

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24829
2019-10-22 11:28:08 +02:00
Fabian Vogt
f4c6de8ec4 Merge branch 'Plasma/5.17' 2019-10-15 16:08:36 +02:00
Fabian Vogt
4982dfd5f5 glx: Don't use sRGB configs on llvmpipe with depth 16
Summary:
This is necessary to keep openQA working, which uses LLVMpipe as a
renderer on a Cirrus device that operates in depth 16.

LLVMpipe advertises 24/32 bit sRGB configurations on this setup, but
they cannot be presented.

CCBUG: 408594

Test Plan: Compile tested only.

Reviewers: fvogt, #kwin, zzag

Reviewed By: fvogt, #kwin, zzag

Subscribers: romangg, sbergeron, fvogt, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22203
2019-10-15 16:07:01 +02:00