From patchwork Fri Feb 10 20:27:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9567453 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A558D60572 for ; Fri, 10 Feb 2017 20:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 961C22859A for ; Fri, 10 Feb 2017 20:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B040285C5; Fri, 10 Feb 2017 20:27:57 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BCA12859A for ; Fri, 10 Feb 2017 20:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752790AbdBJU1z (ORCPT ); Fri, 10 Feb 2017 15:27:55 -0500 Received: from mail.kernel.org ([198.145.29.136]:45694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932082AbdBJU1z (ORCPT ); Fri, 10 Feb 2017 15:27:55 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A3C22025B; Fri, 10 Feb 2017 20:27:53 +0000 (UTC) Received: from CookieMonster.cookiemonster.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77BC02026C; Fri, 10 Feb 2017 20:27:51 +0000 (UTC) From: Kieran Bingham To: laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kieran.bingham@ideasonboard.com Cc: Kieran Bingham Subject: [PATCH 5/8] v4l: vsp1: Operate on partition struct data directly Date: Fri, 10 Feb 2017 20:27:33 +0000 Message-Id: <1f4036763d2d29bf9b2a0d8f39942155e493b343.1486758327.git-series.kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When generating the partition windows, operate directly on the partition struct rather than copying and duplicating the processed data Signed-off-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1_video.c | 43 ++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index a978508a4993..5f1886bfad26 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -189,17 +189,17 @@ static int __vsp1_video_try_format(struct vsp1_video *video, /** * vsp1_video_partition - Calculate the active partition output window * + * @partition: The active partition data * @div_size: pre-determined maximum partition division size * @index: partition index * - * Returns a v4l2_rect describing the partition window. + * Generates the output partitioning positions. */ -static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, - unsigned int div_size, - unsigned int index) +static void vsp1_video_partition(struct vsp1_pipeline *pipe, + struct vsp1_partition *partition, + unsigned int div_size, unsigned int index) { const struct v4l2_mbus_framefmt *format; - struct v4l2_rect partition; unsigned int modulus; format = vsp1_entity_get_pad_format(&pipe->output->entity, @@ -208,18 +208,19 @@ static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, /* A single partition simply processes the output size in full. */ if (pipe->partitions <= 1) { - partition.left = 0; - partition.top = 0; - partition.width = format->width; - partition.height = format->height; - return partition; + partition->dest.left = 0; + partition->dest.top = 0; + partition->dest.width = format->width; + partition->dest.height = format->height; + + return; } /* Initialise the partition with sane starting conditions. */ - partition.left = index * div_size; - partition.top = 0; - partition.width = div_size; - partition.height = format->height; + partition->dest.left = index * div_size; + partition->dest.top = 0; + partition->dest.width = div_size; + partition->dest.height = format->height; modulus = format->width % div_size; @@ -242,18 +243,16 @@ static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, if (modulus < div_size / 2) { if (index == partitions - 1) { /* Halve the penultimate partition. */ - partition.width = div_size / 2; + partition->dest.width = div_size / 2; } else if (index == partitions) { /* Increase the final partition. */ - partition.width = (div_size / 2) + modulus; - partition.left -= div_size / 2; + partition->dest.width = div_size / 2 + modulus; + partition->dest.left -= div_size / 2; } } else if (index == partitions) { - partition.width = modulus; + partition->dest.width = modulus; } } - - return partition; } static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) @@ -274,7 +273,7 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) struct vsp1_partition *partition = &pipe->part_table[0]; pipe->partitions = 1; - partition->dest = vsp1_video_partition(pipe, div_size, 0); + vsp1_video_partition(pipe, partition, div_size, 0); return; } @@ -294,7 +293,7 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) for (i = 0; i < pipe->partitions; i++) { struct vsp1_partition *partition = &pipe->part_table[i]; - partition->dest = vsp1_video_partition(pipe, div_size, i); + vsp1_video_partition(pipe, partition, div_size, i); } }