Commit graph

18616 commits

Author SHA1 Message Date
Aleix Pol
ba1737787a xwl: properly check type inheritance 2020-10-20 02:16:00 +02:00
Aleix Pol
c016f34dee xwl: prefer using local variable than fetching again 2020-10-20 02:14:18 +02:00
Aleix Pol
e81e950693 xwl: simplify logic of boolean function 2020-10-20 02:13:42 +02:00
Aleix Pol
6ec13c41a5 xwl: Remove unnecessary lambda 2020-10-20 02:11:33 +02:00
Alexander Lohnau
d1a0c1491a Do not explicitely define Exec line for KCM 2020-10-19 15:53:26 +00:00
Fabian Vogt
96635ea29c Detect softpipe and llvmpipe on Mesa 20.2+
It seems like the vendor string changed from "VMware Inc." to "Mesa/X.org".
2020-10-19 14:53:38 +00:00
Vlad Zahorodnii
9c20df5030 screencast: Use fences to avoid stalling the graphics pipeline
Currently, we use glFinish() to ensure that stream consumers don't see
corrupted or rather incomplete buffers. This is a serious issue because
glFinish() not only prevents the gpu from processing new GL commands,
but it also blocks the compositor.

This change addresses the blocking issue by using native fences. With
the proposed change, after finishing recording a frame, a fence is
inserted in the command stream. When the native fence is signaled, the
pending pipewire buffer will be enqueued.

If the EGL_ANDROID_native_fence_sync extension is not supported, we'll
fall back to using glFinish().
2020-10-19 14:23:06 +00:00
Vlad Zahorodnii
170c41681d Drop unused EGLSurface getter and setter in Platform
Besides being unused, we should avoid making OpenGL contexts current
against the EGLSurface of the first output because it's a slippery road
that may end up in leaking context-specific resources in the mid of a
compositing restart.
2020-10-19 13:13:08 +03:00
Vlad Zahorodnii
292335beac Introduce persistent global share context
On Wayland, internal windows that use OpenGL are rendered into fbos,
which are later handed over to kwin. In order to achieve that, our QPA
creates OpenGL contexts that share resources with the scene's context.

The problems start when compositing has been restarted. If user changes
any compositing settings, the underlying render backend will be
reinitialized and with it, the scene's context will be destroyed. Thus,
we no longer can accept framebuffer objects from internal windows.

This change addresses the framebuffer object sharing problem by adding
a so called global share context. It persists throughout the lifetime of
kwin. It can never be made current. The scene context and all contexts
created in our QPA share resources with it.

Therefore we can destroy the scene OpenGL context without affecting
OpenGL contexts owned by internal windows, e.g. the outline visual or
tabbox.

It's worth noting that Qt provides a way to create a global share
context. But for our purposes it's not suitable since the share
context must be known when QGuiApplication attempts to instantiate a
QOpenGLContext object. At that moment, the backend is not initialized
and thus the EGLDisplay is not available yet.

BUG: 415798
2020-10-19 12:13:15 +03:00
Vlad Zahorodnii
da12d3804f Fix a potential SIGSEGV
Compositor::self()->scene() may return nullptr while compositing is
being restarted.
2020-10-19 06:12:13 +00:00
Vlad Zahorodnii
cc8cb8db9d qpa: Create a pbuffer for internal windows
If the surfaceless context extension is unsupported by the underlying
platform, the QPA will use the EGLSurface of the first output to make
OpenGL contexts current.

If an internal window attempts to make an OpenGL context current while
compositing is being restarted, for example it's typically the case with
the composited outline visual, QPA will either try to make the context
current with a no longer valid EGLSurface for the first output or will
crash during the call to Platform::supportsSurfacelessContext(). The
latter needs more explanation. After the compositingToggled() signal has
been emitted, there is no scene and supportsSurfacelessContext() doesn't
handle this case.

In either case, we could return EGL_NO_SURFACE if compositing is being
restarted, but if the underlying platform doesn't support the surfaceless
context extension, then the composited outline will not be able to
delete used textures, framebuffer objects, etc.

