Commit graph

20534 commits

Author SHA1 Message Date
Vlad Zahorodnii
0ebc563e6c Drop Toplevel::bufferScale()
On Wayland, a window can have subsurfaces. The spec doesn't require the
main surface and its sub-surfaces to have the same scale factor.

Given that Toplevel::bufferScale() makes no sense with Wayland windows,
this change drops it to make code more reasonable and to prevent people
from using Toplevel::bufferScale().
2021-11-16 09:38:51 +02:00
Vlad Zahorodnii
d755e74c29 Remove some manual repaints in X11Client
Let the scene schedule a repaint instead.
2021-11-16 07:26:44 +00:00
Vlad Zahorodnii
29235e122d kcmkwin/compositing: Hide Compositing label on Wayland
All compositing checkboxes are invisible on Wayland, so hide the
compositing label.
2021-11-16 07:26:09 +00:00
Vlad Zahorodnii
7013c1473c kwinglutils: Clean up persistent vbo fences at the start of the frame
With a persistent vbo, kwin will allocate one big enough buffer and
allocate memory out of it.

In order to prevent overwriting vertex buffer data that is currently
being accessed by the GPU, fences are inserted at the end of frame.

The signaled fences are destroyed after the buffer swap operation, which
seems a bit odd because the just inserted fence most likely won't be
signaled. Perhaps it's a historical artifact?

This change rearranges fence cleanup so it's performed right before
starting a new frame. With it, kwin will most likely re-use the
previously used memory chunk because there will be plenty of time for
the fence to become signaled.

Another motivation behind this change is to make refactoring SceneOpenGL
code easier. As is, m_backend->endFrame() is wrapped in
GLVertexBuffer::endOfFrame() and GLVertexBuffer::framePosted(). With
that, the Compositor can't call m_backend->endFrame(), which can be
desired for cleaning up render backend abstractions.
2021-11-16 07:25:20 +00:00
Vlad Zahorodnii
eecf14394e plugins/screencast: Introduce ScreenCastSource.closed signal
With the closed signal, we can unify how screen cast streams are closed.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
e7cd2c4396 plugins/screencast: Optimize output screencasting with memfd
When screencasting an output, read the output texture directly.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
92a461c687 plugins/screencast: Exclude client-side drop shadows
The buffer geometry may include client-side drop shadows, which looks
odd when screencasting.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
8518a7ea8c Drop Scene::Window::windowTexture() 2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
10032e99e3 plugins/screencast: Make embedded cursor position handling simpler
If the position of the cursor changes, let the screen cast source to
repaint memfd or dmabuf buffer.
2021-11-16 07:24:03 +00:00
Vlad Zahorodnii
c3c87ed8fa plugins/screencast: Introduce base ScreenCastSource type
Currently, when screencasting a window, kwin may render a window into a
temporary offscreen texture, copy that offscreen texture to the dma-buf
render target, and discard the offscreen texture.

Allocating and deallocating offscreen textures is inefficient. Another
issue is that the screencast plugin uses Scene::Window::windowTexture().
It's a blocker for killing scene windows.

This change introduces a base ScreenCastSource type. It allows us to
move away from Scene::Window::windowTexture() and make the dma-buf code
path efficient with applications such as Firefox that utilize
sub-surfaces.

With the ScreenCastSource, kwin can also provide screen cast frames with
arbitrary device pixel ratio.
2021-11-16 07:24:03 +00:00
Marco Martin
9eb5b92023 Apply roles to xdg popups if present
Like top level clients, apply plasmashell roles to popups as well (limiting them, don't allow dock or desktop roles in poups as they don't make sense)

This makes possible to recognize plasma tooltips as tooltips, treating them in a way closer to X, and makes morphingpopups work on wayland
2021-11-15 14:03:53 +00:00
Felipe Kinoshita
57b53e8d4e
Group compositing options in compositor KCM 2021-11-13 12:49:19 -03:00
Vlad Zahorodnii
cc50c64e8d effects/overview: Forward unhandled keys to search field
After user edits the name of a desktop, the search field is no longer
focused. If the user starts typing text, one could expect that it will
be forwarded to the search field without requiring a click.

This change forwards unhandled key events to the search field to ensure
that searching is intuitive.
2021-11-13 14:49:34 +00:00
Vlad Zahorodnii
0b56711bf4 Make ServiceType irrelevant when searching for binary effects
Since binary effects are installed in their own directory, checking
service type is redundant. Also, KPluginMetaData::serviceTypes() has
been deprecated.

