[vlc-commits] mmal: tell the surface clone if it's using CMA buffers

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


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

mmal: tell the surface clone if it's using CMA buffers

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

 modules/hw/mmal/converter.c    |  4 +++-
 modules/hw/mmal/mmal_picture.c | 10 ++++++----
 modules/hw/mmal/mmal_picture.h |  6 ++++--
 modules/hw/mmal/vout.c         |  4 +++-
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index 7d9890b8fa..70245143d2 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -615,8 +615,10 @@ static picture_t *conv_filter(filter_t *p_filter, picture_t *p_pic)
     // We assume the BH is already set up with values reflecting pic date etc.
     stash->pts = p_pic->date;
     {
+        mmal_decoder_device_t *devsys = GetMMALDeviceOpaque(sys->dec_dev);
         MMAL_BUFFER_HEADER_T *const pic_buf = sys->needs_copy_in ?
-            hw_mmal_pic_buf_copied(p_pic, sys->in_pool, sys->input, sys->cma_in_pool) :
+            hw_mmal_pic_buf_copied(p_pic, sys->in_pool, sys->input, sys->cma_in_pool,
+                                   devsys->vcsm_init_type == VCSM_INIT_CMA) :
             hw_mmal_pic_buf_replicated(p_pic, sys->in_pool);
 
         // Whether or not we extracted the pic_buf we are done with the picture
diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index b93abec41a..abc305e5aa 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -453,7 +453,8 @@ static void mem_copy_2d_10_to_8(uint8_t * d_ptr, const size_t d_stride,
 int hw_mmal_copy_pic_to_buf(void * const buf_data,
                             uint32_t * const pLength,
                             const MMAL_ES_FORMAT_T * const fmt,
-                            const picture_t * const pic)
+                            const picture_t * const pic,
+                            bool is_cma)
 {
     const MMAL_VIDEO_FORMAT_T *const video = &fmt->es->video;
     uint8_t * const dest = buf_data;
@@ -518,7 +519,7 @@ int hw_mmal_copy_pic_to_buf(void * const buf_data,
             return VLC_EBADVAR;
     }
 
-    if (cma_vcsm_type() == VCSM_INIT_LEGACY) {  // ** CMA is currently always uncached
+    if (!is_cma) {  // ** CMA is currently always uncached
         flush_range(dest, length);
     }
 
@@ -583,7 +584,8 @@ static int cma_buf_buf_attach(MMAL_BUFFER_HEADER_T * const buf, cma_buf_t * cons
 MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_copied(const picture_t *const pic,
                                               MMAL_POOL_T * const rep_pool,
                                               MMAL_PORT_T * const port,
-                                              cma_buf_pool_t * const cbp)
+                                              cma_buf_pool_t * const cbp,
+                                              bool is_cma)
 {
     MMAL_BUFFER_HEADER_T *const buf = mmal_queue_wait(rep_pool->queue);
     if (buf == NULL)
@@ -598,7 +600,7 @@ MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_copied(const picture_t *const pic,
 
     pic_to_buf_copy_props(buf, pic);
 
-    if (hw_mmal_copy_pic_to_buf(cma_buf_addr(cb), &buf->length, port->format, pic) != VLC_SUCCESS)
+    if (hw_mmal_copy_pic_to_buf(cma_buf_addr(cb), &buf->length, port->format, pic, is_cma) != VLC_SUCCESS)
         goto fail2;
     buf->flags = MMAL_BUFFER_HEADER_FLAG_FRAME_END;
 
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index 48223f8171..eaf9c07e7a 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -54,7 +54,8 @@ bool hw_mmal_vlc_pic_to_mmal_fmt_update(MMAL_ES_FORMAT_T *const es_fmt, const pi
 
 // Copy pic contents into an existing buffer
 int hw_mmal_copy_pic_to_buf(void * const buf_data, uint32_t * const pLength,
-                            const MMAL_ES_FORMAT_T * const fmt, const picture_t * const pic);
+                            const MMAL_ES_FORMAT_T * const fmt, const picture_t * const pic,
+                            bool is_cma);
 
 //----------------------------------------------------------------------------
 
@@ -119,7 +120,8 @@ static inline void buf_to_pic_copy_props(picture_t * const pic, const MMAL_BUFFE
 MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_copied(const picture_t *const pic,
                                               MMAL_POOL_T * const rep_pool,
                                               MMAL_PORT_T * const port,
-                                              cma_buf_pool_t * const cbp);
+                                              cma_buf_pool_t * const cbp,
+                                              bool is_cma);
 
 MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_replicated(const picture_t *const pic, MMAL_POOL_T * const rep_pool);
 
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index a0da1804d1..d546c00537 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -844,7 +844,9 @@ static void vd_prepare(vout_display_t *vd, picture_t *p_pic,
 
         MMAL_BUFFER_HEADER_T * const buf = mmal_queue_wait(sys->copy_pool->queue);
         // Copy 2d
-        hw_mmal_copy_pic_to_buf(buf->data, &buf->length, sys->input->format, p_pic);
+        mmal_decoder_device_t *devsys = GetMMALDeviceOpaque(sys->dec_dev);
+        hw_mmal_copy_pic_to_buf(buf->data, &buf->length, sys->input->format, p_pic,
+                                devsys->vcsm_init_type == VCSM_INIT_CMA);
         buf->flags = MMAL_BUFFER_HEADER_FLAG_FRAME_END;
 
         sys->copy_buf = buf;



More information about the vlc-commits mailing list