This change addresses that problem by making sure that every platform
window has a pbuffer allocated in case the surfaceless context extension
is unsupported.
2020-10-19 06:12:13 +00:00
Vlad Zahorodnii
41d431de27 Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).

While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.

Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.

Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.

Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 16:11:13 +03:00
Vlad Zahorodnii
fea950f23a Track the input shape of the server-side decoration
In order to determine if a window accepts input at specified position,
we need to check if the decorated window and the server-side decoration
contain the given point.

While we have a way to determine if a point falls inside the input shape
of the decorated window, there is no any way to do the same for the deco.
2020-10-17 15:43:16 +03:00
Vlad Zahorodnii
ba4f6b35ae Introduce geometry conversion helpers
The new helpers are designed for the purpose of mapping points from the
global screen coordinates to the frame-local and the surface-local coords
2020-10-17 15:40:51 +03:00
Vlad Zahorodnii
7eccfdc528 wayland: Introduce logicalToNativeMatrix() helper
The new helper function computes the projection matrix from the logical
coordinate space to the display coordinate space.
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
f1741317cd platforms/drm: Fix software flip output transforms
Currently, flip output transformations in the software fallback code
path are equivalent to normal rotate output transformations.

This change implements flip output transformations according to the
wl_output spec.
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
3b8e489b6f platforms/drm: Compute correct cursor transform matrix
Currently, when the DRM platform uses cursor planes, the cursor on
a rotated output may be cropped because the math behind the current
cursor transform matrix is off.

In order to fix the cropping issue, this change replaces the current
cursor transform matrix with the core part of the surface-to-buffer
matrix, which was written against the wl_output spec.

BUG: 427605
CCBUG: 427060
2020-10-16 17:03:39 +00:00
Vlad Zahorodnii
33fad70c9b platforms/drm: Fix initialization of EGL displays
Currently, every time compositing is restarted, both the gbm and the egl
streams backend will re-obtain the EGLDisplay object.

This is wrong because the core assumption is that the EGL display doesn't
change once it has been obtained.
2020-10-16 17:12:33 +03:00
Vlad Zahorodnii
a195223a8d wayland: Fix Qt clients not being maximized initially
Currently, Qt clients send two maximize requests separated by the
initial commit. From spec's perspective, this is totally fine, the
client should receive two configure events with "maximized" state.

But because changeMaximize() in XdgToplevelClient and setMaximized()
operate on two different maximize modes, the second maximize request
will trick kwin into thinking that the client should be restored.
2020-10-15 11:35:06 +00:00
Benjamin Port
4acea54272 KCM: Adapt to KCMUtils change 2020-10-15 08:45:52 +00:00
Vlad Zahorodnii
2093820aba xwayland: Avoid creating a tree query on crash
If Xwayland has crashed, the Workspace will block stacking order updates
and start destroying all X11 clients.

Once stacking order updates are unblocked, the Workspace will mark the X
stacking order as dirty and create a new Xcb::Tree object.

We don't want to create that Xcb::Tree object because accessing it
after the XCB connection has been shut down will lead to a crash.

BUG: 427688
FIXED-IN: 5.20.1
2020-10-14 16:17:42 +00:00
Vlad Zahorodnii
37ffba8b0f libkwineffects: Specify more dependencies 2020-10-14 13:03:57 +00:00
Vlad Zahorodnii
ffeebc4c2f libkwineffects: Specify valid min Qt version in KWinEffects.config.in
REQUIRED_QT_VERSION is used primarily in KF projects, not in Plasma
projects.
2020-10-14 13:03:57 +00:00
Cyril Rossi
d11daecce5 KCM KWinTabbox use KCModuleData
Allow to display a dot in the category list when settings has changed
from default.

