Skip to content

Commit a180c1c

Browse files
davidplowmanpelwell
authored andcommitted
media: bcm2835-isp: fix bytes per line calculations for some image formats
The bytes per line numbers calculated by get_bytesperline was not matching the equivalent calculation being performed by the VideoCore (mostly by the calculate_pitch function there), resulting in failures to set the image format with some image width values. This patches up the RGB24 and YUYV type formats to match the VideoCore calculation. Signed-off-by: David Plowman <[email protected]>
1 parent e485983 commit a180c1c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,11 @@ struct bcm2835_isp_fmt *get_default_format(struct bcm2835_isp_node *node)
676676
static inline unsigned int get_bytesperline(int width,
677677
const struct bcm2835_isp_fmt *fmt)
678678
{
679-
return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align);
679+
/* GPU aligns 24bpp images to a multiple of 32 pixels (not bytes). */
680+
if (fmt->depth == 24)
681+
return ALIGN(width, 32) * 3;
682+
else
683+
return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align);
680684
}
681685

682686
static inline unsigned int get_sizeimage(int bpl, int width, int height,

drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_fmts.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = {
7171
}, {
7272
.fourcc = V4L2_PIX_FMT_YUYV,
7373
.depth = 16,
74-
.bytesperline_align = 32,
74+
.bytesperline_align = 64,
7575
.flags = 0,
7676
.mmal_fmt = MMAL_ENCODING_YUYV,
7777
.size_multiplier_x2 = 2,
@@ -80,7 +80,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = {
8080
}, {
8181
.fourcc = V4L2_PIX_FMT_UYVY,
8282
.depth = 16,
83-
.bytesperline_align = 32,
83+
.bytesperline_align = 64,
8484
.flags = 0,
8585
.mmal_fmt = MMAL_ENCODING_UYVY,
8686
.size_multiplier_x2 = 2,
@@ -89,7 +89,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = {
8989
}, {
9090
.fourcc = V4L2_PIX_FMT_YVYU,
9191
.depth = 16,
92-
.bytesperline_align = 32,
92+
.bytesperline_align = 64,
9393
.flags = 0,
9494
.mmal_fmt = MMAL_ENCODING_YVYU,
9595
.size_multiplier_x2 = 2,
@@ -98,7 +98,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = {
9898
}, {
9999
.fourcc = V4L2_PIX_FMT_VYUY,
100100
.depth = 16,
101-
.bytesperline_align = 32,
101+
.bytesperline_align = 64,
102102
.flags = 0,
103103
.mmal_fmt = MMAL_ENCODING_VYUY,
104104
.size_multiplier_x2 = 2,
@@ -135,7 +135,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = {
135135
}, {
136136
.fourcc = V4L2_PIX_FMT_ABGR32,
137137
.depth = 32,
138-
.bytesperline_align = 32,
138+
.bytesperline_align = 64,
139139
.flags = 0,
140140
.mmal_fmt = MMAL_ENCODING_BGRA,
141141
.size_multiplier_x2 = 2,

0 commit comments

Comments
 (0)