aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch b/target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch
new file mode 100644
index 0000000000..7f4943f9ab
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.4/950-0758-media-bcm2835-isp-fix-bytes-per-line-calculations-fo.patch
@@ -0,0 +1,80 @@
+From 5b07adb57e04530dc571c2a4a1aeea4b7bc57723 Mon Sep 17 00:00:00 2001
+From: David Plowman <david.plowman@raspberrypi.com>
+Date: Fri, 29 May 2020 14:36:56 +0100
+Subject: [PATCH] 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 <david.plowman@raspberrypi.com>
+---
+ .../vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c | 6 +++++-
+ .../vc04_services/bcm2835-isp/bcm2835_isp_fmts.h | 10 +++++-----
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+--- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
++++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
+@@ -676,7 +676,11 @@ struct bcm2835_isp_fmt *get_default_form
+ static inline unsigned int get_bytesperline(int width,
+ const struct bcm2835_isp_fmt *fmt)
+ {
+- return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align);
++ /* GPU aligns 24bpp images to a multiple of 32 pixels (not bytes). */
++ if (fmt->depth == 24)
++ return ALIGN(width, 32) * 3;
++ else
++ return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align);
+ }
+
+ static inline unsigned int get_sizeimage(int bpl, int width, int height,
+--- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_fmts.h
++++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_fmts.h
+@@ -71,7 +71,7 @@ static const struct bcm2835_isp_fmt supp
+ }, {
+ .fourcc = V4L2_PIX_FMT_YUYV,
+ .depth = 16,
+- .bytesperline_align = 32,
++ .bytesperline_align = 64,
+ .flags = 0,
+ .mmal_fmt = MMAL_ENCODING_YUYV,
+ .size_multiplier_x2 = 2,
+@@ -80,7 +80,7 @@ static const struct bcm2835_isp_fmt supp
+ }, {
+ .fourcc = V4L2_PIX_FMT_UYVY,
+ .depth = 16,
+- .bytesperline_align = 32,
++ .bytesperline_align = 64,
+ .flags = 0,
+ .mmal_fmt = MMAL_ENCODING_UYVY,
+ .size_multiplier_x2 = 2,
+@@ -89,7 +89,7 @@ static const struct bcm2835_isp_fmt supp
+ }, {
+ .fourcc = V4L2_PIX_FMT_YVYU,
+ .depth = 16,
+- .bytesperline_align = 32,
++ .bytesperline_align = 64,
+ .flags = 0,
+ .mmal_fmt = MMAL_ENCODING_YVYU,
+ .size_multiplier_x2 = 2,
+@@ -98,7 +98,7 @@ static const struct bcm2835_isp_fmt supp
+ }, {
+ .fourcc = V4L2_PIX_FMT_VYUY,
+ .depth = 16,
+- .bytesperline_align = 32,
++ .bytesperline_align = 64,
+ .flags = 0,
+ .mmal_fmt = MMAL_ENCODING_VYUY,
+ .size_multiplier_x2 = 2,
+@@ -135,7 +135,7 @@ static const struct bcm2835_isp_fmt supp
+ }, {
+ .fourcc = V4L2_PIX_FMT_ABGR32,
+ .depth = 32,
+- .bytesperline_align = 32,
++ .bytesperline_align = 64,
+ .flags = 0,
+ .mmal_fmt = MMAL_ENCODING_BGRA,
+ .size_multiplier_x2 = 2,