From patchwork Wed Aug 14 11:54:39 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 11093795
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 DB4FC112C
for ;
Wed, 14 Aug 2019 11:55:02 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6D9C287CB
for ;
Wed, 14 Aug 2019 11:55:02 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id B9532287D1; Wed, 14 Aug 2019 11:55:02 +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 5D2AD287CB
for ;
Wed, 14 Aug 2019 11:55:02 +0000 (UTC)
Received: from gabe.freedesktop.org (localhost [127.0.0.1])
by gabe.freedesktop.org (Postfix) with ESMTP id 3E32889159;
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 3882A89159
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-Ef; Wed, 14 Aug 2019 13:54:55 +0200
From: Philipp Zabel
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/7] gpu: ipu-v3: image-convert: move output seam valid
interval calculation into find_best_seam
Date: Wed, 14 Aug 2019 13:54:39 +0200
Message-Id: <20190814115444.13024-2-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190814115444.13024-1-p.zabel@pengutronix.de>
References: <20190814115444.13024-1-p.zabel@pengutronix.de>
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 reduces code duplication and allows to easily calculate the valid
interval for the input seam position in the same place.
Signed-off-by: Philipp Zabel
---
drivers/gpu/ipu-v3/ipu-image-convert.c | 30 +++++++++++---------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index c9909f1c9ffb..4ac7377cfe5c 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -442,12 +442,10 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx,
#define round_closest(x, y) round_down((x) + (y)/2, (y))
/*
- * Find the best aligned seam position in the inverval [out_start, out_end].
+ * Find the best aligned seam position for the given column / row index.
* Rotation and image offsets are out of scope.
*
- * @out_start: start of inverval, must be within 1024 pixels / lines
- * of out_end
- * @out_end: end of interval, smaller than or equal to out_edge
+ * @index: column / row index, used to calculate valid interval
* @in_edge: input right / bottom edge
* @out_edge: output right / bottom edge
* @in_align: input alignment, either horizontal 8-byte line start address
@@ -463,8 +461,7 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx,
* @_out_seam: aligned output seam position return value
*/
static void find_best_seam(struct ipu_image_convert_ctx *ctx,
- unsigned int out_start,
- unsigned int out_end,
+ unsigned int index,
unsigned int in_edge,
unsigned int out_edge,
unsigned int in_align,
@@ -482,6 +479,13 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx,
unsigned int out_seam = 0;
unsigned int in_seam = 0;
unsigned int min_diff = UINT_MAX;
+ unsigned int out_start;
+ unsigned int out_end;
+
+ /* Start within 1024 pixels of the right / bottom edge */
+ out_start = max_t(int, index * out_align, out_edge - 1024);
+ /* End before having to add more columns to the left / rows above */
+ out_end = min_t(unsigned int, out_edge, index * 1024 + 1);
/*
* Output tiles must start at a multiple of 8 bytes horizontally and
@@ -722,12 +726,7 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
* horizontally.
*/
- /* Start within 1024 pixels of the right edge */
- 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 + 1);
-
- find_best_seam(ctx, out_start, out_end,
+ find_best_seam(ctx, col,
in_right, out_right,
in_left_align, out_left_align,
allow_in_overshoot ? 1 : 8 /* burst length */,
@@ -767,12 +766,7 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
unsigned int in_top;
unsigned int out_top;
- /* Start within 1024 lines of the bottom edge */
- 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 + 1);
-
- find_best_seam(ctx, out_start, out_end,
+ find_best_seam(ctx, row,
in_bottom, out_bottom,
in_top_align, out_top_align,
1, allow_overshoot ? 1 : out_height_align,