Skip to contentSkip to conversation

media: amphion: ensure the buffer count is not less than min_buffer

PATCH New Ming Qian 1 participant 1 message Apr 27, 2022

Subsystems (2)
lore
Share & tools
lore

Ming Qian

author maintainer
#0 lore raw

PATCH v2 1/1 media: amphion: ensure the buffer count is not less than min_buffer

the output buffer count should >= min_buffer_out
the capture buffer count should >= min_buffer_cap

---
v2
- don't mess up the VIDIOC_CREATE_BUFS ioctl

 drivers/media/platform/amphion/vpu_v4l2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/amphion/vpu_v4l2.c +5 -1
index 9c0704cd5766..0d25ba3afbf6 100644
@@ -340,8 +340,12 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq,
 				return -EINVAL;
 		}
 		return 0;
+	} else {
+		if (V4L2_TYPE_IS_OUTPUT(vq->type))
+			*buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_out);
+		else
+			*buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_cap);
 	}
-
 	*plane_count = cur_fmt->num_planes;
 	for (i = 0; i < cur_fmt->num_planes; i++)
 		psize[i] = cur_fmt->sizeimage[i];
Signature · 1 line
2.36.0