Stored monitor layout not restored when an output reconnects during Muffin's own reconfiguration (hotplug misdetected, output left mirrored)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 43/100
Hướng nghiên cứu
Start with meta_monitor_manager_xrandr_handle_xevent() in src/backends/x11/meta-monitor-manager-xrandr.c and trace how RandR timestamps determine whether a change is treated as a hotplug. Compare that path with meta_monitor_manager_on_hotplug() and the stored monitor configuration lookup. Done means a quick disconnect and reconnect restores the saved three-monitor layout; the issue describes the setup and observable failure, but provides no test file or reproduction harness.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Distribution
Linux Mint 22.3 (Cinnamon 6.6.9, X11)
Package version
muffin 6.6.3+zena (libmuffin0 6.6.3+zena)
Graphics hardware in use
NVIDIA GeForce RTX 2060, proprietary driver 595.99.02 (open kernel module). Two DisplayPort monitors and a 2012 Samsung TV on HDMI.
Frequency
Quite often (not always: it is a race). In one run 2 of 3 power cycles of the TV were fine; in the next, 4 hotplugs in a row hit it.
Bug description
When an output disconnects and reconnects within a couple of seconds, Muffin can skip the saved layout for the full set of monitors and leave the returning output mirrored with another monitor.
My TV keeps its HDMI output "connected" while switched off, but as it powers on it drops the output for about 2 seconds and brings it back. After that blip the saved 3-monitor layout is often not restored: the TV ends up at 0,0 on top of the primary monitor, and the Display settings show them as one mirrored pair.
Saved layout (~/.config/cinnamon-monitors.xml has it for exactly these three monitors):
HDMI-0 1920x1080+0+0
DP-5 1920x1080+0+1080
DP-3 1920x1080+1920+1080 (primary)
After the blip:
HDMI-0 1920x1080+0+0
DP-3 1920x1080+0+0 (primary)
DP-5 1920x1080+1920+0
In that state org.cinnamon.Muffin.DisplayConfig.GetCurrentState lists all three monitors with the same connector/vendor/product/serial as the saved configuration, and two logical monitors: (0,0) with DP-3 + HDMI-0, and (1920,0) with DP-5. So Muffin knows the monitors and has a stored configuration that matches them; it just never applies it.
What I think happens. meta_monitor_manager_xrandr_handle_xevent() in src/backends/x11/meta-monitor-manager-xrandr.c decides whether an event is a hotplug with:
is_hotplug = resources->timestamp < resources->configTimestamp;
In the broken state the X server reports:
timestamp = 40948476 (last configuration change)
configTimestamp = 40948273 (last hotplug)
i.e. the last configuration change landed 203 ms after the last hotplug. That is consistent with this sequence:
- The TV disconnects. Muffin handles it as a hotplug and, having no stored configuration for the two remaining monitors, starts applying a linear one (DP-3 at
0,0, DP-5 at1920,0). - The TV reconnects (
configTimestampmoves) before that configuration has been applied. - Muffin's configuration lands (
timestampmoves, now newer thanconfigTimestamp). - When the event for the reconnection is processed,
timestamp < configTimestampis false, so it is not treated as a hotplug:meta_monitor_manager_on_hotplug()is not called and the stored 3-monitor configuration is never looked up. The state is rebuilt from what X has, where the TV's CRTC is still at0,0.
I have not instrumented Muffin itself; steps 1–3 are inferred from the two timestamps, the resulting layout and the code. The same comparison is still in master.
Steps to reproduce
- Three monitors with a saved non-linear layout, e.g. one output placed above the other two, so that removing it changes the positions of the rest.
- Make that output disconnect and reconnect within ~2 seconds (in my case: power on a TV that toggles HPD while it boots).
- Repeat a few times.
Expected behavior
After the output is back, the stored configuration for the full set of monitors is applied, as it is when the reconnection does not overlap with Muffin's own reconfiguration.
Additional information
Polling xrandr during one failure (local time, 0.4 s resolution):
18:47:03.4 DP-3 1920x1080+1920+1080 (primary) | DP-5 1920x1080+0+1080 <- HDMI-0 gone
18:47:05.2 HDMI-0 1920x1080+0+0 | DP-3 1920x1080+0+0 (primary) | DP-5 1920x1080+1920+0
Cinnamon logged Monitor Watch List updated: [0,1] at the disconnection and nothing afterwards (it logs [0,1,2] when the layout is restored correctly).
Reapplying the positions with xrandr --output … --pos … fixes it, and Muffin then reports three separate logical monitors again. As a workaround I run a small user service that listens for RandR ScreenChangeNotify events with a new config timestamp and, if two monitors end up at the same position shortly after, reapplies the layout from cinnamon-monitors.xml.
Possibly the same underlying problem as #639 (closed as stale).
- Ngôn ngữ chính
- C
- Star
- 249
- Fork
- 133
- Merge trung bình
- 17 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của linuxmint/muffin
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
-
X11: every keyboard layout switch freezes the compositor for up to ~1 s (reload_keybindings regrabs per-window keybindings on every window)Có thể đã có người làm @KAMI911 đã nhận 7 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của linuxmint/muffin
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
389ds/389-ds-base#8152 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition rootCó thể đã có người làm @tuhaihe đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/cloudberry#2356 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100