summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/msm/vidc/msm_v4l2_vidc.c16
-rw-r--r--drivers/media/platform/msm/vidc/msm_vdec.c40
-rw-r--r--drivers/media/platform/msm/vidc/msm_venc.c40
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 becea0c59521..95fd6d22ab15 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 4ec331d121d9..3232f8b7cd7f 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,
};