[vlc-commits] opengl: don't handle direct rendering with subpictures
Thomas Guillem
git at videolan.org
Fri Mar 10 18:50:18 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 9 16:50:30 2017 +0100| [7bf742b110ba6f7f4553ebfe8ba3394c0db3f4fd] | committer: Thomas Guillem
opengl: don't handle direct rendering with subpictures
As picture_t used to render subptictures are not allocated by the converter
pool, they are not configured for direct rendering.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bf742b110ba6f7f4553ebfe8ba3394c0db3f4fd
---
modules/video_output/opengl/converters.c | 58 ++++++++++++++++++++-----------
modules/video_output/opengl/internal.h | 8 +++--
modules/video_output/opengl/vout_helper.c | 4 +--
3 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index a2e1990..5741d6f 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -567,10 +567,11 @@ persistent_release_gpupics(const opengl_tex_converter_t *tc, bool force)
}
static int
-persistent_common_update(const opengl_tex_converter_t *tc, const GLuint *textures,
- const GLsizei *tex_width, const GLsizei *tex_height,
- picture_t *pic)
+tc_persistent_update(const opengl_tex_converter_t *tc, GLuint *textures,
+ const GLsizei *tex_width, const GLsizei *tex_height,
+ picture_t *pic, const size_t *plane_offset)
{
+ (void) plane_offset; assert(plane_offset == NULL);
struct priv *priv = tc->priv;
picture_sys_t *picsys = pic->p_sys;
@@ -801,11 +802,7 @@ tc_common_update(const opengl_tex_converter_t *tc, GLuint *textures,
const GLsizei *tex_width, const GLsizei *tex_height,
picture_t *pic, const size_t *plane_offset)
{
-#ifdef VLCGL_HAS_MAP_PERSISTENT
- if (pic->p_sys != NULL)
- return persistent_common_update(tc, textures, tex_width, tex_height, pic);
-#endif
-
+ assert(pic->p_sys == NULL);
int ret = VLC_SUCCESS;
for (unsigned i = 0; i < tc->tex_count && ret == VLC_SUCCESS; i++)
{
@@ -905,9 +902,9 @@ xyz12_shader_init(opengl_tex_converter_t *tc)
return fragment_shader;
}
-GLuint
-opengl_tex_converter_generic_init(const video_format_t *fmt,
- opengl_tex_converter_t *tc)
+static GLuint
+generic_init(const video_format_t *fmt, opengl_tex_converter_t *tc,
+ bool allow_dr)
{
const vlc_chroma_description_t *desc =
vlc_fourcc_GetChromaDescription(fmt->i_chroma);
@@ -957,18 +954,23 @@ opengl_tex_converter_generic_init(const video_format_t *fmt,
tc->pf_release = tc_common_release;
tc->pf_allocate_textures = tc_common_allocate_textures;
+ if (allow_dr)
+ {
#ifdef VLCGL_HAS_MAP_PERSISTENT
- const bool supports_map_persistent = tc->api->BufferStorage
- && tc->api->MapBufferRange && tc->api->FlushMappedBufferRange
- && tc->api->UnmapBuffer && tc->api->FenceSync && tc->api->DeleteSync
- && tc->api->ClientWaitSync
- && HasExtension(tc->glexts, "GL_ARB_pixel_buffer_object")
- && HasExtension(tc->glexts, "GL_ARB_buffer_storage");
- if (supports_map_persistent)
- tc->pf_get_pool = tc_persistent_get_pool;
- msg_Dbg(tc->gl, "MAP_PERSISTENT support (direct rendering): %s",
- supports_map_persistent ? "On" : "Off");
+ const bool supports_map_persistent = tc->api->BufferStorage
+ && tc->api->MapBufferRange && tc->api->FlushMappedBufferRange
+ && tc->api->UnmapBuffer && tc->api->FenceSync && tc->api->DeleteSync
+ && tc->api->ClientWaitSync
+ && HasExtension(tc->glexts, "GL_ARB_pixel_buffer_object")
+ && HasExtension(tc->glexts, "GL_ARB_buffer_storage");
+ if (supports_map_persistent)
+ {
+ tc->pf_get_pool = tc_persistent_get_pool;
+ tc->pf_update = tc_persistent_update;
+ msg_Dbg(tc->gl, "MAP_PERSISTENT support (direct rendering) enabled");
+ }
#endif
+ }
#ifdef NEED_GL_EXT_unpack_subimage
priv->has_unpack_subimage = HasExtension(tc->glexts,
@@ -982,3 +984,17 @@ error:
tc->api->DeleteShader(fragment_shader);
return 0;
}
+
+GLuint
+opengl_tex_converter_subpictures_init(const video_format_t *fmt,
+ opengl_tex_converter_t *tc)
+{
+ return generic_init(fmt, tc, false);
+}
+
+GLuint
+opengl_tex_converter_generic_init(const video_format_t *fmt,
+ opengl_tex_converter_t *tc)
+{
+ return generic_init(fmt, tc, true);
+}
diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index 6d2c944..2353f25 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -321,12 +321,16 @@ GLuint
opengl_fragment_shader_init(opengl_tex_converter_t *tc, GLenum tex_target,
vlc_fourcc_t chroma, video_color_space_t yuv_space);
-extern GLuint
+GLuint
+opengl_tex_converter_subpictures_init(const video_format_t *,
+ opengl_tex_converter_t *);
+
+GLuint
opengl_tex_converter_generic_init(const video_format_t *,
opengl_tex_converter_t *);
#ifdef __ANDROID__
-extern GLuint
+GLuint
opengl_tex_converter_anop_init(const video_format_t *,
opengl_tex_converter_t *);
#endif
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index d5de83f..ff50510 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -672,8 +672,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
};
/* RGBA is needed for subpictures or for non YUV pictures */
- GLuint fshader = opengl_tex_converter_generic_init(&vgl->fmt,
- &vgl->sub_prgm->tc);
+ GLuint fshader = opengl_tex_converter_subpictures_init(&vgl->fmt,
+ &vgl->sub_prgm->tc);
int ret = opengl_link_program(vgl->sub_prgm, fshader);
if (ret != VLC_SUCCESS)
{
More information about the vlc-commits
mailing list