mpv
                                
                                 mpv copied to clipboard
                                
                                    mpv copied to clipboard
                            
                            
                            
                        Switching video track in tty when default video out is unavailable gets stuck in no video
Important Information
Provide following Information:
- mpv 0.34.1
- Arch 5.18.9-arch1-1
- installed through pacman
- no graphical environment (lxqt environment is installed on system, but not used in this case)
- Mesa Intel(R) HD Graphics 3000 (SNB GT2)
Reproduction steps
Open a video in tty without selecting a video output
mpv example.mp4
It opens fine, going to drm video output setting as we currently are not in a graphical environment
After the video has started press _ the video track cycle key
This goes to the terminal, with video set to video: no (video continues playing)
Press _ again
Expected behavior
The video output cycles to an output that is valid in the current context, such as the one that was used intially, reopening the video
Expected behavior occurs with:
mpv --vo=drm example.mp4
Allowing cycling between drm and video: no
Actual behavior
Instead an error is fired attempting to change vo to gpu and the video output remains on video: no
Log file
http://0x0.st/o1sH.txt
Second log file as I later noticed if you attempt to switch back again after the first failure, the error message gets longer.
First time:
[vo/gpu] Failed to commit ModeSetting atomic request (-13)
[vo/gpu/opengl] Failed to set CRTC for connector 61: Permission denied
[vo/gpu/vulkan/libplacebo] EnumeratePhysicalDevices(inst, &num, NULL): VK_ERROR_INITIALIZATION_FAILED (../src/vulkan/context.c:871)
Error opening/initializing the selected video_out (--vo) device.
Later times:
[vo/gpu] Can't handle VT release - signal already used
[vo/gpu/opengl] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/gpu] Failed to commit ModeSetting atomic request (-13)
[vo/gpu/opengl] Failed to set CRTC for connector 61: Permission denied
[vo/gpu/vulkan/libplacebo] EnumeratePhysicalDevices(inst, &num, NULL): VK_ERROR_INITIALIZATION_FAILED (../src/vulkan/context.c:871)
Error opening/initializing the selected video_out (--vo) device.
http://0x0.st/o1b0.txt
Can you reproduce this issue only with --vo=drm or does it happen as well with --vo=gpu --gpu-context=drm as well?
- mpv video.mp4
- mpv video.mp4 --vo=gpu
- mpv video.mp4 --vo=gpu --gpu-context=drm
All have the issue. They function the exact same way (Video starts fine; switch away to video: no; attempt to switch again but presented with error message and failure), however the error message displayed to the user is slightly different for each one. --vo=gpu contains the largest error message and contains all the parts in the other two error messages.
To clarify another point, I brought up --vo=drm as it exhibits behavior I would expect to happen, specifically being able to switch back to the video after switching tracks with _. Inside of an x session this is the behavior seen with mpv video.mp4 (Being able to press _ twice, first switching away from the video, second going back to it)
This works for me with amdgpu. When trying intel, gpu-context=drm errors out, but vo=drm works fine. The error I get is:
[   3.121][e][vo/gpu] Failed to commit ModeSetting atomic request (-13)
[   3.121][e][vo/gpu/opengl] Failed to set CRTC for connector 95: Permission denied
[   3.121][v][vo/gpu-next/opengl] Initializing GPU context 'drm'
[   3.121][e][vo/gpu-next] Can't handle VT release - signal already used
[   3.121][w][vo/gpu-next/opengl] Failed to set up VT switcher. Terminal switching will be unavailable.
and
[   3.128][e][vo/gpu-next] Failed to commit ModeSetting atomic request (-13)
[   3.128][e][vo/gpu-next/opengl] Failed to set CRTC for connector 95: Permission denied
Might just be a driver bug? This is with mpv from master so maybe a few things are different under the hood.
Both work for me with nvidia's proprietary driver, so it's possibly an intel driver bug. I can test it on my laptop which has an Intel GPU.
Update, on my Intel GPU Laptop, using --vo=drm works as expected, but using --vo=gpu --gpu-context=drm produces an error. mpv version is the Arch Linux package.
https://buzo.us/Q.log
Actually, I know what this is now. mpv simply isn't always dropping the drm master. It appears there are driver differences because toggling the video off doesn't always send a release signal which doesn't result in the master being dropped. On my previous post here, it worked with amdgpu but apparently not anymore. Not sure what changed.
You can just always unconditionally drop the master on uninit like I did in #11098 which accidentally fixes this. The signal isn't still released though which isn't ideal (don't try to switch tty's).
So with Linux 6.1.4 and mesa 22.3.2, this situation is somehow reversed now. This works fine on intel but not on amdgpu (no clue about nvidia but oh well). This is on mpv from master. The root cause is still the same however: mpv not always dropping the drm master on uninit. I can confirm that the rewrite in #11098 fully fixes this on my machine (works in intel and amd) and also doesn't bork tty switching (i.e. you won't freeze if you set no video and try to switch to another tty).
Fixed by #11098.