[vlc-commits] mmal: vout: tell the vzc pool if it's using CMA buffers

Steve Lhomme git at videolan.org
Fri Jan 24 14:15:48 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 24 12:19:26 2020 +0100| [35aceb1a0ef85d521fff4c3cb14a02373c47c901] | committer: Steve Lhomme

mmal: vout: tell the vzc pool if it's using CMA buffers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35aceb1a0ef85d521fff4c3cb14a02373c47c901
---

 modules/hw/mmal/mmal_picture.c | 14 ++++----------
 modules/hw/mmal/mmal_picture.h |  2 +-
 modules/hw/mmal/vout.c         |  3 ++-
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index a060592cae..b93abec41a 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -698,7 +698,7 @@ struct vzc_pool_ctl_s
 
     MMAL_POOL_T * buf_pool;
 
-    vcsm_init_type_t vcsm_init_type;
+    bool is_cma;
 };
 
 typedef struct vzc_subbuf_ent_s
@@ -1096,7 +1096,7 @@ MMAL_BUFFER_HEADER_T * hw_mmal_vzc_buf_from_pic(vzc_pool_ctl_t * const pc,
                 mem_copy_2d(d, dst_stride, s, pic->p[0].i_pitch, fmt->i_visible_height, dst_stride);
 
                 // And make sure it is actually in memory
-                if (pc->vcsm_init_type != VCSM_INIT_CMA) {  // ** CMA is currently always uncached
+                if (!pc->is_cma) {  // ** CMA is currently always uncached
                     flush_range(ent->buf, dst_stride * fmt->i_visible_height);
                 }
             }
@@ -1130,8 +1130,6 @@ static void hw_mmal_vzc_pool_delete(vzc_pool_ctl_t * const pc)
 
     vlc_mutex_destroy(&pc->lock);
 
-    cma_vcsm_exit(pc->vcsm_init_type);
-
 //    memset(pc, 0xba, sizeof(*pc)); // Zap for (hopefully) faster crash
     free (pc);
 }
@@ -1173,18 +1171,14 @@ static MMAL_BOOL_T vcz_pool_release_cb(MMAL_POOL_T * buf_pool, MMAL_BUFFER_HEADE
     return MMAL_TRUE;
 }
 
-vzc_pool_ctl_t * hw_mmal_vzc_pool_new()
+vzc_pool_ctl_t * hw_mmal_vzc_pool_new(bool is_cma)
 {
     vzc_pool_ctl_t * const pc = calloc(1, sizeof(*pc));
 
     if (pc == NULL)
         return NULL;
 
-    if ((pc->vcsm_init_type = cma_vcsm_init()) == VCSM_INIT_NONE)
-    {
-        free(pc);
-        return NULL;
-    }
+    pc->is_cma = is_cma;
 
     pc->max_n = 8;
     vlc_mutex_init(&pc->lock);  // Must init before potential destruction
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index 588a66ca4f..48223f8171 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -147,7 +147,7 @@ MMAL_BUFFER_HEADER_T * hw_mmal_vzc_buf_from_pic(vzc_pool_ctl_t * const pc, pictu
 void hw_mmal_vzc_pool_flush(vzc_pool_ctl_t * const pc);
 void hw_mmal_vzc_pool_release(vzc_pool_ctl_t * const pc);
 void hw_mmal_vzc_pool_ref(vzc_pool_ctl_t * const pc);
-vzc_pool_ctl_t * hw_mmal_vzc_pool_new(void);
+vzc_pool_ctl_t * hw_mmal_vzc_pool_new(bool is_cma);
 
 
 //----------------------------------------------------------------------------
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 06089d5feb..a0da1804d1 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -770,7 +770,8 @@ static int attach_subpics(vout_display_t * const vd, vout_display_sys_t * const
     unsigned int n = 0;
 
     if (sys->vzc == NULL) {
-        if ((sys->vzc = hw_mmal_vzc_pool_new()) == NULL)
+        mmal_decoder_device_t *devsys = GetMMALDeviceOpaque(sys->dec_dev);
+        if ((sys->vzc = hw_mmal_vzc_pool_new(devsys->vcsm_init_type == VCSM_INIT_CMA)) == NULL)
         {
             msg_Err(vd, "Failed to allocate VZC");
             return VLC_ENOMEM;



More information about the vlc-commits mailing list