]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
v4l: xilinx-multi-scaler: Fix the size of 2nd plane for 4:2:2 video formats
authorSuresh Gupta <suresh.gupta@xilinx.com>
Wed, 14 Nov 2018 11:33:25 +0000 (17:03 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 14 Nov 2018 12:30:06 +0000 (13:30 +0100)
The size of the 2nd plane for NV12 is half the size
of 1st plane, this patch fix the size.

Signed-off-by: Suresh Gupta <suresh.gupta@xilinx.com>
Reviewed-by: Sandip Kothari <sandipk@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/media/platform/xilinx/xilinx-multi-scaler.c

index edb1d6c10be023b91b322c5b2ce421ff2bfd5db8..71a0f11a54f521316e1476ed05eba4386a53e6cd 100644 (file)
@@ -1407,6 +1407,15 @@ vidioc_s_fmt(struct xm2msc_chan_ctx *chan_ctx, struct v4l2_format *f)
                pix->plane_fmt[i].sizeimage = q_data->sizeimage[i];
        }
 
+       /* Size of 2nd plane of Y_UV10_420 & Y_UV8_420 is half of 1st plane */
+       if (q_data->fmt->xm2msc_fmt == XILINX_M2MSC_FMT_Y_UV10_420 ||
+           q_data->fmt->xm2msc_fmt == XILINX_M2MSC_FMT_Y_UV8_420) {
+               q_data->sizeimage[1] =
+                       q_data->stride * (q_data->height / 2);
+               pix->plane_fmt[1].sizeimage =
+                       q_data->stride * (q_data->height / 2);
+       }
+
        xm2msc_pr_q(chan_ctx->xm2msc_dev->dev, q_data,
                    chan_ctx->num, f->type, __func__);