Task: https://phabricator.kde.org/T14483
2021-11-13 09:27:58 +00:00
l10n daemon script
07e0205ca5 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-11-13 01:27:20 +00:00
Vlad Zahorodnii
b2f879eb33 effects/overview: Use strict equality operator in DesktopBar
It yields better performance.
2021-11-12 16:27:59 +00:00
Vlad Zahorodnii
b7d0f292f3 effects/overview: Load desktop name editor on demand
It's most likely going to be unused, so don't bother loading it.
2021-11-12 16:27:59 +00:00
David Redondo
3bebd3dce4 Start pointer gestures with fingerCount fingers not time fingers 2021-11-12 13:16:03 +01:00
Vlad Zahorodnii
ca4e643d67 effects/overview: Move Escape key handling to ScreenView
With this, no individual component has to handle the Escape key to
deactivate the effect.
2021-11-12 11:44:02 +00:00
Fushan Wen
25b035e84c effects/overview: Press Enter to create a new desktop
Add `Keys.onReturnPressd` and `Keys.onEnterPressed` to PC3.Button in
DesktopBar, so user can trigger the action by pressing Enter.
2021-11-12 19:20:46 +08:00
Oleg Solovyov
cd4bdaa8fe Use NewStuff Elements 2021-11-12 09:38:31 +00:00
Weng Xuetian
83a036e9d4 Fix XWayland abstract socket address.
NUL-termination byte is not needed for abstract socket. This leads to
XWayland listening to a wrong address.

Confirmed with lsof.

BUG: 442362
2021-11-12 09:02:35 +00:00
Xaver Hugl
0afd0aa4be backends/drm: some simplifications for multi gpu
There is only one type of egl backend now, so the abstract backend can be
removed
2021-11-12 09:30:13 +01:00
Xaver Hugl
c68f7f13f3 backends/drm,wayland: require gbm
The ifdefs for have_gbm obfuscate the code unnecessarily - the drm backend
is not a great experience with qpainter, so in practice noone should ship
it without gbm anyways.
2021-11-12 08:25:15 +00:00
Bharadwaj Raju
87afdb3e01 effects/overview: Make pressing Esc after closing label edit end the effect 2021-11-11 14:08:45 +00:00
Vlad Zahorodnii
affb640bcb Move OverlayWindow getter to RenderBackend 2021-11-11 11:49:13 +02:00
Vlad Zahorodnii
b8b8f93ca3 Drop Workspace::m_compositor
The Compositor is a singleton, there's no need to cache the return value
of Compositor::self().
2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
9fca6209b7 Make Scene responsible for handling Workspace::deletedRemoved() 2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
1fe8a18844 Make Scene responsible for scheduling repaint when current activity changes 2021-11-11 11:33:09 +02:00
Vlad Zahorodnii
6d0cca5c7f Move all dirty region scene repaint scheduling to Scene
The Compositor contains nothing that can potentially get dirty and need
repainting.

As is, the advantages of this move aren't really noticeable, but it
makes sense with multiple scenes.

Backend parts are far from ideal, they can be improved later on as we
progress with the scene redesign.
2021-11-11 11:33:04 +02:00
Vlad Zahorodnii
158fb016a4 Add Workspace::geometryChanged() signal
The new signal can be used to monitor workspace geometry changes. It can
be used by the Scene.
2021-11-11 11:29:23 +02:00
Vlad Zahorodnii
48f943bd75 Introduce explicit base render backend type
The main idea behind the render backend is to decouple low level bits
from scenes. The end goal is to make the render backend provide render
targets where the scene can render.

Design-wise, such a split is more flexible than the current state, for
example we could start experimenting with using qtquick (assuming that
the legacy scene is properly encapsulated) or creating multiple scenes,
for example for each output layer, etc.

So far, the RenderBackend class only contains one getter, more stuff will
be moved from the Scene as it makes sense.
2021-11-11 08:55:29 +00:00
Vlad Zahorodnii
f3071707f9 Simplify no compositing code path in Compositor::setupStart()
If either the render backend or the scene has failed to initialize,
both m_backend and m_scene will be null.
2021-11-11 08:54:52 +00:00
Nicolas Fella
44dff155b4 Remove unneeded X-Plasma-API from KCM metadata
It doesn't serve any purpose
2021-11-11 01:15:26 +01:00
Aleix Pol
bfe5c73541 Install the org.kde.KWin.TabletModeManager.xml 2021-11-10 14:20:56 +00:00
Fushan Wen
c517e6cebd xwl: Fix unused warning in xwldrophandler.cpp 2021-11-10 11:47:16 +00:00
Xaver Hugl
bad5752110 platforms/drm: kill the EglStreams backend
The proprietary NVidia driver now supports gbm, which vastly improves the
user experience. For older devices that will not get gbm support dropping
EglStreams will likely not have a big impact as it has several session breaking
issues anyways.