CCBUG: 426775
2020-10-14 12:10:36 +00:00
Nicolas Fella
cc763e063c [libkwineffects] Clean up link targets
Some can be private, some are in the wrong place, some are not needed at all.
2020-10-14 00:04:28 +00:00
Nicolas Fella
3669ca2083 [libkwineffects] Remove KWIN4_ADD_GLUTILS_BACKEND cmake macro
Defining a macro and then using it only once is a bit strange.
2020-10-14 01:45:34 +02:00
Nicolas Fella
6edffc688d Add proper cmake config files for kwineffects
This makes it easier for out-of-tree effects to find and link against the required libs, including correct dependency propagation.
2020-10-13 23:53:48 +02:00
Vlad Zahorodnii
dbf52ebda5 launcher: Fix a file descriptor leak
The file descriptor must be closed after sending a ReleaseDevice request.
2020-10-13 21:05:33 +00:00
Vlad Zahorodnii
f369a3557c wayland: Block geometry updates while placing popups
Placement::placeTransient() checks the frame geometry right after
setting it. That is a problem because geometry updates for
XdgPopupClient are made in async fashion. We need to block geometry
updates in order to ensure that window placement code sees correct
geometry.
2020-10-13 18:03:40 +00:00
Vlad Zahorodnii
1e01b1334e platforms/drm: Remove redundant drmModeGetResources 2020-10-13 21:02:32 +03:00
Bhushan Shah
d9d1c976cd platforms/drm: do not try to use the GPU card node
On some devices, the GPU nodes are also added as /dev/dri/cardX, they
are not useful for KMS purposes and does not have display resources.
If we encounter such cards, then skip them.
2020-10-13 23:14:06 +05:30
Bhushan Shah
c586a2551e Drop check for if parent subsystem is PCI
This check is completely wrong for mobile GPUs where GPU are internal
and are not attached through PCI subsystem,

P: /devices/platform/display-engine/drm/card1
N: dri/card1
L: 0
S: dri/by-path/platform-display-engine-card
E: DEVPATH=/devices/platform/display-engine/drm/card1
E: DEVNAME=/dev/dri/card1
E: DEVTYPE=drm_minor
E: MAJOR=226
E: MINOR=1
E: SUBSYSTEM=drm
E: USEC_INITIALIZED=4239383
E: ID_PATH=platform-display-engine
E: ID_PATH_TAG=platform-display-engine
E: ID_FOR_SEAT=drm-platform-display-engine
E: DEVLINKS=/dev/dri/by-path/platform-display-engine-card
E: TAGS=:master-of-seat:seat:uaccess:

For example, on A64 platform, the KMS capable card is card1 which is not
attached with PCI.
2020-10-13 11:42:17 +00:00
Vlad Zahorodnii
0ef272bc21 platforms/drm: Save last working output transform
This can be useful for testing output transformations without kscreen.
2020-10-13 05:34:39 +00:00
Vlad Zahorodnii
691ce56627 platforms/drm: Query cursor capabilities per individual gpu
We should not assume that the cursor capabilities are shared by all DRM
devices.
2020-10-13 05:34:01 +00:00
Vlad Zahorodnii
29fbe27ffc core: Use less confusing name for Platform::supportsQpaContext()
Platform::supportsQpaContext() indicates if the EGL display supports
surfaceless contexts, so reflect that in the method name.
2020-10-13 05:32:48 +00:00
Vlad Zahorodnii
9b89a3d967 qpa: Merge OpenGL platform context classes
This makes our QPlatformOpenGLContext private subclass simpler.

