Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp850611ybi; Fri, 12 Jul 2019 05:41:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpo67Jka+2PZFivOJUWVwMIsyvyQdUiXJz6Il+4PFNkPksQ6JKDmaymIZPo2duk4Bpb1Ux X-Received: by 2002:a17:90a:8b98:: with SMTP id z24mr11700756pjn.77.1562935308422; Fri, 12 Jul 2019 05:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935308; cv=none; d=google.com; s=arc-20160816; b=mNeQSnp0r93SX9yKIZcfbxD256uy1x67TgmbDOr+V6rsolp/vGu4OLYFEISJte6fca /vFI4FWzcwrHvpjlP97wawWlQn55945rK4J9E/ipEJRcc80yg9pSyJaYNKhx9v5R3rp0 7uBu8l5m8EYEJHVtktg7S+J2madsZIjFXcLDmJIsphIN6qyerL7igQx8e6J8db93YuMh ZiuCUe1Ig0bENL2Kkw5g+1w21bRgdpWIxeIUtDG9ImZc1RYt5gIwrdf8irzbfstzD0I6 8VK+wCXvdRidigH22MoGowxqIEU4bL8DanAwGUE1YBAjeKxUfL7XWxq1Mn2i0T3fROsA SW5g== 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=cxPLCtUbvLxxysY1i2HfKGBvCNon165w05asHwatYCM=; b=liYeQr4fCwVwnZyF78xWHetQbnlD/raNUPUSvgp7mi4zItkj8pOCkxs28oYlkBav8E binQH7tKi6kZTtFRe/CYJugqIH+aeNuD42N7ySeJQc9adxVwEZy2Ss27EiThYovCtVOR v2etR6mGYOsjqdefOI4Esg4WY/lAcJ4sJ+DqUU08OCrsPrKxcpfiyTnxf2oYJcU1KT1D okhGA1k7p38TQOE5Ky8slO81N8Y237n+bRoCv/QFYAwdcyLbUrSUtyQyo8YfOb5oF+D3 /KTlRiQ4PxGGTcP3CgnKr3Ai6SzghQe8slldkpsKW2Bz0qbA8wuJ65Xubc1k6IzkT65b 2IBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LyyhgG1u; 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 b92si8291746pjc.17.2019.07.12.05.41.32; Fri, 12 Jul 2019 05:41:48 -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=LyyhgG1u; 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 S1727382AbfGLM1j (ORCPT + 99 others); Fri, 12 Jul 2019 08:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728644AbfGLM1e (ORCPT ); Fri, 12 Jul 2019 08:27:34 -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 0B65321670; Fri, 12 Jul 2019 12:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934453; bh=9MWdcpkxAacvmKVTodvhTNoixEDyeUkjLGEYDcsjwRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LyyhgG1ugqzwwpE9VNaW7QXqRyl7pFvPb8w5EscBTJrUcA9Gh2hLxsBZRSDvsjWoO NupT9z8vWzTmma59n7mr5LB5PAg5cUhUeY9XAcYAqAy+VjY38KECBCFDjdjXm0k5/P g47YD8m3NjuiV5YVSlyOaXixGcsy2cPbte3eulrQ= 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 059/138] gpu: ipu-v3: image-convert: Fix image downsize coefficients Date: Fri, 12 Jul 2019 14:18:43 +0200 Message-Id: <20190712121630.943854642@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 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