By removing the backend a lot of logic can be simplified, most notably multi-gpu.
2021-11-10 11:43:36 +00:00
Aleix Pol
f91ae3e975 xwayland: Also follow the primary output
We want to update the XRandR information so that X11 apps know which is
the primary display, since some of them make use of it to position
themselves.
2021-11-10 10:46:23 +00:00
Vlad Zahorodnii
7580d6c6e0 scenes/opengl: Remove NPOT extension check
NPOT textures are in core spec in OpenGL 2.0+.
2021-11-10 06:05:10 +00:00
Xaver Hugl
258b8b9bce WaylandServer: replace quotes with qstring 2021-11-10 03:33:29 +00:00
l10n daemon script
773de94486 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-11-10 01:20:01 +00:00
Nate Graham
6b949cac02 Use "Centered" window placement by default
The current "Minimize Overlapping" window placement tends to position
windows in locations that seem completely random, typically in a screen
corner. It is doing this because, true to its name, it is trying to
avoid overlapping other windows as much as possible. However in practice
this is rarely helpful. When the user opens a new window, it's because
they want to use it, and positioning the window far from where the
user is likely to be looking is counter-productive. This is even more
true on today's large and wide displays, where placing the window in a
corner may position it entirely outside the user's current field of
vision. We get bug reports about this exact issue for notifications
(which always appear in a corner by default) by users of such screens.
For notifications, this can be justifiable because notifications are
designed to be ignorable; app windows on the other hand, are not.

As a result, I commonly see Plasma users open windows and then
immediately, reflexively grab the window's titlebar and drag it to the
center of the screen. I have seen my wife do this. I have seen every
YouTube reviewer of Plasma do this. I have even see fellow KDE
developers at sprints do this. It seems like quite a common impulse
to want a newly-opened window to appear in the center of the screen,
which is where the user is likely to already be looking.

Thankfully, KWin already has a window placement mode that does this
automatically: "Centered". Accordingly, this commit changes the default
KWin window placement mode from "Minimize Overlapping" to "Centered".

No kconf migration script is provided because this is a better default
for most people in most cases, and existing users are highly likely to
appreciate this change.
2021-11-09 22:16:44 +00:00
Xaver Hugl
23d9341f6f platforms/drm: remove property blob handling from DrmProperty
It's no longer used
2021-11-09 22:15:31 +01:00
Xaver Hugl
3f62ea44dd platforms/drm: move gamma blob ownership to DrmPipeline::Gamma 2021-11-09 22:15:31 +01:00
Vlad Zahorodnii
02bb276ebf platforms/drm: Move ownership of mode blob to connector mode
The main motivation behind this change is to move management of drm
blobs out of property wrappers in specialized wrappers to simplify state
management with blobs.

Connector mode blobs are created on demand.
2021-11-09 22:15:31 +01:00
Xaver Hugl
1b5009ae2b platforms/drm: improve logging a bit
Only print the flags once for all pipelines and include changed unused objects
as well.
2021-11-09 22:15:31 +01:00
Xaver Hugl
7283c98f27 platforms/drm: disable unused resources on modesets
When we switch CRTCs it can happen that a CRTC would stay enabled yet has
no connectors anymore. In this case the kernel may reject our atomic commit,
which would cause the modeset to fail. To counteract that, properly disable
unused drm objects
2021-11-09 22:15:31 +01:00
Xaver Hugl
102fb3d5f2 platforms/drm: keep disconnected DrmConnectors around 2021-11-09 22:15:31 +01:00
Xaver Hugl
a07aae8282 platforms/drm: delay presentation for modesets
Currently KWin is combining modesets with presentation, which causes problems
when multiple monitors are used and crtcs need to be switched around, because
taking away a CRTC from another output causes the driver to disable the
other output. In order to avoid such problems, delay presentation until
all pipelines are ready to present and then do a modeset with a single atomic
commit. To process the resulting page flip events properly this commit also
ports KWin to page_flip_handler2 and changes how the pageFlipped and
notifyFrameFailed signals are processed.
2021-11-09 22:15:31 +01:00
Xaver Hugl
e2a0863843 platforms/drm: more dynamic crtc assignment
Hardware constraints limit the number of crtcs and which connector + crtc
combinations can work together. The current code is searching for working
combinations when a hotplug happens but that's not enough, it also needs
to happen when the user enables or disables outputs and when modesets are
done, and the configuration change needs to be applied with a single atomic
commit.

This commit removes the hard dependency of DrmPipeline on crtcs by moving
the pending state of outputs from the drm objects to DrmPipeline itself,
which ensures that it's independent from the set of drm objects currently
used. It also changes requests from KScreen to be applied truly atomically.
2021-11-09 22:15:31 +01:00