As a slightly unrelated change, this patch also fixes a bug where our
platform opengl context may return a wrong surface format if surfaceless
contexts are unsupported.
2020-10-13 05:32:48 +00:00
Vlad Zahorodnii
b7bd8472f2 scene: Reduce the call cost of Platform::supportsQpaContext()
Every time Platform::supportsQpaContext() is called, we go through the
list of supported extensions and perform a string comparison op. This is
not really cheap.
2020-10-13 05:32:48 +00:00
Nicolas Fella
968b57fe2f Fix KWIN_EFFECT_FACTORY macros
The macros don't work because of the mismatching capitalization.
2020-10-12 20:28:22 +00:00
Nicolas Fella
aa9475e64e [effects] Fix documention sentence
It makes more sense this way to me
2020-10-12 19:36:32 +02:00
Vlad Zahorodnii
d3934be591 Prefer std::make_unique over std::unique_ptr(new T)
This way code is thinner and it is guaranteed that no memory leaks will
occur if an exception gets thrown for some reason.
2020-10-12 08:51:01 +03:00
l10n daemon script
faa06ea919 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"
2020-10-12 06:06:51 +02:00
l10n daemon script
5cb6f51ef6 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"
2020-10-11 06:01:48 +02:00
Vlad Zahorodnii
08263b534d Safely remove all internal clients and override-redirect windows
When we destroy all internal clients and override-redirect windows, we
assume that corresponding lists will be implicitly detached.

However, in some cases, that might be not the case. For example, if the
list is not shared, neither begin() nor end() will detach. Therefore, it
is possible to hit invalidated iterators if the list is modified inside
the loop.

This change prevents hitting invalidated iterators by making explicit
list copies.

CCBUG: 427373
2020-10-09 19:33:46 +03:00
Vlad Zahorodnii
a5b811dadb Rename the variable where override-redirect windows are stored
Prepend m_ to unmanaged so no one has to come up with original names if
they want to iterate over a shadow copy of it.
2020-10-09 18:49:32 +03:00
Aleix Pol
ec73f5eec8 Adapt to changes in wayland-server KeyStateInterface 2020-10-09 13:17:38 +00:00
Aleix Pol
daf693d3ed Restore building the wayland_backend without gbm
Disables the compilation on the few places that use it to allow creating
dmabufs easily.

Patch inspired by David Faure.
2020-10-09 13:15:12 +00:00
l10n daemon script
237d52be01 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"
2020-10-09 06:39:13 +02:00
Bhushan Shah
a13f5d4b06 inputmethod: remove the workarounds
- Do not set emit the enabledChanged of the text-input-v2 when it
  requests us to show input panel, it is already enabled when you get
  this request
- If we get the request to show input panel, reset the inputContext,
  there's two reason we can get this event: 1) when keyboard focus is
  activated or 2) when keyboard focus is changed to text field in same
  surface. In both cases, information in input method context is not
  valid anymore and should be reset.
- Also instead of ignoring the update_state events from client, adopt
  input method accordingly.
2020-10-08 17:56:44 +05:30
Ismael Asensio
23788ad9b9 [kcm/kwinrules] Add properties to a rule one-by-one
Change the labels to singular `Property` and close the property sheet
after clicking on one item.

The behaviour of the sheet is now more similar to a menu, and not so
much as a dialog which needs to be dismissed to go on.

The idea is to simplify the rule editor workflow and make it more evident
to the users. By making the `Add property` close after each selection,
the user can see immediately that the property has been added to the
rule list so they can edit it.

Also use ListView transitions to add visual hints when adding
or removing properties, and try to position the new added item
into the visible view.
2020-10-07 23:08:23 +02:00
Vlad Zahorodnii
f247e35c6d wayland: Fix initialization of dmabuf textures
Commit e459c8bf54 added a sanity check to
prevent recomputing the texture matrix if the y-inverted hint hasn't been
changed, which is totally reasonable!

However, code that initializes dmabuf textures implicitly assumes that
calling setYInverted() always results in updating the matrix. But it may
be not the case if the passed value matches current isYInverted().

This change adds missing calls to force updating the texture matrix.

Note that we don't need to check the buffer size every time the dmabuf
image has been modified externally because the window pixmap is going to
be re-created if the dimensions of the attached buffer have changed.

I've seen some reports on the internet about Firefox displaying garbage
instead of videos. 99% that bug is caused by this issue. But it seems
like Firefox no longer displays corrupted videos on my machine, so it's
hard to tell.
2020-10-07 11:43:43 +00:00