[vlc-commits] [Git][videolan/vlc][master] 2 commits: egl_pbuffer: use eglMakeCurrent directly
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon Apr 3 14:54:52 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
c9a8d6dc by Alexandre Janniaux at 2023-04-03T14:28:02+00:00
egl_pbuffer: use eglMakeCurrent directly
MakeCurrent() (triggered by vlc_gl_MakeCurrent) can have different
behaviour than just eglMakeCurrent() to match the VLC API semantic.
However, we'll need to reset the default framebuffer from this function
for this very VLC semantic, whereas the default framebuffer is not yet
existing when calling this function from Open.
By using eglMakeCurrent(), we allow future behaviour change to handle
this correctly.
- - - - -
81ec5619 by Alexandre Janniaux at 2023-04-03T14:28:02+00:00
egl_pbuffer: setup default framebuffer on MakeCurrent
Ensure that the default framebuffer is setup during MakeCurrent(), so
that any vlc_gl_t client can expect the state to be correct after
calling vlc_gl_MakeCurrent() and without changing it.
It seems that the default framebuffer was not always kept, leading to
GL_INVALID_FRAMEBUFFER errors on Linux with a MESA egl_pbuffer (GBM
backend) GLES2 implementation:
$ MESA_DEBUG=1 ./vlc -vv ~/Video/dog_meme.mp4 --video-filter='opengl{filter=mock{mask},gles=any}'
...
Mesa: User error: GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
Mesa: User error: GL_INVALID_FRAMEBUFFER_OPERATION in glDrawArrays
vlc: ../../modules/video_output/opengl/filter_draw.c:112: Draw: Assertion `!"GL_INVALID_FRAMEBUFFER_OPERATION"' failed.
- - - - -
1 changed file:
- modules/video_filter/egl_pbuffer.c
Changes:
=====================================
modules/video_filter/egl_pbuffer.c
=====================================
@@ -84,6 +84,11 @@ static int MakeCurrent (vlc_gl_t *gl)
return VLC_EGENERIC;
sys->current = true;
+
+ const opengl_vtable_t *vt = &sys->api.vt;
+ vt->BindBuffer(GL_PIXEL_PACK_BUFFER, sys->pixelbuffers[sys->current_flip]);
+ vt->BindFramebuffer(GL_FRAMEBUFFER, sys->framebuffers[sys->current_flip]);
+
return VLC_SUCCESS;
}
@@ -434,12 +439,16 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
gl->ops = &gl_ops;
gl->offscreen_vflip = true;
- vlc_gl_MakeCurrent(gl);
+ eglMakeCurrent(sys->display, sys->surface, sys->surface,
+ sys->context);
+
+
int ret = vlc_gl_api_Init(&sys->api, gl);
if (ret != VLC_SUCCESS)
{
msg_Err(gl, "Failed to initialize gl_api");
- vlc_gl_ReleaseCurrent(gl);
+ eglMakeCurrent(sys->display, sys->surface, sys->surface,
+ EGL_NO_CONTEXT);
goto error2;
}
@@ -471,8 +480,8 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height,
sys->current_flip = BUFFER_COUNT - 1;
BindDrawFramebuffer(sys);
-
- vlc_gl_ReleaseCurrent(gl);
+ eglMakeCurrent(sys->display, sys->surface, sys->surface,
+ EGL_NO_CONTEXT);
return VLC_SUCCESS;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/66a8ad52e8aacfdaf6583be72e1361b7f9b07231...81ec561923e267f96b4fba3aeb120fcd501690d9
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/66a8ad52e8aacfdaf6583be72e1361b7f9b07231...81ec561923e267f96b4fba3aeb120fcd501690d9
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list