From patchwork Tue May 28 03:57:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 10963681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67067112C for ; Tue, 28 May 2019 03:57:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56570280FC for ; Tue, 28 May 2019 03:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A0762844B; Tue, 28 May 2019 03:57:10 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 5C0502267B for ; Tue, 28 May 2019 03:57:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E73B589AEB; Tue, 28 May 2019 03:57:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10054.outbound.protection.outlook.com [40.107.1.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7114989AF3 for ; Tue, 28 May 2019 03:57:03 +0000 (UTC) Received: from DB7PR08MB3530.eurprd08.prod.outlook.com (20.177.120.80) by DB7PR08MB3580.eurprd08.prod.outlook.com (20.177.120.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.16; Tue, 28 May 2019 03:57:00 +0000 Received: from DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::e41c:9e3c:80bf:25c6]) by DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::e41c:9e3c:80bf:25c6%5]) with mapi id 15.20.1943.016; Tue, 28 May 2019 03:57:00 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v3 1/2] drm/komeda: Add rotation support on Komeda driver Thread-Topic: [PATCH v3 1/2] drm/komeda: Add rotation support on Komeda driver Thread-Index: AQHVFQlnTJI4hpLns0iKHK2Hp+KXgQ== Date: Tue, 28 May 2019 03:57:00 +0000 Message-ID: <1559015784-18998-2-git-send-email-lowry.li@arm.com> References: <1559015784-18998-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1559015784-18998-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR02CA0197.apcprd02.prod.outlook.com (2603:1096:201:21::33) To DB7PR08MB3530.eurprd08.prod.outlook.com (2603:10a6:10:49::16) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a1a557d8-5077-4dc8-cc05-08d6e3208950 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DB7PR08MB3580; x-ms-traffictypediagnostic: DB7PR08MB3580: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:204; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(366004)(39860400002)(136003)(189003)(199004)(8936002)(6486002)(2501003)(81166006)(81156014)(6436002)(71200400001)(6512007)(86362001)(305945005)(5660300002)(486006)(66066001)(36756003)(478600001)(7736002)(8676002)(71190400001)(50226002)(53936002)(2201001)(316002)(6636002)(2906002)(54906003)(66476007)(66556008)(66446008)(2616005)(73956011)(186003)(26005)(68736007)(446003)(476003)(14444005)(256004)(25786009)(3846002)(6116002)(11346002)(99286004)(52116002)(386003)(6506007)(102836004)(55236004)(72206003)(76176011)(14454004)(66946007)(110136005)(64756008)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3580; H:DB7PR08MB3530.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FSRp5DSLJayYLGfn9kp+K4sZHX7pZH6LrcwbiI4JyQbA2RMJ61H7hKLIqElHEiyDclhSDU3Au2mj/oCMRKHIZnAsWaXu/nAgrV2d/u5VlghuIrnXP6d11mzfOJQf7sxR6+L1wyL9CZwZctVMITmV7lwVxCuZJdWSdBEyKtqFZNNhwOAbdQbWHWC4zL2GFQJStevLV8JyYvEgPrcIjG4ulNq26B4hbjz503PLW/2NwoDwYwUcYfFeoPui1WVZuHaJoRvdTwbRc8rR8a48+42syWIhUj1Ugzw5wmXLJkybUm96XdXNGrRQ7dAWhxYLVs6jq0Qi2aq4Xh1T/Z4lTxMZbuYm0g9WNOGxWCPCM8tQdTqeUkjpjpiaHDz6n3whgzmr6N/hWH7DQWsNdHIk3oTLrDGWjRQ1RGfCC44xul4UHe4= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1a557d8-5077-4dc8-cc05-08d6e3208950 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2019 03:57:00.6313 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lowry.Li@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3580 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ebkvGMDpB+G8m//iJEFAwcRvCyXF58/1P3aolgwFmLc=; b=tpSYF+q4LU9y+mbm8zAlTGHniD8VYmePmWoHmsgBlfA9g7YF3dTZKR/8p7qAKdTd5gUhTgcJlfd2U4IWTGKJlo74SFZzpomIxCMf6m5SH5Q5iRQ/QoUB8iY1dewNcO8m7vApCFZ52l5ySuktrEdY4K0IoHX1sZIZSabqdaYxP/Q= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Lowry Li (Arm Technology China)" - Adds rotation property to plane. - Komeda display rotation support diverges from the specific formats, so need to check the user required rotation type with the format caps and reject the commit if it can not be supported. - In the layer validate flow, sets the rotation value to the layer state. If r90 or r270, swap the width and height of the data flow for next stage. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h | 11 +++++++++++ .../gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 7 +++++++ drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h index bc3b2df36..96de22e 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h @@ -79,6 +79,17 @@ struct komeda_format_caps_table { extern u64 komeda_supported_modifiers[]; +static inline const char *komeda_get_format_name(u32 fourcc, u64 modifier) +{ + struct drm_format_name_buf buf; + static char name[64]; + + snprintf(name, sizeof(name), "%s with modifier: 0x%llx.", + drm_get_format_name(fourcc, &buf), modifier); + + return name; +} + const struct komeda_format_caps * komeda_get_format_caps(struct komeda_format_caps_table *table, u32 fourcc, u64 modifier); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index db34ea2..34737c0 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -339,6 +339,13 @@ struct komeda_pipeline_state * /* update the data flow for the next stage */ komeda_component_set_output(&dflow->input, &layer->base, 0); + /* + * The rotation has been handled by layer, so adjusted the data flow for + * the next stage. + */ + if (drm_rotation_90_or_270(st->rot)) + swap(dflow->in_h, dflow->in_w); + return 0; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index 9b87c25..c9f37ff 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -10,6 +10,7 @@ #include #include "komeda_dev.h" #include "komeda_kms.h" +#include "komeda_framebuffer.h" static int komeda_plane_init_data_flow(struct drm_plane_state *st, @@ -17,6 +18,7 @@ { struct komeda_plane_state *kplane_st = to_kplane_st(st); struct drm_framebuffer *fb = st->fb; + const struct komeda_format_caps *caps = to_kfb(fb)->format_caps; memset(dflow, 0, sizeof(*dflow)); @@ -37,6 +39,15 @@ dflow->in_w = st->src_w >> 16; dflow->in_h = st->src_h >> 16; + dflow->rot = drm_rotation_simplify(st->rotation, caps->supported_rots); + if (!has_bits(dflow->rot, caps->supported_rots)) { + DRM_DEBUG_ATOMIC("rotation(0x%x) isn't supported by %s.\n", + dflow->rot, + komeda_get_format_name(caps->fourcc, + fb->modifier)); + return -EINVAL; + } + dflow->en_img_enhancement = kplane_st->img_enhancement; komeda_complete_data_flow_cfg(dflow); @@ -303,6 +314,11 @@ static int komeda_plane_add(struct komeda_kms_dev *kms, drm_plane_helper_add(plane, &komeda_plane_helper_funcs); + err = drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, + layer->supported_rots); + if (err) + goto cleanup; + err = drm_plane_create_alpha_property(plane); if (err) goto cleanup;