summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-02 15:41:03 -0500
committerDudemanguy <random342@airmail.cc>2023-10-02 15:58:03 -0500
commit47dec1c7c280cc36dbb402e1a13e95ddf619482e (patch)
tree63c19e9e364b85e2c53e4cb45682228b0189fe0c
parent05d79298b8f33f903071d0f173c28c719f9c5315 (diff)
downloadmpv-47dec1c7c280cc36dbb402e1a13e95ddf619482e.tar.bz2
mpv-47dec1c7c280cc36dbb402e1a13e95ddf619482e.tar.xz
vo_dmabuf_wayland: attach solid buffer when using force window
e125da2096d97ec7e64701bf6289705a24c31729 changed the z order of the surfaces a bit, but it turns out this has a side effect. If the aspect ratio of the actual video doesn't match your display, the osd surface doesn't scale properly and gets clipped. Put the z ordering back where it used to be. Instead when we have the force window case, simply attach the already existing solid buffer to the video surface. This allows the osd surface to actually draw over it instead of always being obscured so it satisfies the case of not having any real video frames but still wanting to draw the osd. Also don't mess with any of the viewport source setting stuff with force window. Weston complains about it, and it's nonsensical anyway. Fixes #12547.
-rw-r--r--video/out/vo_dmabuf_wayland.c11
-rw-r--r--video/out/wayland_common.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index 5c894dcd7e..8290bad263 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -489,6 +489,9 @@ static void set_viewport_source(struct vo *vo, struct mp_rect src)
struct priv *p = vo->priv;
struct vo_wayland_state *wl = vo->wl;
+ if (p->force_window)
+ return;
+
if (wl->video_viewport && !mp_rect_equals(&p->src, &src)) {
wp_viewport_set_source(wl->video_viewport, src.x0 << 8,
src.y0 << 8, mp_rect_w(src) << 8,
@@ -587,12 +590,18 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
struct osd_buffer *osd_buf;
double pts;
- if (!vo_wayland_check_visible(vo) && !p->force_window)
+ if (!vo_wayland_check_visible(vo))
return;
if (p->destroy_buffers)
destroy_buffers(vo);
+ // Reuse the solid buffer so the osd can be visible
+ if (p->force_window) {
+ wl_surface_attach(wl->video_surface, p->solid_buffer, 0, 0);
+ wl_surface_damage_buffer(wl->video_surface, 0, 0, 1, 1);
+ }
+
pts = frame->current ? frame->current->pts : 0;
if (frame->current) {
struct mp_image *src = mp_image_new_ref(frame->current);
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index b23c999a9d..47dc4d9605 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -2239,8 +2239,8 @@ bool vo_wayland_init(struct vo *vo)
goto err;
if (wl->subcompositor) {
+ wl->osd_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->osd_surface, wl->video_surface);
wl->video_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->video_surface, wl->surface);
- wl->osd_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->osd_surface, wl->surface);
}
#if HAVE_WAYLAND_PROTOCOLS_1_27