From patchwork Thu Sep 15 18:30:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9334551 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 1E7D660839 for ; Thu, 15 Sep 2016 18:31:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1493F29AAF for ; Thu, 15 Sep 2016 18:31:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0907829B0F; Thu, 15 Sep 2016 18:31:07 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 A7BC329AAF for ; Thu, 15 Sep 2016 18:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbcIOSbG (ORCPT ); Thu, 15 Sep 2016 14:31:06 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33251 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbcIOSbF (ORCPT ); Thu, 15 Sep 2016 14:31:05 -0400 Received: by mail-pa0-f65.google.com with SMTP id oz2so2400717pac.0 for ; Thu, 15 Sep 2016 11:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yPZwiPLCqLPKgNl22TuTC2kjaxLuPCB3iAUdQhsMtjY=; b=C8Ox7fOSqfTCw/kBJmgBoat6FMb9x83ycVPfSVo6pWyJF465oDxLhWZGW/lsnk5zjY 2RXIsNJvSJxvJO49uABQVnCd5dxt2K+7viMBHfsx9QJEp6q46UGmW0ixolcz4wtdUjyX 06fxUb7PVFCVcdZCobrAJwwZX4hrncchgoD5CRASTIhdA3L3R2xdOvvhDiLtG5RVYDLc wSuB5SblRNgPAzzznobETIH7vWIM6CEJ9yUlpwGf8Ta5mVUAucStObJP61wOkKsbfcKV sjjlBFYFNYY6DtQeNnvOOh4L5u6jj3Q6Alx6ZzzDYiQ+SL2aqLLghPWb4cO/8crsjd94 ehBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yPZwiPLCqLPKgNl22TuTC2kjaxLuPCB3iAUdQhsMtjY=; b=FQpgVyE22JDwMg2kOrZ+tFL3iLZPQx1JyX+DISwJTCgbbGR2DLpykoshX2eYTt+KKx bCPZqv12v1CrayOCLSUnooic48cgih7eqMBrrZYe/w/Ssm6JTLpbSv5T+JKX4HTrhcrX Efp6ViPSPCj56by3i61sTWQYjZ6q2Wk2R9Tn4yQHGR/Reg2/Wjeuyk9WujYJSkL7D2In +Iz+HNOeU7BRqFn8HJ//068cwwo+ZrXyC3+QiBpY6jKXZn2UZuxIXEOU/NevvAAD9EGQ l1T8eRmgWQ68ZunbgUROhjpKMMS7qR8Fggr39HDWLG/FQnWQZAr97rqKy4ZrWny0iGVL 8mDA== X-Gm-Message-State: AE9vXwN6ncIxc57BEbIzSX0nilBSPwRHS+anjVc6ka4GI9bXmUkWIaG7SHnpCTg1NQp6PA== X-Received: by 10.66.82.42 with SMTP id f10mr16818010pay.17.1473964264756; Thu, 15 Sep 2016 11:31:04 -0700 (PDT) Received: from majic.world.mentorg.com (c-73-241-2-21.hsd1.ca.comcast.net. [73.241.2.21]) by smtp.googlemail.com with ESMTPSA id yu7sm6680554pab.45.2016.09.15.11.31.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Sep 2016 11:31:04 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: p.zabel@pengutronix.de, tomi.valkeinen@ti.com Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Steve Longerbeam Subject: [PATCH v6 2/3] gpu: ipu-v3: Add ipu_rot_mode_is_irt() Date: Thu, 15 Sep 2016 11:30:50 -0700 Message-Id: <1473964251-20662-3-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473964251-20662-1-git-send-email-steve_longerbeam@mentor.com> References: <1473964251-20662-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a macro that returns boolean true if the given ipu_rotate_mode requires the use of the Image Rotator. Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- include/video/imx-ipu-v3.h | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 1a37afc..321eb98 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -619,7 +619,7 @@ int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel, ipu_ic_write(ic, ic_idmac_2, IC_IDMAC_2); ipu_ic_write(ic, ic_idmac_3, IC_IDMAC_3); - if (rot >= IPU_ROTATE_90_RIGHT) + if (ipu_rot_mode_is_irt(rot)) ic->rotation = true; unlock: diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index 49d5439..f39a3d6 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h @@ -63,17 +63,25 @@ enum ipu_csi_dest { /* * Enumeration of IPU rotation modes */ +#define IPU_ROT_BIT_VFLIP (1 << 0) +#define IPU_ROT_BIT_HFLIP (1 << 1) +#define IPU_ROT_BIT_90 (1 << 2) + enum ipu_rotate_mode { IPU_ROTATE_NONE = 0, - IPU_ROTATE_VERT_FLIP, - IPU_ROTATE_HORIZ_FLIP, - IPU_ROTATE_180, - IPU_ROTATE_90_RIGHT, - IPU_ROTATE_90_RIGHT_VFLIP, - IPU_ROTATE_90_RIGHT_HFLIP, - IPU_ROTATE_90_LEFT, + IPU_ROTATE_VERT_FLIP = IPU_ROT_BIT_VFLIP, + IPU_ROTATE_HORIZ_FLIP = IPU_ROT_BIT_HFLIP, + IPU_ROTATE_180 = (IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP), + IPU_ROTATE_90_RIGHT = IPU_ROT_BIT_90, + IPU_ROTATE_90_RIGHT_VFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_VFLIP), + IPU_ROTATE_90_RIGHT_HFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_HFLIP), + IPU_ROTATE_90_LEFT = (IPU_ROT_BIT_90 | + IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP), }; +/* 90-degree rotations require the IRT unit */ +#define ipu_rot_mode_is_irt(m) (((m) & IPU_ROT_BIT_90) != 0) + enum ipu_color_space { IPUV3_COLORSPACE_RGB, IPUV3_COLORSPACE_YUV,