Commit 3f12704a authored by Julian Scheel's avatar Julian Scheel Committed by Rémi Denis-Courmont

mmal/vout: Rework buffer handling

This patch reflects the buffer handling improvements done in the mmal codec
module into the the mmal video output module.
A nice side effect of the restructuring is that less magic values need to be
defined as the required values can be computed dynamically now.
Signed-off-by: default avatarJulian Scheel <julian@jusst.de>
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 0bf3d5ac
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/* This value must match the define in codec/mmal.c /* This value must match the define in codec/mmal.c
* Think twice before changing this. Incorrect values cause havoc. * Think twice before changing this. Incorrect values cause havoc.
*/ */
#define NUM_ACTUAL_OPAQUE_BUFFERS 40 #define NUM_ACTUAL_OPAQUE_BUFFERS 22
#define MAX_BUFFERS_IN_TRANSIT 2 #define MAX_BUFFERS_IN_TRANSIT 2
#define VC_TV_MAX_MODE_IDS 127 #define VC_TV_MAX_MODE_IDS 127
...@@ -433,9 +433,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count) ...@@ -433,9 +433,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
if (sys->opaque) { if (sys->opaque) {
if (count <= NUM_ACTUAL_OPAQUE_BUFFERS) if (count <= NUM_ACTUAL_OPAQUE_BUFFERS)
count = NUM_ACTUAL_OPAQUE_BUFFERS; count = NUM_ACTUAL_OPAQUE_BUFFERS;
else
msg_Err(vd, "More picture (%u) than NUM_ACTUAL_OPAQUE_BUFFERS (%d) requested. Expect errors",
count, NUM_ACTUAL_OPAQUE_BUFFERS);
} }
if (count < sys->input->buffer_num_recommended) if (count < sys->input->buffer_num_recommended)
...@@ -460,7 +457,8 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count) ...@@ -460,7 +457,8 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
goto out; goto out;
} }
sys->pool = mmal_pool_create_with_allocator(count, sys->input->buffer_size, sys->num_buffers = count;
sys->pool = mmal_pool_create_with_allocator(sys->num_buffers, sys->input->buffer_size,
sys->input, sys->input,
(mmal_pool_allocator_alloc_t)mmal_port_payload_alloc, (mmal_pool_allocator_alloc_t)mmal_port_payload_alloc,
(mmal_pool_allocator_free_t)mmal_port_payload_free); (mmal_pool_allocator_free_t)mmal_port_payload_free);
...@@ -469,7 +467,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count) ...@@ -469,7 +467,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
count, sys->input->buffer_size); count, sys->input->buffer_size);
goto out; goto out;
} }
sys->num_buffers = count;
memset(&picture_res, 0, sizeof(picture_resource_t)); memset(&picture_res, 0, sizeof(picture_resource_t));
sys->pictures = calloc(sys->num_buffers, sizeof(picture_t *)); sys->pictures = calloc(sys->num_buffers, sizeof(picture_t *));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment