Skip to content

Commit

Permalink
options: replace --wayland-disable-vsync with --wayland-internal-vsync
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dudemanguy committed Oct 15, 2024
1 parent 4c24eae commit aba5b14
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions DOCS/interface-changes/wayland-internal-vsync.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecate `--wayland-disable-vsync`
add `--wayland-internal-vsync` as a replacement for `--wayland-disable-vsync`
11 changes: 6 additions & 5 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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=<yes|no>``
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=<value>``
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
Expand All @@ -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=<no|auto|yes>``
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=<yes|no>``
Enable the use of wayland's presentation time protocol for more accurate
frame presentation if it is supported by the compositor (default: ``yes``).
Expand Down
5 changes: 4 additions & 1 deletion options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion video/out/opengl/context_wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion video/out/vo_dmabuf_wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion video/out/vo_wlshm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion video/out/vulkan/context_wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aba5b14

Please sign in to comment.