From patchwork Fri Apr 19 07:58:30 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: 10908675 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 9749514DB for ; Fri, 19 Apr 2019 07:58:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BB3328C3D for ; Fri, 19 Apr 2019 07:58:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FA7528D70; Fri, 19 Apr 2019 07:58: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=-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 1D4F128C3D for ; Fri, 19 Apr 2019 07:58:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F1CD891FF; Fri, 19 Apr 2019 07:58:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00089.outbound.protection.outlook.com [40.107.0.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D432891FF for ; Fri, 19 Apr 2019 07:58:32 +0000 (UTC) Received: from DB7PR08MB3530.eurprd08.prod.outlook.com (20.177.120.80) by DB7PR08MB3387.eurprd08.prod.outlook.com (20.176.238.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.16; Fri, 19 Apr 2019 07:58:30 +0000 Received: from DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::899e:4160:166b:923a]) by DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::899e:4160:166b:923a%3]) with mapi id 15.20.1813.013; Fri, 19 Apr 2019 07:58:30 +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 v1 1/2] drm/komeda: Add rotation support on Komeda driver Thread-Topic: [PATCH v1 1/2] drm/komeda: Add rotation support on Komeda driver Thread-Index: AQHU9oWtmoFimKfIy0KwjVL7yIQzDA== Date: Fri, 19 Apr 2019 07:58:30 +0000 Message-ID: <1555660675-4903-2-git-send-email-lowry.li@arm.com> References: <1555660675-4903-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1555660675-4903-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: HK0PR03CA0073.apcprd03.prod.outlook.com (2603:1096:203:72::13) 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: d68236d1-4e9e-48f5-9b35-08d6c49ccfa4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB7PR08MB3387; x-ms-traffictypediagnostic: DB7PR08MB3387: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0012E6D357 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(136003)(346002)(366004)(199004)(189003)(55236004)(71200400001)(68736007)(71190400001)(2616005)(53936002)(386003)(6506007)(86362001)(25786009)(14454004)(6636002)(2201001)(97736004)(256004)(14444005)(486006)(7736002)(76176011)(52116002)(6486002)(4326008)(11346002)(305945005)(446003)(3846002)(6116002)(72206003)(8676002)(186003)(36756003)(81156014)(81166006)(5660300002)(110136005)(2906002)(6436002)(476003)(54906003)(26005)(316002)(2501003)(478600001)(50226002)(102836004)(66066001)(6512007)(99286004)(64756008)(66556008)(66476007)(73956011)(66946007)(66446008)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3387; H:DB7PR08MB3530.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: b0xvmuI8QLRHWkGrHIGrZ9b0WkkYQR4La2YsTTIejaq1uyojhgo5MNEXD7sBPyhQ8jSQkxHy1oeo96O8qUC2X9/MS1mak/+74nZIdPUUwM9lSnC2Odn3Q6VjwAgcYvNzCG/HK0FT9Nd7WKR9ZbValjpm8nxcJXEXf7Ya03e+nT6HWaXlJLk60yOZy3r4Ps4pGPYS9KVNL/M/VU+wSYzvhwA2FXbp4xt8dztf4W24sa7EArErc0JKRoHAO17budNjkUSv59c9sob9GEyv5E+ecrebXdoyN/u3OOBL683jtNWIEtj4Z041nMm0R7FCtGskplSETDkXnWBJYz/wb8TDJ5kgko3LHyvRz2sIXCDAQ/iK5FOkRYuoCZcCFXxl0cxz3KYA3di3xWcRS12fY5amf2xGeq8ubvKia5s+JQPAD8c= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: d68236d1-4e9e-48f5-9b35-08d6c49ccfa4 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2019 07:58:30.1040 (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-Transport-CrossTenantHeadersStamped: DB7PR08MB3387 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ey22I86sPmrgn8KV0BgV5XuvXKpTPsecI/l18vprVBE=; b=gVdf7T1Rhfoc+xJUHsgmFwdoBvrERKoS5RIUsn9poIAm0zXOgpKhGJW0No05nH+bJQm7ECvj5dM98490kiGfPtdHxCq1iXFnr8e1zfK3RBDyhxjJRtk6xRG+tJwUeXtBDhWKJW9k9wvGTBARVaKpEs1dqiVVRTLNP7nZsvruN1I= 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 - 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) --- 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 9b29e9a..8c133e4 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -317,6 +317,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 14d6861..5e5bfdb 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -9,12 +9,14 @@ #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, struct komeda_data_flow_cfg *dflow) { struct drm_framebuffer *fb = st->fb; + const struct komeda_format_caps *caps = to_kfb(fb)->format_caps; memset(dflow, 0, sizeof(*dflow)); @@ -35,6 +37,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; + } + return 0; } @@ -233,6 +244,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; From patchwork Fri Apr 19 07:58:34 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: 10908677 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 C99FB17EE for ; Fri, 19 Apr 2019 07:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFA8228C3D for ; Fri, 19 Apr 2019 07:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B33A528D70; Fri, 19 Apr 2019 07:58:40 +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 23D1428C3D for ; Fri, 19 Apr 2019 07:58:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 558CB89202; Fri, 19 Apr 2019 07:58:39 +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-eopbgr10069.outbound.protection.outlook.com [40.107.1.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61B3489202 for ; Fri, 19 Apr 2019 07:58:37 +0000 (UTC) Received: from DB7PR08MB3530.eurprd08.prod.outlook.com (20.177.120.80) by DB7PR08MB3387.eurprd08.prod.outlook.com (20.176.238.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.16; Fri, 19 Apr 2019 07:58:34 +0000 Received: from DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::899e:4160:166b:923a]) by DB7PR08MB3530.eurprd08.prod.outlook.com ([fe80::899e:4160:166b:923a%3]) with mapi id 15.20.1813.013; Fri, 19 Apr 2019 07:58:34 +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 v1 2/2] drm/komeda: Adds limitation check for AFBC wide block not support Rot90 Thread-Topic: [PATCH v1 2/2] drm/komeda: Adds limitation check for AFBC wide block not support Rot90 Thread-Index: AQHU9oWwvWqkpNx6QEag3d00LHOkKA== Date: Fri, 19 Apr 2019 07:58:34 +0000 Message-ID: <1555660675-4903-3-git-send-email-lowry.li@arm.com> References: <1555660675-4903-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1555660675-4903-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: HK0PR03CA0073.apcprd03.prod.outlook.com (2603:1096:203:72::13) 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: 553823ac-c08c-494c-c59b-08d6c49cd256 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB7PR08MB3387; x-ms-traffictypediagnostic: DB7PR08MB3387: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0012E6D357 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(136003)(346002)(366004)(199004)(189003)(55236004)(71200400001)(68736007)(71190400001)(2616005)(53936002)(386003)(6506007)(86362001)(25786009)(14454004)(6636002)(2201001)(97736004)(256004)(486006)(7736002)(76176011)(52116002)(6486002)(4326008)(11346002)(305945005)(446003)(3846002)(6116002)(72206003)(8676002)(186003)(36756003)(81156014)(81166006)(5660300002)(110136005)(2906002)(6436002)(476003)(54906003)(26005)(316002)(2501003)(478600001)(50226002)(102836004)(66066001)(6512007)(99286004)(64756008)(66556008)(66476007)(73956011)(66946007)(66446008)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3387; H:DB7PR08MB3530.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: jpLbqYevofteROir3IxQ278glbBDeve3RHZ87V+dl/Wr4V0gKztXti3x8hJcWBH/jIV687xP/Ypi/x5vup8Fg3aFLfa6A/tWBMDXsmC6fP4+OYl4tYh83A/m63Dt2PnqiepG2ifs8RCYcSZs/hw0aDi/7qxVJNK4pzkbQKiK+MJSmudrxwyP0ZTXIvYgCrpDQ8fOuKvbnll7K/7EQTt6Af+ydeP4mzahVFnhtDTRFZBGzZ+RqqImssOUcTR8CvFAEyRE/DfNMWmM6TionXjVCLu7lMw5lLNgV/R+ShgF8gkybOXc6AUop4vhOtwi7BzqEoAvrxoIOwKkutsn6nfGPYJDkNE0p54AlBq2f1JiBmMujfgKyVxjKqNoNQ/JyTiGxwsgEfmGCGP2Wiv1bDHfQ5gdigAVPcg3Li1swKCxHI0= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 553823ac-c08c-494c-c59b-08d6c49cd256 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2019 07:58:34.6260 (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-Transport-CrossTenantHeadersStamped: DB7PR08MB3387 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eLSqz2YcLXD7eg+Wzs/7SHyHkUhVNoHGZO+RVYxmwf4=; b=dRF2zy4+zMDxdc4JFQsiCp+1q0gzNayTLO1gIhxzlMRKJDJVm7cUaeP1df4K8t11SNgy2mzFmU3bunGSFhZ/2PzD1suszorH+r5atrF+Q0wUipXt1ixQoL+DYp9ABP1GRD7V5KMrSWs+RBIv1sCWE8YkYbMqv1+DvLT2gRBMZWI= 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 Komeda series hardware doesn't support Rot90 for AFBC wide block. So add limitation check to reject it if such configuration has been posted. Signed-off-by: Lowry Li (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 15 +++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_format_caps.c | 7 ++++++- .../gpu/drm/arm/display/komeda/komeda_format_caps.h | 8 +++++++- .../gpu/drm/arm/display/komeda/komeda_framebuffer.c | 18 +++++++++--------- .../gpu/drm/arm/display/komeda/komeda_framebuffer.h | 5 +++-- .../gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 8 +++++++- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 2 +- 7 files changed, 48 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 34506ef..9603de9 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -494,11 +494,26 @@ static int d71_enum_resources(struct komeda_dev *mdev) {__HW_ID(6, 7), 0/*DRM_FORMAT_YUV420_10BIT*/, 1, RICH, Rot_ALL_H_V, LYT_NM, AFB_TH}, }; +static bool d71_format_mod_supported(const struct komeda_format_caps *caps, + u32 layer_type, u64 modifier, u32 rot) +{ + uint64_t layout = modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK; + + if ((layout == AFBC_FORMAT_MOD_BLOCK_SIZE_32x8) && + drm_rotation_90_or_270(rot)) { + DRM_DEBUG_ATOMIC("D71 doesn't support ROT90 for WB-AFBC.\n"); + return false; + } + + return true; +} + static void d71_init_fmt_tbl(struct komeda_dev *mdev) { struct komeda_format_caps_table *table = &mdev->fmt_tbl; table->format_caps = d71_format_caps_table; + table->format_mod_supported = d71_format_mod_supported; table->n_formats = ARRAY_SIZE(d71_format_caps_table); } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c index b219514..cd4d9f5 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c @@ -74,7 +74,8 @@ }; bool komeda_format_mod_supported(struct komeda_format_caps_table *table, - u32 layer_type, u32 fourcc, u64 modifier) + u32 layer_type, u32 fourcc, u64 modifier, + u32 rot) { const struct komeda_format_caps *caps; @@ -85,6 +86,10 @@ bool komeda_format_mod_supported(struct komeda_format_caps_table *table, if (!(caps->supported_layer_types & layer_type)) return false; + if (table->format_mod_supported) + return table->format_mod_supported(caps, layer_type, modifier, + rot); + return true; } 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 96de22e..381e873 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h @@ -71,10 +71,15 @@ struct komeda_format_caps { * * @n_formats: the size of format_caps list. * @format_caps: format_caps list. + * @format_mod_supported: Optional. Some HW may have special requirements or + * limitations which can not be described by format_caps, this func supply HW + * the ability to do the further HW specific check. */ struct komeda_format_caps_table { u32 n_formats; const struct komeda_format_caps *format_caps; + bool (*format_mod_supported)(const struct komeda_format_caps *caps, + u32 layer_type, u64 modifier, u32 rot); }; extern u64 komeda_supported_modifiers[]; @@ -100,6 +105,7 @@ u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, void komeda_put_fourcc_list(u32 *fourcc_list); bool komeda_format_mod_supported(struct komeda_format_caps_table *table, - u32 layer_type, u32 fourcc, u64 modifier); + u32 layer_type, u32 fourcc, u64 modifier, + u32 rot); #endif diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c index f842c88..d5822a3 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c @@ -239,20 +239,20 @@ struct drm_framebuffer * } /* if the fb can be supported by a specific layer */ -bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type) +bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type, + u32 rot) { struct drm_framebuffer *fb = &kfb->base; struct komeda_dev *mdev = fb->dev->dev_private; - const struct komeda_format_caps *caps; u32 fourcc = fb->format->format; u64 modifier = fb->modifier; + bool supported; - caps = komeda_get_format_caps(&mdev->fmt_tbl, fourcc, modifier); - if (!caps) - return false; + supported = komeda_format_mod_supported(&mdev->fmt_tbl, layer_type, + fourcc, modifier, rot); + if (!supported) + DRM_DEBUG_ATOMIC("Layer TYPE: %d doesn't support fb FMT: %s.\n", + layer_type, komeda_get_format_name(fourcc, modifier)); - if (!(caps->supported_layer_types & layer_type)) - return false; - - return true; + return supported; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h index e3bab0d..6cbb2f6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h @@ -35,9 +35,10 @@ struct komeda_fb { struct drm_framebuffer * komeda_fb_create(struct drm_device *dev, struct drm_file *file, - const struct drm_mode_fb_cmd2 *mode_cmd); + const struct drm_mode_fb_cmd2 *mode_cmd); dma_addr_t komeda_fb_get_pixel_addr(struct komeda_fb *kfb, int x, int y, int plane); -bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type); +bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type, + u32 rot); #endif 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 8c133e4..711dadc 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -252,6 +252,11 @@ struct komeda_pipeline_state * struct komeda_plane_state *kplane_st, struct komeda_data_flow_cfg *dflow) { + struct komeda_fb *kfb = to_kfb(kplane_st->base.fb); + + if (!komeda_fb_is_layer_supported(kfb, layer->layer_type, dflow->rot)) + return -EINVAL; + if (!in_range(&layer->hsize_in, dflow->in_w)) { DRM_DEBUG_ATOMIC("src_w: %d is out of range.\n", dflow->in_w); return -EINVAL; @@ -337,7 +342,8 @@ struct komeda_pipeline_state * struct komeda_layer_state *st; int i; - if (!komeda_fb_is_layer_supported(kfb, wb_layer->layer_type)) + if (!komeda_fb_is_layer_supported(kfb, wb_layer->layer_type, + dflow->rot)) return -EINVAL; c_st = komeda_component_get_state_and_set_user(&wb_layer->base, diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index 5e5bfdb..aae6fe6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -170,7 +170,7 @@ static void komeda_plane_reset(struct drm_plane *plane) u32 layer_type = kplane->layer->layer_type; return komeda_format_mod_supported(&mdev->fmt_tbl, layer_type, - format, modifier); + format, modifier, 0); } static const struct drm_plane_funcs komeda_plane_funcs = {