1 From 0006b5f547bb0f83fbd23d14ff9f8ad8fd7d3c92 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 2 May 2019 14:32:21 +0100
4 Subject: [PATCH 481/782] staging: bcm2835-codec: Remove height padding for ISP
7 The ISP has no need for heights to be a multiple of macroblock
8 sizes, therefore doesn't require the align on the height.
9 Remove it for the ISP role. (It is required for the codecs).
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 .../bcm2835-codec/bcm2835-v4l2-codec.c | 13 ++++++++-----
14 1 file changed, 8 insertions(+), 5 deletions(-)
16 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 @@ -1015,7 +1015,8 @@ static int vidioc_g_fmt_vid_cap(struct f
19 return vidioc_g_fmt(file2ctx(file), f);
22 -static int vidioc_try_fmt(struct v4l2_format *f, struct bcm2835_codec_fmt *fmt)
23 +static int vidioc_try_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,
24 + struct bcm2835_codec_fmt *fmt)
27 * The V4L2 specification requires the driver to correct the format
28 @@ -1034,11 +1035,13 @@ static int vidioc_try_fmt(struct v4l2_fo
29 f->fmt.pix.height = MIN_H;
32 - * Buffer must have a vertical alignment of 16 lines.
33 + * For codecs the buffer must have a vertical alignment of 16
35 * The selection will reflect any cropping rectangle when only
36 * some of the pixels are active.
38 - f->fmt.pix.height = ALIGN(f->fmt.pix.height, 16);
39 + if (ctx->dev->role != ISP)
40 + f->fmt.pix.height = ALIGN(f->fmt.pix.height, 16);
42 f->fmt.pix.bytesperline = get_bytesperline(f->fmt.pix.width,
44 @@ -1065,7 +1068,7 @@ static int vidioc_try_fmt_vid_cap(struct
45 fmt = find_format(f, ctx->dev, true);
48 - return vidioc_try_fmt(f, fmt);
49 + return vidioc_try_fmt(ctx, f, fmt);
52 static int vidioc_try_fmt_vid_out(struct file *file, void *priv,
53 @@ -1084,7 +1087,7 @@ static int vidioc_try_fmt_vid_out(struct
54 if (!f->fmt.pix.colorspace)
55 f->fmt.pix.colorspace = ctx->colorspace;
57 - return vidioc_try_fmt(f, fmt);
58 + return vidioc_try_fmt(ctx, f, fmt);
61 static int vidioc_s_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,