From patchwork Wed May 17 07:56:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 9730327 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 E862060138 for ; Wed, 17 May 2017 07:57:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9F802867A for ; Wed, 17 May 2017 07:57:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDE7C28718; Wed, 17 May 2017 07:57:12 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 608862867A for ; Wed, 17 May 2017 07:57:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 934A46E3B3; Wed, 17 May 2017 07:57:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F3B289803 for ; Wed, 17 May 2017 07:56:56 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4H7urCj007154; Wed, 17 May 2017 02:56:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495007813; bh=kdb/lwBLtnT6ExO/KV8mYircRmFLQQJC7iGHaPHnldQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yBdKOmeDv75U5QTzBovdWK84qqXm8aKaB212HrwrM8IjWeYf26rBxhVSbX57g95VR nxFuzeAGXdkFmqXc1WfpyaLfy5SdEkXFL5xU5XnpGteNv4my1NHAszyxXpqWfdFCkv S8VjPN6/nD451glGRPnnKuTlNiVznWwR1KiVePKA= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4H7urhR015194; Wed, 17 May 2017 02:56:53 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Wed, 17 May 2017 02:56:53 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4H7ulGU013387; Wed, 17 May 2017 02:56:52 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCH 3/7] drm/omap: use DRM_ROTATE_* instead of OMAP_DSS_ROT_* Date: Wed, 17 May 2017 10:56:40 +0300 Message-ID: <1495007804-6133-4-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495007804-6133-1-git-send-email-tomi.valkeinen@ti.com> References: <1495007804-6133-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Cc: Tomi Valkeinen , Jyri Sarha X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP At the moment the dispc driver uses a custom enum for rotation. Change it to use the DRM's DRM_ROTATE_*. Note that mirroring is at the moment handled as a separate boolean in the dispc driver, so we only use the DRM_ROTATE_* values. Note, DSS HW uses clockwise rotation, DRM counter-clockwise. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/dispc.c | 46 +++++++++++++++++------------------ drivers/gpu/drm/omapdrm/dss/omapdss.h | 8 ------ drivers/gpu/drm/omapdrm/omap_plane.c | 2 +- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 7ccbcfc1d011..612170a96bdd 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "omapdss.h" #include "dss.h" @@ -1600,22 +1601,20 @@ static void dispc_ovl_set_accu_uv(enum omap_plane_id plane, { 0, 1, 0, 1, -1, 1, 0, 1 }, }; - switch (rotation) { - case OMAP_DSS_ROT_0: + switch (rotation & DRM_ROTATE_MASK) { + default: + case DRM_ROTATE_0: idx = 0; break; - case OMAP_DSS_ROT_90: + case DRM_ROTATE_270: idx = 1; break; - case OMAP_DSS_ROT_180: + case DRM_ROTATE_180: idx = 2; break; - case OMAP_DSS_ROT_270: + case DRM_ROTATE_90: idx = 3; break; - default: - BUG(); - return; } switch (fourcc) { @@ -1742,8 +1741,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane, case DRM_FORMAT_YUYV: case DRM_FORMAT_UYVY: /* For YUV422 with 90/270 rotation, we don't upsample chroma */ - if (rotation == OMAP_DSS_ROT_0 || - rotation == OMAP_DSS_ROT_180) { + if (!drm_rotation_90_or_270(rotation)) { if (chroma_upscale) /* UV is subsampled by 2 horizontally */ orig_width >>= 1; @@ -1753,7 +1751,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane, } /* must use FIR for YUV422 if rotated */ - if (rotation != OMAP_DSS_ROT_0) + if (rotation != DRM_ROTATE_0) scale_x = scale_y = true; break; @@ -1815,38 +1813,38 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation, if (fourcc == DRM_FORMAT_YUYV || fourcc == DRM_FORMAT_UYVY) { if (mirroring) { - switch (rotation) { - case OMAP_DSS_ROT_0: + switch (rotation & DRM_ROTATE_MASK) { + case DRM_ROTATE_0: vidrot = 2; break; - case OMAP_DSS_ROT_90: + case DRM_ROTATE_270: vidrot = 1; break; - case OMAP_DSS_ROT_180: + case DRM_ROTATE_180: vidrot = 0; break; - case OMAP_DSS_ROT_270: + case DRM_ROTATE_90: vidrot = 3; break; } } else { - switch (rotation) { - case OMAP_DSS_ROT_0: + switch (rotation & DRM_ROTATE_MASK) { + case DRM_ROTATE_0: vidrot = 0; break; - case OMAP_DSS_ROT_90: + case DRM_ROTATE_270: vidrot = 1; break; - case OMAP_DSS_ROT_180: + case DRM_ROTATE_180: vidrot = 2; break; - case OMAP_DSS_ROT_270: + case DRM_ROTATE_90: vidrot = 3; break; } } - if (rotation == OMAP_DSS_ROT_90 || rotation == OMAP_DSS_ROT_270) + if (drm_rotation_90_or_270(rotation)) row_repeat = true; else row_repeat = false; @@ -1869,7 +1867,7 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation, bool doublestride = fourcc == DRM_FORMAT_NV12 && rotation_type == OMAP_DSS_ROT_TILER && - (rotation == OMAP_DSS_ROT_0 || rotation == OMAP_DSS_ROT_180); + !drm_rotation_90_or_270(rotation); /* DOUBLESTRIDE */ REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), doublestride, 22, 22); @@ -3916,7 +3914,7 @@ static const struct dispc_errata_i734_data { .screen_width = 1, .width = 1, .height = 1, .fourcc = DRM_FORMAT_XRGB8888, - .rotation = OMAP_DSS_ROT_0, + .rotation = DRM_ROTATE_0, .rotation_type = OMAP_DSS_ROT_NONE, .mirror = 0, .pos_x = 0, .pos_y = 0, diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index b4bd070bab33..daf792496882 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -145,14 +145,6 @@ enum omap_dss_rotation_type { OMAP_DSS_ROT_TILER = 1 << 0, }; -/* clockwise rotation angle */ -enum omap_dss_rotation_angle { - OMAP_DSS_ROT_0 = 0, - OMAP_DSS_ROT_90 = 1, - OMAP_DSS_ROT_180 = 2, - OMAP_DSS_ROT_270 = 3, -}; - enum omap_overlay_caps { OMAP_DSS_OVL_CAP_SCALE = 1 << 0, OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1, diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 08644326f7eb..0ea97aa15c19 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane, memset(&info, 0, sizeof(info)); info.rotation_type = OMAP_DSS_ROT_NONE; - info.rotation = OMAP_DSS_ROT_0; + info.rotation = DRM_ROTATE_0; info.global_alpha = 0xff; info.mirror = 0; info.zorder = state->zpos;