aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2018-09-18 05:34:18 -0400
committerPhilipp Zabel <p.zabel@pengutronix.de>2018-11-05 08:40:08 -0500
commitd966e23d61a2c3769ed0c0a3c6e20b300a313317 (patch)
treee07568da84a8f987c737b9c50f6c74d60995c65d
parentff652fcf84f7a0977bbad4eab976f7813665fbc8 (diff)
gpu: ipu-v3: image-convert: fix bytesperline adjustment
For planar formats, bytesperline does not depend on BPP. It must always be larger than width and aligned to tile width alignment restrictions. The input bytesperline to ipu_image_convert_adjust() may be uninitialized, so don't rely on input bytesperline as the minimum value for clamp_align(). Use 2 << w_align as the minimum instead. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> [slongerbeam@gmail.com: clamp input bytesperline] Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/gpu/ipu-v3/ipu-image-convert.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index 0829723a7599..b735065fe288 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -1915,10 +1915,18 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out,
1915 out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H, h_align); 1915 out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H, h_align);
1916 1916
1917 /* set input/output strides and image sizes */ 1917 /* set input/output strides and image sizes */
1918 in->pix.bytesperline = (in->pix.width * infmt->bpp) >> 3; 1918 in->pix.bytesperline = infmt->planar ?
1919 in->pix.sizeimage = in->pix.height * in->pix.bytesperline; 1919 clamp_align(in->pix.width, 2 << w_align, MAX_W, w_align) :
1920 out->pix.bytesperline = (out->pix.width * outfmt->bpp) >> 3; 1920 clamp_align((in->pix.width * infmt->bpp) >> 3,
1921 out->pix.sizeimage = out->pix.height * out->pix.bytesperline; 1921 2 << w_align, MAX_W, w_align);
1922 in->pix.sizeimage = infmt->planar ?
1923 (in->pix.height * in->pix.bytesperline * infmt->bpp) >> 3 :
1924 in->pix.height * in->pix.bytesperline;
1925 out->pix.bytesperline = outfmt->planar ? out->pix.width :
1926 (out->pix.width * outfmt->bpp) >> 3;
1927 out->pix.sizeimage = outfmt->planar ?
1928 (out->pix.height * out->pix.bytesperline * outfmt->bpp) >> 3 :
1929 out->pix.height * out->pix.bytesperline;
1922} 1930}
1923EXPORT_SYMBOL_GPL(ipu_image_convert_adjust); 1931EXPORT_SYMBOL_GPL(ipu_image_convert_adjust);
1924 1932