Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp729025lqp; Thu, 21 Mar 2024 13:47:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUVVcxAJ5MOrIMpeZjknUhuWA8w0Dhl8mOp2pIhuP1DfehBve2BZk2v8KJmwFCPiQgVZes/er/oK+QTyUNrGszrjlwT8TUK0QaW53LfQ== X-Google-Smtp-Source: AGHT+IEg9oaZBlg6H/hC2QB68ypbIPoQ7yoUH8LFiKvtuKa3KFLWkXDrYHv4UOcjpEm1XJS6R1bj X-Received: by 2002:a17:90a:4cc4:b0:2a0:245e:1d13 with SMTP id k62-20020a17090a4cc400b002a0245e1d13mr460979pjh.12.1711054057364; Thu, 21 Mar 2024 13:47:37 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i13-20020a17090acf8d00b0029dd816e84fsi4078154pju.180.2024.03.21.13.47.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 13:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="y/7qRhfP"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-110660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8D1BAB22B90 for ; Thu, 21 Mar 2024 20:46:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C9A913791A; Thu, 21 Mar 2024 20:44:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="y/7qRhfP" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2087.outbound.protection.outlook.com [40.107.95.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4AF5137748; Thu, 21 Mar 2024 20:44:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.87 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711053853; cv=fail; b=QCxT64XOed2ZahMt0LwyhhC/33BCsyWt1O5QpgVOubP284zaVWYNBRpzgSkEQ2wn9NgxDD5O2rWleDlRkb0zhjm8TYjs9JrxqJAUW0lCtHHbDqSdyn9vLOO3SL+BcfVJQBctQpnRZGIWGMyZj9hmzr8MAf4jZlaYN/dv8nb2DBo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711053853; c=relaxed/simple; bh=yo/XqrpT7rQWq98u9SD2LLhp/LEWIrDgQiF9jkNbmSI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=mP4+HDFbfUZz0NajQI6fFhMoPWtWNxRXhePOWd+gU5NZ3xTBrsef4Uvk8qkt+7bV1BqwICLgR4PJEn/1zxHxs+v8IG+RW6WuL3Hqnxjy4kJ1yOPc3hn+XVUs9OX/xViHc+AFIB+Sl9H9HqBzv1gTPRh48QEfrM3SeqqNcRkpZtw= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=y/7qRhfP; arc=fail smtp.client-ip=40.107.95.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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 --- 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]; -- 2.25.1