Public bug reported:

[Impact]

On Ubuntu 26.04 with mutter 50.1-0ubuntu2.5, a PipeWire screen cast of a 
monitor whose consumer
uses shared-memory (SHM) buffers stops receiving frames as soon as a fullscreen 
window is shown by
direct scanout. Frames resume when the window leaves fullscreen. Consumers 
using dma-buf are not
affected.

User-visible effect, for example with GNOME Network Displays 
(Miracast/Chromecast casting, in
universe): while casting the whole screen, making a video fullscreen (YouTube 
in Firefox, a film in
VLC) freezes the picture on the receiver on the last frame, while audio keeps 
playing. Pressing Esc
brings the picture back. The sender shows nothing wrong, because GND repeats 
the last frame it got.

Measured on an affected machine : the rate of frames
delivered by mutter to the cast went from ~60/s to 0/s the moment a window went 
fullscreen (one frame
in 107 s), and back to ~60/s on Esc. Lenovo ThinkPad X1 Extreme Gen 2, internal 
panel driven by Intel
UHD 630 (i915), GNOME on Wayland, NVIDIA dGPU idle in PRIME on-demand mode.

Cause: in src/backends/meta-screen-cast-monitor-stream-src.c, 
before_stage_painted() returns early
when the stream does not use dma-bufs. During direct scanout, stage_painted is 
not called, so for SHM
streams no frame is recorded at all.

The only workaround is running `global.compositor.disable_unredirect()` from 
Looking Glass every
session, or a shell extension that does the same.

This has been reported upstream many times: gnome-network-displays #245, #364 
(moved to
mutter#3356), #398, #478, #487; mutter#3903, #3074; PipeWire #1556.

[Fix]

Upstream commit by Michel Dänzer, "stream-source/monitor: Fix direct scanout 
handling without
dma-buf". It closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3903 and is 
the only commit in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5276

- gnome-50 branch: 817424e85c3c4ae1a242978c34d210c6fc7b4c0c (released in mutter 
50.5), +23/−10
  lines, one file: src/backends/meta-screen-cast-monitor-stream-src.c
  
https://gitlab.gnome.org/GNOME/mutter/-/commit/817424e85c3c4ae1a242978c34d210c6fc7b4c0c
- main: 2021ac0c71bf395b3248d35854308961cb9aab14 (in 51.0)

The gnome-50 commit applies cleanly to the upstream 50.1 tag (`patch 
--dry-run`, no fuzz). I have
not tested it on top of Ubuntu's own 50.1-0ubuntu2.5 patches.

The current -proposed upload (50.1-0ubuntu2.6, LP: #2169221) does not
include this fix.

[Test Plan]


1. Ubuntu 26.04, GNOME on Wayland, a single internal display driven by the 
integrated GPU.
2. Start a whole-screen cast with an SHM consumer. For example, install 
gnome-network-displays and
   cast to a Miracast receiver (we used a Microsoft 4K Wireless Display 
Adapter), or use any client
   of the ScreenCast portal that negotiates SHM buffers through GStreamer 
`pipewiresrc`.
3. Play a video in a window and check that the receiver/consumer updates.
4. Make the video fullscreen.
   - Broken: the receiver freezes on the last frame (no new PipeWire buffers 
arrive) and audio
     continues. It recovers on Esc.
   - Fixed: the receiver keeps updating while fullscreen.
5. Regression checks: casting without fullscreen works as before; a dma-buf 
consumer (e.g. OBS
   screen capture via PipeWire) still records fullscreen windows; fullscreen 
games/video without
   any cast still use direct scanout (no added composition cost when nothing is 
cast).

[Where problems could occur]

The change affects only monitor screen-cast sources, and only while their view 
is direct-scanned-out.
For streams without dma-buf, it now schedules an idle frame record instead of 
returning, so SHM casts
get frames during fullscreen. As a result:
- While an SHM cast is active and a window is fullscreen, mutter does extra 
work (frames are recorded
  that previously weren't). This is the intended behaviour.
- For dma-buf streams, an idle record is now also scheduled if the pre-paint 
record captured nothing.
- Without an active screen cast, the code path doesn't run.

Regressions would show up as screen-cast glitches or crashes in the idle record 
path
(maybe_record_frame_on_idle, an existing function).

[Other Info]

- Affected package: mutter 50.1-0ubuntu2.5 (resolute-updates). Fixed upstream 
in 50.5 and 51.x;
  Ubuntu 26.10 (stonking) and 27.04 (tenacious) already ship mutter 51.0.
- Upstream NEWS for 50.5 lists "Fix direct scanout handling for captures 
without dma-buf [Michel; !5276]"
  (checked 2026-11-22 on the gnome-50 branch).

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175542

Title:
  Screen casts using SHM buffers receive no frames while a fullscreen
  window is direct-scanned-out (fixed upstream in 50.5, mutter#3903)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2175542/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to