9e25fe1016bd7a161db2993312e9d635ba2b0e83
[openwrt/staging/linusw.git] /
1 From 453caa19909edf2de1add80b369fb30570a440ed Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 2 May 2019 14:30:24 +0100
4 Subject: [PATCH] staging: bcm2835-codec: Correct port width calc for
5 truncation
6
7 The calculation converting from V4L2 bytesperline to MMAL
8 width had an operator ordering issue that lead to Bayer raw 10
9 (and 12 and 14) setting an incorrect stride for the buffer.
10 Correct this operation ordering issue.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 ---
14 .../staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
19 @@ -605,8 +605,8 @@ static void setup_mmal_port_format(struc
20
21 if (!(q_data->fmt->flags & V4L2_FMT_FLAG_COMPRESSED)) {
22 /* Raw image format - set width/height */
23 - port->es.video.width = q_data->bytesperline /
24 - (q_data->fmt->depth >> 3);
25 + port->es.video.width = (q_data->bytesperline << 3) /
26 + q_data->fmt->depth;
27 port->es.video.height = q_data->height;
28 port->es.video.crop.width = q_data->crop_width;
29 port->es.video.crop.height = q_data->crop_height;