Commit graph

417 commits

Author SHA1 Message Date
Alexander Lohnau
9c689d7ddb plugins: Port away from deprecated version checks
Task: https://phabricator.kde.org/T14302
2021-06-07 15:01:19 +00:00
Xaver Hugl
3c10398104 screencast: only use glGetTextureImage where supported 2021-06-07 14:11:07 +02:00
Xaver Hugl
0208f78336 platforms/drm: make context current for direct scanout 2021-06-07 13:45:50 +02:00
Xaver Hugl
cfd7af0179 platforms/drm: support NVidia as secondary GPU with CPU copy
BUG: 431062
2021-06-07 09:23:06 +02:00
Ömer Fadıl Usta
8fc3b024be Update dumb_swapchain.cpp 2021-06-05 04:59:02 +00:00
Vlad Zahorodnii
5498b37938 scenes/opengl: Delegate viewport setup to backend
Only the backend knows what the right viewport rect is. Furthermore,
setting up the viewport before rendering is less error-prone.
2021-06-04 16:18:34 +03:00
Vlad Zahorodnii
8b3e999fbf scenes/opengl: Properly destroy backend if initialization fails
SceneOpenGL takes the ownership of the backend. So, if the scene fails
to initialize, the backend will be deleted twice.
2021-06-04 07:39:51 +00:00
Ömer Fadıl Usta
6c97cd118d fix include 2021-06-02 17:41:10 +00:00
Xaver Hugl
b88b6f3bc3 platforms/drm: log when direct scanout starts and stops 2021-06-01 13:02:13 +02:00
Aleix Pol
aba3335ea6 Fix weird decoration glitch when using a scaled display
We used to get a weird line around the window decoration because the
clamping would hit the outside of the rendered decoration.
To make sure we fall inside take the displayPixelRatio into account.
Also on non-integer scales, make sure we are actually falling inside.
2021-05-31 13:01:25 +00:00
Xaver Hugl
7bf79090cf platforms/drm: add outputs on EglGbmBackend initialisation
BUG: 437761
2021-05-31 13:15:16 +02:00
Vlad Zahorodnii
33bb146861 scenes/opengl: Remove unused render node leaf type 2021-05-31 09:35:52 +03:00
Vlad Zahorodnii
048c732a4e scenes/opengl: Remove half-pixel correction workaround
It was needed to work around visual glitches in the wobbly windows
effect. Since the wobbly windows effect renders the animated window into
an offscreen texture, we don't need this workaround anymore.

Furthermore, rather than using half-pixel correction, it is more
desirable to use an offscreen texture as it results in simpler design.
Performance-wise, it's not that bad that we need to start looking for
other ways to get rid of the seams between window contents and deco.
2021-05-31 05:27:22 +00:00
Nicolas Fella
f910b0de97 Use version-less qt DBus macros
They work with both Qt5 and Qt6
2021-05-31 01:00:35 +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
Aleix Pol
644dcbe173 screencasting: do not attempt to copy a null texture
It seldom happens, but it does happen.
2021-05-26 12:56:59 +00:00
Vlad Zahorodnii
870c1e5557 scenes/qpainter: Clean up includes
Wayland-specific code in the qpainter renderer was removed long time ago.
2021-05-26 09:36:20 +03: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
Vlad Zahorodnii
7f32594692 Port decoration renderers to Decoration::damaged signal 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
1a464530bd scenes/xrender: Remove SceneXRenderShadow::buildQuads()
It's effectively the same as Shadow::buildQuads().
2021-05-24 06:22:28 +00:00
David Edmundson
af66f39f19 Support High DPI Aurorae decorations
With high DPI we can't use the image size as a logical size directly.

The other change is use of QPainter::drawImage(QRect target, QImage
image, QRect source)

This slightly confusing method uses logical pixels for the target, but
the source rect is in native pixels of the source.

