1
0
Fork 0
Commit graph

29966 commits

Author SHA1 Message Date
Olivier Fourdan
5e7754f742 x11/display: Delay cursor updates
When a client (either Wayland or X11) is started, the window activation
will update the cursor to the "busy" cursor.

Mutter will then set the X11 cursor on the X11 root window to match that
so that X11 applications which do not explicitly set a cursor inherit
from that default (busy) cursor.

Updating the X11 cursor too often can hammer the X11 connection and
cause a deadlock with Xwayland.

Reload the X11 cursor in a later handler to avoid that issue.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2849>
2023-03-04 09:07:44 +00:00
Jonas Ådahl
734b72099a readme: Expand how to tag commit messages
It's a common mistake that links to issues being resolved are not URLs,
and that Part-of was added manually by contributors. Make it clear what
the expectations are regarding this. Formalize on `Fixes:` for fixing
commit messages, and `Closes:` for closing issues while at it. Format
and alias for generating `Fixes:` tags come from mesa.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2847>
2023-03-03 23:17:26 +00:00
Jonas Ådahl
4551bc6b86 tests/kms/hotplug: Add tests for connector coming and going
Doesn't test any known issue, but just for the sake of testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2887>
2023-03-03 22:36:30 +00:00
Jonas Ådahl
995f9f9db8 onscreen/native: Hold output and CRTC refs until dispose
We relied on them being valid longer to keep track of used GPUs. If we
don't have the CRTC (or output) we don't have a way to fetch the pointer
to the MetaGpu that drives the associated monitor.

This avoids a crash when trying to fetch said pointer from what would be
the NULL MetaCrtc pointer.

Fixes: 08593ea872 ("onscreen/native: Hold ref to the output and CRTC until detached")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2667
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2887>
2023-03-03 22:36:30 +00:00
Michel Dänzer
3d28e03a29 wayland: Take surface reference for presentation-time feedback
Without this, the feedback->surface pointer could outlive the surface
it pointed to, which could result in use-after-free.

One consequence of this is that if a MetaWaylandPresentationFeedback
object ever lingers on longer than expected, it would keep the
MetaWaylandSurface alive as well.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2585
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2886>
2023-03-03 21:14:07 +00:00
Carlos Garnacho
beeeea546b core: Avoid setting up frames on fullscreen windows
Ensure we preserve the fast zero-copy paths in Xwayland fullscreen
windows, instead of maybe rendering the client surface on top of the
frame surface, and providing the latter to the compositor.

To achieve this, additionally synchronize frame state when
recalculating features (e.g. after fullscreen/unfullscreen), and
account for this new condition when creating or destroying frames.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2797>
2023-03-03 20:33:18 +00:00
Carlos Garnacho
1a210218c9 build: Fix cogl-pango underlinking
This library is using Pango and PangoCairo. Make it declare them
as requirements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
ff56431140 build: Only require gtk3 dependency if tests are enabled
It's only used there, now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
2e49c16264 build: Move to gnome-desktop-4 dependency
We no longer need gnome-desktop-3.0, and its dependency on gtk3 is
not desirable. Move to gnome-desktop-4 which actually does not
link to any GTK, conveniently for us.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
cd6b338ece build: Drop gtk3 build dependency from mutter library/executable
This is no longer directly needed by Mutter, so can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
a4f508db57 x11: Drop all bypass_gtk checks
There's no longer a GTK to appease, we can drop these
checks to tiptoe over it the right way.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
1fbbb73343 compositor: Add utility function to convert region to cairo_t path
We were relying on gdk_cairo_region() to convert a cairo_region_t
into a path ready to fill/stroke in a cairo_t. This is a small
and detached helper that we can do ourselves, so put it together
with all other region helper functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
ab9ea61d3d x11: Open a X11 Display directly
Do the few remaining things that GDK is doing for us:
- Open and close the X11 Display
- Set up a GSource on the Display FD to handle events
- Allocate and free the content of XGenericEventCookie,
  to "unroll" the few XInput2 events that Mutter still
  does handle.

And remove the GdkDisplay we've so long relied on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
a5042000c6 x11: Adopt X11 error trap infrastructure from GDK
From reading the comment in the top of the file, not for the first
time. Keep our own error handler and maintain our own list of
failable x11 sequences in MetaX11Display, so we can move away from
GTK's.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
2a182b91fb core: Sync after issuing key/button passive grabs
Try to collect any possible errors in place, instead of maybe
delegating asynchronous errors to maybe another error handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
a7e89453a7 core: Trap errors during passive button/key grabs
These are done on the backend X11 connection, so it is unclear
what is the interplay through the borrowed global XSetErrorHandler()
that triggers issues for us here.

