mirror of
https://github.com/mpv-player/mpv
synced 2025-03-02 20:28:02 +00:00
vo_dmabuf_wayland: only resize when a new frame is about to be drawn
This commit is contained in:
parent
5bd991f338
commit
f1f6eaa3de
@ -60,6 +60,7 @@ struct priv {
|
|||||||
struct wlbuf_pool *wlbuf_pool;
|
struct wlbuf_pool *wlbuf_pool;
|
||||||
bool want_reset;
|
bool want_reset;
|
||||||
uint64_t reset_count;
|
uint64_t reset_count;
|
||||||
|
bool want_resize;
|
||||||
struct mp_rect src;
|
struct mp_rect src;
|
||||||
bool resized;
|
bool resized;
|
||||||
|
|
||||||
@ -208,6 +209,8 @@ static void resize(struct vo *vo)
|
|||||||
|
|
||||||
vo->want_redraw = true;
|
vo->want_redraw = true;
|
||||||
p->resized = true;
|
p->resized = true;
|
||||||
|
p->want_reset = true;
|
||||||
|
p->want_resize = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_frame(struct vo *vo, struct vo_frame *frame)
|
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)
|
if (!entry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (p->want_resize)
|
||||||
|
resize(vo);
|
||||||
|
|
||||||
MP_VERBOSE(entry->vo, "Schedule buffer pool entry : %lu\n",entry->key );
|
MP_VERBOSE(entry->vo, "Schedule buffer pool entry : %lu\n",entry->key );
|
||||||
wl_surface_attach(wl->video_surface, entry->buffer, 0, 0);
|
wl_surface_attach(wl->video_surface, entry->buffer, 0, 0);
|
||||||
wl_surface_damage_buffer(wl->video_surface, 0, 0, INT32_MAX, INT32_MAX);
|
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) {
|
switch (request) {
|
||||||
case VOCTRL_SET_PANSCAN:
|
case VOCTRL_SET_PANSCAN:
|
||||||
if (p->resized)
|
p->want_resize = true;
|
||||||
resize(vo);
|
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
case VOCTRL_LOAD_HWDEC_API:
|
case VOCTRL_LOAD_HWDEC_API:
|
||||||
assert(p->hwdec_ctx.ra);
|
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);
|
ret = vo_wayland_control(vo, &events, request, data);
|
||||||
if (events & VO_EVENT_RESIZE)
|
if (events & VO_EVENT_RESIZE){
|
||||||
|
p->want_resize = true;
|
||||||
|
if (!p->resized)
|
||||||
resize(vo);
|
resize(vo);
|
||||||
|
}
|
||||||
if (events & VO_EVENT_EXPOSE)
|
if (events & VO_EVENT_EXPOSE)
|
||||||
vo->want_redraw = true;
|
vo->want_redraw = true;
|
||||||
vo_event(vo, events);
|
vo_event(vo, events);
|
||||||
|
Loading…
Reference in New Issue
Block a user