From 24f4582b6f7f57f566418551f9252b8578d2b602 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 19 Jun 2022 19:40:20 -0500 Subject: 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. --- video/out/x11_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'video/out') diff --git a/video/out/x11_common.c b/video/out/x11_common.c index f041d594ec..054557189f 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -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, -- cgit v1.2.3