mpv-player / mpv-player/mpv

Pink tint with drmprime/dmabuf on Lima driver (X11/Weston/tty)

Open
#12,968 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

hwdec:drm hwdec:vaapi os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important Information

Provide following Information:

  • mpv version: 0.35.1
  • Linux Distribution and Version: debian bookworm, ubuntu jammy
  • Source of the mpv binary: distribution source code
  • If known which version of mpv introduced the problem: probably 0.35
  • Window Manager and version: xfce, Weston, bare terminal
  • GPU driver and version: Mesa git (23.2) via oibaf PPA on Ubuntu, Mesa 22.3 on Debian Bookworm
  • Possible screenshot or video of visual glitches:
    Istantanea_2023-11-24_22-03-01

mpv is version 0.35.1 because it is the packaged binary that comes with Debian Bookworm.

My intent was to provide an apt repository with ffmpeg compiled with v4l2-request and v4l2-drmprime patches from LibreElec project to ease the fruition and testing of such features on ready-made distribution images (for instace debian/ubuntu images built by Armbian project) for ARM devices. The repository is still experimental and under testing, but has already proved to work for arm64 and amrhf architectures (see below for setup instructions)

I'm not exactly sure the issue presented here is related to mpv or mesa driver, but I would like to discover and possibly excalate.

Reproduction steps

Preconditions:

  • a running system with Debian Bookworm or Ubuntu Jammy, or any other suitable distro
  • Mali Utgard 400/450 hardware
  • ffmpeg (>= 4.4.2) with v4l2-request and v4l2-drmprime patches
  • mpv version 0.35.1 installed

Run an h.264/h.265 video with the following command lines:

# Hardware decoded video running in a X11 window (tested on xfce), presentation via EGL
mpv --vo=gpu --hwdec=drm --gpu-context=x11egl --gpu-hwdec-interop=drmprime <your-video.mp4>
# Hardware decoded video running in a window of a Wayland compositor (tested on weston), presentation via EGL
mpv --vo=gpu --hwdec=drm --gpu-context=wayland --gpu-hwdec-interop=drmprime  <your-video.mp4>
# Hardware decoded video running on bare terminal, presentation via EGL
mpv --vo=gpu --hwdec=drm --gpu-context=drm --gpu-hwdec-interop=drmprime  <your-video.mp4>

Additional details:

  • the command lines supplied above all make use of hardware decoding and dmabuf features, with smooth reproduction of the content and reasonably low cpu usage even on slower armhf SoCs.
  • Debian Bookworm comes with ffmpeg 5.1.4, Ubuntu Jammy with ffmpeg 4.4.2; on both of them the issue is appearing
  • the pink tint has been experimented on various SoCs, in particular I tested rockchip rk3229 (armhf, mali400, rkvdec hardware decoder), rk3328 (arm64, mali450, rkvdec hardware decoder) and allwinner H3 (armhf, mali400, cedrus hardware decoder) and all of them exhibit the very same issue
  • testing on SoCs like rk3288 (armhf, mali T760) and rk3399 (arm64, mali T860) does not trigger the same issue, presumably because the GPU is handled by panfrost and not lima driver
  • Using mpv in a "direct to plane" fashion in a virtual terminal with mpv --vo=gpu --hwdec=drm --gpu-context=drm --gpu-hwdec-interop=drmprime-overlay <your-video.mp4> does not show the issue
  • Using --hwdec=drm-copy does not show the issue, although playback is choppy depending upon the SoC power

To make testing easier, I can provide the details of my ffmpeg-v4l2request testing repository but I would prefer to be contacted in private via email since it is temporarely hosted on a server in my private LAN. and instructions to setup are available on Armbian forum here

Expected behavior

The video is played with correct colors

Actual behavior

The video colors are biased to pink: full white is pink, full black is red; as can be seen from the screenshot, it affects only the texture of the video and not the HUD overlay.

Log file

mpv.log

Sample files

Any h.264 or h.265 video file that can trigger the hardware decoding capabilities of the SoC.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached mpv.log and reproduce the pink tint using the three drmprime command lines on the listed Lima hardware. Compare the working drmprime-overlay and drm-copy paths, then determine whether the fix belongs in mpv or the Mesa/Lima path; done means correct video colors without those workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
computer-graphics, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.