Commit Graph

30 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii 925bb4eea3 Adapt to XdgOutputManagerV1 changes 2020-08-20 17:53:10 +03:00
Aleix Pol d5da366507 Add a generic Output::transformation method
Makes it possible to map any space into the output's coordinates system
2020-08-19 14:51:42 +00:00
Aleix Pol 494c89a2d9 Introduce AbstractWaylandOutput::geometry 2020-08-18 10:55:21 +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
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
David Edmundson a13ecf8d0e [wayland] Add new XdgOutput properties
Summary:
AbstractOutput::name() behaviour is changed so that it matches the X11
behaviour, showing an identifier like "HDMI-0".

XdgOutput.name is set to this name.

XdgOutput.description is currently set to the manufacturer name and
model, but it's not exposed to Qt so we probably don't care too much.

This should fix plasmashell changing applets when switching between X11
and wayland.

Test Plan:
Relevant unit test
I still need to run it on my laptop.

Reviewers: #kwin, #plasma, zzag

Reviewed By: #kwin, #plasma, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28230
2020-04-08 10:39:59 +01:00
Aleix Pol 48a8fdbdc7 Fix output initialization
Summary: Fixes a regression where displays would not be available to kscreen.

Test Plan: Can configure my screens again.

Reviewers: davidedmundson

Reviewed By: davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28243
2020-03-24 17:24:45 +01:00
David Edmundson 80d3f148e0 [wayland] Simplify output handling
Summary:
Instead of changing lifespan of kwayland objects we can just call
create() and delete() on it which affects the lifespan of the underlying
resource, but not the kwayland wrapper.

This gets rid of some duplicate syncing.

Test Plan:
Ran WAYLAND_DEBUG=1
plugged in and removed a monitor
output showed wl_output and xdg_output being handled correctly

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27899
2020-03-23 23:04:06 +00: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
Roman Gilg 429fe05856 Cache output transformation first
Summary:
First we need to set a transformation, then update the backend. In DRM the
cursor gets updated and needs the new transformed size.

Longterm we need a pending state if we want to apply configuration changes
atomically or deny them.

Test Plan: Compiles.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25903
2020-02-28 12:22:42 +00:00
Roman Gilg 15de237dbe Add modeSize getter
Summary:
The getter pixelSize rotates the size of the mode. In contrast modeSize just
directly returns the current mode size.

Test Plan: Compiles

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25901
2020-02-28 12:22:42 +00:00
Roman Gilg f246768468 Inform Screens about size change
Summary:
Changes to a Wayland output that could affect the overall geometry
need to be communicated to the Screens class.

Test Plan: Compiles, runtime tested with other patches for rotation.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25900
2020-02-28 12:22:42 +00: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
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
Roman Gilg df3c1de848 [platforms/drm] Rework enablement and dpms switching
Summary:
This patch further refines output management.

We go now through AbstractWaylandOutput virtual functions to enable and
disable outputs.

Dpms changes and enablement switches use separate code paths at start in the
Drm backend code since they are similar but not the directly same. Common code
is shared though, functions are renamed accordingly.

Asserts have been put in place to better understand and check the control
flow. A seemingly unnecessary call to DrmOutput::pageFlipped on reactivation
after Vt switch has been removed to allow for that.

In future patches we need to look additionally at the legacy mode switching
code path which was and is still not working and better handling of the
current monitor Dpms state. For example a monitor being switched off is not
properly acted on and the workspace still expanded.

Test Plan:
With one and two monitors:
* Dpms off/on
* Vt switches
* Screen disable/enable

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23600
2019-09-05 17:36:21 +02:00
Roman Gilg b3e7664d2c Replace Wayland/XDG outputs checks with enablement checks
Summary:
Make it more explicit what the relation is between Wayland and XDG objects
existing and enablement:

The ouput is enabled if and only if Wayland and XDG output objects exist.

We can simplify the code by replacing checks on the outputs with checking
the current enablement value.

