like below fixes the issue The comment you added made it more explicit that you are concerned about tearing: Obviously you should use double buffering which you activate when you call ChoosePixelFormat() but you still have to get the timing right to have no tearing:
Attribute changed for parent outside of ShadowDom (display: none -> display: flex -> display: none)
To fix the issue you can do Actually glXSwapBuffers should return immediately. What's blocking however is the very next OpenGL command that introduces a so called synchronization point. Usually this is the next glClear that follows the call of glXSwapBuffers. Note that it's actually desireable to somehow synchronize with the V-Blank, otherwise nasty tearing artifacts happen. But you're right, that in a naive implementation this introduces about one display refresh interval of latency.
Correct way to wait for VBLANK on windows 10 in windowed mode
should help you out Why are you trying to wait for VBLANK in windowed mode? DWM will ensure that the composited surface will flip in the VBLANK region. When you say "DWM completes composition at some time before the VBLANK event", what would make DWM initiate composition? It does not happen after any app presents, or after the app in focus presents. Composition actually begins when the VBLANK occurs. It may finish and flip the composited surface within the VBLANK, or it may end up actually flipping in the next VBLANK (so you may end up with an extra frame duration in latency). That isn't in your control though - it depends on the duration of the composition and not on your app's present.