Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1424245lql; Tue, 12 Mar 2024 17:55:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXq9mpUI7+9LUc4ds18YHhNCMB8xX3YpLQOACE+dv8alncYlD+CvEZ80KA9Lvy1g9bqCWQL9T/WpEabj9pl5sWPdqrgJBjBdKb2S8zh5g== X-Google-Smtp-Source: AGHT+IGCiIpUoJoRnAhe7iHmejAXgiEtD90x8gpk2WdDm/+xfkfYwAjyBKpo95WCAKtoNgvXkb+L X-Received: by 2002:a17:907:1819:b0:a46:5941:8927 with SMTP id lg25-20020a170907181900b00a4659418927mr204046ejc.68.1710291333342; Tue, 12 Mar 2024 17:55:33 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw9-20020a170906478900b00a464cf9451asi590328ejc.252.2024.03.12.17.55.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 17:55:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jWAROU41; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-100976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100976-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E19AD1F227C9 for ; Wed, 13 Mar 2024 00:55:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC162BA37; Wed, 13 Mar 2024 00:55:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jWAROU41" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2045.outbound.protection.outlook.com [40.107.101.45]) (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 92F086FCB; Wed, 13 Mar 2024 00:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.45 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710291312; cv=fail; b=C1geDOYnuL78c81ZR3tdpDP0kEVXnFCbdh3YTQVkEa01IKcjXW+pQXZOAWTnqRylaDlcfOpyTwh3mz+scM8lmhA3FwFJHIJGyRW/gvBNIl6wh4U0+btsRs3aZgKl1Wnry9meYbaP9L1J1Df3G4G9CdrDapNg5Y9NYHhcnXsUYnY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710291312; c=relaxed/simple; bh=CPbM2BrEGM07YF7niBevAi4iSjCuqvWP19jmiHG5PdU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=sJGpqyUsJ97p/iBIvH3zwO9c5uoa6t/WFYZD37ESi4OVa6s4CXkf30mLLhJnsDqC2ZpHEA1qJiGogr1HnzTE7ibgji3hQZIEK56B7iGFbXbOFn2P/heMpFkjmX4zbFp1X0wPdpo7gifggikNzg4/ppAprr/F+A7TGv2UXSmRBcA= 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=jWAROU41; arc=fail smtp.client-ip=40.107.101.45 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=MgvdXdyten0CaFL76UgsMQLj3kch/GelUhg3jq3hfb/R1k4YEtCkiGJAZauSBFJzs6HUHh0z7Cowokl1rgYNCXXPXnULoP0RR36CcSlk7N/kF82Y3kbKn4ha+tGi3lhEZOhY3bwao8IEke/TurEBCNLAzagAz7S0861xAMdITSDlebSnVaUo0RnoZFUi/ei77vvRa3ujcZTT+hTPF/ohot8/cvzYD3a+VPNXGHQaNDKEJWS82ar1By9e6P49uTR9Lh5pokRkguLy8hwQYuPbxxKRHU53PdQyyRreqfv7v6t/SzGCmjZrLoZn6bVe2rHWMWbxqFXbNsx8p0mnW+rczg== 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=zP4EV/pG2As/itVcnlKhw4oWiqWoz0FtggQhdNxJwso=; b=dbqQxMTYyYv/LchrMkG+lsYyfXl9KVvMJI3+d2srJZLQVUemMRXVbEiqZjyfV8CEkquZu9GNbU1OSSxCtmsj2nHoeblMw27YfA7XnRdcQBpHwwf1glK8UIIgSwFnRpGnvzfuC/lRgWOc7WS7VlG4CqSSX8sxDHywAM4PNkNB0rVJOqPpNMOKDFd6dVqpZOwrz0SYd+8N8ARbf/SbwYrygx7bjgim/wWlJTTYNMGtCa2d5cX4LUgq0554bP3m5rgl92S518JNe9EmsPqj65ao1qyPDzDOwf7gwjBmo81Bm5x35VSg0u+XWyCChYk4pWczUIMRVeI7FUVsBERIDO+Z1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kwiboo.se 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=zP4EV/pG2As/itVcnlKhw4oWiqWoz0FtggQhdNxJwso=; b=jWAROU41pwBOaPaTv79fX2OVNUhmMciKv4RpGFqTnI3C+Z02HlPZg1oDR1xZAkTdwoMowcUZGcZNFDPRUHSDsy3Nclmv9NP1j+4RhrmXoWLF4N2EBPSeK/6W5OexsvIMLxd39M79bGNiguHSd4AJSDdpLhD+oja2CCwFacbskRg= Received: from CH2PR12CA0012.namprd12.prod.outlook.com (2603:10b6:610:57::22) by MW4PR12MB5603.namprd12.prod.outlook.com (2603:10b6:303:16a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Wed, 13 Mar 2024 00:55:05 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:57:cafe::11) by CH2PR12CA0012.outlook.office365.com (2603:10b6:610:57::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Wed, 13 Mar 2024 00:55:05 +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 CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Wed, 13 Mar 2024 00:55:04 +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, 12 Mar 2024 19:55:04 -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, 12 Mar 2024 19:55:02 -0500 From: Anatoliy Klymenko Date: Tue, 12 Mar 2024 17:54:58 -0700 Subject: [PATCH v2 1/8] drm: xlnx: zynqmp_dpsub: Set layer mode during creation 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: <20240312-dp-live-fmt-v2-1-a9c35dc5c50d@amd.com> References: <20240312-dp-live-fmt-v2-0-a9c35dc5c50d@amd.com> In-Reply-To: <20240312-dp-live-fmt-v2-0-a9c35dc5c50d@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: , , , , , Anatoliy Klymenko 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: CH1PEPF0000AD76:EE_|MW4PR12MB5603:EE_ X-MS-Office365-Filtering-Correlation-Id: 4041570d-faa5-4ef6-5827-08dc42f83892 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dHShAGqCq6jfQDb6nusflru1CKxKJPZu3vN1mS0jNWF3hKdrBJ0aXHYkSm2AebR81l2M20NnylcbaxP7DN1P1bcEyEdLFMcC0cs0qOroZzm7Uu9VmEtVqiKc6zOR2hYv6KemkQEgyUcOl5RydOJJH3S3AJJ3dDGmVyKzCXNrvPa5oBNI1x/3RFJdsfbyB8Mi3ITSPJnDDEM/gaEbGY3fLBg3dRGJqRzX0Zmt+cBu6rOlA2Fl4Bur3nCld+b7VWWE1CEB5PBbLbdB7vYZECkAjixb1YII9/7RFhVFBtb3WuOWnR5MD/B91JusKWymXje7xm0pFvRfuY7V1bZQPHzDTkX8/lVBUZZ//RtSI2bRLyrigA6JIDFBa+D/6ClAI2O6UyIHc24rxqJJrVJ+QWYkHg9xBjiXlFQtd0UfW6ZL9KWm9YbzvSHyHM488HZpwr2dx7M02DUO8g5q7F2EUd1pcCiTk79RNTB/RMEjSW+UArEQORf6Yjd5ykWOepx9YxnLAfecdEK/MNJmvQgCGgqdO5EvvxJWk+oiLuwGmfAkS3JG7H/CtV7OPSa9paNQShnbxK0GyqG+FIBXw+Mujjy9Es+uWIkApTDcvbojtE3ZqQ1cPh9lKDHpvWVqMejXRez1M8T9YGpb3/cz1RdmcQniTAArWVQdtAhrQ2rnPsFLaXfWp1MMG4/dd3/ZzILSqdW3aldqgIQDDJ806lvgfrYKajrmoKLVVG1DhbPmNeZ+BMiCguHBqkjNDBohta21BcVa09AfxEHw5uQQ5L1af/y91w== 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)(36860700004)(7416005)(1800799015)(376005)(82310400014)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2024 00:55:04.7580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4041570d-faa5-4ef6-5827-08dc42f83892 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: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5603 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 --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 20 ++++++++++++++++---- 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, 19 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 8a39b3accce5..e6d26ef60e89 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,11 @@ 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 = { -- 2.25.1