From patchwork Thu Jul 5 14:25:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Halder X-Patchwork-Id: 10509505 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 CFA636024A for ; Thu, 5 Jul 2018 14:26:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC84B281DB for ; Thu, 5 Jul 2018 14:26:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE74E28FAF; Thu, 5 Jul 2018 14:26: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=BAD_ENC_HEADER,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 26AD5281DB for ; Thu, 5 Jul 2018 14:26:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C50F089DBF; Thu, 5 Jul 2018 14:26:07 +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-eopbgr00068.outbound.protection.outlook.com [40.107.0.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id BECEA89DBF for ; Thu, 5 Jul 2018 14:26:05 +0000 (UTC) Received: from e113505-lin.cambridge.arm.com (217.140.96.140) by HE1PR0801MB1385.eurprd08.prod.outlook.com (2603:10a6:3:3a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Thu, 5 Jul 2018 14:26:01 +0000 From: Ayan Kumar Halder To: ayan.halder@arm.com, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART Date: Thu, 5 Jul 2018 15:25:43 +0100 Message-Id: <1530800743-2250-1-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: MR2P264CA0047.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500::35) To HE1PR0801MB1385.eurprd08.prod.outlook.com (2603:10a6:3:3a::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a79b5f2-42fc-430f-71bc-08d5e2833c5b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1385; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1385; 3:yoGCVmIoZtsNaTIi6FcnVJXOhJhSrHemm8DvYm5YLIfC6GN3w7QHE5YVt3RMRctJEoNX5easa8//FgcOWHMPST644+lunJ/+14HeMIcp/ArfAajKKIh0p8XPtCjnhS5Jf/XTsnQMf4/vxVPekoff3cr5vfe6JBOK2O3O+gx5+RVusOH0CgjEKLJlxUWN2Jvw381V1yMkrh57PeQ84YvncClq7e2r9mWkKt83tUdzIpbfJ9QQNcSvv2XeELwx4sM7; 25:3Pr0Bly8SXJKsJxKvaJXUMeBlbw60E8RgLGXhcO5Ib5YrP/a74/Q7El15ezdgsnSCS1NA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GzNAHf7WsbzGfjTTThEB0+t6e/UodT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB1385; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1385; X-Forefront-PRVS: 0724FCD4CD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(39860400002)(346002)(136003)(199004)(189003)(81166006)(6116002)(3846002)(86362001)(68736007)(45080400002)(50466002)(48376002)(81156014)(5660300001)(7736002)(47776003)(478600001)(66066001)(97736004)(72206003)(2906002)(6666003)(305945005)(8936002)(16526019)(51416003)(26005)(316002)(25786009)(52116002)(16586007)(4326008)(956004)(106356001)(486006)(53936002)(476003)(386003)(105586002)(6486002)(2616005)(36756003)(14444005)(50226002)(7696005)(8676002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB1385; H:e113505-lin.cambridge.arm.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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1385; 23:GdUIaOpdChGNF45GMV/6vBIeS/fsN/qufB7MewF?= =?us-ascii?Q?fenSxVnFnjqLdEW+1S3TNAGHGT6NQU+uquUWPiCNEhwpsgrMlDJTYVKnFtC5?= =?us-ascii?Q?kTJB5CfGuzIuzXfOJVmuU/UG1QKy8+CdrUwveT9yQI8Uk/UwsOGHiJ/yYsYM?= =?us-ascii?Q?cP97I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y8d9U87LrlTtT5tWF6yXPLNAE/IkPx0HpbCd/kuYEGqsNqu1UAVanKpJrJyoRK8qXkiGuRJ67NIPi/ZMp/xMV+X9IxDmMFrhqyzPonB1VPxA=; 24:eeCsDwGQfq1jetFF2pMpDJsaITb9058xYrCxLx51R3Pr+rsjkRrxCuH+O5GlphA19dHdr8fh76N42Pw4N/KP0PnZzhGuS0keErxYS4aw7yQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1385; 7:eKf0McyZM9SZlzuK+5e5NMMeGr03UD8nFA+NGy7Hpmnrr9cBo5PhDjBPHiL9Gqz0NsCw3+yF15EuPYlToOzHxsrmVCtVqkSuMd6TwoiUjOZSiIVSI564YUiVn4vJAYGcJykHcOuC8d9VvLIN6bn6yM8pAFEh1X35SBqICx67MaFOOjMyJkHVWqthZ8KPMbdGbZaxJhfBgG2SV0Qvwy4IqvXyYDhvczCxVd7v7Bz9+ZfqdBoHxTWii4Ga0U09IFOw X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2018 14:26:01.6656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a79b5f2-42fc-430f-71bc-08d5e2833c5b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1385 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: nd@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On planes which support AFBC, expose an AFBC modifier for use with BGR888. Signed-off-by: Ayan Kumar halder Reviewed-by: Brian Starkey Reviewed-by: Liviu Dudau Changes from v2: - Removed the gerrit change-id - Replaced DRM_ERROR() with DRM_DEBUG_KMS() in malidp_format_mod_supported() to report unsupported modifiers. --- drivers/gpu/drm/arm/malidp_drv.c | 1 + drivers/gpu/drm/arm/malidp_planes.c | 46 +++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 7b6a848..7bcd679 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -392,6 +392,7 @@ static int malidp_init(struct drm_device *drm) drm->mode_config.max_height = hwdev->max_line_size; drm->mode_config.funcs = &malidp_mode_config_funcs; drm->mode_config.helper_private = &malidp_mode_config_helpers; + drm->mode_config.allow_fb_modifiers = true; ret = malidp_crtc_init(drm); if (ret) { diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 3950504..914cc58 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -124,6 +124,35 @@ static void malidp_plane_atomic_print_state(struct drm_printer *p, drm_printf(p, "\tn_planes=%u\n", ms->n_planes); } +static bool malidp_format_mod_supported(struct drm_plane *plane, + u32 format, u64 modifier) +{ + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) + return false; + + /* All the pixel formats are supported without any modifier */ + if (modifier == DRM_FORMAT_MOD_LINEAR) + return true; + + if ((modifier >> 56) != DRM_FORMAT_MOD_VENDOR_ARM) + return false; + + if (modifier & + ~DRM_FORMAT_MOD_ARM_AFBC(AFBC_MOD_VALID_BITS)) { + DRM_DEBUG_KMS("Unsupported modifiers\n"); + return false; + } + + switch (modifier) { + case DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | + AFBC_FORMAT_MOD_YTR | + AFBC_FORMAT_MOD_SPARSE): + if (format == DRM_FORMAT_BGR888) + return true; + } + return false; +} + static const struct drm_plane_funcs malidp_de_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -132,6 +161,7 @@ static const struct drm_plane_funcs malidp_de_plane_funcs = { .atomic_duplicate_state = malidp_duplicate_plane_state, .atomic_destroy_state = malidp_destroy_plane_state, .atomic_print_state = malidp_plane_atomic_print_state, + .format_mod_supported = malidp_format_mod_supported, }; static int malidp_se_check_scaling(struct malidp_plane *mp, @@ -524,6 +554,13 @@ int malidp_de_planes_init(struct drm_device *drm) u32 *formats; int ret, i, j, n; + static const u64 modifiers[] = { + DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | + AFBC_FORMAT_MOD_YTR | AFBC_FORMAT_MOD_SPARSE), + DRM_FORMAT_MOD_LINEAR, + DRM_FORMAT_MOD_INVALID + }; + formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) { ret = -ENOMEM; @@ -547,9 +584,14 @@ int malidp_de_planes_init(struct drm_device *drm) plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; + + /* + * All the layers except smart layer supports AFBC modifiers. + */ ret = drm_universal_plane_init(drm, &plane->base, crtcs, - &malidp_de_plane_funcs, formats, - n, NULL, plane_type, NULL); + &malidp_de_plane_funcs, formats, n, + (id == DE_SMART) ? NULL : modifiers, plane_type, NULL); + if (ret < 0) goto cleanup;