diff options
author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2023-02-28 17:39:50 +0800 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-02-28 15:07:14 +0000 |
commit | 1f493b76719095c4db612c4102b54ce0f558728d (patch) | |
tree | d60b28ecb2ac805b47098d95e46378cc9e4e28b3 /video/out | |
parent | 8a43fc0e9ae10741b2ccdb59e370ea1bf5013393 (diff) | |
download | mpv-1f493b76719095c4db612c4102b54ce0f558728d.tar.bz2 mpv-1f493b76719095c4db612c4102b54ce0f558728d.tar.xz |
wayland: deduplicate and cache detection of dmabuf-wayland
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/wayland_common.c | 7 | ||||
-rw-r--r-- | video/out/wayland_common.h | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index ba34273f39..6fade185fd 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -978,8 +978,7 @@ static void preferred_scale(void *data, double old_scale = wl->scaling; // dmabuf_wayland is always wl->scaling = 1 - bool dmabuf_wayland = !strcmp(wl->vo->driver->name, "dmabuf-wayland"); - wl->scaling = !dmabuf_wayland ? (double)scale / 120 : 1; + wl->scaling = !wl->using_dmabuf_wayland ? (double)scale / 120 : 1; MP_VERBOSE(wl, "Obtained preferred scale, %f, from the compositor.\n", wl->scaling); wl->pending_vo_events |= VO_EVENT_DPI; @@ -1719,9 +1718,8 @@ static void set_surface_scaling(struct vo_wayland_state *wl) return; // dmabuf_wayland is always wl->scaling = 1 - bool dmabuf_wayland = !strcmp(wl->vo->driver->name, "dmabuf-wayland"); double old_scale = wl->scaling; - wl->scaling = !dmabuf_wayland ? wl->current_output->scale : 1; + wl->scaling = !wl->using_dmabuf_wayland ? wl->current_output->scale : 1; rescale_geometry(wl, old_scale); wl_surface_set_buffer_scale(wl->surface, wl->scaling); @@ -2069,6 +2067,7 @@ bool vo_wayland_init(struct vo *vo) .vo_opts_cache = m_config_cache_alloc(wl, vo->global, &vo_sub_opts), }; wl->vo_opts = wl->vo_opts_cache->opts; + wl->using_dmabuf_wayland = !strcmp(wl->vo->driver->name, "dmabuf-wayland"); wl_list_init(&wl->output_list); diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 80d0835fab..06d742e5ed 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -104,6 +104,7 @@ struct vo_wayland_state { void *dmabuf_feedback; wayland_format *format_map; uint32_t format_size; + bool using_dmabuf_wayland; /* TODO: remove these once zwp_linux_dmabuf_v1 version 2 support is removed. */ int *drm_formats; int drm_format_ct; |