From patchwork Fri Feb 10 20:27:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9567449 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 9C18860573 for ; Fri, 10 Feb 2017 20:27:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D07F2859A for ; Fri, 10 Feb 2017 20:27:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E8E285C5; Fri, 10 Feb 2017 20:27:55 +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 1DB55285AE for ; Fri, 10 Feb 2017 20:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932114AbdBJU1y (ORCPT ); Fri, 10 Feb 2017 15:27:54 -0500 Received: from mail.kernel.org ([198.145.29.136]:45656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932082AbdBJU1x (ORCPT ); Fri, 10 Feb 2017 15:27:53 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 393052012D; Fri, 10 Feb 2017 20:27:51 +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 280932034A; Fri, 10 Feb 2017 20:27:49 +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 4/8] v4l: vsp1: Move partition rectangles to struct Date: Fri, 10 Feb 2017 20:27:32 +0000 Message-Id: <2a0da9a22511742091a8b8d1b79549f3cbd0c775.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 As we develop the partition algorithm, we need to store more information per partition to describe the phase and other parameters. To keep this data together, further abstract the existing v4l2_rect into a partition specific structure Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_pipe.h | 12 ++++++++++-- drivers/media/platform/vsp1/vsp1_rpf.c | 4 ++-- drivers/media/platform/vsp1/vsp1_uds.c | 8 +++++--- drivers/media/platform/vsp1/vsp1_video.c | 14 ++++++++++---- drivers/media/platform/vsp1/vsp1_wpf.c | 9 +++++---- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h index 5aa31143ce59..6494c4c75023 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/vsp1/vsp1_pipe.h @@ -60,6 +60,14 @@ enum vsp1_pipeline_state { }; /* + * struct vsp1_partition - A description of each partition slice performed by HW + * @dest: The position and dimension of this partition in the destination image + */ +struct vsp1_partition { + struct v4l2_rect dest; +}; + +/* * struct vsp1_pipeline - A VSP1 hardware pipeline * @pipe: the media pipeline * @irqlock: protects the pipeline state @@ -114,8 +122,8 @@ struct vsp1_pipeline { struct vsp1_dl_list *dl; unsigned int partitions; - struct v4l2_rect partition; - struct v4l2_rect part_table[VSP1_PIPE_MAX_PARTITIONS]; + struct vsp1_partition *partition; + struct vsp1_partition part_table[VSP1_PIPE_MAX_PARTITIONS]; }; void vsp1_pipeline_reset(struct vsp1_pipeline *pipe); diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index b2e34a800ffa..df380a237118 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -107,9 +107,9 @@ static void rpf_configure(struct vsp1_entity *entity, output = vsp1_entity_get_pad_format(wpf, wpf->config, RWPF_PAD_SOURCE); - crop.width = pipe->partition.width * input_width + crop.width = pipe->partition->dest.width * input_width / output->width; - crop.left += pipe->partition.left * input_width + crop.left += pipe->partition->dest.left * input_width / output->width; } diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index da8f89a31ea4..98c0836d6dcd 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -272,11 +272,13 @@ static void uds_configure(struct vsp1_entity *entity, bool multitap; if (params == VSP1_ENTITY_PARAMS_PARTITION) { - const struct v4l2_rect *clip = &pipe->partition; + struct vsp1_partition *partition = pipe->partition; vsp1_uds_write(uds, dl, VI6_UDS_CLIP_SIZE, - (clip->width << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) | - (clip->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); + (partition->dest.width + << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) | + (partition->dest.height + << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); return; } diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 4ade958a1c9e..a978508a4993 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -271,8 +271,11 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) /* Gen2 hardware doesn't require image partitioning. */ if (vsp1->info->gen == 2) { + struct vsp1_partition *partition = &pipe->part_table[0]; + pipe->partitions = 1; - pipe->part_table[0] = vsp1_video_partition(pipe, div_size, 0); + partition->dest = vsp1_video_partition(pipe, div_size, 0); + return; } @@ -288,8 +291,11 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) pipe->partitions = DIV_ROUND_UP(format->width, div_size); - for (i = 0; i < pipe->partitions; i++) - pipe->part_table[i] = vsp1_video_partition(pipe, div_size, i); + for (i = 0; i < pipe->partitions; i++) { + struct vsp1_partition *partition = &pipe->part_table[i]; + + partition->dest = vsp1_video_partition(pipe, div_size, i); + } } /* ----------------------------------------------------------------------------- @@ -373,7 +379,7 @@ static void vsp1_video_pipeline_run_partition(struct vsp1_pipeline *pipe, { struct vsp1_entity *entity; - pipe->partition = pipe->part_table[partition_number]; + pipe->partition = &pipe->part_table[partition_number]; list_for_each_entry(entity, &pipe->entities, list_pipe) { if (entity->ops->configure) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index ad67034e08e9..bd4cd2807cc6 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -227,7 +227,7 @@ static void wpf_configure(struct vsp1_entity *entity, * multiple slices. */ if (pipe->partitions > 1) - width = pipe->partition.width; + width = pipe->partition->dest.width; vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | @@ -255,10 +255,11 @@ static void wpf_configure(struct vsp1_entity *entity, * order the partitions correctly. */ if (flip & BIT(WPF_CTRL_HFLIP)) - offset = format->width - pipe->partition.left - - pipe->partition.width; + offset = format->width + - pipe->partition->dest.left + - pipe->partition->dest.width; else - offset = pipe->partition.left; + offset = pipe->partition->dest.left; mem.addr[0] += offset * fmtinfo->bpp[0] / 8; if (format->num_planes > 1) {