From patchwork Tue Apr 16 20:31:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13632587 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 4FEF6C04FFF for ; Tue, 16 Apr 2024 20:32:55 +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=Tm7TBB5KKrApePa6rwTWge5LEgtn+PTH9FziJ8W9hVY=; b=oRaazVkarXze2u zvVeU39MbzE5CRUBUveHWn3qbulDhleXl00S/KYwaGldIyGinT1OFLIKI/vLGbd9cqru/oJiMXQV8 m3MCb+pR35Puoxed6wCmMfl1Lo4Xfr5h+kCCqBP4jvBVS+7ztoPvmY5Qo95sUvbjrHYQX4ac+4IQm wWbOgdeUz5SlZ1WirVY94vJk3T5VX63tNlJdbrHLrCS8ZJiHmGW6EOqs3APpLd8fYuBMndO6BXRP0 upe9vTH8prB4A4sbopep8mFjRmQ3EmTkmDPAbh6sGq7GlUjLJC9xkO8AkaQVpSBjVOEyBLDKkHIYt ddk4ZNoVffhkgjWdo8XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwpTp-0000000Divq-3Uep; Tue, 16 Apr 2024 20:32:37 +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-0000000DijC-3TRw for linux-arm-kernel@bombadil.infradead.org; Tue, 16 Apr 2024 20:32:17 +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=SwSfwu+mLADPdCZDXGU6Dt5Ba6S34HX3cnX0JXk+hpU=; b=QWsyq1n3OKqHWThiNsQ1YcNc3d HG9cz4YgCx0tmDDXbSBRHY7K/WMRVopJY41Sc8T7+rfbl+hhsf+fDvM1XQTpwSXZMlrGzCKxYc1Lo 3/Ol0tj4T7M3bdwJqSYyqv0WvMwzxLYiHlDng4lNaPJBGmuLl67e2XYHmr605eXVW7CeglhLCZgr/ gMfxlC900uwNMsml+x+tnLX+DtHZ4D8/SthBKwYKZfYt+bc6c9uATTojU8D9XRCCas8VDE+ZI/eMI CMh91Cc+w3nbQh2PDmZK0bdIVdfGNSSEKsx05JyrUCjrABseG7aU1OTOYr+3mLFZUYEQgIl9SiaSz h7zUICjg==; Received: from mail-mw2nam12on20600.outbound.protection.outlook.com ([2a01:111:f403:200a::600] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwpTN-0000000BF8I-41dR 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=gADZ7wfsFzF9QnieQD0WKuCmp56dTnKi+sWm0luf1E8yoItgVtylg91xw931Vo4Xep3xTcJuhh2BWsi+fnHlJhMSqD2Ug8BF0xMD0+8jCNuGSTY1v9z1q2uGfFdjsnj7NvOSbp9kqvVK0u0ytvFWYaUQYZOB+bHypszaIdyNaEFsDHXAxe2rva21ZUv3lGqw7eCHfHZsCB8O13/17IrXkSsWtTdlvlmDt/TFLJSo+ytiRhH+l+ggbxCvrxycSahH3uD+i/hf7a+r8IA9L4BXDjo+O1icsGmA2S1vGB+ylFHFcr6z5dGv+BIEv73zWg3cEcbaji2u0zd3qVIdoDhVoQ== 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=SwSfwu+mLADPdCZDXGU6Dt5Ba6S34HX3cnX0JXk+hpU=; b=ajdPIjScZq+iiYMlkK8UqIIZUQJqP88Q0wzs7BdVNC6ej80MvQB8RRtGx231H/ZcxIp00ymAyI+rLN7tLKxj1e+FoaqobAHFObAe+8MNy9YNjSXpLaVw8/P3hujGBH3MO4detZq5pOTjsp6kvj+51+7+w847PWYrklAbpIa8yfOyPdEqChj9J1nOKouGth0zBo9FEFGMNssxHy0nHg6UeEDMJ9SIxrYjvpUsjM26cKcQSYJS1UlU6TWMa9iccCKZaua5IMBYw/V52gEIE6RLnRi/gFJNrXFR2D7NeQjmFY5bxuFgaxTca66NdGKgiCLitVt8gqZctW5oUbRiwu17+g== 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=SwSfwu+mLADPdCZDXGU6Dt5Ba6S34HX3cnX0JXk+hpU=; b=HPzXMUroPY9gs/8yY0kL1tIm5XqvKehCmoeF/hWPZPoYeJ2mCSr4vOPQVJZnhc8rdQfzRQ5jVUUFByVDhuS75bCH2WZnYZDKh20ImspUrcpUvievydQzJYDWwICMNamM3tNaDlpsictw17bMdqAWwMo6Uplqqi5Pv1oB7dkmhYo= Received: from CH2PR10CA0010.namprd10.prod.outlook.com (2603:10b6:610:4c::20) by CYXPR12MB9386.namprd12.prod.outlook.com (2603:10b6:930:de::20) 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:56 +0000 Received: from CH2PEPF0000009A.namprd02.prod.outlook.com (2603:10b6:610:4c:cafe::17) by CH2PR10CA0010.outlook.office365.com (2603:10b6:610:4c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 16 Apr 2024 20:31:56 +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 CH2PEPF0000009A.mail.protection.outlook.com (10.167.244.22) 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:56 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Tue, 16 Apr 2024 15:31:55 -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:54 -0500 From: Anatoliy Klymenko Date: Tue, 16 Apr 2024 13:31:38 -0700 Subject: [PATCH v4 3/7] drm: xlnx: zynqmp_dpsub: Add connected live layer helper MIME-Version: 1.0 Message-ID: <20240416-dp-live-fmt-v4-3-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 (SATLEXMB04.amd.com: anatoliy.klymenko@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009A:EE_|CYXPR12MB9386:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c41dcce-124a-49ed-4c68-08dc5e5442a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s+3lSBZHv44eqHItZ7JrikSq7+38vZ3InvjXQ9pnZNCSb32SBmouOpyP18UjQC9UvLrvUCCiOb7Ap4JIYQewrdp/HwbZ/xVPFyvwDh9xAX1n1LPSTL5UP68R+aiAVFNwmFTyCiVcGKif3+IQwrAHRPBcIQLoh5viIrZ/I+XLEMWo9eRdPSFic+SWeGnee4e/LqiiQXhWJn6Cnlj/mFOZnUocH+UdecYbtYp7JGNlyuB/vYxYCjGFzCNoPmMT+TxAlUr+oc1LQ6++v9LId3hWh74VQ2UInCcuIpK7JNwfb7fRX60iu98pEoqv55arevPYy+JRRpDdsbERQ5ElFpqB9pd0cMWBgjIQrIEVwV03FfPfemaL0ecMhjcZCRydrT9uBbIjXjCAoCEYkUL9POSbeLzUjGWXDn3G9OeF9iUGpRM7pTVt4hFQWhg1K8wke+mLoRNhyHqZ4sRfy/1jm9l5vM8mXvPSKaTKHLOI8RLIUCKjxWEZrcBLoLwt9k+4lM/NMFLKtK56z4rjqSqVHWiURf8t72C5u47FDdHJQufWiBtVt5OWjZz/BdtQIOcvElSW4LZbHckWUPOKQ/t/4cPcoo+Bu+WDlnYL+Fhe+JVDdTYNLqHG7yoXqp72sViA7t1qHgpUvSiAlX3RwMFXBZrqxVb3acqtMjxJZfVwhh2jv0Q4eNzEEzQ6TrEfAaVMCaiQraiBKajoOxUr88YFmv6YSr+f72lHy4lupOqLyRlEguVOYbbXdkFPsb3Z7g6KiFyGgpelhG25+r+LN5TWH1nYEw== 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)(376005)(36860700004)(82310400014)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2024 20:31:56.7339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c41dcce-124a-49ed-4c68-08dc5e5442a2 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: CH2PEPF0000009A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9386 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_213210_646222_2FB0EE3E X-CRM114-Status: GOOD ( 13.97 ) 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 Add a helper function capturing the first connected live display layer discovery logic. Signed-off-by: Anatoliy Klymenko Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/xlnx/zynqmp_dp.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 04b6bcac3b07..7faeb010e1ae 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1276,28 +1276,40 @@ static void zynqmp_dp_encoder_mode_set_stream(struct zynqmp_dp *dp, * DISP Configuration */ +/** + * zynqmp_dp_disp_connected_live_layer - Return the first connected live layer + * @dp: DisplayPort IP core structure + * + * Return: The first connected live display layer or NULL if none of the live + * layers are connected. + */ +static struct zynqmp_disp_layer * +zynqmp_dp_disp_connected_live_layer(struct zynqmp_dp *dp) +{ + if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) + return dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_VID]; + else if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)) + return dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_GFX]; + else + return NULL; +} + static void zynqmp_dp_disp_enable(struct zynqmp_dp *dp, struct drm_bridge_state *old_bridge_state) { - enum zynqmp_dpsub_layer_id layer_id; struct zynqmp_disp_layer *layer; const struct drm_format_info *info; - if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) - layer_id = ZYNQMP_DPSUB_LAYER_VID; - else if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)) - layer_id = ZYNQMP_DPSUB_LAYER_GFX; - else + layer = zynqmp_dp_disp_connected_live_layer(dp); + if (!layer) return; - layer = dp->dpsub->layers[layer_id]; - /* TODO: Make the format configurable. */ info = drm_format_info(DRM_FORMAT_YUV422); zynqmp_disp_layer_set_format(layer, info); zynqmp_disp_layer_enable(layer); - if (layer_id == ZYNQMP_DPSUB_LAYER_GFX) + if (layer == dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_GFX]) zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, true, 255); else zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, false, 0); @@ -1310,11 +1322,8 @@ static void zynqmp_dp_disp_disable(struct zynqmp_dp *dp, { struct zynqmp_disp_layer *layer; - if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) - layer = dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_VID]; - else if (dp->dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX)) - layer = dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_GFX]; - else + layer = zynqmp_dp_disp_connected_live_layer(dp); + if (!layer) return; zynqmp_disp_disable(dp->dpsub->disp);