From patchwork Thu Jun 22 13:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 111665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5064246vqr; Thu, 22 Jun 2023 06:20:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XFt74Ui/70dhhwFT4InMU7QhKQ9BN/bXX1pOPkx7cUDbsgkg2h46e/tL2e3XtPeWiewuH X-Received: by 2002:a92:dc45:0:b0:342:1954:6bfe with SMTP id x5-20020a92dc45000000b0034219546bfemr14663692ilq.17.1687440043852; Thu, 22 Jun 2023 06:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687440043; cv=none; d=google.com; s=arc-20160816; b=AXNhj/xOqOP7xf5ck78GcfcUOijFlzQKeuJ+Fp2ecrmNBIHfcD6SSOBKB5GK7AX2LJ X9bIteDyzkjqnKXD9zy4VSO2bicoF2RTRtp4k/WRCMLSWPs06TKJ0Nqs8b9nQ/s8j/6m UWwMkFZtXMGKEPdzRCayhJ9+J4meM8QRa4EsUm/R1ip5NkHro5HAqweZz4g4XZAmNCFc r5WZPKAz8m0CyGeXT9DVmo9KUCFlPsqWUlCLNcMjZC9Ebt514o6UUHsC/mcHDwaPe8fj ZGSxedlOs/R4BkLk8JuYty5sNHfX3tV8JKV/+Ez5xZqOnNncpRSBKIu7ujMIY2oPyqO3 so4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+1vg8ScmpNm8razALRYUW1Fadsefo82sU0cK+F0RPcw=; b=h6q2V9UDW029Uqkd38KQ6JsJtExFeUCDquitLY73xfP74O/R3nXfWoa93Yhi8+P6LP R1A6ooO6i/z3JKSxZdr9ensHRpJKmCW5djfTVjrSkfDZgqrlspvnwIF5Cbfc3b8wfmHX ceFOpSFLMFAhEwrdsNZ29e6DHGYk5CK1jf0DxCLrH126UEyXU8uQNM5Ze2CmWyTNQ/3M T2zInSJZ9EUgsrYRBdWvGjfjFJJNnj1kUE7iTJ8m3KpYywIbc7SxKYdsrzM9txiHjXeE hG720RyPt9zlFssUM6ZBxvDC7IfGaYkgBjyk0skzOMyyPG7oJb7LxDHVV6nh4aDJN4Ck As1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oie9OYCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a63b955000000b00553c4551a09si2442586pgo.398.2023.06.22.06.20.30; Thu, 22 Jun 2023 06:20:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oie9OYCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbjFVNOe (ORCPT + 99 others); Thu, 22 Jun 2023 09:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231611AbjFVNOD (ORCPT ); Thu, 22 Jun 2023 09:14:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29CF1BD2; Thu, 22 Jun 2023 06:14:02 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7d72:676c:e745:a6ef]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 465616607134; Thu, 22 Jun 2023 14:14:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687439641; bh=L/PjipZuAgM8U3/G13tgH1tvV239+bgnDOvwg/NHT0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oie9OYCVzgy392asDkxBx6pxe2/ZE5DwJwj5wC+XHaa1K50YLVzx2KFrvUnDE4Fxb bolJAeXxnDGzshzKaVttYEvDKuWJMvWDs/tnXVj2YJDdRkm1YGLQL5AKKZlonUsHhl kqJ43rCFtmcWzXqIK7gNcRlJOFy6NaHRp/jM96egbEOykqF4U5IprC1Yzk7lY41CxP rJtWH/9odTvPjI7XFgv321jDmQ01jhmTZbtv1y6RSn4ZJRCQHTCgU0CJiFeBbSX69h NtaB6tRkK34wlQgPgbUmlhb3bh4dLhcA0RhJvtfjLTIrAZZYIU8uYVFn6YB+p0mNhs nBqsle6SK92Lw== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v3 08/11] media: verisilicon: postproc: Fix down scale test Date: Thu, 22 Jun 2023 15:13:46 +0200 Message-Id: <20230622131349.144160-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230622131349.144160-1-benjamin.gaignard@collabora.com> References: <20230622131349.144160-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769409131593147262?= X-GMAIL-MSGID: =?utf-8?q?1769409131593147262?= Do not allow down scaling if the source buffer resolution is smaller than destination one. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/verisilicon/hantro_postproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/verisilicon/hantro_postproc.c b/drivers/media/platform/verisilicon/hantro_postproc.c index a6b67d0cc66c..a4f2c5e8932c 100644 --- a/drivers/media/platform/verisilicon/hantro_postproc.c +++ b/drivers/media/platform/verisilicon/hantro_postproc.c @@ -103,7 +103,10 @@ static void hantro_postproc_g1_enable(struct hantro_ctx *ctx) static int down_scale_factor(struct hantro_ctx *ctx) { - if (ctx->src_fmt.width == ctx->dst_fmt.width) + if (ctx->src_fmt.width <= ctx->dst_fmt.width) + return 0; + + if (ctx->src_fmt.height <= ctx->dst_fmt.height) return 0; return DIV_ROUND_CLOSEST(ctx->src_fmt.width, ctx->dst_fmt.width);