BUG: 422342
2021-05-21 11:26:53 +00:00
Aleix Pol
22f2e3e43c No need to reset the damage for objects that we already know have none 2021-05-20 13:38:30 +00:00
Aleix Pol
848e9e2076 aurorae: Fix warning at startup
Give an opportunity to the settings to get initialized. Otherwise we set
an null object and qml scripts complain.
2021-05-20 13:36:04 +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
Vlad Zahorodnii
e4ec955d88 Remove shadow related bits in Scene::Window 2021-05-19 14:13:47 +03: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
Aleix Pol
a20a4327f5 screencasting: Make sure we don't stream after we've stopped a stream
When doing some (intense) testing I've seen it crash. This will prevent
it for good.
2021-05-18 11:51:05 +00: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
l10n daemon script
18793f83d3 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-17 01:33:52 +00:00
Alexander Lohnau
8125f9137f
GIT_SILENT Remove obsolete KRunner property 2021-05-15 10:03:33 +02: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
50dd08531e Make sure we do not get references on temporary objects 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
Aleix Pol
a06bf936bc --warning: Remove unnecessay cast 2021-05-14 01:35:33 +02:00
Aleix Pol
1754744297 Add switch case for impossible enum
It's already treated above and the compiler just does not see it.
2021-05-14 01:35:33 +02:00
Zhang Liang
837ef14e46 Change the argument name in function declaration
Change the name from "pipewireStream" to "stream",keep it same as definition.
2021-05-12 10:39:03 +00: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
Jan Grulich
caaabf84df Screencast: use dma-bufs only when client explicitly asks for it 2021-05-05 10:01:49 +02: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
2200f4ded9 windowsystem: Fix compilation with no deprecated build of KWindowSystem
Highlight window and present windows API has been deprecated in 5.82.
2021-04-29 10:46:39 +03: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
Vlad Zahorodnii
2c05229141 qpa: Set minimum device ratio of 1 for windows
This is to prevent rendering issues in the present windows close buttons
as Qt supports scale factors that are less than one poorly.
2021-04-26 11:41:37 +00:00
Vlad Zahorodnii
c9ac2e3fb8 decoration: Fix rendering issues with scale factors < 1
QPainter::setWindow() doesn't work as we expect if the device pixel
ratio of the paint device is less than 1, for example 0.5 or 0.75.

QPainter only allows the effective device pixel ratios that are greater
than or equal to 1. This restriction probably has to be lifted.

For the time being, this change introduces a helper function that can be
used to determine the scale factor by which QPainter::window() must be
multiplied.

BUG: 432766
2021-04-26 11:41:37 +00:00
Vlad Zahorodnii
c103eb8f5c qpa: Simplify backing store blitting
We can use QPainter::drawImage() to update the dirty area of the front
buffer. This way, we don't need to call std::copy().
2021-04-26 09:21:34 +00:00
Aleix Pol
b372de8c74 Fix startup when running with ASAN
We can't call kwinApp() before KWin::Application hasn't been properly
initialized.
2021-04-23 09:38:42 +00:00
l10n daemon script
6276c8882e 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-04-23 01:18:39 +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
Xaver Hugl
0292c4a74c platforms/drm: Add support for setting overscan
BUG: 428201
2021-04-19 18:46:41 +02:00
Xaver Hugl
7dddcf202b platforms/drm: Don't create outputs without primary plane in AMS 2021-04-19 12:12:26 +00:00
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
b68cd3110a Fix streaming of windows when we are using a mix of scales
At the moment a streamed screen when the screen scale was differnt
buffer scale would render wrong. This change addresses it by
compensating it.

This change compensates it resizing the rendered viewport to their
difference.

BUG: 428594
2021-04-16 17:18:56 +02:00
Aleix Pol
01f7ef35e7 drm: Make sure we read all pending udev events 2021-04-15 15:00:52 +00:00
Aleix Pol
b49c7497fa --warning: remove unused class member 2021-04-15 16:40:38 +02:00
Xaver Hugl
888a08530e Make DrmObject::Property flags const 2021-04-15 11:16:18 +00:00
David Edmundson
ab34fa348c Follow kwindoweffects::windowSizes deprecation 2021-04-15 05:55:46 +00:00
Alois Wohlschlager
59f6b77612
Fix crash when stopping PipeWire streaming
The stream object was deleted from a slot connected to its stopStreaming
signal. This is unsafe and can lead to memory corruption and ultimately
crashes when PipWwire streaming is stopped. Use deleteLater instead.

BUG: 428268 435588
2021-04-13 10:28:15 +02: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
e88033f914 wayland: Fix blank window thumbnails
With the introduction of stripped down window items, the WindowPixmap
objects no longer form a hierarchy. WindowPixmap::children() method was
removed.

Surprisingly, the removal of the children() method didn't result in a
compilation error because the QObject class has a method with the same
name.

Currently, a window pixmap will have no QObject children even if the
associated wayland surface has child sub-surfaces. This may result in
blank thumbnails of apps that use sub-surfaces, e.g. Firefox. In order
to fix that issue, we need to check if there are child items instead.
2021-04-08 22:15:33 +03: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
47113e09b8 scene: Introduce window items
Currently, dealing with sub-surfaces is very difficult due to the scene
design being heavily influenced by X11 requirements.

The goal of this change is to re-work scene abstractions to make improving
the wayland support easier.

The Item class is based on the QQuickItem class. My hope is that one day
we will be able to transition to QtQuick for painting scene, but in
meanwhile it makes more sense to have a minimalistic internal item class.

The WindowItem class represents a window. The SurfaceItem class represents
the contents of either an X11, or a Wayland, or an internal surface. The
DecorationItem and the ShadowItem class represent the server-side deco and
drop-shadow, respectively.

At the moment, the SurfaceItem is bound to the scene window, but the long
term plan is to break that connection so we could re-use the SurfaceItem
for things such as software cursors and drag-and-drop additional icons.

