Skip to content

native: Keep framebuffers on screen while releasing them - #905

Open
SyberHexen wants to merge 1 commit into
linuxmint:masterfrom
SyberHexen:6.8.6/hotplug-blank-fix
Open

SyberHexen wants to merge 1 commit into
linuxmint:masterfrom
SyberHexen:6.8.6/hotplug-blank-fix

Conversation

@SyberHexen

Copy link
Copy Markdown

Fixes linuxmint/wayland#246.

Bug: every monitor change destroys and recreates all views, so the scanout buffers of the monitors that stay connected are released while still on screen. drmModeRmFB() turns off whatever shows the framebuffer it removes; amdgpu can't disable a primary plane alone, so it turns off the whole CRTC (drm_framebuffer_remove: Disabling [CRTC:381:crtc-0] because [FB:447] is removed with drm.debug). The monitors that stay connected go black for about 110 ms on every hotplug.

Reproduce: Cinnamon Wayland session on amdgpu with two monitors; unplug or plug a third one (or switch an output off and on in Display settings): the other monitors blink black.

Fix: release framebuffers that may be on screen with drmModeCloseFB() (Linux 6.8, libdrm 2.4.117), which drops the handle and leaves the picture up until it's replaced; fall back to drmModeRmFB() where it's missing (checked in meson).

Tested: over repeated hotplugs a probe polling the CRTC state never saw it go off, and the monitors no longer blink; with an older libdrm the build takes the RmFB fallback.

Every monitor change destroys and recreates all views, so the scanout
buffers of the monitors that stay connected are released too, while
they are still on screen.  drmModeRmFB() turns off whatever shows a
framebuffer it removes, and amdgpu, which cannot disable a primary
plane alone, turned off the whole CRTC:

  drm_framebuffer_remove: Disabling [CRTC:381:crtc-0] because [FB:447] is removed

The monitor then stayed black for about 110 ms on every hotplug, until
the new view set the CRTC again.

Release framebuffers that may be on screen with drmModeCloseFB()
(Linux 6.8, libdrm 2.4.117), which drops the handle and leaves the
picture up until it is replaced, and fall back to drmModeRmFB() where
it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitors that stay connected go black for a moment on every hotplug

1 participant