Commit graph

113 commits

Author SHA1 Message Date
Xaver Hugl
7bf79090cf platforms/drm: add outputs on EglGbmBackend initialisation
BUG: 437761
2021-05-31 13:15:16 +02:00
Xaver Hugl
2742e5b422 Rearrange wayland startup sequence
The backend can now optionally wait for the scene to be created before
it updates its outputs, which is necessary for better atomic tests in
the DRM backend.
2021-05-27 13:41:40 +00:00
Vlad Zahorodnii
f46c7bae8d Move decoration renderer to decoration item
Currently, the implementation of the DecoratedClient and the decoration
renderer are strongly coupled. This poses a problem with the item based
design as the ultimate goal is to have scene items construct paint nodes
which are then fed to the renderer. The DecorationItem has to have
control over the decoration texture. Another issue is that the scene
cannot smoothly cross-fade between two window states if the decoration
is removed, e.g. from fullscreen mode to normal and vice versa.

This change moves the decoration renderer to the decoration item. With
the introduction of a generic scene texture atlas, we hope to get rid of
the decoration renderer altogether.
2021-05-26 06:35:03 +00:00
David Edmundson
600c1e0a54 platforms/drm: Make context current before EGLStreams calls
attachStreamConsumer and resetOutput are not called as part of the scene
render and as such the context might not be set.

All credit goes to Simon Spinner for his investigation.

BUG: 437573
2021-05-24 13:51:18 +00:00
Vlad Zahorodnii
bc22b9e59e Fix build 2021-05-20 16:25:13 +03:00
Xaver Hugl
793cc5fa25 platforms/drm: replace pointer to egl backend with QPointer
If the egl backend gets deleted this leaves a dangling pointer. In
order to prevent crashes with QPainter or EglStreams also don't try
to create dmabuf textures without a EglGbmBackend.
2021-05-20 14:37:55 +02:00
Aleix Pol
386814176b drm: Use KScreen's json files to set up the initial output composition
So far we had a composition setup within kwinrc and kscreen. This
produces flickering sometime and makes the state a bit more flimsy.
This patch changes the kwin's behaviour to use the files produced by
kscreen which are anyways available down the line.

THis simplifies our behaviour down to just one format that we write to
and feed from. This also allows us to leverage it further by using this
format for default setups (which consist in the right file in
~/.local/share/kscreen).
2021-05-18 14:18:38 +00:00
Xaver Hugl
7de0f1f2ad platforms/drm: CPU copy for multi-gpu
Not all GPUs can scan out linear buffers, so if import with a dmabuf
fails manually copy the data into a non-linear gbm buffer instead.

BUG: 432707
2021-05-18 14:54:05 +02:00
Vlad Zahorodnii
0f2f69ad7c Decouple window pixmaps from scene windows
One of the scene redesign goals is to make wayland surface items
re-usable. So we have the same rendering path for drag-and-drop icons,
software cursors, and window surfaces.

The biggest issue at the moment is that window pixmaps are tightly
coupled with scene windows.

This change de-couples window pixmaps from scene windows. In order to
achieve that, some architecture changes were made.

The WindowPixmap class was replaced with the SurfacePixmap class. A
surface pixmap is created by a surface item.

Under the hood, a SurfacePixmap will create a PlatformSurfaceTexture
object, which contains all the information necessary for the renderer.

The SceneOpenGLTexture class was removed. However, the GLX and the EGL
on X11 backends still mess with GLTexture's internals.
2021-05-18 09:11:24 +00:00
Vlad Zahorodnii
77a9d38166 Make libdrm required dependency
As is, kwin with the drm backend results in the most pleasant user
experience on Wayland. Given that and the fbdev being about to be
dropped, making libdrm a required dependency seems a reasonable decision.
2021-05-14 18:00:40 +00:00
Aleix Pol
035ea75ab7 Use qAsConst in fors when there's a risk for it to detach 2021-05-14 01:35:33 +02:00
Aleix Pol
f70256931c --warning: treat unused variables so we are not warned about them 2021-05-14 01:35:33 +02:00
Bhushan Shah
4e7c6b57a6 platforms/drm: put double tap timer behind config option
This feature was implemented in commit a66eb1a5b9 earlier

