summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-09-27 18:29:58 -0500
committersfan5 <sfan5@live.de>2023-09-29 17:00:05 +0200
commit27ef1725e7724f4b6899e3992ac3a884db9fbe13 (patch)
treebaf0b05a0f76de614f907f326a8b251b0d1ecc77
parentc19115c8dad38ee94474f305c09714b24a85f746 (diff)
downloadmpv-27ef1725e7724f4b6899e3992ac3a884db9fbe13.tar.bz2
mpv-27ef1725e7724f4b6899e3992ac3a884db9fbe13.tar.xz
vo_dmabuf_wayland: assume counter-clockwise rotations
In practice, most compositors implement the rotation clockwise which matches mpv's option, but amusingly this is actually incorrect. According to the spec*, wayland buffer rotations are counter-clockwise. So with this assumption in mind, in order for the rotation to match mpv's usual semantics, the 90 degree and 270 degree positions need to be flipped. Of course, this will make the VO rotate the wrong way on most compositors, but this is what the spec says (sway master is known to currently be correct). Fixes #12508 (sort of but will break the rotation direction on other compositors. Oh well). *: https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
-rw-r--r--video/out/vo_dmabuf_wayland.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index 2566b96be4..5c894dcd7e 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -677,7 +677,10 @@ done:
if (!vo_wayland_reconfig(vo))
return VO_ERROR;
- wl_surface_set_buffer_transform(vo->wl->video_surface, img->params.rotate / 90);
+ // mpv rotates clockwise but the wayland spec has counter-clockwise rotations
+ // swap 1 and 3 to match mpv's direction
+ int transform = (360 - img->params.rotate) % 360 / 90;
+ wl_surface_set_buffer_transform(vo->wl->video_surface, transform);
// Immediately destroy all buffers if params change.
destroy_buffers(vo);