mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
wayland: deduplicate and cache detection of dmabuf-wayland
This commit is contained in:
parent
8a43fc0e9a
commit
1f493b7671
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user