summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorAaron Boxer <boxerab@protonmail.com>2023-02-03 13:36:10 -0500
committerDudemanguy <random342@airmail.cc>2023-02-05 23:27:08 +0000
commitf1f6eaa3de857824e871a971afcdcdae78d5661f (patch)
tree72b0ab6ee2ffcf0e20f543bcf9cb55b1c5498029 /video/out
parent5bd991f338c26b12b9f96de70bf03714ed0bd0dc (diff)
downloadmpv-f1f6eaa3de857824e871a971afcdcdae78d5661f.tar.bz2
mpv-f1f6eaa3de857824e871a971afcdcdae78d5661f.tar.xz
vo_dmabuf_wayland: only resize when a new frame is about to be drawn
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_dmabuf_wayland.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index 565fe50a97..37646beb12 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -60,6 +60,7 @@ struct priv {
struct wlbuf_pool *wlbuf_pool;
bool want_reset;
uint64_t reset_count;
+ bool want_resize;
struct mp_rect src;
bool resized;
@@ -208,6 +209,8 @@ static void resize(struct vo *vo)
vo->want_redraw = true;
p->resized = true;
+ p->want_reset = true;
+ p->want_resize = false;
}
static void draw_frame(struct vo *vo, struct vo_frame *frame)
@@ -244,6 +247,9 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
if (!entry)
return;
+ if (p->want_resize)
+ resize(vo);
+
MP_VERBOSE(entry->vo, "Schedule buffer pool entry : %lu\n",entry->key );
wl_surface_attach(wl->video_surface, entry->buffer, 0, 0);
wl_surface_damage_buffer(wl->video_surface, 0, 0, INT32_MAX, INT32_MAX);
@@ -302,8 +308,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_SET_PANSCAN:
- if (p->resized)
- resize(vo);
+ p->want_resize = true;
return VO_TRUE;
case VOCTRL_LOAD_HWDEC_API:
assert(p->hwdec_ctx.ra);
@@ -321,8 +326,11 @@ static int control(struct vo *vo, uint32_t request, void *data)
}
ret = vo_wayland_control(vo, &events, request, data);
- if (events & VO_EVENT_RESIZE)
- resize(vo);
+ if (events & VO_EVENT_RESIZE){
+ p->want_resize = true;
+ if (!p->resized)
+ resize(vo);
+ }
if (events & VO_EVENT_EXPOSE)
vo->want_redraw = true;
vo_event(vo, events);