From patchwork Fri Jun 15 13:51:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Halder X-Patchwork-Id: 10466533 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 2262E6020F for ; Fri, 15 Jun 2018 13:51:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 105FF28744 for ; Fri, 15 Jun 2018 13:51:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04DCD28D8E; Fri, 15 Jun 2018 13:51:59 +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 99ACD28744 for ; Fri, 15 Jun 2018 13:51:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77F146EB5B; Fri, 15 Jun 2018 13:51:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0065.outbound.protection.outlook.com [104.47.0.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACD536EB55 for ; Fri, 15 Jun 2018 13:51:50 +0000 (UTC) Received: from e113505-lin.cambridge.arm.com (217.140.96.140) by AM5PR0801MB1378.eurprd08.prod.outlook.com (2603:10a6:203:1f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Fri, 15 Jun 2018 13:51:48 +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 4/4] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART Date: Fri, 15 Jun 2018 14:51:34 +0100 Message-Id: <1529070694-21088-5-git-send-email-ayan.halder@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529070694-21088-1-git-send-email-ayan.halder@arm.com> References: <1529070694-21088-1-git-send-email-ayan.halder@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: LO2P265CA0171.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::15) To AM5PR0801MB1378.eurprd08.prod.outlook.com (2603:10a6:203:1f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bae5bc29-f834-40d1-f4e8-08d5d2c72408 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM5PR0801MB1378; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1378; 3:vBr1Ki/o2RbDtL345UcjbPyzT1JFUqsciIMYDvo+8v5/clL2Bj/eMPJYgt24W0KRplYzODl5xGZthFm1nUE4I+55bfnUb0rWzMQmmkDNyCQhKYtciQJ7PEC2TtPCmp2H74cXNLHQlrFv2JG/1AlQOt9zd5xV+exZsUlSfd8yR0zXSTxusBxJahXTo+IckjZoodoZpfVWyyjgJaQ/IRDDOa6HGUl2XIgUUH20Dw3l58XitCQAnbee0q01Gp3DhKNz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YMw4tD2K45CKQnHSBPLDxxtyZr9lzmtTTI8AVmwihyRU9xIfuuQlYzamqVMHkds6uy2Z6N015y7/vHjvNqW5BOiAt9XsMM2ZJmsAdM7cY5J1nSzpT0pfned1TBZGigpnBwxlk+IrqtlLZYHl7YD5B3R5GKPAp1k2C09TYB 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)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:AM5PR0801MB1378; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1378; X-Forefront-PRVS: 0704670F76 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(376002)(366004)(346002)(199004)(189003)(2616005)(2906002)(476003)(5660300001)(47776003)(8936002)(76176011)(97736004)(7696005)(52116002)(11346002)(51416003)(7736002)(53936002)(59450400001)(386003)(446003)(486006)(66066001)(956004)(305945005)(45080400002)(26005)(3846002)(6116002)(50466002)(16526019)(6486002)(478600001)(16586007)(68736007)(48376002)(81166006)(81156014)(36756003)(50226002)(4326008)(106356001)(575784001)(72206003)(8676002)(25786009)(86362001)(105586002)(316002)(6666003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB1378; 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; AM5PR0801MB1378; 23:lYYk4EWUdzrpxoxZuNCeou8grMwcTkGV0rDLloO?= =?us-ascii?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KjCQHmkU4XZD0XT/GzTfDHVpVJ4G/hOB8swrbRdCaeDORUxaqLb6m29VMj3BtUncWmY/lOLyipw==; 5:syL1wJqYnr8HTtQXCXqOQMOqXQgT4pANUZBMgO/w3RA5oaBVK+R+7IVPrOJJF6nRfWy+H1E97QV2imBufBQbfjcXwa52yosj69BrXs6W7XGNcaWDrhoU/4q3az3wvHosonocfjH0oSk8Wlq5I6KLTeO20h/MSLLjUyxeuOo1fNU=; 24:XNE5+8LvZbuNN8Ioxofs3Ld64keHEadphRcDHXDcXz8Nm/KgwKwDQD6HmBr7S1hh822wr3dA615MlQhdM1q+pNgpGaAHXwXyAa561oJPASM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1378; 7:W0FCuZSGTHe+C7tRF+pSaORkp4IuHpptB3KmsUgDe+1W7w1D7R5L0qu3121UwAPZPYHEYUXlXdFmXPyvEqp7nCsyet1TXRmVpTE7C+ugMU7a+nHHA564qthiI4+cgXHupbLzx/bzdAT29humUhB1hykqw1NpKuBJ2t34lbvkpx4oVjUSkhXqWZNCBaxlfy5EpA7sLmJUhKf2JD4fEKTGoc2FQFWYiHYePrvoHU9WVO3d7YL5E2t/AAAjIJ73aD6e X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2018 13:51:48.5302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae5bc29-f834-40d1-f4e8-08d5d2c72408 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1378 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 Change-Id: I4739ff55c0f6d5715b268cb3947ed133a9ee7c2e Reviewed-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 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..55c9a1f6 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_ERROR("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;