From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A0FDC48BD6 for ; Thu, 27 Jun 2019 00:52:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA4F320665 for ; Thu, 27 Jun 2019 00:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561596722; bh=Z2FQXOTKv+1PDnULnMt3wLBqjLRrQA1FAvv1gewbimQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UjvAKNN1Qr7MtO8z39qcO8aJuctULiPxP17XqlNoat4PE23foLqFNC47jq92mlVJU ogWK+4KS4sC8sk3b0j3X8FmAusyApIGbK9jgNpo4ka1tG8aOuEa7T5yUsRgujKGm2S 0jTDbYMFXkH02tmVD00VQxxHExNTBzlS8wjFTSGU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727909AbfF0AeD (ORCPT ); Wed, 26 Jun 2019 20:34:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:38026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727887AbfF0Ad7 (ORCPT ); Wed, 26 Jun 2019 20:33:59 -0400 Received: from sasha-vm.mshome.net (unknown [107.242.116.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DD5F217D8; Thu, 27 Jun 2019 00:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561595638; bh=Z2FQXOTKv+1PDnULnMt3wLBqjLRrQA1FAvv1gewbimQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ghrRlHI7YTakET364VtMGgPpNmNcvphOLevt5FchW3tyEnlm3KlZthQ0ZiUR1w3KB n83KXBU948tWCelgC1pF7gJCy3OD7mca6JyTvgmTKhQoNZtK4OmUUC7x7hrG/M5rx5 TniBpqnUmKf4kkwf/V1npkmu5TX1DLUpSD/dsYNE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Steve Longerbeam , Philipp Zabel , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.1 63/95] gpu: ipu-v3: image-convert: Fix image downsize coefficients Date: Wed, 26 Jun 2019 20:29:48 -0400 Message-Id: <20190627003021.19867-63-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190627003021.19867-1-sashal@kernel.org> References: <20190627003021.19867-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Steve Longerbeam [ Upstream commit 912bbf7e9ca422099935dd69d3ff0fd62db24882 ] The output of the IC downsizer unit in both dimensions must be <= 1024 before being passed to the IC resizer unit. This was causing corrupted images when: input_dim > 1024, and input_dim / 2 < output_dim < input_dim Some broken examples were 1920x1080 -> 1024x768 and 1920x1080 -> 1280x1080. Fixes: 70b9b6b3bcb21 ("gpu: ipu-v3: image-convert: calculate per-tile resize coefficients") Signed-off-by: Steve Longerbeam Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/gpu/ipu-v3/ipu-image-convert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 19d3b85e0e98..e9803e2151f9 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -409,12 +409,14 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx, if (WARN_ON(resized_width == 0 || resized_height == 0)) return -EINVAL; - while (downsized_width >= resized_width * 2) { + while (downsized_width > 1024 || + downsized_width >= resized_width * 2) { downsized_width >>= 1; downsize_coeff_h++; } - while (downsized_height >= resized_height * 2) { + while (downsized_height > 1024 || + downsized_height >= resized_height * 2) { downsized_height >>= 1; downsize_coeff_v++; } -- 2.20.1