1
0
Fork 0
Commit graph

31892 commits

Author SHA1 Message Date
Michel Dänzer
c25f6f2ded wayland/buffer: Pass g_object_unref to g_ptr_array_new_with_free_func
The release_points array holds pointers to MetaWaylandSyncPoint objects.

Fixes leaking references (and ultimately the underlying memory) for the
array elements.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3442
Fixes: e8b890ab53 ("wayland: Implement linux-drm-syncobj-v1")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3710>
2024-04-19 10:32:38 +00:00
Fabio Tomat
a1d2cc5c64 Update Friulian translation 2024-04-18 08:09:27 +00:00
Carlos Garnacho
c087d9b746 clutter: Make low-level picking function private to ClutterStage
It's now only called within it, inside other higher-level accessors
to update picking based on actor/view/event changes. This can now be
made a private call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
4ab868154f clutter: Update all devices in a view in ClutterStage code
Avoid open-coding the process of figuring out the affected devices
on view changes and repick on those, in exchange for a ClutterStage
method to do this altogether.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
5220bc61b4 clutter: Add ClutterStage function to repick from event
Instead of doing that in clutter-main.c code, move it together
with the rest of picking calls to ClutterStage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
22d0ff569a clutter: Drop clutter-wide clutter_stage_repick_device()
This is only called from a single place inside ClutterStage code,
drop this public internal function, and repick in place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Jonas Dreßler
bbb196bdde wayland/touch: Store touch serials more persistently
Right now we store touch serials on their according MetaWaylandTouchInfo
entries. These entries are gone as soon as the touchpoint ended though, and
it's not unlikely that clients will respond to that touch-end event after we
removed the touchpoint.

In this case we currently can't match the client provided serial to any of
our known touch sequences, which causes xdg_popup grabs that get requested
shortly after the touch-end to fail.

Let's be a bit more gentle on clients here and store the latest touch-down
serial on the MetaWaylandTouch, so that it continues to be around after the
touch-end and we can match the serial of the xdg_popup_grab() as expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2946>
2024-04-17 11:13:08 +00:00
Daniel van Vugt
d53da38198 onscreen/native: Avoid dereferencing gbm.next_fb when not in MODE_GBM
Such as with MODE_EGL_DEVICE.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3436
Fixes: 40950f99b3 ("drm-buffer-gbm: Do not call ensure_fb_id from...")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3708>
2024-04-17 13:34:22 +08:00
Daniel van Vugt
040800268f onscreen/native: Don't refuse primary GPU copy support based on egl_surface
Because that egl_surface is only used for secondary GPU copying, which
isn't relevant to primary GPU copies.

This is a partial revert of 41bfabad96 which is no longer required since
the previous commits have enabled secondary GPU copy support for nvidia-drm.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2551
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
7e27d297dd renderer/native: Remove cached program ID when EGLContext destroyed
In the rare event that hotplugs destroy and then create a new EGLContext
with the exactly the same ID, this ensures we will forget the old program
which presumably wouldn't work in the new context. It will be recreated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
ccca3709c2 renderer/native-gles3: Fix up function parameter alignment
check-code-style was complaining about this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
2d3a2a52b8 renderer/native-gles3: Add fallback using a shader
The EGL context can only import and blit an EGLImage if the
backing DMA buffer has a format modifier combination that is advertised
as supported and not marked as "external_only".

When the context can't blit the imported image, we can still paint using
it GL_OES_EGL_image_external using the texture target
GL_TEXTURE_EXTERNAL_OES.

However, treat drivers who doesn't support modifiers at all as if they
do support blitting, if the modifier is 'linear', to avoid regressions.

[jadahl: Make shader path a fallback to allow hardware to utilize copy
engines via blitting]

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6221
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2247
Related: https://launchpad.net/bugs/1970291

now only falls back if modifiers are supported, and they mark linear as
export only.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
b065dce194 renderer/native-gles3: Remember to set the glViewport
This is a critical part of any OpenGL program. Mesa allowed us to get
away without it and provided a sane default of the full buffer, but
Nvidia seems to default to an empty/zero viewport so would refuse to
paint any pixels.

