Commit graph

61 commits

Author SHA1 Message Date
Xaver Hugl
5a22deda3b platforms/drm: Introduce DrmPipeline
DrmPipeline is what now contains all the drm bits related to
modesetting and presentation, instead of that being in DrmOutput.
This gives a lot more freedom for managing drm resources and
enables far better usage of the atomic API with guaranteed
immutability for failed tests.
2021-04-16 20:26:34 +02:00
Aleix Pol
01f7ef35e7 drm: Make sure we read all pending udev events 2021-04-15 15:00:52 +00:00
Xaver Hugl
888a08530e Make DrmObject::Property flags const 2021-04-15 11:16:18 +00:00
Xaver Hugl
a461ff918d platforms/drm: replace dpms property hack with proper check
Instead of marking the dpms property as immutable, read the
DRM_MODE_PROP_ATOMIC flag and only add atomic properties to
atomic requests.
2021-04-12 19:30:17 +02:00
Xaver Hugl
18f857b1f3 platforms/drm: fix crash with multi-gpu 2021-04-11 20:52:08 +02:00
Vlad Zahorodnii
24d865ea38 wayland: Generate valid output uuids
Currently, kwin generates invalid output uuids.
2021-04-08 19:04:17 +00:00
Vlad Zahorodnii
d1c5970273 Fix build 2021-04-07 20:49:32 +03:00
Vlad Zahorodnii
da5fc3d9e9 wayland: Wire in subpixel information
kwaylandserver has all the code to send subpixel information but kwin
doesn't really use it.
2021-04-07 16:33:50 +03:00
Vlad Zahorodnii
9d9747490e wayland: Send missing output-device properties
Currently, we don't set eisa id and the serial number.
2021-04-07 15:00:56 +03:00
Vlad Zahorodnii
c27230719c wayland: Move Wayland-specific code out of AbstractWaylandOutput
Currently, output properties are looked up either on the wl_output
object or the output device object. This puts a hard dependency on the
wayland server in the platforms.

This change intends to fix some flaws in the current output
abstractions, and allow creating/destroying wayland-specific globals as
we wish.

With the work done in this patch, the need for the AbstractWaylandOutput
class is unclear, and it might be a good idea to merge it with the base
AbstractOutput class.
2021-04-07 14:23:16 +03:00
Xaver Hugl
50f03ac6dc platforms/drm: improve buffer handling with GbmBuffer 2021-04-06 23:18:25 +02:00
Vlad Zahorodnii
913d242bd9 platforms/drm: Fix crash in EglGbmBackend::presentOnOutput()
If the damage history is empty and EGL_KHR_partial_update is supported,
kwin may crash.
2021-04-06 11:53:26 +03:00
Jan Blackquill
9f215a06fa Fix crash on hotplugging displays while switched to another TTY
Currently, we inhibit renderloops when switching to another TTY, and unhibit
when switching back. When we hotplug a display while switched to another TTY,
its renderloop isn't inhibited by default, yet when we switch back, we try
to uninhibit the fresh renderloop, which triggers an assert.

Inhibiting newly created outputs while switched to another TTY fixes this crash.

BUG: 435388
FIXED-IN: 5.21
2021-04-05 15:08:59 -04:00
Xaver Hugl
8bbd186f8e platform/drm: add dpmsFinishOn to atomicEnable
Without it the output will stay blank after enabling
2021-04-05 11:03:53 +00:00
Xaver Hugl
b2653c45c8 platforms/drm: drop connector name from modelName with serial
The connector name is not relevant to applications or
users - expectation is that the same physical monitor always gets the
same name, regardless of how it's connected. If no serial is available,
fall back to the old scheme to prevent multiple connected outputs from
having the same name.
2021-04-05 11:02:01 +00:00
Vlad Zahorodnii
7054f6b2d6 platforms/drm: Drop stream operator for DrmOutput
There is already one that works for all AbstractOutput classes and
properly restores the state of QDebug.
2021-04-01 18:15:42 +03:00
Vlad Zahorodnii
dd9a1e5320 platforms/drm: Rename DrmCrtc::resIndex()
The value that the DrmCrtc::resIndex() function returns is better known
as "pipe index." This change renames the method to match the terminology
used by kernel developers and other compositor developers.
2021-04-01 14:41:07 +03:00
Vlad Zahorodnii
53796aacb2 platforms/drm: Remove unused parameter in DrmCrtc constructor 2021-04-01 14:41:07 +03:00
Vlad Zahorodnii
d883cccfd3 platforms/drm: Minor coding style fixes
This reformats some code according to the KF coding style.
2021-04-01 14:41:05 +03:00
Vlad Zahorodnii
7926fce598 platforms/drm: Make DrmObject::m_id private
There's already a getter for the object id.
2021-04-01 14:19:48 +03:00
Vlad Zahorodnii
2ea66eb4c3 platforms/drm: Remove unused field in DrmObject 2021-04-01 14:17:46 +03:00
Vlad Zahorodnii
f534b64e5c platforms/drm: Associate drm objects with their gpus
This makes the code more consistent. At the moment, we initialize drm
objects either with the corresponding gpu object or with its fd.
2021-04-01 14:15:42 +03:00
Vlad Zahorodnii
75e7562953 platforms/drm: Fix handling of missing EDID
drmModeGetPropertyBlob() may return null and we should handle that. In
addition to that, m_conn is not initialized in DrmConnector so kwin will
crash whenever the connector info is accessed.
2021-04-01 11:01:53 +00:00
Vlad Zahorodnii
53f7bda7d2 platforms/drm: Make DRM backend less chatty
These warnings can be safely ignored, their priority can be lowered.
2021-04-01 13:21:33 +03:00
Xaver Hugl
2efb9c473d Move Edid and DPMS into DrmConnector 2021-03-31 16:08:33 +00:00
Vlad Zahorodnii
326d211691 platform: Use damage tracked by SurfaceItem
There is no need for both kwin and kwaylandserver track damage.
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
2ade92d69b platform: Make OpenGLBackend::scanout take SurfaceItem
This allows removing SurfaceInterface::trackedDamage().
2021-03-31 13:56:55 +00:00
Vlad Zahorodnii
0f1afdbdc0 scene: Pass dirty region to SceneOpenGLTexture::updateTexture 2021-03-31 13:56:55 +00:00
Xaver Hugl
c0c3ec09af Refactor DrmObject 2021-03-31 10:19:42 +00:00
Xaver Hugl
e262c8df33 Move pageFlipHandler to DrmGpu 2021-03-30 14:32:43 +02:00
Xaver Hugl
eb7703cd64 Only use drmModeAddFB2WithModifiers if supported 2021-03-23 22:13:00 +00:00
Xaver Hugl
c737fde3da DRM: Use QSharedPointer 2021-03-23 15:47:59 +00:00
Vlad Zahorodnii
ade861d6de Refactor session code
At the moment, the session code is far from being extensible. If we
decide to add support for libseatd, it will be a challenging task with
the current design of session management code. The goal of this
refactoring is to fix that.

