Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ff60ca8 authored by Vikash Garodia's avatar Vikash Garodia
Browse files

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: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent c30ff10a
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -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);
			}
+10 −6
Original line number Diff line number Diff line
@@ -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);
			}