In the OpenGL ES 2.0 spec this is ambiguous:

> In the initial state, w and h are set to the width and height,
> respectively, of the window into which the GL is to do its rendering.

because the first "window" used is EGL_NO_SURFACE in
init_secondary_gpu_data_gpu. It has no width or height.

In the OpenGL ES 3.0 spec the ambiguity is somewhat resolved:

> If the default framebuffer is bound but no default framebuffer is
> associated with the GL context (see chapter 4), then w and h are
> initially set to zero.

but not entirely resolved because neither spec says whether
EGL_NO_SURFACE should be treated as zero dimensions (Nvidia) or ignored
and not counted as the first "window" (Mesa).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
af98776224 onscreen/native: Finish primary GPU rendering before copying to secondary
As mentioned in the OES_EGL_image_external spec, there is no implicit
sync between the EGLImage producer and consumer. And in this code path
we don't have meta_drm_buffer_gbm_new_lock_front on the primary GPU to
do it for us either. So synchronization has to be done manually or else
the secondary GPU is likely to get an unfinished image.

This problem has only been observed when the secondary GPU is using the
Nvidia proprietary driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
5edb22d7d7 renderer/native: Flag when explicit sync between GPUs is required
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
8c6aabb9ca egl: Add function: meta_egl_query_string
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Daniel van Vugt
9fee3a9ec1 onscreen/native: Fall back to gbm_surface_create without flags
The Nvidia driver will return ENOSYS if any flags are used. Bug filed
upstream on the NVIDIA forums.

https://forums.developer.nvidia.com/t/gbm-surface-create-fails-if-flags-0/279951

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Jonas Ådahl
32da2789bf meta/util: Move out debug topics and meta_topic()
The purpose is to not include all of clutter and cogl.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Jonas Ådahl
a24b7956da meta/common: Put META_EXPORT in its own header
Want to include it without including all of clutter and cogl.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Jonas Ådahl
0b91d22848 common/cogl-drm-formats: Split out format to string helper
It means it can be included in places that assume cogl and everything it
involves shouldn't be included, e.g. meta-renderer-native-gles3.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3304>
2024-04-16 21:05:09 +00:00
Sebastian Wick
f91851154e core/window: Do not rely on Monitor Numbering
When the monitors change meta_window_update_for_monitors_changed is
called which is responsible for updating window->monitor. It however can
go through the entire window placement and constraint machinery before
it's able to do so. In this period window->monitor points to the old
MetaMonitor where the monitor number doesn't reflect the index into the
MonitorManager anymore.

Avoid relying on the window->monitor->number and go through the Monitor
directly.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3402
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3691>
2024-04-16 20:31:23 +00:00
Sebastian Wick
74a01e3f39 color-device: Use a sRGB profile if the EDID is missing
This makes sure the ColorDevice can initialize successfully even if the
display doesn't have an EDID.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3394
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3673>
2024-04-16 13:45:13 +02:00
Carlos Garnacho
d214583aa2 wayland: Do not bypass MetaWaylandInput changing keyboard focus
In every other device and circumstance, we update the logical focus
(i.e. the surface that would be focused, if no other circumstances
applied) but let the MetaWaylandInput figure out the surface that
should be effectively focused, if at all. This is where we apply the
actual compositor state (e.g. grabs) and result in an effective focus
window.

The only exception to this is `meta_wayland_seat_set_input_focus()`
where the logical focus for keyboards and related devices is set, but
also applied as the effective surface.

We should do the same as everywhere else, and let MetaWaylandInput
focus determine whether the logical focus is also the effective focus.
These replaced set_focus() internal calls will happen through the
default MetaWaylandEventInterface.focus implementation in MetaWaylandSeat.

