mpv-player / mpv-player/mpv

vo_dmabuf_wayland: Support for buffer pre-rotation

Open
#11,379 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

meta:feature-request vo:dmabuf-wayland
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

On Wayland, similarly like on Android, the compositor can let clients know about the output transform, e.g. 90 deg rotation, in order to allow clients to draw buffers pre-rotated. When clients do so, chances are much higher that the compositor can directly "scan-out" the buffer and put it on a hardware plane without needing to composite/redraw, reducing power consumption.

That is because hardware planes usually don't support rotations. Especially 90/270 deg. ones are rarely supported, while 180 deg is more common.

So whenever mpv can easily do rotations, either because it's using GL/VK already or when a post-processing API offers the feature, it would be great if it did and set the the buffer transform hint accordingly (via wl_surface_set_buffer_transform()) so the compositor knows that the buffer is already rotated.

This is technically very similar to the already supported buffer_scale and preferred_scale and should be thus be quite straight forward to implement.

This would mainly benefit mobile devices where displays are often used rotated 90/270 deg.

See also:

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 at the vo_dmabuf_wayland implementation and compare its existing buffer_scale and preferred_scale handling with the Wayland wl_surface_set_buffer_transform() API. Trace which rendering paths can provide a pre-rotated buffer, then verify that the compositor receives the matching transform hint and that normal, 90/270-degree, and 180-degree cases remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
desktop, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.