Anyways, better to be explicit, and use error traps the MetaBackendX11
style, in coherence with the rest of the things happening in that
display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
ab3b12052d cogl: Trap GLX call with error trap
This is a X request that may result in errors, so it is better
to have covered by an error trap.

It is thus far not, explicitly at least, which means other less
lenient error traps might not like what happens here. Make the
error trap threeway between backend, x11 and cogl happen less
by chance here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
ae2ceeda0b ci,tests: Pass GTK_A11Y=none to tests
Same rationale applies than NO_AT_BRIDGE, but for GTK4 bits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
53cf1a2878 ci: Update image with new/future dependencies
gnome-desktop4 will be used from both Mutter and GNOME Shell,
and libnma-gtk4 only from GNOME Shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:00 +00:00
Robert Mader
b521747d81 Remove support for window shading
It's been broken for an unknown time and was never supported on Wayland.
Thus let's remove the leftovers.

Helpful command: `rg 'shade(?!r)' --pcre2`

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2884>
2023-03-03 19:17:51 +00:00
Robert Mader
92ac922519 window: Fix an if-block indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2884>
2023-03-03 19:17:51 +00:00
Jürgen Benvenuti
9b7700b677 Update German translation 2023-03-03 18:49:28 +00:00
Jonas Ådahl
08593ea872 onscreen/native: Hold ref to the output and CRTC until detached
When an onscreen is "attached" it means it has an active CRTC and output
it interacts with, e.g. listens to configuration changes to update gamma
and privacy screen state.

MetaOutput and MetaCrtc are rather short lived objects meaning they are
disposed of and regenerated each time the compositor reloads monitor
resources, and while MetaOutput are indirectly kept alive due to the
MetaMonitor holding on to them during reloading, the same does not apply
to MetaCrtc, so to avoid trying to disconnect our signals from
disappeared outputs and CRTCs when we dispatch, hold our own references
to these objects.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2665
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2885>
2023-03-03 17:32:04 +00:00
Jonas Ådahl
d1785a3917 onscreen/native: Detach onscreens when disposing
On exit, explicitly detach the onscreens during disposal. This means no
functional changes, but allows for doing more cleanup on detach that
doesn't need to be repeated on disposal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2885>
2023-03-03 17:32:04 +00:00
Simon McVittie
ed12df1099 color-device: Don't close lcms profile on error from cd_icc_load_handle
As implemented in colord 1.4.6, cd_icc_load_handle() has three possible
results:

1. success, taking ownership of the profile;
2. failure because cmsGetProfileContextID returns NULL, *not* taking
   ownership of the profile;
3. failure in cd_icc_load(), taking ownership of the profile.

The previous commit ensures that we are not in case 2.

In case 3 where cd_icc_load() fails, ownership was already given to
the colord CdIcc object, so it will be freed when the g_autoptr unrefs
the CdIcc, and we must not free it again: that would be a double-free,
potentially resulting in memory corruption.

Resolves: https://gitlab.gnome.org/GNOME/mutter/-/issues/2659
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2877>
2023-03-03 12:07:02 +00:00
Simon McVittie
e2be2d271b color-device: Make sure lcms_context is not NULL
lcms interprets a NULL context as using a default, non-thread-safe
context, which is unsuitable for mutter's use. Make sure we're always
using a non-trivial context.

