mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
gpu: ipu-v3: image-convert: Fix input bytesperline width/height align
The output width and height alignment values were being used in the
input bytesperline calculation. Fix by separating local vars w_align
and h_align into w_align_in, h_align_in, w_align_out, and h_align_out.
Fixes: d966e23d61
("gpu: ipu-v3: image-convert: fix bytesperline
adjustment")
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
d1fdb6d8f6
commit
ff391ecd65
@ -1876,7 +1876,8 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out,
|
||||
enum ipu_rotate_mode rot_mode)
|
||||
{
|
||||
const struct ipu_image_pixfmt *infmt, *outfmt;
|
||||
u32 w_align, h_align;
|
||||
u32 w_align_out, h_align_out;
|
||||
u32 w_align_in, h_align_in;
|
||||
|
||||
infmt = get_format(in->pix.pixelformat);
|
||||
outfmt = get_format(out->pix.pixelformat);
|
||||
@ -1908,22 +1909,31 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out,
|
||||
}
|
||||
|
||||
/* align input width/height */
|
||||
w_align = ilog2(tile_width_align(IMAGE_CONVERT_IN, infmt, rot_mode));
|
||||
h_align = ilog2(tile_height_align(IMAGE_CONVERT_IN, infmt, rot_mode));
|
||||
in->pix.width = clamp_align(in->pix.width, MIN_W, MAX_W, w_align);
|
||||
in->pix.height = clamp_align(in->pix.height, MIN_H, MAX_H, h_align);
|
||||
w_align_in = ilog2(tile_width_align(IMAGE_CONVERT_IN, infmt,
|
||||
rot_mode));
|
||||
h_align_in = ilog2(tile_height_align(IMAGE_CONVERT_IN, infmt,
|
||||
rot_mode));
|
||||
in->pix.width = clamp_align(in->pix.width, MIN_W, MAX_W,
|
||||
w_align_in);
|
||||
in->pix.height = clamp_align(in->pix.height, MIN_H, MAX_H,
|
||||
h_align_in);
|
||||
|
||||
/* align output width/height */
|
||||
w_align = ilog2(tile_width_align(IMAGE_CONVERT_OUT, outfmt, rot_mode));
|
||||
h_align = ilog2(tile_height_align(IMAGE_CONVERT_OUT, outfmt, rot_mode));
|
||||
out->pix.width = clamp_align(out->pix.width, MIN_W, MAX_W, w_align);
|
||||
out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H, h_align);
|
||||
w_align_out = ilog2(tile_width_align(IMAGE_CONVERT_OUT, outfmt,
|
||||
rot_mode));
|
||||
h_align_out = ilog2(tile_height_align(IMAGE_CONVERT_OUT, outfmt,
|
||||
rot_mode));
|
||||
out->pix.width = clamp_align(out->pix.width, MIN_W, MAX_W,
|
||||
w_align_out);
|
||||
out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H,
|
||||
h_align_out);
|
||||
|
||||
/* set input/output strides and image sizes */
|
||||
in->pix.bytesperline = infmt->planar ?
|
||||
clamp_align(in->pix.width, 2 << w_align, MAX_W, w_align) :
|
||||
clamp_align(in->pix.width, 2 << w_align_in, MAX_W,
|
||||
w_align_in) :
|
||||
clamp_align((in->pix.width * infmt->bpp) >> 3,
|
||||
2 << w_align, MAX_W, w_align);
|
||||
2 << w_align_in, MAX_W, w_align_in);
|
||||
in->pix.sizeimage = infmt->planar ?
|
||||
(in->pix.height * in->pix.bytesperline * infmt->bpp) >> 3 :
|
||||
in->pix.height * in->pix.bytesperline;
|
||||
|
Loading…
Reference in New Issue
Block a user