[vlc-commits] mmal: simplify the decoder device shared flag
Steve Lhomme
git at videolan.org
Fri Jan 24 14:15:53 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 24 12:38:35 2020 +0100| [6625dadec19152f551a4573fc5c1d780d8a85fb5] | committer: Steve Lhomme
mmal: simplify the decoder device shared flag
No need to the users to know the internals of the types used.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6625dadec19152f551a4573fc5c1d780d8a85fb5
---
modules/hw/mmal/converter.c | 4 ++--
modules/hw/mmal/decoder_device.c | 25 +++++++++++++------------
modules/hw/mmal/mmal_picture.h | 8 +-------
modules/hw/mmal/vout.c | 4 ++--
4 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index 70245143d2..74cbda4fd2 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -618,7 +618,7 @@ static picture_t *conv_filter(filter_t *p_filter, picture_t *p_pic)
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,
- devsys->vcsm_init_type == VCSM_INIT_CMA) :
+ devsys->is_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
@@ -878,7 +878,7 @@ retry:
assert(devsys != NULL);
if (sys->needs_copy_in &&
- (sys->cma_in_pool = cma_buf_pool_new(2, 2, devsys->vcsm_init_type == VCSM_INIT_CMA, "conv-copy-in")) == NULL)
+ (sys->cma_in_pool = cma_buf_pool_new(2, 2, devsys->is_cma, "conv-copy-in")) == NULL)
{
msg_Err(p_filter, "Failed to allocate input CMA pool");
goto fail;
diff --git a/modules/hw/mmal/decoder_device.c b/modules/hw/mmal/decoder_device.c
index 8bc964b8d3..cb92090c06 100644
--- a/modules/hw/mmal/decoder_device.c
+++ b/modules/hw/mmal/decoder_device.c
@@ -43,6 +43,12 @@ vlc_module_begin()
vlc_module_end()
+typedef enum {
+ VCSM_INIT_NONE = 0,
+ VCSM_INIT_LEGACY,
+ VCSM_INIT_CMA
+} vcsm_init_type_t;
+
// Preferred mode - none->cma on Pi4 otherwise legacy
static volatile vcsm_init_type_t last_vcsm_type = VCSM_INIT_NONE;
@@ -81,13 +87,10 @@ static vcsm_init_type_t cma_vcsm_init(void)
return rv;
}
-static void cma_vcsm_exit(const vcsm_init_type_t init_mode)
+static void cma_vcsm_exit()
{
- if (init_mode != VCSM_INIT_NONE)
- {
- vcsm_exit();
- bcm_host_deinit(); // Does nothing but add in case it ever does
- }
+ vcsm_exit();
+ bcm_host_deinit(); // Does nothing but add in case it ever does
}
static const char * cma_vcsm_init_str(const vcsm_init_type_t init_mode)
@@ -98,18 +101,16 @@ static const char * cma_vcsm_init_str(const vcsm_init_type_t init_mode)
return "CMA";
case VCSM_INIT_LEGACY:
return "Legacy";
- case VCSM_INIT_NONE:
- return "none";
default:
- break;
+ vlc_assert_unreachable();
+ return NULL;
}
- return "???";
}
static void CloseDecoderDevice(vlc_decoder_device *device)
{
- mmal_decoder_device_t *sys = device->opaque;
- cma_vcsm_exit(sys->vcsm_init_type);
+ VLC_UNUSED(device);
+ cma_vcsm_exit();
}
static const struct vlc_decoder_device_operations mmal_device_ops = {
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index ab4c3a8c56..e53e1491da 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -160,12 +160,6 @@ MMAL_FOURCC_T pic_to_slice_mmal_fourcc(MMAL_FOURCC_T);
bool rpi_is_model_pi4(void);
-typedef enum vcsm_init_type_e {
- VCSM_INIT_NONE = 0,
- VCSM_INIT_LEGACY,
- VCSM_INIT_CMA
-} vcsm_init_type_t;
-
#define MMAL_RESIZE_NAME "mmal-resize"
#define MMAL_ISP_NAME "mmal-isp"
@@ -181,7 +175,7 @@ void CloseConverter(vlc_object_t *);
typedef struct
{
- vcsm_init_type_t vcsm_init_type;
+ bool is_cma; // legacy MMAL mode otherwise
} mmal_decoder_device_t;
static inline mmal_decoder_device_t *GetMMALDeviceOpaque(vlc_decoder_device *dec_dev)
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index d546c00537..3b3bfb4d84 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -771,7 +771,7 @@ static int attach_subpics(vout_display_t * const vd, vout_display_sys_t * const
if (sys->vzc == 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)
+ if ((sys->vzc = hw_mmal_vzc_pool_new(devsys->is_cma)) == NULL)
{
msg_Err(vd, "Failed to allocate VZC");
return VLC_ENOMEM;
@@ -846,7 +846,7 @@ static void vd_prepare(vout_display_t *vd, picture_t *p_pic,
// Copy 2d
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);
+ devsys->is_cma);
buf->flags = MMAL_BUFFER_HEADER_FLAG_FRAME_END;
sys->copy_buf = buf;
More information about the vlc-commits
mailing list