diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-12-04 05:55:31 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-12-04 05:55:31 -0800 |
| commit | 5142c18bae30439decd1c139999b54197e2aae91 (patch) | |
| tree | 289765acf1ac8fda41a1ae825d9713aa0fe4bfc1 | |
| parent | 7e4605dbeb762daacae20a0fd95b58ae04720064 (diff) | |
| parent | 2747f8529f82d33d06b08e21e40a6693fa3d109b (diff) | |
Merge "msm: vidc: Align release buffers with V4L2 states"
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_v4l2_vidc.c | 16 | ||||
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_vdec.c | 40 | ||||
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_venc.c | 40 |
3 files changed, 81 insertions, 15 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c index fbdccea56f67..368df242a707 100644 --- a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c @@ -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, diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c index dc178801fe4f..f958cf13f1e3 100644 --- a/drivers/media/platform/msm/vidc/msm_vdec.c +++ b/drivers/media/platform/msm/vidc/msm_vdec.c @@ -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, }; diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c index cab5db542b00..6127c03df581 100644 --- a/drivers/media/platform/msm/vidc/msm_venc.c +++ b/drivers/media/platform/msm/vidc/msm_venc.c @@ -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, }; |
