diff options
| author | Vikash Garodia <vgarodia@codeaurora.org> | 2017-05-14 16:24:32 +0530 |
|---|---|---|
| committer | Vikash Garodia <vgarodia@codeaurora.org> | 2017-05-18 17:21:51 +0530 |
| commit | 8ff60ca80475dac0bcbe081dcbf9e4546dbbe30b (patch) | |
| tree | 1afacebb6cc4d6bdce4e296e0e7a1ea952968775 /drivers | |
| parent | c30ff10a7032bf627b8dcad73492cdc081d93b09 (diff) | |
msm: vidc: Update VB2 buffer state during stream_on failure
While streaming is started, buffers pending to be submitted
to hardware, is initiated for submission. At this point, if
buffer submission fails, then the buffer state needs to be
updated to VB2_BUF_STATE_QUEUED for all the buffers queued
so far.
The change iterates over queued list in VB2 queue to identify
all queued buffers and updates the state as required by the
V4L2 core.
Change-Id: Ifcf057eaa4006c50041d11ad073b2f38d8824cb8
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_vdec.c | 15 | ||||
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_venc.c | 16 |
2 files changed, 19 insertions, 12 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c index 953780e3c220..85afcf790ae1 100644 --- a/drivers/media/platform/msm/vidc/msm_vdec.c +++ b/drivers/media/platform/msm/vidc/msm_vdec.c @@ -1767,6 +1767,7 @@ static int msm_vdec_start_streaming(struct vb2_queue *q, unsigned int count) struct msm_vidc_inst *inst; int rc = 0; struct hfi_device *hdev; + struct vb2_buffer *vb; struct vb2_buf_entry *temp, *next; if (!q || !q->drv_priv) { dprintk(VIDC_ERR, "Invalid input, q = %pK\n", q); @@ -1791,8 +1792,7 @@ static int msm_vdec_start_streaming(struct vb2_queue *q, unsigned int count) break; default: dprintk(VIDC_ERR, "Queue type is not supported: %d\n", q->type); - rc = -EINVAL; - goto stream_start_failed; + return -EINVAL; } if (rc) { dprintk(VIDC_ERR, @@ -1811,12 +1811,15 @@ static int msm_vdec_start_streaming(struct vb2_queue *q, unsigned int count) stream_start_failed: if (rc) { + list_for_each_entry(vb, &q->queued_list, queued_entry) { + if (vb->type == q->type && + vb->state == VB2_BUF_STATE_ACTIVE) + vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED); + } mutex_lock(&inst->pendingq.lock); - list_for_each_entry_safe(temp, next, &inst->pendingq.list, - list) { + list_for_each_entry_safe(temp, next, + &inst->pendingq.list, list) { if (temp->vb->type == q->type) { - vb2_buffer_done(temp->vb, - VB2_BUF_STATE_QUEUED); list_del(&temp->list); kfree(temp); } diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c index 30726354164b..dd3e175b0362 100644 --- a/drivers/media/platform/msm/vidc/msm_venc.c +++ b/drivers/media/platform/msm/vidc/msm_venc.c @@ -1897,7 +1897,9 @@ static int msm_venc_start_streaming(struct vb2_queue *q, unsigned int count) { struct msm_vidc_inst *inst; int rc = 0; + struct vb2_buffer *vb; struct vb2_buf_entry *temp, *next; + if (!q || !q->drv_priv) { dprintk(VIDC_ERR, "Invalid input, q = %pK\n", q); return -EINVAL; @@ -1916,8 +1918,7 @@ static int msm_venc_start_streaming(struct vb2_queue *q, unsigned int count) break; default: dprintk(VIDC_ERR, "Queue type is not supported: %d\n", q->type); - rc = -EINVAL; - goto stream_start_failed; + return -EINVAL; } if (rc) { dprintk(VIDC_ERR, @@ -1936,12 +1937,15 @@ static int msm_venc_start_streaming(struct vb2_queue *q, unsigned int count) stream_start_failed: if (rc) { + list_for_each_entry(vb, &q->queued_list, queued_entry) { + if (vb->type == q->type && + vb->state == VB2_BUF_STATE_ACTIVE) + vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED); + } mutex_lock(&inst->pendingq.lock); - list_for_each_entry_safe(temp, next, &inst->pendingq.list, - list) { + list_for_each_entry_safe(temp, next, + &inst->pendingq.list, list) { if (temp->vb->type == q->type) { - vb2_buffer_done(temp->vb, - VB2_BUF_STATE_QUEUED); list_del(&temp->list); kfree(temp); } |
