0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/video/out/opengl
Sultan Alsawaf 0d44ae319d x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timing
PresentNotifyMSC turns out to be not only redundant, but also harmful with
mesa-backed egl/glx/vulkan VOs because for all of them, mesa uses
PresentPixmap behind the scenes when DRI3 is available, which already
spawns a PresentCompleteNotify event when the buffer swap actually
finishes. This is important because without using the timing information
from these PresentCompleteKindPixmap events, there's no way for mpv to know
exactly when a frame becomes visible on the display.

By using PresentNotifyMSC in conjunction with DRI3-enabled mesa, two
problems are created:
1. mpv assumes that a vblank won't elapse (i.e., it assumes the current MSC
   won't change) between the time when mesa enqueues the buffer swap and
   the time when mpv calls PresentNotifyMSC to ask xorg for a notification
   at the next MSC, relative to the current MSC at the time that xorg reads
   it for the PresentNotifyMSC call. This means that mpv could get a
   notification one or more vblanks later than it expects, since the
   intention here is for mpv to get a notification at the MSC that the
   buffer swap completes.
2. mpv assumes that a buffer swap always takes one vblank to complete,
   which isn't always true. A buffer swap (i.e., a page flip) could take
   longer than that depending on hardware conditions (if the GPU is running
   slowly or needs to exit a low-power state), scheduling delays (under
   heavy system or GPU load), or unfortunate timing (if the raster scan
   line happens to be at one of the last few rows of pixels and a vblank
   elapses just before the buffer swap is enqueued).

This causes mpv to have a faulty assumption of when frames become visible.

Since mpv already receives the PresentCompleteNotify events generated by
mesa's buffer swaps under the hood, the PresentNotifyMSC usage is unneeded
and just throws a wrench in mpv's vsync timing when xpresent is enabled.

Simply removing the PresentNotifyMSC usage from the egl, glx, and vulkan
VOs fixes the xpresent vsync timing.
2023-01-25 03:13:23 +00:00
..
angle_dynamic.c angle_dynamic: silence warnings during compilation 2016-11-25 09:49:49 +01:00
angle_dynamic.h vo_opengl: angle: rewrite with custom swap chain 2017-02-07 22:45:07 +11:00
common.c vo_gpu: implement VO_DR_FLAG_HOST_CACHED 2023-01-23 14:13:34 +01:00
common.h vo_gpu: implement VO_DR_FLAG_HOST_CACHED 2023-01-23 14:13:34 +01:00
context_android.c context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
context_angle.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
context_cocoa.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
context_drm_egl.c drm: rewrite based around vo_drm_state 2023-01-21 17:08:29 +00:00
context_dxinterop.c video: opengl: use gl_check_extension() instead of strstr() 2021-11-17 22:38:34 +01:00
context_glx.c x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timing 2023-01-25 03:13:23 +00:00
context_rpi.c rpi: destroy fullscreen change handling 2019-12-11 18:50:37 +01:00
context_wayland.c wayland: add wp-fractional-scale-v1 support 2023-01-24 00:04:39 +00:00
context_win.c video: opengl: use gl_check_extension() instead of strstr() 2021-11-17 22:38:34 +01:00
context_x11egl.c x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timing 2023-01-25 03:13:23 +00:00
context.c wayland: unify visibility checking code 2022-04-11 18:14:22 +00:00
context.h wayland: unify visibility checking code 2022-04-11 18:14:22 +00:00
egl_helpers.c egl_helpers: request at least 8 alpha bits if necessary 2022-04-07 16:56:36 +00:00
egl_helpers.h egl_helpers: introduce wrapper around eglCreatePlatformWindowSurface 2021-11-17 22:38:34 +01:00
formats.c vo_opengl: remove some dead code 2017-08-11 21:29:35 +02:00
formats.h vo_opengl: refactor into vo_gpu 2017-09-21 15:00:55 +02:00
gl_headers.h vo_gpu: stop hard-coding max compute group threads 2021-12-19 01:51:54 +01:00
hwdec_d3d11egl.c video: opengl: use gl_check_extension() instead of strstr() 2021-11-17 22:38:34 +01:00
hwdec_dxva2egl.c vo: hwdec: do hwdec interop lookup by image format 2022-09-21 09:39:34 -07:00
hwdec_dxva2gldx.c vo: hwdec: do hwdec interop lookup by image format 2022-09-21 09:39:34 -07:00
hwdec_ios.m vo: hwdec: do hwdec interop lookup by image format 2022-09-21 09:39:34 -07:00
hwdec_osx.c vo: hwdec: do hwdec interop lookup by image format 2022-09-21 09:39:34 -07:00
hwdec_rpi.c client API: add a new way to pass X11 Display etc. to render API 2018-03-26 19:47:08 +02:00
hwdec_vdpau.c vo: hwdec: do hwdec interop lookup by image format 2022-09-21 09:39:34 -07:00
libmpv_gl.c {player,video}: remove references to obsolete opengl-cb API 2021-12-15 12:29:10 +01:00
ra_gl.c vo_gpu: implement VO_DR_FLAG_HOST_CACHED 2023-01-23 14:13:34 +01:00
ra_gl.h vo_opengl: refactor into vo_gpu 2017-09-21 15:00:55 +02:00
utils.c vo_gpu: make screenshots use the GL renderer 2018-02-11 17:45:51 -08:00
utils.h vo_gpu: make screenshots use the GL renderer 2018-02-11 17:45:51 -08:00