This resulted in keyboard focus being set on windows in circumstances
it ought not to, like in the overview. Actual key events were never
sent in these circumstances, but changes to modifier state could.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7528
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3704>
2024-04-15 20:43:44 +00:00
Carlos Garnacho
3b5f467163 core: Allow fullscreen modals to move out of the center of their parents
If a modal dialog (i.e. with a "revolves around center of parent window" policy)
becomes fullscreen, we cannot neatly honor both the modal dialog going fullscreen
and the window staying around the center of its parent.

In order to make fullscreening work in this situation, allow fullscreen modal
dialogs to "snap out" of the parent. This rule will become again effective after
the window is unfullscreened.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3425
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3695>
2024-04-15 20:24:30 +00:00
Sophie Herold
d36afd32d7 wayland: Always use logical pixels for bounds
This fixes that with scale-monitor-framebuffer disabled, windows were always
configured with bounds using physical instead of logical pixels.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3269

Co-authored-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3698>
2024-04-15 20:13:50 +00:00
Jonas Ådahl
454a70cce5 edge-resistance: Use current conventions for lists
Use GList *l and for loop for iterating, autopointers and autolists
for memory management, and a function instead of a macro for a
condition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3703>
2024-04-15 16:48:04 +00:00
Jonas Ådahl
5dab10e441 mtk/rectangle: Add auto-cleanup integration
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3703>
2024-04-15 16:48:04 +00:00
Jonas Ådahl
3091449298 mtk/rectangle: Add constructor for an empty rectangle
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3703>
2024-04-15 16:48:04 +00:00
Robert Mader
1f82365021 window-actor/wayland: Improve scanout candidate check
By ignoring obcured surfaces we can generalize the single-pixel-buffer
background check to work with arbitrary surface trees, as long as the
two top ones are the background and content surfaces.

As a nice side effect of this, clients like Firefox now usually take the
shorter `meta_window_is_fullscreen (window) && n_visible_surface_actors == 1`
route.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3699>
2024-04-15 15:52:26 +00:00
Jonas Ådahl
e5068bfc91 wayland/single-pixel-buffer: Fix reusing buffer
We had missed to actually return the cached texture, so do that.

Also add a test.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3432
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3702>
2024-04-15 17:37:52 +02:00
Michel Dänzer
a834eb5c94 onscreen/native: Don't create timestamp query with secondary GPU work
The timestamp query is currently always created for the primary GPU, so
it doesn't cover any later secondary GPU work.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3070
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3689>
2024-04-10 11:59:30 +02:00
Michel Dänzer
09267d0bdd cogl/onscreen: Add cogl_onscreen_egl_maybe_create_timestamp_query
Move the code out of cogl_onscreen_egl_swap_buffers_with_damage, and
call the new function from callers of the former.

v2:
* Use early return if the cogl context doesn't support timestamp
  queries. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3689>
