Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp849404ybi; Fri, 12 Jul 2019 05:40:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9Hljxvpjsx86+TAFtgAWZKbG85IAvj5U2jEi9OQ7xmrYKjGnPnx5UmiUhd9oJ1cUp012+ X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr11480262plr.154.1562935237542; Fri, 12 Jul 2019 05:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935237; cv=none; d=google.com; s=arc-20160816; b=gcX70SuWg24hYT7XFPXQ6fL6vYoWYcAN5pliqvfKAKJQW5F/YQhI1Hks9OqHJ0mpax +eFCqaS2Lcy5qy53fNXE0uphsooB036nxW7iJSSqQH8H5pBeQGPQxhcAwPm8KLMvJM48 9BQ3vfWEPOShamKW8AV6//VvRIkvWaIV3n3scnlJy2O0AJoxTvPqcyLuN5hTWE/kT0/c xnn4m2Wl0giWhlXJ/XFiZkJLMsEVG/JgTcME4n/ChldanCh2K3S5OUwD4YFjhEMnv6px CaMIbhgdveJf+a5ujmrZcmxkJiFJQk6NAxz3tQFclbV7mcCnBxFRPlzjGL6niNiXyXmP 8uAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZUQZyDqtbM1s61jIYOJJtZCpdrAu/g951Tk0ezNhkGM=; b=kyTLMdhsOE2dwHMgOoxJWN5zDZAMGXLa55VkzyaDiEhZLkzcC1/kN7UPVDe7jRh1wL 45ZroYPGO60bvv24UdpcsVYguMHh2nWmywmw7zVrCi5hJ0BftXI5A8Mw0109R38u2nU7 T1EVWU3yD8QuEjIVC0/W7bSq06uJP35VHWrVlWLrIHxBMZ8wW3TVGOVZ5J0VWQjQXfdI leqBBhGfsvZYaV3pbaNhmo2qmNVqw8ezts+kog7q51BGtCeZ60ADzuBDr+cZ2obelVdW cTpDD4np8Q7WVbeoPKI5hEPZYUQvJDRZzGtiOW4+5vqWNu37Kt8ylJog1n6QjzOXJ6zr om8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kC3l1bWs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si7700417pgc.185.2019.07.12.05.40.21; Fri, 12 Jul 2019 05:40:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kC3l1bWs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728632AbfGLM1b (ORCPT + 99 others); Fri, 12 Jul 2019 08:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:39950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728268AbfGLM12 (ORCPT ); Fri, 12 Jul 2019 08:27:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D35512166E; Fri, 12 Jul 2019 12:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934447; bh=zYP2Ti/Utohd5XGJj5U02ylzBFMqcU/5tV7xvYzf0EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kC3l1bWsM5CszyO4WjiZXsZY7UrnxkAqjMWb/GpI3ap0R09jfFMRkpzRdCjLnOQON 9SoMCxUUqj5iL8DMqolvALDcjjIoIR+o6MED+Tu8qKSYqaJQLc+7lJpfAKE1ChHCit uXXCImUzPy0KgQd+3KCMgqLSPdoBRDedfDi/+/18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve Longerbeam , Philipp Zabel , Sasha Levin Subject: [PATCH 5.1 057/138] gpu: ipu-v3: image-convert: Fix input bytesperline width/height align Date: Fri, 12 Jul 2019 14:18:41 +0200 Message-Id: <20190712121630.859600179@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ff391ecd65a1b8324c49046c3db98d9c8ab29af9 ] 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: d966e23d61a2c ("gpu: ipu-v3: image-convert: fix bytesperline adjustment") Signed-off-by: Steve Longerbeam Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/gpu/ipu-v3/ipu-image-convert.c | 32 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 13103ab86050..0d971985f8c9 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -1885,7 +1885,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); @@ -1917,22 +1918,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; -- 2.20.1