summaryrefslogtreecommitdiff
authorSong Zhao <song.zhao@amlogic.com>2020-04-30 23:39:05 (GMT)
committer Song Zhao <song.zhao@amlogic.com>2020-04-30 23:52:22 (GMT)
commit0c91ad676115c5acd2219754ecbaca85c69e60f1 (patch)
tree8cdeb39dd1b0fdc01da54b73d5f28015dd8af9a9
parentf9d4e3253932450c688e739db7394f9b9d083394 (diff)
downloadmedia_modules-0c91ad676115c5acd2219754ecbaca85c69e60f1.zip
media_modules-0c91ad676115c5acd2219754ecbaca85c69e60f1.tar.gz
media_modules-0c91ad676115c5acd2219754ecbaca85c69e60f1.tar.bz2
v4l2: skip size check for dmabuf on output port [1/1]
PD#SWPL-25323 Problem: When dmabuf is used on output port, the size of it is decided by the allocator. But when REQBUFS is called to setup the vb2 queue, the minimium size of plane is returned by queue_setup(). It will lead to a sanity check failure in __qbuf_dmabuf(). Solution: When dmabuf mode is used on output port. queue_setup() will return size 0 for it. And vb2 will use the size of the dmabuf itself. Verify: U212 + Cobalt + WV Change-Id: I47c375f587fd40f4b187d747a58ef8ff0f4214ca Signed-off-by: Song Zhao <song.zhao@amlogic.com>
Diffstat
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c
index 83cc40d..df27881 100644
--- a/drivers/amvdec_ports/aml_vcodec_dec.c
+++ b/drivers/amvdec_ports/aml_vcodec_dec.c
@@ -1246,6 +1246,12 @@ static int vidioc_decoder_reqbufs(struct file *file, void *priv,
ctx->state, rb->count, ctx->dpb_size);
//rb->count = ctx->dpb_size;
}
+ } else {
+ if (rb->memory == VB2_MEMORY_DMABUF) {
+ v4l_dbg(ctx, V4L_DEBUG_CODEC_INPUT,
+ "%s, output_dma_mode set", __func__);
+ ctx->output_dma_mode = true;
+ }
}
return v4l2_m2m_ioctl_reqbufs(file, priv, rb);
@@ -1988,6 +1994,8 @@ static int vb2ops_vdec_queue_setup(struct vb2_queue *vq,
for (i = 0; i < *nplanes; i++) {
sizes[i] = q_data->sizeimage[i];
+ if (V4L2_TYPE_IS_OUTPUT(vq->type) && ctx->output_dma_mode)
+ sizes[i] = 0;
//alloc_devs[i] = &ctx->dev->plat_dev->dev;
alloc_devs[i] = v4l_get_dev_from_codec_mm();//alloc mm from the codec mm
}
@@ -2010,6 +2018,10 @@ static int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb)
"%s, type: %d, idx: %d\n",
__func__, vb->vb2_queue->type, vb->index);
+ if (vb->memory == VB2_MEMORY_DMABUF
+ && V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type))
+ return 0;
+
q_data = aml_vdec_get_q_data(ctx, vb->vb2_queue->type);
for (i = 0; i < q_data->fmt->num_planes; i++) {
@@ -2105,12 +2117,6 @@ static void vb2ops_vdec_buf_queue(struct vb2_buffer *vb)
src_mem.size = vb->planes[0].bytesused;
src_mem.model = vb->memory;
- if (vb->memory == VB2_MEMORY_DMABUF) {
- v4l_dbg(ctx, V4L_DEBUG_CODEC_INPUT,
- "%s, output_dma_mode set", __func__);
- ctx->output_dma_mode = true;
- }
-
if (vdec_if_probe(ctx, &src_mem, NULL)) {
v4l2_m2m_src_buf_remove(ctx->m2m_ctx);