[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: interop_sw: implement as a module

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Dec 14 09:35:22 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
cf672816 by Alexandre Janniaux at 2022-12-14T09:20:36+00:00
opengl: interop_sw: implement as a module

This commit introduce the "opengl sw interop" to allow interop to be
implemented as modules for the desc->plane_count != 0 case.

No functional changes, but now the interop doesn't need to be built into
the clients that are using it and is separated into a different plugin.

It still doesn't allow to use software interop in --glinterop parameter.

- - - - -
93f42387 by Alexandre Janniaux at 2022-12-14T09:20:36+00:00
interop_sw: move functions to static linkage

Clean-up after previous patches, remove the now-unused header and
prevent module functions from being exposed.

- - - - -


4 changed files:

- modules/video_output/opengl/Makefile.am
- modules/video_output/opengl/interop.c
- modules/video_output/opengl/interop_sw.c
- − modules/video_output/opengl/interop_sw.h


Changes:

=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -14,8 +14,6 @@ OPENGL_COMMONSOURCES = \
        video_output/opengl/importer_priv.h \
        video_output/opengl/interop.h \
        video_output/opengl/interop.c \
-       video_output/opengl/interop_sw.c \
-       video_output/opengl/interop_sw.h \
        video_output/opengl/picture.c \
        video_output/opengl/picture.h \
        video_output/opengl/sampler.c \
@@ -59,6 +57,33 @@ if HAVE_GLES2
 noinst_LTLIBRARIES += libvlc_opengles.la
 endif
 
+libglinterop_sw_plugin_la_SOURCES = video_output/opengl/interop_sw.c
+libglinterop_sw_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
+if HAVE_GL
+vout_LTLIBRARIES += libglinterop_sw_plugin.la
+else
+if HAVE_GLES2
+vout_LTLIBRARIES += libglinterop_sw_plugin.la
+libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
+endif
+endif
+
+if HAVE_DARWIN
+vout_LTLIBRARIES += libglinterop_sw_plugin.la
+if HAVE_OSX
+libglinterop_sw_plugin_la_LIBADD = libvlc_opengl.la
+else
+libglinterop_sw_plugin_la_LIBADD = libvlc_opengles.la
+libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
+endif
+endif
+
+if HAVE_ANDROID
+libglinterop_sw_plugin_la_LIBADD = libvlc_opengles.la
+libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
+vout_LTLIBRARIES += libglinterop_sw_plugin.la
+endif
+
 ### OpenGL ###
 libgles2_plugin_la_SOURCES = video_output/opengl/display.c \
     $(OPENGL_VOUT_COMMONSOURCES)


=====================================
modules/video_output/opengl/interop.c
=====================================
@@ -27,8 +27,6 @@
 
 #include "gl_util.h"
 #include "interop.h"
-#include "interop_sw.h"
-#include "vout_helper.h"
 
 struct vlc_gl_interop_private
 {
@@ -184,17 +182,14 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, vlc_video_context *context,
         /* Opaque chroma: load a module to handle it */
         interop->vctx = context;
         interop->module = module_need_var(interop, "glinterop", "glinterop");
-        if (interop->module == NULL)
-            goto error;
     }
     else
     {
-        /* No opengl interop module found: use a generic interop. */
-        int ret = opengl_interop_generic_init(interop, true);
-        if (ret != VLC_SUCCESS)
-            goto error;
+        interop->module = module_need(interop, "opengl sw interop", NULL, false);
     }
 
+    if (interop->module == NULL)
+        goto error;
 
     return interop;
 
@@ -222,14 +217,15 @@ vlc_gl_interop_NewForSubpictures(struct vlc_gl_t *gl)
     OPENGL_VTABLE_F(LOAD_SYMBOL);
 #undef LOAD_SYMBOL
 
-    int ret = opengl_interop_generic_init(interop, false);
-    if (ret != VLC_SUCCESS)
-    {
-        vlc_object_delete(interop);
-        return NULL;
-    }
+    interop->module = module_need(interop, "opengl sw interop", "sw", true);
+
+    if (interop->module == NULL)
+        goto error;
 
     return interop;
+error:
+    vlc_object_delete(interop);
+    return NULL;
 }
 
 void


=====================================
modules/video_output/opengl/interop_sw.c
=====================================
@@ -26,10 +26,13 @@
 #include <limits.h>
 #include <stdlib.h>
 
-#include "interop_sw.h"
-
 #include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_opengl.h>
+#include <vlc_opengl_interop.h>
+
 #include "gl_util.h"
+#include "interop.h"
 
 #define PBO_DISPLAY_COUNT 2 /* Double buffering */
 typedef struct
@@ -559,7 +562,7 @@ opengl_interop_init(struct vlc_gl_interop *interop, GLenum tex_target,
     return interop_rgb_base_init(interop, tex_target, chroma);
 }
 
-void
+static void
 opengl_interop_generic_deinit(struct vlc_gl_interop *interop)
 {
     struct priv *priv = interop->priv;
@@ -569,7 +572,7 @@ opengl_interop_generic_deinit(struct vlc_gl_interop *interop)
     free(priv);
 }
 
-int
+static int
 opengl_interop_generic_init(struct vlc_gl_interop *interop, bool allow_dr)
 {
 
@@ -705,3 +708,28 @@ error:
     interop->priv = NULL;
     return VLC_EGENERIC;
 }
+
+static int OpenInteropSW(vlc_object_t *obj)
+{
+    struct vlc_gl_interop *interop = (void *) obj;
+    return opengl_interop_generic_init(interop, false);
+}
+
+static int OpenInteropDirectRendering(vlc_object_t *obj)
+{
+    struct vlc_gl_interop *interop = (void *) obj;
+    return opengl_interop_generic_init(interop, true);
+}
+
+vlc_module_begin ()
+    set_description("Software OpenGL interop")
+    set_capability("opengl sw interop", 1)
+    set_callback(OpenInteropSW)
+    set_subcategory(SUBCAT_VIDEO_VOUT)
+    add_shortcut("sw")
+
+    add_submodule()
+    set_callback(OpenInteropDirectRendering)
+    set_capability("opengl sw interop", 2)
+    add_shortcut("pbo")
+vlc_module_end ()


=====================================
modules/video_output/opengl/interop_sw.h deleted
=====================================
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * interop_sw.h: OpenGL internal header
- *****************************************************************************
- * Copyright (C) 2017 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VLC_OPENGL_INTEROP_SW_H
-#define VLC_OPENGL_INTEROP_SW_H
-
-#include "interop.h"
-
-int
-opengl_interop_generic_init(struct vlc_gl_interop *interop, bool);
-
-void
-opengl_interop_generic_deinit(struct vlc_gl_interop *interop);
-
-#endif /* include-guard */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02343458eadb9eccb4ba8befd4e470930d9913f3...93f42387b6db63de44aeb1410f1d3b8bede4ab99

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02343458eadb9eccb4ba8befd4e470930d9913f3...93f42387b6db63de44aeb1410f1d3b8bede4ab99
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