Skip to content
Snippets Groups Projects

vout: synchronize GLX and EGL/X11 window sizes with gl surface sizes

Merged Jeffrey Knockel requested to merge jeffk/vlc:glx-x11-sync into master
  1. May 26, 2022
    • Jeffrey Knockel's avatar
      egl: add intermediate X11 window controlled by EGL · 2fe4871b
      Jeffrey Knockel authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      Asynchronous window resizes cannot be kept in sync with EGL.
      To keep the underlying X11 window and the EGL drawable sizes in sync,
      embed a new X11 window so that EGL can synchronously resize.
      
      At a high level, to resize, we (1) wait until EGL is done drawing, (2)
      resize the X11 window, and (3) wait for the window to be resized before
      EGL resumes drawing.
      
      With Nvidia, eglWaitNative() is sufficient to wait for the window to be
      resized.  With Mesa, it is not, so after eglWaitNative() we (for the
      Xlib backend) check if Xlib knows if the X server has already processed
      the resize and, if not, XSync(), or (for the XCB backend) wait on the
      void cookie corresponding to our resize request.
      
      To work around an issue with Mesa, we also call
      eglQuerySurface(EGL_HEIGHT) to coerce Mesa to observe the new X11 window
      size and resize its EGL surface.  On Nvidia, this is not required, but
      we call it in any case.
      
      Refs #26734 for EGL.
      2fe4871b
    • Jeffrey Knockel's avatar
      glx: add intermediate X11 window controlled by GLX · d0836b10
      Jeffrey Knockel authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      Asynchronous window resizes cannot be kept in sync with GLX.  To keep
      the underlying X11 window and the GLX drawable sizes in sync, embed a
      new X11 window so that GLX can synchronously resize.
      
      At a high level, to resize, we (1) wait until GLX is done drawing, (2)
      resize the X11 window, and (3) wait for the window to be resized before
      GLX resumes drawing.
      
      With Nvidia, glXWaitX() is sufficient to wait for the window to be
      resized.  With Mesa, it is not, so after glXWaitX() we check if Xlib
      knows if the X server has already processed the resize and, if not,
      XSync().
      
      Refs #26734 for GLX.
      d0836b10
Loading