Helps: https://gitlab.gnome.org/GNOME/mutter/-/issues/2659
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2877>
2023-03-03 12:07:02 +00:00
Marek Černocký
f447c0df18 Update Czech translation 2023-03-03 11:58:40 +00:00
Jonas Ådahl
6c1274b75e tests/monitor/default-scale: Add a couple of more test cases
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
d03dce4378 monitor: Use fractional scale result to decide the non-fractional scale
We want to avoid using too high scales too easily, which started to
happen 2f1dd049bf ("monitor-manager: Rework default scale factor
selection"). Instead of using the closest non-fractional scale, which
effectively is what we'd do, only round upwards if we're closer than
0.25 (25%).

Since there are some wiggle room for scales to make the logical
resolution on the integer pixel grid, make sure to compensate. This
compensation is done by adding an extra 0.2 to scale difference.

For example the following fractional scales will get these corresponding
integer scales:

    * 1.25 -> 1.0
    * 1.5 -> 1.0
    * 1.75 -> 2.0
    * 2.0 -> 2.0
    * 2.50 -> 2.0

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Carlos Garnacho
bf8027ef0d tests: Fix default_scale test
It was only testing for the first item in all cases, instead
of going through all of them.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
b0207f9567 tests/monitor/default-scale: Fix test cases
They weren't running, and didn't pass. Update the values to match what
is the current result.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
98c9db98e3 tests/monitor/default-scale: Use a large epsilon
To have the test case say e.g. 1.75 while the effective scale is
1.74863386, use an epsilon of 0.2.

Fixes: a6217c720e ("tests: Add tests for monitor_calculate_mode_scale")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2880>
2023-03-03 08:46:02 +00:00
Jonas Ådahl
f3f9200f9a tests: Port headless start test case to VKMS
Instead of testing headless start using the dummy backend, do so with
the real native backend, and use the drm-mock library instead to emulate
monitors being disconnected at startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
17623189e8 tests/drm-mock: Add filter mocking
This new filter allows test cases to manipulate what the kernel reports,
e.g. mark connected connectors as disconnected to emulate monitors
connecting and disconnecting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
671efb9937 tests/drm-mock: Add missing newline in macro
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Jonas Ådahl
9abce2fca7 gpu/kms: Report that we can have outputs if we have connectors
As part of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/525
(introduction of transactional KMS API), the logic determining whether a
GPU can have outputs was changed from whether any connectors existed to
whether any connected connectors existed. That effectively meant that we
wouldn't attempt to start at all if there were no monitors connected
while starting up.

This was unintentional, so lets revert back the expected behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2821>
2023-03-02 23:49:15 +00:00
Anders Jonsson
2c85eb7254 Update Swedish translation 2023-03-02 22:12:45 +00:00
Jonas Ådahl
ffd1e8106c kms/update: Merge connector updates too
This includes privacy screen updates, underscanning etc; this is needed
when merging mode set updates that happen to change these too, which is
rather likely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2881>
2023-03-02 22:09:16 +01:00
Balázs Úr
907e17ac25 Update Hungarian translation 2023-03-02 01:57:03 +00:00
Jonas Ådahl
f27ca241f9 renderer/native: Move per frame KMS update to MetaFrameNative
In order to make things more and more asynchronus and to each time we
paint be an isolated event, that can be potentially be applied
individually or together with other updates, make it so that each time
we draw, we use the transient MetaFrameNative (ClutterFrame) instance to
carry a KMS update for us.

For this to work, we also need to restructure how we apply mode sets.
Previously we'd amend the same KMS update each frame during mode set,
then after the last CRTC was composited, we'd apply the update that
contained updates for all CRTC.

Now each CRTC has its own KMS update, and instead we put them in a per
device table, and whenever we finished painting, we'll merge the new
update into any existing one, and then finally once all CRTCs have been
composited, we'll apply an update that contains all the mode sets for all
relevant CRTCs on a device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:40:16 +01:00
Jonas Ådahl
90ae14e792 kms/device: Move result queueing to impl device
This means there will be no entry points to the dispatch machinery that
doesn't report about the results.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
25172c21c9 kms/impl-device: Move fd hold to update when processing
This will let us move the update ownership to the backend, allowing it
to handle it with less restrictions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
6d043e6a8f kms/impl-device: Let process() always take ownership of the update
This allows more freedom how to handle the update in the backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
f9802ca2a4 clutter/frame-clock: Debug log frame drops per second if there were any
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
135ed27d27 clutter/frame: Allow setting a backend release function
The one set by the native backend is empty, but it will be used later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
7b634df379 renderer-view/native: Allocate backend specific ClutterFrame
This will carry an on-demand created MetaKmsUpdate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
678dc3243f clutter/stage-view: Allow stage view to allocate frame
This will be used to allow the native backend to allocate a KMS update
that'll be used for one frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
b80e84dea6 clutter/frame-clock: Allow frame clock listener iface allocate frame
This will allow the frame clock listener to allocate larger structs
where it can keep e.g. backend specific frame state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Dor Askayo
1abd930c56 backends/native: Introduce MetaRendererViewNative
MetaRendererViewNative is a MetaRendererView which contains logic
specific to views of the native backend. It will be used by following
commits.

In the future, per-view logic from MetaRendererNative can be moved to
MetaRendererViewNative where it makes more sense to have it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
2dfbbf0068 tests/kms/render: Add test for scanout failure handling
Make sure we repaint correctly if direct scanout updates fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00