Commit 2cf251c0 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] coda: reuse src_bufs in coda_job_ready

The v4l2_m2m_num_src_bufs_ready() function is called in multiple places
in coda_cob_ready, and there already is a variable src_bufs that is
assigned to its result. Move it to the beginning and use it everywhere.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent f0710815
...@@ -888,14 +888,14 @@ static void coda_pic_run_work(struct work_struct *work) ...@@ -888,14 +888,14 @@ static void coda_pic_run_work(struct work_struct *work)
static int coda_job_ready(void *m2m_priv) static int coda_job_ready(void *m2m_priv)
{ {
struct coda_ctx *ctx = m2m_priv; struct coda_ctx *ctx = m2m_priv;
int src_bufs = v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx);
/* /*
* For both 'P' and 'key' frame cases 1 picture * For both 'P' and 'key' frame cases 1 picture
* and 1 frame are needed. In the decoder case, * and 1 frame are needed. In the decoder case,
* the compressed frame can be in the bitstream. * the compressed frame can be in the bitstream.
*/ */
if (!v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) && if (!src_bufs && ctx->inst_type != CODA_INST_DECODER) {
ctx->inst_type != CODA_INST_DECODER) {
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"not ready: not enough video buffers.\n"); "not ready: not enough video buffers.\n");
return 0; return 0;
...@@ -911,9 +911,8 @@ static int coda_job_ready(void *m2m_priv) ...@@ -911,9 +911,8 @@ static int coda_job_ready(void *m2m_priv)
struct list_head *meta; struct list_head *meta;
bool stream_end; bool stream_end;
int num_metas; int num_metas;
int src_bufs;
if (ctx->hold && !v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx)) { if (ctx->hold && !src_bufs) {
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"%d: not ready: on hold for more buffers.\n", "%d: not ready: on hold for more buffers.\n",
ctx->idx); ctx->idx);
...@@ -927,8 +926,6 @@ static int coda_job_ready(void *m2m_priv) ...@@ -927,8 +926,6 @@ static int coda_job_ready(void *m2m_priv)
list_for_each(meta, &ctx->buffer_meta_list) list_for_each(meta, &ctx->buffer_meta_list)
num_metas++; num_metas++;
src_bufs = v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx);
if (!stream_end && (num_metas + src_bufs) < 2) { if (!stream_end && (num_metas + src_bufs) < 2) {
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"%d: not ready: need 2 buffers available (%d, %d)\n", "%d: not ready: need 2 buffers available (%d, %d)\n",
...@@ -937,8 +934,8 @@ static int coda_job_ready(void *m2m_priv) ...@@ -937,8 +934,8 @@ static int coda_job_ready(void *m2m_priv)
} }
if (!v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) && if (!src_bufs && !stream_end &&
!stream_end && (coda_get_bitstream_payload(ctx) < 512)) { (coda_get_bitstream_payload(ctx) < 512)) {
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"%d: not ready: not enough bitstream data (%d).\n", "%d: not ready: not enough bitstream data (%d).\n",
ctx->idx, coda_get_bitstream_payload(ctx)); ctx->idx, coda_get_bitstream_payload(ctx));
......
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