Another motivation behind this change is to prepare session related code
for upstreaming to kwayland-server where it belongs.
2021-03-23 08:01:19 +00:00
Xaver Hugl
a8055e4546 Refactor DRM presentation
Presentation doesn't have to go through DrmBackend and by moving
DrmGpu::deleteBufferAfterPageflip into DrmBuffer some code can be
simplified
2021-03-22 13:52:50 +00:00
Xaver Hugl
ca23bca813 Port DrmSurfaceBuffer to drmModeAddFB2 2021-03-19 08:59:58 +00:00
Xaver Hugl
6569bf80c3 EglGbmBackend: use output reference
CCBUG: 432707
2021-03-18 15:22:31 +01:00
Aleix Pol
58debd72a3 Only scanout when the texture matches the display size
Otherwise drmModeAtomicCommit() in DrmOutput::doAtomicCommit() fails due
to unmatched buffer sizes.

While rendering continues working properly, this makes drm freak out and
try to go back to a previous state (see the test commit in
presentAtomically()) that in turn starts issuing screen events to every
process even though it's just to say the same thing. The fact that this
happens per frame makes the system unusable as soon as fullscreen starts
happening on a scaled display.

Another thing we could do is get EglGbmBackend::scanout() to take care
of the resizing.
2021-03-11 15:01:09 +01:00
Méven Car
ef19948c00 Reflect changes in kwayland-server changes
https://invent.kde.org/plasma/kwayland-server/-/merge_requests/180
2021-03-11 08:24:33 +00:00
Vlad Zahorodnii
38996d9725 libkwineffects: Introduce EffectScreen
This provides the compositor a way to indicate what output is being
rendered. The effects such as the screenshot can check the provided
screen object in order to function as expected.
2021-03-09 08:58:22 +00:00
Vlad Zahorodnii
b3e7031893 platforms/drm: Fix potential stack corruption
If the file descriptor of the DRM device is greater than FD_SETSIZE, the
stack will be corrupted. However, it is highly unlikely that we ever hit
this case because DRM devices are opened at startup of kwin, so the file
descriptors should small.

In order to prevent the potential stack corruption, this change replaces
the usage of select() with poll().

Unlike select(), the api of poll() is much more sensible. Back 20 or so
years ago the main argument against poll() was that it's not implemented
by all platforms. But, nowadays, it's supported on all major platforms.
2021-03-09 10:27:17 +02:00
Bhushan Shah
debea631f3 platforms/drm: inhibit the renderloop when screen is turned off
Otherwise we will continue using gpu resources even when we can not show
any content on screen.
2021-03-04 15:01:15 +00:00
Xaver Hugl
7cc95d931b Improvements for direct scanout
Instead of cancelling direct scanout if the client buffer is not
fitting, adjust the atomic planes. Also ignore all toplevels from
other screens.
2021-03-02 17:17:36 +00:00
Xaver Hugl
1f7e794b82 DrmGpu: add gbm device nullptr check
BUG: 433145
2021-02-25 19:14:02 +01:00
Bhushan Shah
28d2650f24 [platforms/drm] include missing errno.h include
CCMAIL: Xaver Hugl <xaver.hugl@gmail.com>
2021-02-23 12:07:17 +05:30
Xaver Hugl
6703bc9d24 Improve teardown of DrmGpu 2021-02-22 21:56:03 +01:00
Bhushan Shah
ae8e69b4bb [platforms/drm] accept both keypress and keyrelease event in filter
We don't want to pass out either of key press or release event to other
filters.
2021-02-22 21:52:57 +05:30
Vlad Zahorodnii
58bee8e38a Fix build 2021-02-22 18:11:06 +02:00
Bhushan Shah
b24fc72969 [platforms/drm] only enable output on key press not release
Otherwise if powerdevil for example is configured to turn screen off on
the power key press, we will turn it right back on when we get key
release event.

Suggested-by: David Edmundson <kde@davidedmundson.co.uk>
2021-02-22 21:16:00 +05:30
Vlad Zahorodnii
45979ed460 x11: Introduce an envvar to force software vsync
This can be useful for debugging purposes and for people wishing to ramp
up the refresh rate on their setups with different refresh rates.

BUG: 433094
2021-02-19 14:59:47 +00:00
Vlad Zahorodnii
fb93037ca7 x11: Introduce an envvar to prevent sync'ing to vblanks
This can be useful if you want to ensure that the buffer swap operation
won't block.

CCBUG: 433094
2021-02-19 14:59:47 +00:00