2024-04-10 11:17:23 +02:00
Michel Dänzer
0bbc25f694 cogl: Update latest sync fd from cogl_onscreen_swap_buffers_with_damage
Preparation for later changes, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3689>
2024-04-10 11:17:19 +02:00
Michel Dänzer
40950f99b3 drm-buffer-gbm: Do not call ensure_fb_id from lock_front
When preparing a frame for scanout on a secondary GPU, calling
meta_drm_buffer_gbm_ensure_fb_id for the primary GPU device is
unnecessary and potentially harmful.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3389
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3674>
2024-04-09 08:28:59 +00:00
Gwan-gyeong Mun
8f08e39e00 Update Korean translation 2024-04-08 14:34:22 +00:00
Rachida SACI
e2d12d80ed Update Kabyle translation 2024-04-08 10:23:42 +00:00
Bilal Elmoussaoui
34d79b9ddf cogl: Make sure generated enum header is built before sources using it
Fixes: 63a558950 ("cogl: Generate a GType for PixelFormat")
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3413

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3690>
2024-04-07 14:29:07 +00:00
Barnabás Pőcze
c0ae617b3f tests/mtk/region: Fix MtkRectangle leak
`mtk_rectangle_new()` allocates the object dynamically,
but in the "contains-point" test case the allocated object
was not freed. Fix that by creating the object on the stack.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3679>
2024-04-05 15:10:18 +00:00
Daniel van Vugt
22689d722a compositor/sync-ring: Allow the gpu_fence to be moved
When the compositor inserts two waits in a frame, such as f606a4424a,
the second insertion shouldn't break the ring's state machine as easily
as it does. We can instead merge the two GL waits into one by simply moving
the GL fence to the latest insertion. Each insertion still does its own X11
sync though.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3384
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3685>
2024-04-05 14:18:12 +00:00
Jonas Ådahl
82c0f9c57d cursor-renderer/native: Don't predict the dumb buffer stride
The stride of the dumb buffer isn't necessarily 4 * width even if the
bytes per pixel is 4, so lets not make that assumption.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2267951
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3666>
2024-04-05 14:06:54 +00:00
Ivan Molodetskikh
25c9cff7be dbus-interfaces: Fix layout-mode comment
This corresponds to the values in the code. The second comment is
correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3671>
2024-04-05 13:45:01 +00:00
Bilal Elmoussaoui
ee3221f146 tests/wayland-clients: Avoid using static when not needed
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3687>
2024-04-04 14:51:21 +00:00
Bilal Elmoussaoui
4b26feafac tests/wayland-clients: Pass WaylandDisplay as user_data
Avoids using a static and make sure things are properly freed by
using g_autoptr. Also take the opportunity to add some missing NULL
initialization for auto-pointers variables

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3687>
2024-04-04 14:51:21 +00:00
Athmane MOKRAOUI
c0c0b70599 Update Kabyle translation 2024-04-04 12:24:33 +00:00
Bilal Elmoussaoui
260a8d92dc cogl: Use uint64_t for size params
As we are using a GParamSpecUint64 for that property
which makes it fail under 32bits platforms

Fixes: 6efd4a228 ("cogl/cleanup: Use construct-only properties for
CoglBuffer")
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3408

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3683>
2024-04-03 14:30:49 +00:00
Carlos Garnacho
bc72428a02 backends/native: Declare variables at beginning of block
In consistence with the code style, and in order to fix build errors
with older clang:

    ../src/backends/native/meta-onscreen-native.c:521:7: error: expected expression
      521 |       graphene_rect_t src_rect;
          |       ^
    ../src/backends/native/meta-onscreen-native.c:529:39: error: use of undeclared identifier 'src_rect'; did you mean 'dst_rect'?
      529 |                                      &src_rect);
          |                                       ^~~~~~~~
          |                                       dst_rect
    ../src/backends/native/meta-onscreen-native.c:522:20: note: 'dst_rect' declared here
      522 |       MtkRectangle dst_rect;
          |                    ^

And warnings with newer clang:

    ../src/backends/native/meta-onscreen-native.c:521:7: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
      521 |       graphene_rect_t src_rect;
          |       ^

This should allow the build for coverity to succeed again.

Fixes: adc776d0d7 ("crtc/kms: Pass on src and dst rects to primary plane assignments")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3686>
2024-04-03 10:37:17 +00:00
Carlos Garnacho
3207b9d8c5 ci: Check repo sanity
Check that the container registry in user repositories is
enabled, and issue a more descriptive error around it. Lifted
from Tracker.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3681>
2024-04-02 11:16:31 +02:00
Nathan Follens
f4b3322b77 Update Dutch translation 2024-03-31 10:13:31 +00:00
Rachida SACI
c438e7389b Update Kabyle translation 2024-03-30 09:31:52 +00:00
Austin Shafer
e8b890ab53 wayland: Implement linux-drm-syncobj-v1
This implements the explicit sync protocol linux-drm-syncobj-v1. This
works by importing a DRM syncobj timeline and importing/exporting fds
to/from the sync points on the timeline corresponding to buffer acquire
and release. We take fds for sync points provided during a surface
commit and use them to delay transaction application, and fetch fds
from Cogl to signal when we are done using a particular buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3300>
2024-03-28 13:28:08 -04:00