mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 01:47:38 +00:00
x11: add --x11-present option
With the recent addition of the libxpresent, it should improve frame timings for most users. However, there were known cases of bad behavior (Nvidia) which lead to a construction of a whitelist instead of just enabling this all the time. Since there's no way to predict whatever combination of hardware/drivers/etc. may work correctly, just give users an option to switch the usage of xorg's presentation statistics on/off. The default value, auto, works like before (basically, Mesa drivers and no Nvidia are allowed), but now one can force it on/off if needed.
This commit is contained in:
parent
d9f7dd7212
commit
24f4582b6f
@ -42,6 +42,7 @@ Interface changes
|
||||
- `--sub-visibility` no longer has any effect on secondary subtitles
|
||||
- add `film-grain` sub-parameter to `format` video filter
|
||||
- add experimental `--vo=vaapi-wayland` video output driver
|
||||
- add `--x11-present` for controlling whether to use xorg's present extension
|
||||
--- mpv 0.34.0 ---
|
||||
- deprecate selecting by card number with `--drm-connector`, add
|
||||
`--drm-device` which can be used instead
|
||||
|
@ -3354,6 +3354,23 @@ Window
|
||||
|
||||
``never`` asks the window manager to never disable the compositor.
|
||||
|
||||
``--x11-present=<no|auto|yes>``
|
||||
Whether or not to use presentation statistics from X11's presentation
|
||||
extension (default: ``auto``).
|
||||
|
||||
mpv asks X11 for present events which it then may use for more accurate
|
||||
frame presentation. This only has an effect if ``--video-sync=display-...``
|
||||
is being used.
|
||||
|
||||
The auto option enumerates XRandr providers for autodetection. If amd, radeon,
|
||||
intel, or nouveau (the standard x86 Mesa drivers) is found and nvidia is NOT
|
||||
found, presentation feedback is enabled. Other drivers are not assumed to
|
||||
work, so they are not enabled automatically.
|
||||
|
||||
``yes`` or ``no`` can still be passed regardless to enable/disable this
|
||||
mechanism in case there is good/bad behavior with whatever your combination
|
||||
of hardware/drivers/etc. happens to be.
|
||||
|
||||
|
||||
Disc Devices
|
||||
------------
|
||||
|
@ -175,6 +175,8 @@ static const m_option_t mp_vo_opt_list[] = {
|
||||
{"x11-netwm", OPT_CHOICE(x11_netwm, {"auto", 0}, {"no", -1}, {"yes", 1})},
|
||||
{"x11-bypass-compositor", OPT_CHOICE(x11_bypass_compositor,
|
||||
{"no", 0}, {"yes", 1}, {"fs-only", 2}, {"never", 3})},
|
||||
{"x11-present", OPT_CHOICE(x11_present,
|
||||
{"no", 0}, {"auto", 1}, {"yes", 2})},
|
||||
#endif
|
||||
#if HAVE_WIN32_DESKTOP
|
||||
{"vo-mmcss-profile", OPT_STRING(mmcss_profile)},
|
||||
@ -212,6 +214,7 @@ const struct m_sub_options vo_sub_opts = {
|
||||
.WinID = -1,
|
||||
.window_scale = 1.0,
|
||||
.x11_bypass_compositor = 2,
|
||||
.x11_present = 1,
|
||||
.mmcss_profile = "Playback",
|
||||
.ontop_level = -1,
|
||||
.timing_offset = 0.050,
|
||||
|
@ -29,6 +29,7 @@ typedef struct mp_vo_opts {
|
||||
char *appid;
|
||||
int x11_netwm;
|
||||
int x11_bypass_compositor;
|
||||
int x11_present;
|
||||
int native_keyrepeat;
|
||||
|
||||
float panscan;
|
||||
|
@ -1286,11 +1286,13 @@ void vo_x11_check_events(struct vo *vo)
|
||||
break;
|
||||
case GenericEvent: {
|
||||
XGenericEventCookie *cookie = (XGenericEventCookie *)&Event.xcookie;
|
||||
if (cookie->extension == x11->present_code && x11->have_present &&
|
||||
x11->has_mesa && !x11->has_nvidia)
|
||||
if (cookie->extension == x11->present_code && x11->have_present)
|
||||
{
|
||||
int present = x11->opts->x11_present;
|
||||
bool use_present = (x11->has_mesa && !x11->has_nvidia &&
|
||||
present) || present == 2;
|
||||
XGetEventData(x11->display, cookie);
|
||||
if (cookie->evtype == PresentCompleteNotify) {
|
||||
if (cookie->evtype == PresentCompleteNotify && use_present) {
|
||||
XPresentCompleteNotifyEvent *present_event;
|
||||
present_event = (XPresentCompleteNotifyEvent *)cookie->data;
|
||||
present_update_sync_values(x11->present, present_event->ust,
|
||||
|
Loading…
Reference in New Issue
Block a user