Merge "msm: vidc: Align release buffers with V4L2 states"

This commit is contained in:
Linux Build Service Account 2016-12-04 05:55:31 -08:00 committed by Gerrit - the friendly Code Review server
commit 5142c18bae
3 changed files with 81 additions and 15 deletions

View file

@ -137,21 +137,7 @@ int msm_v4l2_reqbufs(struct file *file, void *fh,
struct v4l2_requestbuffers *b)
{
struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh);
int rc = 0;
if (!b->count) {
rc = msm_vidc_release_buffers(vidc_inst, b->type);
if (rc)
dprintk(VIDC_WARN,
"Failed in %s for release output buffers\n",
__func__);
} else {
rc = msm_vidc_reqbufs((void *)vidc_inst, b);
if (rc)
dprintk(VIDC_WARN,
"Failed in %s for buffer requirements\n",
__func__);
}
return rc;
return msm_vidc_reqbufs((void *)vidc_inst, b);
}
int msm_v4l2_prepare_buf(struct file *file, void *fh,

View file

@ -1869,10 +1869,50 @@ static void msm_vdec_buf_queue(struct vb2_buffer *vb)
dprintk(VIDC_ERR, "Failed to queue buffer: %d\n", rc);
}
static void msm_vdec_buf_cleanup(struct vb2_buffer *vb)
{
int rc = 0;
struct buf_queue *q = NULL;
struct msm_vidc_inst *inst = NULL;
if (!vb) {
dprintk(VIDC_ERR, "%s : Invalid vb pointer %pK",
__func__, vb);
return;
}
inst = vb2_get_drv_priv(vb->vb2_queue);
if (!inst) {
dprintk(VIDC_ERR, "%s : Invalid inst pointer",
__func__);
return;
}
q = msm_comm_get_vb2q(inst, vb->type);
if (!q) {
dprintk(VIDC_ERR,
"%s : Failed to find buffer queue for type = %d\n",
__func__, vb->type);
return;
}
if (q->vb2_bufq.streaming) {
dprintk(VIDC_DBG, "%d PORT is streaming\n",
vb->type);
return;
}
rc = msm_vidc_release_buffers(inst, vb->type);
if (rc)
dprintk(VIDC_ERR, "%s : Failed to release buffers : %d\n",
__func__, rc);
}
static const struct vb2_ops msm_vdec_vb2q_ops = {
.queue_setup = msm_vdec_queue_setup,
.start_streaming = msm_vdec_start_streaming,
.buf_queue = msm_vdec_buf_queue,
.buf_cleanup = msm_vdec_buf_cleanup,
.stop_streaming = msm_vdec_stop_streaming,
};

View file

@ -1836,10 +1836,50 @@ static void msm_venc_buf_queue(struct vb2_buffer *vb)
dprintk(VIDC_ERR, "Failed to queue buffer: %d\n", rc);
}
static void msm_venc_buf_cleanup(struct vb2_buffer *vb)
{
int rc = 0;
struct buf_queue *q = NULL;
struct msm_vidc_inst *inst = NULL;
if (!vb) {
dprintk(VIDC_ERR, "%s : Invalid vb pointer %pK",
__func__, vb);
return;
}
inst = vb2_get_drv_priv(vb->vb2_queue);
if (!inst) {
dprintk(VIDC_ERR, "%s : Invalid inst pointer",
__func__);
return;
}
q = msm_comm_get_vb2q(inst, vb->type);
if (!q) {
dprintk(VIDC_ERR,
"%s : Failed to find buffer queue for type = %d\n",
__func__, vb->type);
return;
}
if (q->vb2_bufq.streaming) {
dprintk(VIDC_DBG, "%d PORT is streaming\n",
vb->type);
return;
}
rc = msm_vidc_release_buffers(inst, vb->type);
if (rc)
dprintk(VIDC_ERR, "%s : Failed to release buffers : %d\n",
__func__, rc);
}
static const struct vb2_ops msm_venc_vb2q_ops = {
.queue_setup = msm_venc_queue_setup,
.start_streaming = msm_venc_start_streaming,
.buf_queue = msm_venc_buf_queue,
.buf_cleanup = msm_venc_buf_cleanup,
.stop_streaming = msm_venc_stop_streaming,
};