From patchwork Fri Nov 4 18:19:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9413067 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 92E566022E for ; Fri, 4 Nov 2016 18:19:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88FA22B1C6 for ; Fri, 4 Nov 2016 18:19:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DF4F2B1CA; Fri, 4 Nov 2016 18:19: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=ham 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 EAF702B1BC for ; Fri, 4 Nov 2016 18:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938686AbcKDSTq (ORCPT ); Fri, 4 Nov 2016 14:19:46 -0400 Received: from mail.kernel.org ([198.145.29.136]:52778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936133AbcKDSTp (ORCPT ); Fri, 4 Nov 2016 14:19:45 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D11082038A; Fri, 4 Nov 2016 18:19:43 +0000 (UTC) Received: from CookieMonster.cookiemonster.local (cpc87017-aztw30-2-0-cust65.18-1.cable.virginm.net [92.232.232.66]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 014EE20386; Fri, 4 Nov 2016 18:19:41 +0000 (UTC) From: Kieran Bingham To: laurent.pinchart@ideasonboard.com Cc: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, Kieran Bingham Subject: [PATCH 1/4] v4l: vsp1: Implement partition algorithm restrictions Date: Fri, 4 Nov 2016 18:19:27 +0000 Message-Id: <1478283570-19688-2-git-send-email-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478283570-19688-1-git-send-email-kieran.bingham+renesas@ideasonboard.com> References: <1478283570-19688-1-git-send-email-kieran.bingham+renesas@ideasonboard.com> 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 The partition algorithm introduced to support scaling, and rotation on Gen3 hardware has some restrictions on pipeline configuration. The UDS must not be connected after the SRU in a pipeline, and whilst an SRU can be connected before the UDS, it can only do so in identity mode. On Gen3 hardware, the use of an SRU will always engage the partition algorithm, therefore we must always ensure the restrictions are met on Gen3 hardware utilising an SRU in the pipeline. A pipeline with an SRU connected after the UDS will disable any scaling features of the SRU. Signed-off-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1_sru.c | 7 +++++-- drivers/media/platform/vsp1/vsp1_sru.h | 1 + drivers/media/platform/vsp1/vsp1_video.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index b4e568a3b4ed..42a3ed6d9461 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -152,7 +152,8 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, fse->min_width = format->width; fse->min_height = format->height; if (format->width <= SRU_MAX_SIZE / 2 && - format->height <= SRU_MAX_SIZE / 2) { + format->height <= SRU_MAX_SIZE / 2 && + sru->force_identity_mode == false) { fse->max_width = format->width * 2; fse->max_height = format->height * 2; } else { @@ -203,7 +204,8 @@ static void sru_try_format(struct vsp1_sru *sru, if (fmt->width <= SRU_MAX_SIZE / 2 && fmt->height <= SRU_MAX_SIZE / 2 && - output_area > input_area * 9 / 4) { + output_area > input_area * 9 / 4 && + sru->force_identity_mode == false) { fmt->width = format->width * 2; fmt->height = format->height * 2; } else { @@ -355,6 +357,7 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL); sru->intensity = 1; + sru->force_identity_mode = false; sru->entity.subdev.ctrl_handler = &sru->ctrls; diff --git a/drivers/media/platform/vsp1/vsp1_sru.h b/drivers/media/platform/vsp1/vsp1_sru.h index 85e241457af2..f8652c04268e 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.h +++ b/drivers/media/platform/vsp1/vsp1_sru.h @@ -30,6 +30,7 @@ struct vsp1_sru { struct v4l2_ctrl_handler ctrls; unsigned int intensity; + bool force_identity_mode; }; static inline struct vsp1_sru *to_sru(struct v4l2_subdev *subdev) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index f19d879ce5ee..d1d3413c6fdf 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -35,6 +35,7 @@ #include "vsp1_hgt.h" #include "vsp1_pipe.h" #include "vsp1_rwpf.h" +#include "vsp1_sru.h" #include "vsp1_uds.h" #include "vsp1_video.h" @@ -458,10 +459,12 @@ static int vsp1_video_pipeline_build_branch(struct vsp1_pipeline *pipe, struct vsp1_rwpf *input, struct vsp1_rwpf *output) { + struct vsp1_device *vsp1 = output->entity.vsp1; struct media_entity_enum ent_enum; struct vsp1_entity *entity; struct media_pad *pad; bool bru_found = false; + bool sru_found = false; int ret; ret = media_entity_enum_init(&ent_enum, &input->entity.vsp1->media_dev); @@ -512,13 +515,37 @@ static int vsp1_video_pipeline_build_branch(struct vsp1_pipeline *pipe, goto out; } - /* UDS can't be chained. */ + if (entity->type == VSP1_ENTITY_SRU) { + struct vsp1_sru *sru = to_sru(&entity->subdev); + + /* + * Gen3 partition algorithm restricts SRU double-scaled + * resolution if it is connected after a UDS entity + */ + if (vsp1->info->gen == 3 && pipe->uds) + sru->force_identity_mode = true; + + sru_found = true; + } + if (entity->type == VSP1_ENTITY_UDS) { + /* UDS can't be chained. */ if (pipe->uds) { ret = -EPIPE; goto out; } + /* + * On Gen3 hardware using the partition algorithm, the + * UDS must not be connected after the SRU. Using the + * SRU on Gen3 will always engage the partition + * algorithm + */ + if (vsp1->info->gen == 3 && sru_found) { + ret = -EPIPE; + goto out; + } + pipe->uds = entity; pipe->uds_input = bru_found ? pipe->bru : &input->entity;