msm: vidc: allow clients to set buffer size on OUTPUT plane
Accept the size set by clients for buffers on decoder's OUTPUT
plane. Limit the size based on the max width and height
supported by fw.
Change-Id: I76d0641ede9f3a5aa444e192a723b97b789229e1
Signed-off-by: Shalaj Jain <shalajj@codeaurora.org>
diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c
index 08881aa..f835b33 100644
--- a/drivers/media/platform/msm/vidc/msm_vdec.c
+++ b/drivers/media/platform/msm/vidc/msm_vdec.c
@@ -691,12 +691,7 @@
if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
for (i = 0; i < fmt->num_planes; ++i) {
f->fmt.pix_mp.plane_fmt[i].sizeimage =
- fmt->get_frame_size(i,
- inst->capability.height.max,
- inst->capability.width.max);
- inst->bufq[OUTPUT_PORT].
- vb2_bufq.plane_sizes[i] =
- f->fmt.pix_mp.plane_fmt[i].sizeimage;
+ inst->bufq[OUTPUT_PORT].vb2_bufq.plane_sizes[i];
}
} else {
switch (fmt->fourcc) {
@@ -812,6 +807,8 @@
int ret = 0;
int i;
struct hal_buffer_requirements *buff_req_buffer;
+ int max_input_size = 0;
+
if (!inst || !f) {
dprintk(VIDC_ERR,
"Invalid input, inst = %p, format = %p\n", inst, f);
@@ -902,9 +899,14 @@
frame_sz.width = inst->prop.width;
frame_sz.height = inst->prop.height;
msm_comm_try_set_prop(inst, HAL_PARAM_FRAME_SIZE, &frame_sz);
- f->fmt.pix_mp.plane_fmt[0].sizeimage =
- fmt->get_frame_size(0, inst->capability.height.max,
+
+ max_input_size = fmt->get_frame_size(0,
+ inst->capability.height.max,
inst->capability.width.max);
+
+ if (f->fmt.pix_mp.plane_fmt[0].sizeimage > max_input_size)
+ f->fmt.pix_mp.plane_fmt[0].sizeimage = max_input_size;
+
f->fmt.pix_mp.num_planes = fmt->num_planes;
for (i = 0; i < fmt->num_planes; ++i) {
inst->bufq[OUTPUT_PORT].vb2_bufq.plane_sizes[i] =