Double tap wake up is not a feature to be implemented at compositor
level but rather at the hardware/kernel level. Double tap timer here
means when screen is turned off, libinput will continue to poll the
touchscreen for new events.

double-tap-to-wakeup is generally interrupt at driver/hardware level
which have ability to wake system up even from the sleep.

Provide a option to disable the double tap timer on kwin side for
devices which makes use of suspend since when in suspend kwin can not
wake device up, and that provides confusing user experience.
2021-05-11 00:47:21 +00:00
Xaver Hugl
5bd938f0f0 platforms/drm: release gbm buffers before eglDestroySurface
BUG: 436500
2021-05-04 17:36:09 +00:00
Adriaan de Groot
49fcadb185 Fix build on 32-bit systems
The added comment explains it all, really: you can't fit a 32-bit
unsigned into a 32-bit (signed) time_t, but we don't care.
2021-05-04 12:34:07 +00:00
Xaver Hugl
bd4a8be319 platforms/drm: fix DrmOutput::updateMode 2021-05-04 10:01:55 +00:00
Xaver Hugl
089134d0bd platforms/drm: GPU power management
When a GPU has no outputs attached we need to release all resources and
close the fd to allow the driver to completely power down the GPU. This
is also required to allow the driver to be unloaded for VFIO.
2021-05-03 18:03:09 +02:00
l10n daemon script
31cdb8676d 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"
2021-05-03 01:21:56 +00:00
Ömer Fadıl Usta
a8d7e99874 [plugins/platforms/drm/drm_backend] Fix build for bsd 2021-05-01 19:43:00 +00:00
Vlad Zahorodnii
8d9e47ee22 platforms/drm: Introduce KWIN_DRM_DEVICES
This allows to instruct kwin what drm devices must be used explicitly.

BUG: 435467
2021-05-01 12:14:34 +00:00
Xaver Hugl
faddf0bf5f Wayland: variable refresh rate support
BUG: 405912
2021-04-30 16:18:39 +02:00
Vlad Zahorodnii
706eb16b3a Remove Platform::screenGeometries and Platform::screenScales
If you need screen geometries or scales, use AbstractOutput::geometry()
and AbstractOutput::scale(), respectively.
2021-04-29 11:31:31 +00:00
Vlad Zahorodnii
ac3c09ba75 Remove Platform::areOutputsEnabled()
This flag is redundant. If an output is disabled, the compositor won't
attempt to perform compositing on it.
2021-04-29 10:47:41 +00:00
Vlad Zahorodnii
f8c00a530f Remove Platform::prepareShutdown()
Platform::prepareShutdown() was introduced to work around the issue
where the platform accesses destroyed OutputDeviceInterface objects.

Since we no longer query OutputDeviceInterface for output info, the
Platform::prepareShutdown() function can be dropped.
2021-04-29 10:47:41 +00:00
Vlad Zahorodnii
9e1de4522e platforms/drm: Remove unused defs and includes in drm_backend.cpp 2021-04-29 08:45:27 +03:00
Vlad Zahorodnii
c4c46a089f platforms/drm: Properly detect if there are no DRM devices
If no primary gpu can be found, we need to quit.
2021-04-29 05:34:19 +00:00
Vlad Zahorodnii
9f030ecd40 platforms/drm: Enable atomic modesetting in hot plugged gpus
At the moment, if a gpu is hot plugged, it won't have atomic modesetting
enabled.
2021-04-29 05:34:19 +00:00
Vlad Zahorodnii
03c38e02e9 platforms/drm: Remove DrmBackend::findOutput()
It's unused.
2021-04-29 08:10:37 +03:00
Vlad Zahorodnii
54a034b7cf platforms/drm: Use dev nums to find gpus
This way we don't need to convert strings to ints every time
udev_device_get_sysnum() is called.
2021-04-29 04:58:46 +00:00
Vlad Zahorodnii
fe0039091c platforms/drm: Don't search for gpus on add udev event
If a gpu is added, don't search for it pointlessly in m_gpus.
2021-04-29 04:58:46 +00:00
Vlad Zahorodnii
04c3bee803 Remove unused things in drm_backend.h 2021-04-28 22:12:58 +03:00
Xaver Hugl
9cd046f206 platforms/drm: add GPU hotplug support 2021-04-28 18:57:47 +02:00
Xaver Hugl
0284aeb7bb platforms/drm: Don't release drm buffers in EglGbmBackend
When we release the buffers that also removes the drm fbs.
This causes failing atomic commits that the atomic code
doesn't (yet) handle correctly, the result is a black
screen when compositing is restarted.
2021-04-28 13:51:06 +00:00
Xaver Hugl
40eb0e4f0e platforms/drm: only print error for direct scanout when useful
Most wayland-native apps provide buffers that aren't suitable
for direct scanout; the message usually only spams the log full
without proper reason or useful information
2021-04-27 15:22:20 +02:00
Aleix Pol
af6f95b2eb fb: remove unnecessary casts 2021-04-27 15:14:06 +02:00
Aleix Pol
4b3b5fa368 fb: make it easier to run on nomodeset
In the few cases where the framebuffer is needed, we'd get problems
because ioctl(KWIN_FB_NO_VSYNC) fails.
This removes the code entirely to just use a timer to refresh.

