vo_dmabuf_wayland: attach solid buffer when using force window

e125da2096 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.
This commit is contained in:
Dudemanguy
2023-10-02 15:58:03 -05:00
parent 05d79298b8
commit 47dec1c7c2
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -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);
+1 -1
View File
@@ -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