From aba5b1450a0d454d5223dbaa40f45dd62fb9dca6 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 12 Oct 2024 09:44:56 -0500 Subject: [PATCH] options: replace --wayland-disable-vsync with --wayland-internal-vsync With the upcoming fixes to FIFO in wayland, it should be preferable to use FIFO instead of our own hacky heuristic. This means --wayland-disable-vsync should become a tristate option with an "auto" behavior (not implemented in this commit). The semantics have to slightly change so introduce --wayland-internal-vsync and deprecate --wayland-disable-vsync. --- DOCS/interface-changes/wayland-internal-vsync.txt | 2 ++ DOCS/man/options.rst | 11 ++++++----- options/options.c | 5 ++++- options/options.h | 1 + video/out/opengl/context_wayland.c | 2 +- video/out/vo_dmabuf_wayland.c | 2 +- video/out/vo_wlshm.c | 2 +- video/out/vulkan/context_wayland.c | 2 +- 8 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 DOCS/interface-changes/wayland-internal-vsync.txt diff --git a/DOCS/interface-changes/wayland-internal-vsync.txt b/DOCS/interface-changes/wayland-internal-vsync.txt new file mode 100644 index 0000000000000..8131143998f37 --- /dev/null +++ b/DOCS/interface-changes/wayland-internal-vsync.txt @@ -0,0 +1,2 @@ +deprecate `--wayland-disable-vsync` +add `--wayland-internal-vsync` as a replacement for `--wayland-disable-vsync` diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 9ba83bf26e636..843f7d926c607 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -6011,11 +6011,6 @@ them. (default) will automatically switch between telling the compositor the content is a photo, video or possibly none depending on internal heuristics. -``--wayland-disable-vsync=`` - Disable mpv's internal vsync for Wayland-based video output (default: no). - This is mainly useful for benchmarking wayland VOs when combined with - ``video-sync=display-desync``, ``--audio=no``, and ``--untimed=yes``. - ``--wayland-edge-pixels-pointer=`` Defines the size of an edge border (default: 16) to initiate client side resize events in the wayland contexts with the mouse. This is only active if @@ -6025,6 +6020,12 @@ them. Defines the size of an edge border (default: 32) to initiate client side resizes events in the wayland contexts with touch events. +``--wayland-internal-vsync=`` + Controls whether to use mpv's internal vsync for Wayland-base video outputs + (default: ``auto``). This is mainly useful for benchmarking wayland VOs when + combined with ``video-sync=display-desync``, ``--audio=no``, and + ``--untimed=yes``. + ``--wayland-present=`` Enable the use of wayland's presentation time protocol for more accurate frame presentation if it is supported by the compositor (default: ``yes``). diff --git a/options/options.c b/options/options.c index 46b532a65480f..db41f14f4534b 100644 --- a/options/options.c +++ b/options/options.c @@ -198,7 +198,10 @@ static const m_option_t mp_vo_opt_list[] = { {"auto", -1}, {"no", 0}, {"yes", 1})}, {"wayland-content-type", OPT_CHOICE(wl_content_type, {"auto", -1}, {"none", 0}, {"photo", 1}, {"video", 2}, {"game", 3})}, - {"wayland-disable-vsync", OPT_BOOL(wl_disable_vsync)}, + {"wayland-disable-vsync", OPT_BOOL(wl_disable_vsync), + .deprecation_message = "replaced by --wayland-internal-vsync=no"}, + {"wayland-internal-vsync", OPT_CHOICE(wl_internal_vsync, + {"no", 0}, {"auto", 1}, {"yes", 2})}, {"wayland-edge-pixels-pointer", OPT_INT(wl_edge_pixels_pointer), M_RANGE(0, INT_MAX)}, {"wayland-edge-pixels-touch", OPT_INT(wl_edge_pixels_touch), diff --git a/options/options.h b/options/options.h index 9bed9ca291ace..ed933ec4cac74 100644 --- a/options/options.h +++ b/options/options.h @@ -38,6 +38,7 @@ typedef struct mp_vo_opts { int wl_configure_bounds; int wl_content_type; bool wl_disable_vsync; + int wl_internal_vsync; int wl_edge_pixels_pointer; int wl_edge_pixels_touch; bool wl_present; diff --git a/video/out/opengl/context_wayland.c b/video/out/opengl/context_wayland.c index b4b200cfb398a..6940c9749eae5 100644 --- a/video/out/opengl/context_wayland.c +++ b/video/out/opengl/context_wayland.c @@ -69,7 +69,7 @@ static void wayland_egl_swap_buffers(struct ra_ctx *ctx) eglSwapBuffers(p->egl_display, p->egl_surface); - if (!wl->opts->wl_disable_vsync) + if (wl->opts->wl_internal_vsync) vo_wayland_wait_frame(wl); if (wl->use_present) diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c index 733a011cd9dd3..93788a9a79493 100644 --- a/video/out/vo_dmabuf_wayland.c +++ b/video/out/vo_dmabuf_wayland.c @@ -651,7 +651,7 @@ static void flip_page(struct vo *vo) wl_surface_commit(wl->osd_surface); wl_surface_commit(wl->surface); - if (!wl->opts->wl_disable_vsync) + if (wl->opts->wl_internal_vsync) vo_wayland_wait_frame(wl); if (wl->use_present) diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c index 3132d7a563959..4c2c0d4a87d10 100644 --- a/video/out/vo_wlshm.c +++ b/video/out/vo_wlshm.c @@ -299,7 +299,7 @@ static void flip_page(struct vo *vo) vo->dheight); wl_surface_commit(wl->surface); - if (!wl->opts->wl_disable_vsync) + if (wl->opts->wl_internal_vsync) vo_wayland_wait_frame(wl); if (wl->use_present) diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c index 700822c9a49a1..eae5d25e7d3c4 100644 --- a/video/out/vulkan/context_wayland.c +++ b/video/out/vulkan/context_wayland.c @@ -36,7 +36,7 @@ static void wayland_vk_swap_buffers(struct ra_ctx *ctx) { struct vo_wayland_state *wl = ctx->vo->wl; - if (!wl->opts->wl_disable_vsync) + if (wl->opts->wl_internal_vsync) vo_wayland_wait_frame(wl); if (wl->use_present)