From patchwork Thu Mar 21 20:43:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599373 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 71E19C6FD1F for ; Thu, 21 Mar 2024 20:45:10 +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=lrTlp0EPhPHMN48JhQCm6LQioJptFXRL83+jBgm0wE8=; b=CByYYkArQ2fUGO u6S/SJ8dKskGBHp7oWuBvozVrPr6tBPCaOJD4GSkcf35U2q/PwZQNLLkzR+3MEn0e93jFqDyJfozV gvKvMGqHj+5qGcxTjn9heaKppa98pfEVgPKrQdj79K7dLjJYrtG9wEAv7flMboUDYMZjuCEjxhZpm scA/tTZZ/t5pQ2pEpvgySgesd9z3Y0wbf7h+4yARMdr7Ca/FX7k3nHdDM5FdqgOJT5ppb6K/H25LF KCscBDuupD6tQVOj9g3A4j0OUCruvE8vxABjgouteKO1ux0tKbrT7mW7XloYE02hiCgdzLsmYQc78 esyGEc/2at3vQrVdhDGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHU-00000004ZSm-3rAT; Thu, 21 Mar 2024 20:44:56 +0000 Received: from mail-mw2nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:200a::601] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGn-00000004YzF-1Og0 for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dXE9cK7y0YTNTY03z38ikZpihLXvyGTXxu8VcnwGS82qWL5xdh6UO889l+vGCqnPgAFP94n6ifBHQWvVcYM46Mpi9YKZcG94SfQwUJh9gF/O2KJyahxVybjz0RlUvd9ay1mnt6wy4JKr/COkvnkTyeVIwH9fwTGGsRyosVc5bE1bRb/nBYHTRs6D6gyribRT26V63x4db5a0RWZ4PpHA93oJuISjQeN0SqBw109vLQnVPwArojbu3mIC+PcxyICi0LWeX4YxZ0SILbcd3hLxB6NJTgadBai0HEveLGgPdOJkFiBwpazxDvPKfbdymJkQqkfmP+zVZaf08fug7Sl83A== 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=cjKa660Fh8XIC5VWjeV/p1RJCfTdPanwEzPrEQM6c2k=; b=O82HwBEzrV7rbgQk4zS4LGqOE2JerHd7HdpZWVUV6FngTyfK+SUhH7daJ/dH3nuo79nQ0+8lBaGcUWGGJsKoE9YS6pkEwqSwAFKre/GTOFocdEQa7hEO7CeNYweNXKX13qZC8llrAXr1V7kptVY0fU/ET6mxJs3cWtBhPAjFUl/G3ZiYIW+oneAVntCZuLc8fkp1mc4CWltT7DTRt7s+CB+DV5gH3VYufkHLPB2gkQ4nsi9ZrbTrYAcQ+1BSXxTQtWuRidMIwWGMxM+kHYSlgvzIO3RA+8iB9xtEtmih3StWU9xokU2et4UMpj08iUPbe0PR76bLHnzncz857K5zUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=cjKa660Fh8XIC5VWjeV/p1RJCfTdPanwEzPrEQM6c2k=; b=y/7qRhfPekksjFaE5U0cF+GaEQJOy1BdZgvFtxUDhpyt+4nP7su43W3ffTgqeXSGhAycVHO42yK78mY/HT8jPGSC24SwBS7HZru4c2cNiAed530NUwSkU7TlYQMiZBFFcGjWBOjGBmJeZWcINAffzGDzW2V9Q2MqPPqvVFtM83E= Received: from BN9PR03CA0153.namprd03.prod.outlook.com (2603:10b6:408:f4::8) by PH7PR12MB7354.namprd12.prod.outlook.com (2603:10b6:510:20d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Thu, 21 Mar 2024 20:44:07 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:408:f4:cafe::2b) by BN9PR03CA0153.outlook.office365.com (2603:10b6:408:f4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28 via Frontend Transport; Thu, 21 Mar 2024 20:44:07 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B077.mail.protection.outlook.com (10.167.243.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 21 Mar 2024 20:44:07 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 21 Mar 2024 15:44:05 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 21 Mar 2024 13:44:04 -0700 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; Thu, 21 Mar 2024 15:44:03 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:43 -0700 Subject: [PATCH v3 5/9] drm: xlnx: zynqmp_dpsub: Minimize usage of global flag MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-5-d5090d796b7e@amd.com> References: <20240321-dp-live-fmt-v3-0-d5090d796b7e@amd.com> In-Reply-To: <20240321-dp-live-fmt-v3-0-d5090d796b7e@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 X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B077:EE_|PH7PR12MB7354:EE_ X-MS-Office365-Filtering-Correlation-Id: b4e663a4-36e3-4297-63fa-08dc49e7a769 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U7i9EWg510ChJ7cgLQc1jgJtp6LIRVdQKnt1/SwbA7VCtSaX2zfDThabg92HPnHRYh66+e+LwpU3Oyl/0pzm3u9qcv4thNxHzeIibXv9LOGBm42Xdo/CMMr7K6NQ3JcRwYCu7TYqdL/u1l8INGf+oZvOrAewrKSKoy4MsYUVKWRf9/nJ74VkoCqHDwfkK03EGtKDetT3Uy3ZEQk6wKSgbzrbqYwnojx1LQzZMz0++TEppFSoHaTYgfkZvQ2J4hfPoQjmtqqRtBvCit7WrqSropZ2Y4RQsIJm07rsb/G1kq8d9eaDfJlNkBIdzGbcVg3+2/4pKBx3js3Rj/Sj7PuZEYPNTvaEBY0NXdld3R6kx3C5CvkVb34ht6dJLFLXVrqqcxH6/v47Svvq5N0TJQtQqGXDaxli+piGWI76ddnrTV4aRX3OYANB++r2GsitV0azzoBZs2dEgiRNIK/q0dPscJzR50vQDoFbMVrU2Z3ocZfI2WliSWzB7+vnP4g0MCsaBF+EyBP54jYRPmslMD2C9gsz1nwots6IiMQre3PiD85Dq6DgNnRiGhY1Kua9ZKm//c6l1y+aEOXhFo//6IN50HgYmCAA3/gcR1MYLA5v5FrbCnsJ1jK5rOlt1AbnGRS/Hh34TA04Fm5hOpw37s3ip2R+v7tcbyeyh45sn/HYE3Eq7hY6GMlnskKby3jL837QY8POl9f5Mgv2Bhg1a4fUDPGWTOTqH4Q0LGy6OeWi0y4wdxwEo5vy6gXiJgPWSFDmEnZ05WyTAaXtizhejqfOZA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(7416005)(82310400014)(36860700004)(1800799015)(376005)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:07.2399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4e663a4-36e3-4297-63fa-08dc49e7a769 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B077.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7354 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134413_618869_4B26C233 X-CRM114-Status: GOOD ( 16.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 Avoid usage of global zynqmp_dpsub.dma_enabled flag in DPSUB layer context. This flag signals whether the driver runs in DRM CRTC or DRM bridge mode, assuming that all display layers share the same live or non-live mode of operation. Using per-layer mode instead of global flag will simplify future support of the hybrid scenario. Remove redundant checks in DMA request/release contexts as zynqmp_disp_layer.info is well-defined for all layer types, including the correct number of DMA channels required for each particular layer. Signed-off-by: Anatoliy Klymenko Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index abdc3971b193..0c2b3f4bffa6 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -980,7 +980,7 @@ void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer) { unsigned int i; - if (layer->disp->dpsub->dma_enabled) { + if (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE) { for (i = 0; i < layer->drm_fmt->num_planes; i++) dmaengine_terminate_sync(layer->dmas[i].chan); } @@ -1006,7 +1006,7 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); - if (!layer->disp->dpsub->dma_enabled) + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) return; /* @@ -1044,7 +1044,7 @@ int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer, const struct drm_format_info *info = layer->drm_fmt; unsigned int i; - if (!layer->disp->dpsub->dma_enabled) + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) return 0; for (i = 0; i < info->num_planes; i++) { @@ -1094,9 +1094,6 @@ static void zynqmp_disp_layer_release_dma(struct zynqmp_disp *disp, { unsigned int i; - if (!layer->info || !disp->dpsub->dma_enabled) - return; - for (i = 0; i < layer->info->num_channels; i++) { struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; @@ -1137,9 +1134,6 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, unsigned int i; int ret; - if (!disp->dpsub->dma_enabled) - return 0; - for (i = 0; i < layer->info->num_channels; i++) { struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; char dma_channel_name[16];