From patchwork Tue Jul 10 13:18:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Halder X-Patchwork-Id: 10516985 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 2058B600CA for ; Tue, 10 Jul 2018 13:19:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E64A290A1 for ; Tue, 10 Jul 2018 13:19:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02735290A4; Tue, 10 Jul 2018 13:19:39 +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 91FA2290A1 for ; Tue, 10 Jul 2018 13:19:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A02D6E757; Tue, 10 Jul 2018 13:19:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40051.outbound.protection.outlook.com [40.107.4.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id E92FF6E72C for ; Tue, 10 Jul 2018 13:19:29 +0000 (UTC) Received: from e113505-lin.cambridge.arm.com (217.140.96.140) by DB6PR0801MB1384.eurprd08.prod.outlook.com (2603:10a6:4:b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.17; Tue, 10 Jul 2018 13:19:28 +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: [PATCH v2 4/4] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART Date: Tue, 10 Jul 2018 14:18:57 +0100 Message-Id: <1531228737-5450-5-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531228737-5450-1-git-send-email-ayan.halder@arm.com> References: <1531228737-5450-1-git-send-email-ayan.halder@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: DB7PR03CA0037.eurprd03.prod.outlook.com (2603:10a6:5:2a::14) To DB6PR0801MB1384.eurprd08.prod.outlook.com (2603:10a6:4:b::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fce8b00b-5dd4-438a-a906-08d5e667c3d1 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:DB6PR0801MB1384; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1384; 3:shMgxN6YobBYwTovnj8O1sRis90si9uHgQAG3eTQ/rAOavArEnVQt7JFHJdatmXyLqhK3mN4ysbp23gi4w31iqNhs6BN57rcwzcI7cMSFocnfH/ltGRgR0n/UQj1jIVZu97UKs+7g/aTLyQuikNgUQs7dO5RnpjETazXZVZUdlR5mbDjcsoJ4xxQaFqEtBHrJws1Mgg8FA4cvMB16CEZ0bJDpCgdEMMKX7pCoLqMBVQMc4i1NUzH4PrEGJ8lrGui; 25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kzngKYNw3/r6snDXjqZEXcCZ1rPTZYULh/kFpnlgO0iHK48qbJC+kAgV5PM/rRfPXusrI+eOz8KdSIMqTXQl 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)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB1384; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1384; X-Forefront-PRVS: 0729050452 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39860400002)(346002)(136003)(376002)(199004)(189003)(51416003)(7696005)(52116002)(5660300001)(26005)(386003)(36756003)(7736002)(305945005)(6666003)(68736007)(16526019)(76176011)(8676002)(106356001)(446003)(50466002)(97736004)(14444005)(2616005)(486006)(11346002)(956004)(476003)(72206003)(48376002)(3846002)(105586002)(4326008)(25786009)(2906002)(6116002)(53936002)(50226002)(81166006)(81156014)(66066001)(8936002)(47776003)(16586007)(86362001)(45080400002)(478600001)(6486002)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1384; 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; DB6PR0801MB1384; 23:wl0yGmIIHvhgIIAKaZDz/eG2JTxWl0KjkSNh2oq?= =?us-ascii?Q?ecLRjHsl+i5J8XVl/rDByPcN5RD0DNjeQqEzR6ypSq0gBg1cHkH1SKceCD/t?= =?us-ascii?Q?zDKWLGb/6Lj/uZd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DsYsAU0unjv4vcYW5/Q4RuwcUk4U5u45ZzFETxpK0ffX9aEWHHadNQzicItZVqxcAkNxr8BzbJWMbsMlQ==; 5:yZnrNK5gnQsOhO+mPQSYDL3+nhJOOQ6uBl/bMGYzbwuu3v3WduWxCR7RxXZQeFkDmOfEc7b5w3z53gRSacMZn18/WjKn/opwI/7OkjdFFZWXimJ/ErXuaCspppnj/XNQ1BU7HftXUQu3bmEhLL0FIIcoUXb3tTeJMpELWjBFq2o=; 24:F1Z7PVcJs3sdQnYq0qqQusu8j7nB8azOMFWu6kVfF1C9i0qVH6sEldDQK2gpngPqHFJ0KyjuXDVdd36L3ee21MNYvQ+1oT8QvOjbjhlhUK4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1384; 7:EB54lUoBz/wQn7XmC7gtqe7G3BZ1oxMVxIkcnHtcx8rNLRfeQ9YmzyxEmftmSTakPBbZihVy/bNxHVO1WLbOLl0mwG4LS+Spl/dTIfgeLipNeBN1HfsdzSNPoW+EvmGA4o1eZTsgDHVSPZzfhKyQzp88BFI8QHmevGATwUq097DhkKZ5vJIlsH/SGsnJBITWsasLrFIWZW6htvoYuPbRujxWCGNQmKZHCHOa2WM92/5o7vZQMQFl3fszFD5FU1g3 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2018 13:19:28.2329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fce8b00b-5dd4-438a-a906-08d5e667c3d1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1384 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. Acked-by: Liviu Dudau --- 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 262a830..4f6e52e 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 0122091..605c5ae 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, @@ -526,6 +556,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; @@ -549,9 +586,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;