Test Plan: Wayland nested and virtual backends.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23553
2019-09-05 17:29:08 +02:00
Roman Gilg f7ff62e2e2 Lift output enablement into Platform
Summary:
This lifts the enablement code for outputs from the DRM backend to Platform
allowing other Wayland backends in the future to use this interface as well.

To do that we also create some helper functions on Platform level and have to
spill some KWayland classes into AbstractOutput what motivates a further split
of Platform into a Wayland child class like for AbstractOutput.

Test Plan: Disabled and enabled an output in DRM session.

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23545
2019-09-05 17:22:44 +02:00
Roman Gilg e8fada8a36 Get name and refresh rate from output device
Summary:
We can simplify the AbstractWaylandOutput code some more by getting name and
refresh rate of an output from the always available output device object.

Test Plan: Tested with DRM, Wayland nested and virtual backends.

Reviewers: #kwin

Subscribers: davidedmundson, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23546
2019-08-29 16:04:09 +02:00
Roman Gilg f2c5f85cae Assure wayland output interface creation path
Summary:
The Wayland and XDG output interfaces are created or destroyed when the
output is en- or disabled. This follows a clear path of dependencies and
we should not check if this is indeed the case but instead assert on it.

Test Plan: Nested Wayland and Drm sessions.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23540
2019-08-28 18:33:00 +02:00
Roman Gilg 331f5d7da7 Get output physical size from output device
Summary:
Get the physical size directly from the always available output device
interface instead of saving an additional copy in the abstract wayland
output class.

There is some ambiguity with orientation and naming that needs to be
cleaned up when output orientation is reworked.

Test Plan: Nested Wayland, Drm, virtual backends tested.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23496
2019-08-28 14:56:26 +02:00
Roman Gilg dbb2cede08 Get output pixel size from output device
Summary:
Get the pixel size directly from the always available output device
interface instead of saving an additional copy in the backends.

Test Plan: Nested Wayland, Drm, virtual backends tested.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23495
2019-08-28 14:54:14 +02:00
Roman Gilg 819609a8a6 Get output position and scale from output device interface
Summary:
Let the data saved in OutputDeviceInterface be the single source of truth
and as low hanging fruits first do this for global position and scale.

Test Plan: Nested Wayland, Drm, virtual backends tested.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23489
2019-08-28 14:51:12 +02:00
Roman Gilg 0bcfb4d609 Rely on output device existence
Summary:
For every abstract wayland output an output device interface is created
by the backend directly after instance creation. We can therefore rely on
its existence and remove superfluous checks.

Test Plan: Relevant auto tests pass. Wayland nested and DRM sessions tested.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23486
2019-08-28 14:48:28 +02:00
Roman Gilg 0301c0866a Emit mode-change on all relevant changes
Summary:
The EGL GBM backend must be informed about mode changes so that the surface
gets reset. This fixes mode changes for me. Rotations still not work, this
needs some more structure cleanup.

Test Plan: Manually changed resolution and scale alone and together with KScreen.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23435
2019-08-26 12:41:42 +02:00
Roman Gilg 9bf7cbc7f6 Remove change-set null check
Summary:
It is unnecessary to check if the change-set is null when looking at the
KWayland code. Also the check would be useless at the moment anyway because
before the check we access the change-set already in the DRM backend and at
the check we would not return if it would be null.

Test Plan: Relevant auto tests pass.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23428
2019-08-26 12:38:23 +02:00
Roman Gilg 6ac1585e12 Fix xdg-output creation
In 1a11abc821 some function calls in the createXdgOutput function were
accidentally removed resulting in possibility of broken setup on startup.

Add these calls back again.
2019-06-14 12:10:28 +02:00
Roman Gilg 1a11abc821 [platforms/x11/standalone] Port to AbstractOutput
Summary:
Represent outputs in the X11 session via AbstractOutput. For that we
move all Wayland specific parts of AbstractOutput into a new subclass
AbstractWaylandOutput and let the outputs of our Wayland backends inherit
from there.

This should allow us to get rid of the Screens class later on.

Test Plan: Manually in X session.

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, zzag, davidedmundson

Subscribers: ngraham, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19208
2019-06-13 11:39:25 +02:00