From patchwork Sun Feb 12 23:17:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9568615 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 BA874601C3 for ; Sun, 12 Feb 2017 23:17:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B06132808F for ; Sun, 12 Feb 2017 23:17:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A510628112; Sun, 12 Feb 2017 23:17:36 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 5EA112808F for ; Sun, 12 Feb 2017 23:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751000AbdBLXRe (ORCPT ); Sun, 12 Feb 2017 18:17:34 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:41818 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbdBLXRd (ORCPT ); Sun, 12 Feb 2017 18:17:33 -0500 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 9402A20098; Mon, 13 Feb 2017 00:16:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1486941403; bh=ILSGdCvUsVCNIc9+UY+JPscl6Zq8kaoK0SCgPfg3AyM=; h=From:To:Cc:Subject:Date:From; b=Bo9s1j0t1qno/9oEgy+YJaS4r1Lj3HhCiyw11JEkeRTfJORTIk5rWvDNjzz3IW4B5 TwQOr7V8qmL9z5sdU6iYa4ZGXHNscbAGRZCJby4Hqw1x+bIuMp6Wk+bXH5RDZu/6Jx bruJ4oQ8yUl278YEkzTP1QSXrtrlqjF+U/GcixlQ= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kieran.bingham@ideasonboard.com Subject: [PATCH] v4l: vsp1: Fix WPF U/V order in 3-planar formats on Gen3 Date: Mon, 13 Feb 2017 01:17:53 +0200 Message-Id: <20170212231753.30397-1-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.10.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The WPF U/V order bit has no effect for 3-planar formats on Gen3 hardware. Swap the U and V planes manually instead in that case. Fixes: b915bd24a034 ("[media] v4l: vsp1: Add tri-planar memory formats support") Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1_wpf.c | 9 +++++++++ 1 file changed, 9 insertions(+) This makes the vsp-unit-test-0002.sh test pass on both H2 and H3. diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 7c48f81cd5c1..052a83e2d489 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -216,6 +216,7 @@ static void wpf_configure(struct vsp1_entity *entity, if (params == VSP1_ENTITY_PARAMS_PARTITION) { const struct v4l2_pix_format_mplane *format = &wpf->format; + const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; struct vsp1_rwpf_memory mem = wpf->mem; unsigned int flip = wpf->flip.active; unsigned int width = source_format->width; @@ -281,6 +282,14 @@ static void wpf_configure(struct vsp1_entity *entity, } } + /* + * On Gen3 hardware the SPUVS bit has no effect on 3-planar + * formats. Swap the U and V planes manually in that case. + */ + if (vsp1->info->gen == 3 && format->num_planes == 3 && + fmtinfo->swap_uv) + swap(mem.addr[1], mem.addr[2]); + vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]);