One of the responsibilities of the Item is to schedule repaints as needed.
Ideally, there shouldn't be any addRepaint() calls in the core code. The
Item class schedules repaints on geometry updates. In the future, it also
has to request an update if its opacity or visibility changes.
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
Vlad Zahorodnii
0bb5a51da8 x11: Move damage fetching code to X11Compositor
This is needed to make damage fetching specific to X11 surfaces.
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
38a15996f4 Consider the opaque region for direct scanout 2021-03-18 23:51:29 +01:00
Xaver Hugl
6569bf80c3 EglGbmBackend: use output reference
CCBUG: 432707
2021-03-18 15:22:31 +01:00
Alexander Lohnau
3cbbdbee99 GIT_SILENT Silence warning about unused parameter in windows runner 2021-03-16 08:45:29 +01:00
Alexander Lohnau
81b40966ed GIT_SILENT Add trailing comma to enums 2021-03-14 18:06:22 +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
Xaver Hugl
7a937fc7af Ignore fully translucent Toplevels for direct scanout 2021-03-05 19:59:48 +01: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
Vlad Zahorodnii
691df1ae00 qpa: Use imported targets for QtCore and QtGui private headers 2021-03-04 13:11:27 +00:00
Chaojiang Luo
fdc7e976fe screencast: Add OpenGLES support for screencasting
OpenGLES does not support glGetTextureImage, we use glReadPixels to
replace it.
2021-03-04 09:29:57 +00:00
l10n daemon script
5f7a2806f0 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-03-03 07:52:05 +01: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
l10n daemon script
553b6d39c6 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-02-22 06:57:46 +01:00
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
Vlad Zahorodnii
e179fb697d platforms/drm: Refactor event dispatching code
There are a couple of reasons not to use the lambda:

* It is unnecessary. The DrmGpu has the DRM file descriptor
* If a crash occurs somewhere in the lambda, the backtrace will be hard
  to read
* Instead of processing events in the destructor of the DrmBackend
  class, we should keep dispatching events without involving
  QCoreApplication::processEvents() until all page flips are completed.
2021-02-19 13:40:07 +00:00
Xaver Hugl
79ccfaddf0 Properly clean up DrmGpu
CCBUG: 433145
2021-02-19 13:19:21 +01:00
Vlad Zahorodnii
6053bbd2d0 Sprinkle static keywords
There is no need to query the environment variables every time kwin
tries to determine the current compositing refresh rate.
2021-02-19 11:16:50 +02:00
David Faure
abab1660aa Define -DQT_NO_CAST_TO_ASCII and fix compilation 2021-02-19 11:00:27 +02:00
Aleix Pol
8950b78121 pipewire: Don't crash if we're passed a null spa_data
I just had that crash, this is what coredumpctl suggested it was
happening.
We don't need to make sure we're in dmabuf mode to remove the buffer.
Worst case scenario it won't remove anything. Check the spa_data before
querying in case it's null.
2021-02-18 17:13:36 +00:00
Méven Car
11c3ada121 DrmGpu fix atomicModeSetting try 2021-02-18 16:26:18 +00:00
Vlad Zahorodnii
cf2486d643 x11: Properly detect whether swap events have to disabled
qEnvironmentVariableIntValue() will return 0 if the specified variable
is not set.

This means that swap events will be disabled on AMD GPUs unless the env
var is set explicitly to 1.
2021-02-18 12:04:27 +00:00
Vlad Zahorodnii
8570b64384 Rename visibleRect to visibleGeometry
"rect"s have their origin at the top-left corner of the frame. However,
visibleRect() returns a QRect that's in the global coordinates.
2021-02-16 06:56:04 +00:00
Xaver Hugl
995437f57c decouple DRM planes from DrmOutput 2021-02-15 17:28:58 +00:00
Méven Car
7c2c213f52 QPA Integration: Save enabled screens
Since QWindowSystemInterface::handleScreenRemoved would not be called in Integration::handleScreenDisabled, Qt apps would still reference disabled screens resulting in crashes.
2021-02-15 07:30:18 +00:00
Dan Leinir Turthra Jensen
df498d9be4 Add CLI tool to set window decorations, and use for KNS adoptions
This adds a command line tool which allows the user to set the window
decoration, and then that tool is used in the two knsrc files to allow
the user to switch window decoration directly from either a KNS dialog,
or from Discover.
2021-02-11 16:44:33 +00:00
Vlad Zahorodnii
3d363fb797 Fix build on FreeBSD 2021-02-11 16:49:05 +02:00
Vlad Zahorodnii
9ccae5eda6 platforms/wayland: Round up fractional scale factors
Currently, fractional scale factors that are less than 1 will be floored
to 0, which is a protocol violation.

CCBUG: 432766
2021-02-11 12:06:37 +00:00
Vlad Zahorodnii
2ce49877f7 platforms/wayland: Emit outputEnabled() signal
Otherwise the QPA won't create QPlatformScreens and the compositor may
not work as expected.
2021-02-11 12:03:26 +00:00
Vlad Zahorodnii
93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
2021-02-10 15:31:43 +00:00