BUG: 436053
2021-04-26 12:46:55 +00:00
Xaver Hugl
49c650eed2 platforms/drm: don't ignore blob properties without valid blobs
Instead of deleting all blob properties without a valid
blob check for the blob existing before using it. This is
necessary because some properties are needed even without
currently valid blobs.

BUG: 435786
2021-04-22 12:40:48 +00:00
Aleix Pol
b3ddb11b7c drm: hide the cursor as we are setting dpms off
It seems to crash amdgpu and it's consistent with how we're cleaning all
our planes.

BUG: 435941
2021-04-22 10:18:15 +00:00
Aleix Pol
633136d228 drm: remove unused attribute in DrmOutput 2021-04-22 10:17:29 +00:00
Vlad Zahorodnii
0d9185053c platforms/drm: Ignore udev events while session is inactive
While the session is inactive, the drm master permissions are revoked.
Therefore, we cannot perform things such as modesetting, etc. It also
makes no sense to create or destroy DrmOutput objects.

CCBUG: 435941
2021-04-21 23:17:54 +00:00
Aleix Pol
f7526f50fe build... 2021-04-21 17:42:55 +02:00
Aleix Pol
8d186efa08 drm: Do not check egl extensions before setting them up 2021-04-21 17:34:07 +02:00
Xaver Hugl
5a2177a51c platforms/drm: use surfaceless context
On multi-gpu systems it could happen that the primary GPU
has no working outputs attached, yet we still need the
egl context.
2021-04-21 09:06:17 +00:00
Vlad Zahorodnii
700028b37d Fix build 2021-04-20 14:37:43 +03:00
Vlad Zahorodnii
15f1b9792b Revert "platforms/drm: Introduce DrmPipeline"
This reverts commit 5a22deda3b.

We still need more work to finish the DrmPipeline. At the moment, there
are a few major issues, e.g. some outputs not turning on, output
transforms not working correctly, a crash when changing dpms mode.

Let's merge this change back once all major issues are fixed and after
more testing.
2021-04-20 11:34:04 +00:00
Aleix Pol
d999aa6c6a drm: destroy the gbm device after we are done with all of the objects
Just in case they still need to interact with gbm
2021-04-20 13:02:46 +02:00
Aleix Pol
300f28a5a9 drm: remember to clean up DrmGpu's outputs when destroying 2021-04-20 13:02:46 +02:00
Aleix Pol
d5ac0cf919 drm: Also release the pipeline buffer when DrmOutput::releaseBuffers() 2021-04-20 13:02:46 +02:00
Aleix Pol
b82840d7e0 drm: Don't call virtual methods from a parent class destructor
We'd be relying on AbstractEglDrmBackend on calling cleanup but we'd be
doing it when cleanupSurfaces cannot be reached out anymore, turning it
into a half-baked cleanup.

Instead call cleanup from the leaf class destructors.
2021-04-20 13:02:46 +02:00
Xaver Hugl
7a9676dc0a Introduce the legacy flag for drm properties
There are properties like for example rotation
that don't have the atomic flag, yet work and
are needed in atomic mode setting.
2021-04-20 09:22:50 +02:00