[vlc-devel] [PATCH 2/4] mmal: initialize the VideoCore Shared Memory

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 17 17:00:56 CET 2020


From: John Cox <jc at kynesim.co.uk>

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 configure.ac                   |  2 +-
 modules/hw/mmal/mmal_picture.c | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index a7cf39d2174..cf34d2ae261 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3684,7 +3684,7 @@ if test "${enable_mmal}" != "no"; then
         VLC_ADD_PLUGIN([mmal])
         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
         VLC_ADD_CFLAGS([mmal],[ -isystem /opt/vc/include -isystem /opt/vc/include/interface/vcos/pthreads -isystem /opt/vc/include/interface/vmcs_host/linux ])
-        VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lmmal_core -lmmal_components -lmmal_util -lvchostif ]) ], [
+        VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lmmal_core -lmmal_components -lmmal_util -lvchostif -lvcsm ]) ], [
           AS_IF([test "${enable_mmal}" = "yes"],
             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
             [ AC_MSG_WARN([Cannot find bcm library...]) ])
diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index 0da944b72cf..5dd5169a9d7 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -29,6 +29,7 @@
 #include <interface/mmal/util/mmal_util.h>
 #include <interface/mmal/util/mmal_default_components.h>
 #include <interface/vmcs_host/vcgencmd.h>
+#include <interface/vcsm/user-vcsm.h>
 
 #include "mmal_picture.h"
 
@@ -1020,9 +1021,17 @@ vcsm_init_type_t cma_vcsm_type(void)
 
 vcsm_init_type_t cma_vcsm_init(void)
 {
-    vcsm_init_type_t rv = VCSM_INIT_LEGACY;
+    vcsm_init_type_t rv = VCSM_INIT_NONE;
+
+    {
+        if (vcsm_init_ex(0, -1) == 0)
+            rv = VCSM_INIT_LEGACY;
+    }
+
+    // Just in case this affects vcsm init do after that
+    if (rv != VCSM_INIT_NONE)
+        bcm_host_init();
 
-    bcm_host_init();
     last_vcsm_type = rv;
     return rv;
 }
@@ -1031,6 +1040,7 @@ void cma_vcsm_exit(const vcsm_init_type_t init_mode)
 {
     if (init_mode != VCSM_INIT_NONE)
     {
+        vcsm_exit();
         bcm_host_deinit();  // Does nothing but add in case it ever does
     }
 }
-- 
2.17.1



More information about the vlc-devel mailing list