From patchwork Wed Aug 14 11:54:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 11093801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2508B1398 for ; Wed, 14 Aug 2019 11:55:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12168287CB for ; Wed, 14 Aug 2019 11:55:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06852287D1; Wed, 14 Aug 2019 11:55:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B308C287CB for ; Wed, 14 Aug 2019 11:55:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DE338991C; Wed, 14 Aug 2019 11:54:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C6DB8991C for ; Wed, 14 Aug 2019 11:54:57 +0000 (UTC) Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28] helo=dude02.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1hxrrj-00036w-Dx; Wed, 14 Aug 2019 13:54:55 +0200 From: Philipp Zabel To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/7] gpu: ipu-v3: image-convert: fix output seam valid interval Date: Wed, 14 Aug 2019 13:54:38 +0200 Message-Id: <20190814115444.13024-1-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, Steve Longerbeam Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This fixes a failure to determine any seam if the output size is exactly 1024 multiplied by the number of tiles in a given direction. In that case an empty interval out_start == out_end is being passed to find_best_seam, which looks for a seam out_start <= x < out_end. Also reduce the interval all but the left column / top row, to avoid returning position 0 as best fit. Signed-off-by: Philipp Zabel --- drivers/gpu/ipu-v3/ipu-image-convert.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 9d25db6924b3..c9909f1c9ffb 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -723,9 +723,9 @@ static void find_seams(struct ipu_image_convert_ctx *ctx, */ /* Start within 1024 pixels of the right edge */ - out_start = max_t(int, 0, out_right - 1024); + out_start = max_t(int, col * out_left_align, out_right - 1024); /* End before having to add more columns to the left */ - out_end = min_t(unsigned int, out_right, col * 1024); + out_end = min_t(unsigned int, out_right, col * 1024 + 1); find_best_seam(ctx, out_start, out_end, in_right, out_right, @@ -768,9 +768,9 @@ static void find_seams(struct ipu_image_convert_ctx *ctx, unsigned int out_top; /* Start within 1024 lines of the bottom edge */ - out_start = max_t(int, 0, out_bottom - 1024); + out_start = max_t(int, row * out_top_align, out_bottom - 1024); /* End before having to add more rows above */ - out_end = min_t(unsigned int, out_bottom, row * 1024); + out_end = min_t(unsigned int, out_bottom, row * 1024 + 1); find_best_seam(ctx, out_start, out_end, in_bottom, out_bottom,