Skip to content
  • Daniel van Vugt's avatar
    cogl: Remove GLX "threaded swap wait" used on Nvidia · 6ed5d2e2
    Daniel van Vugt authored
    Threaded swap wait was added for using together with the Nvidia GLX
    driver due to the lack of anything equivalent to the INTEL_swap_event
    GLX extension. The purpose was to avoid inhibiting the invocation of
    idle callbacks when constantly rendering, as the combination of
    throttling on swap-interval 1 and glxSwapBuffers() and the frame clock
    source having higher priority than the default idle callback sources
    meant they would never be invoked.
    
    This was solved in gbz#779039 by introducing a thread that took care of
    the vsync waiting, pushing frame completion events to the main thread
    meaning the main thread could go idle while waiting to draw the next
    frame instead of blocking on glxSwapBuffers().
    
    As of !363, the
    main thread will instead use prediction to estimate when the next frame
    should be drawn. A side effect of this is that even without
    INTEL_swap_event, we would not block as much, or at all, on
    glxSwapBuffers(), as at the time it is called, we have likely already
    hit the vblank, or will hit it soon.
    
    After having introduced the swap waiting thread, it was observed that
    the Nvidia driver used a considerable amount of CPU waiting for the
    vblank, effectively wasting CPU time. The need to call glFinish() was
    also problematic as it would wait for the frame to finish, before
    continuing. Due to this, remove the threaded swap wait, and rely only on
    the frame clock not scheduling frames too early.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=781835
    Related: #700
    
    [jadahl: Rewrote commit message]
    
    !602
    6ed5d2e2