[vlc-devel] [PATCH 5/7] egl_pbuffer: add support for surfaceless context

Romain Vimont rom1v at videolabs.io
Wed Mar 3 17:52:48 UTC 2021


On Wed, Mar 03, 2021 at 07:43:42PM +0200, Rémi Denis-Courmont wrote:
> Le keskiviikkona 3. maaliskuuta 2021, 19.36.38 EET Romain Vimont a écrit :
> > From: Alexandre Janniaux <ajanni at videolabs.io>
> > 
> > If the EGL extension EGL_KHR_surfaceless_context is available, create a
> > surfaceless context.
> > 
> > Co-authored-by: Romain Vimont <rom1v at videolabs.io>
> > ---
> >  modules/video_filter/egl_pbuffer.c | 37 ++++++++++++++++++++++++------
> >  1 file changed, 30 insertions(+), 7 deletions(-)
> > 
> > diff --git a/modules/video_filter/egl_pbuffer.c
> > b/modules/video_filter/egl_pbuffer.c index 5ede974602..ff4ba946ce 100644
> > --- a/modules/video_filter/egl_pbuffer.c
> > +++ b/modules/video_filter/egl_pbuffer.c
> > @@ -155,7 +155,11 @@ static int InitEGL(vlc_gl_t *gl, unsigned width,
> > unsigned height) #endif
> >              );
> > 
> > -    const EGLint conf_attr[] = {
> > +    const char *extensions = eglQueryString(sys->display, EGL_EXTENSIONS);
> > +    bool need_surface =
> > +        !vlc_gl_StrHasToken(extensions, "EGL_KHR_surfaceless_context");
> > +
> > +    const EGLint conf_attr_surface[] = {
> >          EGL_RED_SIZE, 8,
> >          EGL_GREEN_SIZE, 8,
> >          EGL_BLUE_SIZE, 8,
> > @@ -167,6 +171,19 @@ static int InitEGL(vlc_gl_t *gl, unsigned width,
> > unsigned height) EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
> >          EGL_NONE,
> >      };
> > +
> > +    const EGLint conf_attr_surfaceless[] = {
> > +#ifdef USE_OPENGL_ES2
> > +        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
> > +#else
> > +        EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
> > +#endif
> > +        EGL_NONE,
> > +    };
> > +
> > +    const EGLint *conf_attr = need_surface ? conf_attr_surface
> > +                                           : conf_attr_surfaceless;
> 
> This seems to kind-of assume (incorrectly) that the tables are static.

OK, I will make them static (in practice, they are only used during the
call to eglChooseConfig(), so it's harmless).


More information about the vlc-devel mailing list