mpv icon indicating copy to clipboard operation
mpv copied to clipboard

vo_vaapi_wayland doesn't send DRM format modifiers properly

Open rsmith-brightsign opened this issue 3 years ago • 2 comments

Important Information

Provide following Information:

  • mpv version: 7ff4a27eb600dc01d20547880056c13d6cf3e9e7
  • Linux Distribution and Version: Yocto
  • Source of the mpv binary: Yocto local build
  • If known which version of mpv introduced the problem
  • Window Manager and version: Weston 9.0.0
  • GPU driver and version: i915
  • Possible screenshot or video of visual glitches

If you're not using git master or the latest release, update. Releases are listed here: https://github.com/mpv-player/mpv/releases

Reproduction steps

Play a video using vo_vaapi_wayland that decodes to a DRM format with a modifier.

Expected behavior

Weston assigns the video to a DRM hardware plane.

Actual behavior

Weston falls back to gl-renderer composition.

Log file

n/a

The problem is that MPV binds to version 2 of zwp_linux_dmabuf_v1, but DRM format modifier support only came in with version 3. Weston (at least) ignores the modifier given in zwp_linux_buffer_params_v1 if zwp_linux_dmabuf_v1 was bound at less than version 3. Weston then tries to create a DRM fb with no modifiers when the underlying buffer objects do have modifiers, and i915 rejects this.

Somehow when it falls back to gl-renderer composition it appears to work despite still not knowing about the modifiers.

The obvious fix is to bind to version 3 of zwp_linux_dmabuf_v1, but then Weston (at least) stops sending format events - only modifier events - so MPV doesn't see any formats as being supported by the compositor. Listening for supported formats through the modifier event works for Weston, but as far as I can tell this is an implementation detail of Weston - I think Weston should continue to send format events at version 3. Both format and modifier events are deprecated from version 4 anyway, so I'm not sure what the right way to fix this is.

rsmith-brightsign avatar Jul 01 '22 18:07 rsmith-brightsign

Sounds like we have to upgrade to version 4 then. It was on the TODO list anyway. The main reason why version 2 was used at first is because it's dramatically simpler and also wouldn't require any extra wayland-protocols version checking. Version 4 has a bunch of extra crap that we don't really care about but well if it needs to be done then it needs to be done at some point.

Dudemanguy avatar Jul 01 '22 18:07 Dudemanguy

I implemented this in #10382, feel free to take it over.

linkmauve avatar Jul 08 '22 14:07 linkmauve

Fixed in #10533.

Dudemanguy avatar Oct 26 '22 18:10 Dudemanguy