From patchwork Tue Apr 16 20:31:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13632585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 723F3C4345F for ; Tue, 16 Apr 2024 20:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Fr46gd5D9kGIoQLxfdYPt1LP0lq8XOYOPnxFvFJG0TQ=; b=YeLcV8ltKCNC6B 7gbMwkWo56iSaK2E65Nbcicvj4hJD1rDMjCQGJsO99Jh2bmepASkVsl7nDkbf6/JBJsqfUm0XDaAI 5gGsgdincDqr18pF3bwcsTPnLdRDMz+H2fVuNENB/ebYhvV4V70cWGGfE7rOHJamJmHnBNpqEQTWd y1zE9+CP0YXa74FSax81YL3LkkmVZiY761shef+ej6mNziI3yKVnIBBZrJh9ZgXaAX5pdrCbtBw8I sYaStM/a/r6DDn6vGqTuKAGq8Zy2wBRUOx1xknvWLz10AVLBCaZIOpwliGDZXeHxuqKGBoG56AAIF WkPJjLZnLrDQoBml21ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwpTo-0000000Dium-37QF; Tue, 16 Apr 2024 20:32:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwpTU-0000000Dij9-3TZB for linux-arm-kernel@bombadil.infradead.org; Tue, 16 Apr 2024 20:32:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=gI78DgeVSuvR0lmtMiBL8BCiSiZvCDxuOJhqcDKL/2w=; b=pAetYMlf5qjup13aBmYSksNYpq yJfPwMV784xPsz/BaUCwuoZxQZEEdkshxmQDWJWm51O7zqHcJCCGo9dB1J5hxOB0eb5ApFviRJwR7 CC3YpTm6G4XEBQNLkmg6H7BG/Y2k1ufgS3ErdFSUPYFmGVO81HVxgUFbPcXEH/H37pv34YHU3Optj UF/ztnvDuj5gZWhtRP2Kj39eYf8eSkgDdFOH1J2WxDipPbdYpzsORsDL8/5lEwkTFKWH/rliLt09Y EFHReyVaxRSnglYAIDMdQeXS88Qq7aYceJjWXj2vQqRQd6/AqMaSEoGLwDGg9/Y/wLzwOU9YWotJv l/Ug3VfA==; Received: from mail-bn8nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:2418::600] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwpTO-0000000BF8P-2FPh for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 20:32:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+6P8BgEYBlwZOozEUfeuHfR1DrGenlH94In/VHE8vrE/VYgSOcjOaf8aoPjfZqW1x58F6svhmDCsNjq+X4Kqy1xKbuDl6Q2NwJX0kDXUu0fLxxs5kPS7HRl9nwO83aAxFXtogIc185DLKCMRUoWIBMa+sZC47Qo9WWIFjmTFiXcAMevH4UpntN543pDCQbTioEwEU1y8e0XnLUi9S03lMfs4Wmh3kqVTxFL8H2pDl0XCrzQOal1Jo7bd98+0i4wlmXgL/3re4Uu0nNZZfOFMHSYa0P/E2dOxaeP6bbfweB/tHeCLvEmzwXWHT6Qdung2nSfvF2rf5AIxgXXrMlcDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gI78DgeVSuvR0lmtMiBL8BCiSiZvCDxuOJhqcDKL/2w=; b=lRqUJZR1ZaxNkQPXwZKmYCbNd/bbTt4DCoYtQfhVPkvmZT7+C3XMlU1scZCp9DDmnAWKApd9H7BeWF9+CxTg6ALF6Tr8BFGk1SK9iiUpV0c4vYk5zceKr35G3dKozav0ZUKe4d9F8T/FicllP8e12n6mHc4DKOmkkpoIYMV4FTjgrEIj/oKvhZ8z4qJ9QQueapIGW76DIsgCjRS+w7sp6Ju018Gtnl3R9vWsQtAIJCd/G7FuGSDg6TtJauRXEzsxAu9ArGuvMNxM3itQuf4D1oTvXU38EJWJh+V7vZdC0NXEtt2MhwRtQqhwrJj8VfoPPTJpBWVTj1dzYQFB7pu00g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gI78DgeVSuvR0lmtMiBL8BCiSiZvCDxuOJhqcDKL/2w=; b=XaFZ9WxR+OU3gTy/753pLU0J3NhYtQSGDcGw2HVdP/6aYIqgoGkFw7ZUuKnoVrJHUTLal83AK1ZurW9p7oY701LhlUDs8fGJBzrxZA5FoaCIL5Z03ELt7vSxvdoQQxl0bKlLMKVyZTqDyPpCDrRcR37tC/7yrko8aihKxba8JRA= Received: from MN2PR06CA0012.namprd06.prod.outlook.com (2603:10b6:208:23d::17) by CY8PR12MB8241.namprd12.prod.outlook.com (2603:10b6:930:76::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.50; Tue, 16 Apr 2024 20:31:57 +0000 Received: from BL6PEPF0001AB72.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::30) by MN2PR06CA0012.outlook.office365.com (2603:10b6:208:23d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.20 via Frontend Transport; Tue, 16 Apr 2024 20:31:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF0001AB72.mail.protection.outlook.com (10.167.242.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Tue, 16 Apr 2024 20:31:57 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 16 Apr 2024 15:31:52 -0500 Received: from xsjanatoliy50.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 16 Apr 2024 15:31:50 -0500 From: Anatoliy Klymenko Date: Tue, 16 Apr 2024 13:31:36 -0700 Subject: [PATCH v4 1/7] drm: xlnx: zynqmp_dpsub: Set layer mode during creation MIME-Version: 1.0 Message-ID: <20240416-dp-live-fmt-v4-1-c7f379b7168e@amd.com> References: <20240416-dp-live-fmt-v4-0-c7f379b7168e@amd.com> In-Reply-To: <20240416-dp-live-fmt-v4-0-c7f379b7168e@amd.com> To: Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Michal Simek , "Andrzej Hajda" , Neil Armstrong , Robert Foss , Jonas Karlman , "Jernej Skrabec" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mauro Carvalho Chehab CC: , , , Tomi Valkeinen , , , Anatoliy Klymenko , Tomi Valkeinen X-Mailer: b4 0.13.0 Received-SPF: None (SATLEXMB03.amd.com: anatoliy.klymenko@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB72:EE_|CY8PR12MB8241:EE_ X-MS-Office365-Filtering-Correlation-Id: 44045ffd-305c-4e1c-91b2-08dc5e54432f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 717mzN7iONfhb8QEmFa6i4Ua5gzYIx1haiTQOgA74U+3q2js1UPXr0W7VP0nKoclP5JvnOr6WINVppeAJGrVRA/XLyfOcECm7eLDjSwKlS9xPGL3kmcAgMQZ3PsMbHG76/+N65zM7VdXYpxdjI+yYmBp1QwLdSqnPY7sgxz1PKEPpTWFycVgrTPTF02aU5xiKzUuigRGqRlgpyKa494ltk0HnxZScd0fu44v0dh/b8JdDcxIT108e7mW2EMSsSEjuPDJ3jXCi1BHjmDrTwkLeR2675vK+WNo0riHVSJwCex/7I424nzYrV6HlJRPJs+usxGyQ5JoH9lg/bu42bxX6TDZrYkqrilU+wMV6cTi3WG0Y76foJyz4ezCkpxypoaLfNIunbjnNtHllWkS6LH6n14QQLaCUmyg5vjmr1rDfJ0mE/4NGRcadj7UXSoHPjbk3qhLG5TDeJdPnmEVfaaRjXcvMxlUfwn9LdptEe1xxXgFosp5G2cVUBiSksFPVSpResqgz8MIW8Bt0A/XdGNbHpQ9T7tPzozQcnaLYqC7ik//dVTm/jhNMGi3lXvC+EEXfaOEf7wZa+S9mxfVW3h1WrM2xtb6rGEZrq5xC8cTFrw1HLwBg3M8aH0Ll63UOAwi+PmrJF3w6Au7fH5GAEZUb/XWYrISM9dNeuEU6xqd3Jq9dp52xxkRf412oejl62FzQIJktLsI3jaYIDEWhusS+VmZWxMQilpcsVwJS+hfjBx60mzRyM5srkSPPFRXqx6UwNUTXGPtD9dwHxCiLbh1Iw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(82310400014)(376005)(36860700004)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2024 20:31:57.6910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44045ffd-305c-4e1c-91b2-08dc5e54432f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB72.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8241 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_213210_851553_E633CB01 X-CRM114-Status: GOOD ( 18.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Set layer mode of operation (live or dma-based) during layer creation. Each DPSUB layer mode of operation is defined by corresponding DT node port connection, so it is possible to assign it during layer object creation. Previously it was set in layer enable functions, although it is too late as setting layer format depends on layer mode, and should be done before given layer enabled. Signed-off-by: Anatoliy Klymenko Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 21 +++++++++++++++++---- drivers/gpu/drm/xlnx/zynqmp_disp.h | 13 +------------ drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- drivers/gpu/drm/xlnx/zynqmp_kms.c | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 8a39b3accce5..891577475349 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -64,6 +64,16 @@ #define ZYNQMP_DISP_MAX_NUM_SUB_PLANES 3 +/** + * enum zynqmp_dpsub_layer_mode - Layer mode + * @ZYNQMP_DPSUB_LAYER_NONLIVE: non-live (memory) mode + * @ZYNQMP_DPSUB_LAYER_LIVE: live (stream) mode + */ +enum zynqmp_dpsub_layer_mode { + ZYNQMP_DPSUB_LAYER_NONLIVE, + ZYNQMP_DPSUB_LAYER_LIVE, +}; + /** * struct zynqmp_disp_format - Display subsystem format information * @drm_fmt: DRM format (4CC) @@ -902,15 +912,12 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, /** * zynqmp_disp_layer_enable - Enable a layer * @layer: The layer - * @mode: Operating mode of layer * * Enable the @layer in the audio/video buffer manager and the blender. DMA * channels are started separately by zynqmp_disp_layer_update(). */ -void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer, - enum zynqmp_dpsub_layer_mode mode) +void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer) { - layer->mode = mode; zynqmp_disp_avbuf_enable_video(layer->disp, layer); zynqmp_disp_blend_layer_enable(layer->disp, layer); } @@ -1134,6 +1141,12 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) layer->id = i; layer->disp = disp; layer->info = &layer_info[i]; + /* + * For now assume dpsub works in either live or non-live mode for both layers. + * Hybrid mode is not supported yet. + */ + layer->mode = disp->dpsub->dma_enabled ? ZYNQMP_DPSUB_LAYER_NONLIVE + : ZYNQMP_DPSUB_LAYER_LIVE; ret = zynqmp_disp_layer_request_dma(disp, layer); if (ret) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.h b/drivers/gpu/drm/xlnx/zynqmp_disp.h index 123cffac08be..9b8b202224d9 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.h @@ -42,16 +42,6 @@ enum zynqmp_dpsub_layer_id { ZYNQMP_DPSUB_LAYER_GFX, }; -/** - * enum zynqmp_dpsub_layer_mode - Layer mode - * @ZYNQMP_DPSUB_LAYER_NONLIVE: non-live (memory) mode - * @ZYNQMP_DPSUB_LAYER_LIVE: live (stream) mode - */ -enum zynqmp_dpsub_layer_mode { - ZYNQMP_DPSUB_LAYER_NONLIVE, - ZYNQMP_DPSUB_LAYER_LIVE, -}; - void zynqmp_disp_enable(struct zynqmp_disp *disp); void zynqmp_disp_disable(struct zynqmp_disp *disp); int zynqmp_disp_setup_clock(struct zynqmp_disp *disp, @@ -62,8 +52,7 @@ void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp, u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, unsigned int *num_formats); -void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer, - enum zynqmp_dpsub_layer_mode mode); +void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer); void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer); void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, const struct drm_format_info *info); diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 1846c4971fd8..04b6bcac3b07 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1295,7 +1295,7 @@ static void zynqmp_dp_disp_enable(struct zynqmp_dp *dp, /* TODO: Make the format configurable. */ info = drm_format_info(DRM_FORMAT_YUV422); zynqmp_disp_layer_set_format(layer, info); - zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_LIVE); + zynqmp_disp_layer_enable(layer); if (layer_id == ZYNQMP_DPSUB_LAYER_GFX) zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, true, 255); diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c index db3bb4afbfc4..43bf416b33d5 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -122,7 +122,7 @@ static void zynqmp_dpsub_plane_atomic_update(struct drm_plane *plane, /* Enable or re-enable the plane if the format has changed. */ if (format_changed) - zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_NONLIVE); + zynqmp_disp_layer_enable(layer); } static const struct drm_plane_helper_funcs zynqmp_dpsub_plane_helper_funcs = {