From patchwork Thu Mar 21 20:43:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599371 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 2CB1AC54E58 for ; Thu, 21 Mar 2024 20:44:28 +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=+sFVpkFSU3iQe+kz0eT6h7TdDsXLAbVaVidKyA2ifXw=; b=ULb/Q4tIYL7Vc+ CG2IrnExIkLSIEwbIc6u1Lqo7EyMijk4pDAS05XuaLDlZbVnBRO6u9cvIys2jKibJsE5sdzZ4eVFL chiBOETolq5lVm2vAGaxqj8PF+NxEvTXhyxrLQ1dxN7Po87IlEVhJXxdJx538bQibEJqRcKS2fygu 9mHtKJLIqiFXr9qzWqvgOtzpO5uKNENBwqlgzorE+KrCOo+AQMZ4R4hr139n4I1LVQ/HthajHmK1X /GXV1PEkVG1LNfSb8UFjDrElBWeOmScT1wPs7ZAI97yT2t0Can4sJBVvknRwP2lz6P95UhyCJZGMZ T9lySITWAolfc1uB7jHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGn-00000004Z1U-45dc; Thu, 21 Mar 2024 20:44:13 +0000 Received: from mail-co1nam11on20601.outbound.protection.outlook.com ([2a01:111:f403:2416::601] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGh-00000004YsX-32wn for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bYYEuWQ1L2Z7zE44bLzRALGQ9V0ZPi2UG+TTSoSfu/7G74Pi0TsD1ekp5lOnohL5DWaty96YodzWkjE1AyMS0pHOZEKoJ+R5kF58TgCrX/AUOyYnQBLO8XSKpPWqYrXz+pPttur2k6hjIsW7WMOalKkuEPIQLq/dR57S+080ATr5w18yZjeXdxZ3B6PO0gQ4cUVXqin5D7DQ0mXSmj4XTAm5ibXfKhSZNXZzqrlEBBCx2lbH3fvzku+waTL9eFRge0PlXM9HVHg1JHegvpn3iBwZIj+6ELkmdwPqXfx224nD3DoSZ8vIdVyAsTL2kfyA4wmR4h3LgDfAyB0HqcTNMA== 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=L30m8KULZLU2w7J3btUecK9pXaDVzkCm2z2D4JMsR9cpS2wwHsd9AOPXj/8z9FLNcx7JJzD+LEFf3no+Vxa4W3g8jVM2bz9Oz0AtXqWgKay3wfTyF10JWLPyR+K/k2vffd3SmTiLottVxgsJlhF9lxNXcTvsmo2Ijy/PuumsDYFmOaJ4wLJ7RaKuo85OuffknnLaChe6lE+kDqLSFWd9jVFqYqR2fEkApiMikVPfM2WVxdSV0n4iHimxOXDjmat1tzKl0Zn/9PJMwbjDhLpejQtAaFehqH4E3jGDPpLn6ABAAKFjCb2SwtF8E43BlE7ITy83jTF9FRojRpMcVQl/fw== 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=zP4EV/pG2As/itVcnlKhw4oWiqWoz0FtggQhdNxJwso=; b=M0f0x8LBujRIxp9qp/zKEggTpTcvRPRMr1V64DA3oNnyGYnvV9tgAvQWNTAa8Gdelt2VOxHMhcfifToa2r+H1VKcHvGYuqkIn2+M/xtFA/7DwFyWKwPYrYejxM/nxQ0cGqU/ptY9s55/5/8Pad1kM67WqE0J3MtZAgg+L5jJ88o= Received: from BN0PR02CA0029.namprd02.prod.outlook.com (2603:10b6:408:e4::34) by CY8PR12MB8362.namprd12.prod.outlook.com (2603:10b6:930:7e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.34; Thu, 21 Mar 2024 20:44:00 +0000 Received: from BN3PEPF0000B071.namprd04.prod.outlook.com (2603:10b6:408:e4:cafe::b2) by BN0PR02CA0029.outlook.office365.com (2603:10b6:408:e4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Thu, 21 Mar 2024 20:44:00 +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 BN3PEPF0000B071.mail.protection.outlook.com (10.167.243.116) 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:43:59 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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:43:58 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) 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:43:58 -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; Thu, 21 Mar 2024 15:43:57 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:39 -0700 Subject: [PATCH v3 1/9] drm: xlnx: zynqmp_dpsub: Set layer mode during creation MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-1-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 Received-SPF: None (SATLEXMB05.amd.com: anatoliy.klymenko@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B071:EE_|CY8PR12MB8362:EE_ X-MS-Office365-Filtering-Correlation-Id: 51db50f9-707e-4b18-a560-08dc49e7a2db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5SSDbj1jiGQPHtkNYSohWOqvZMLWvQWPsDF//mAhtdmWp0oK3C4iTMqtdCjUWOxKg7iI6ZSrkelg3FUzoRb3vfLpm/WuYEBEq2WRRPPde2FACgYt+lbH086gNbiXHxP2Cyib9cDa1WUoSjVlK567g/ACjvzKFfHnpOj/cj1g1jkxSf6+GTq1z0tdPWq8NKBY57yhIaK0IA3RrKBsjIl4NSc5+WEojHvrvtuCJ4W9Txd9VD5XbyUEObisPk7oh1mLspFFz+cQUIC9peCSnGXfkFdrj5d3vtujuO4fHFwcSDVnhtm7nSdX5bxPd55i3xXp485hnFQBHbdDI/n0YGZ6XBvkS31G7MVBEDIDDzFLHizPdiw9EC3P344ei803yEKKAUK1CE/29PBx/Ns4Y3zzMBx7bdY+uh2SLn3G60T3iF1lmgoPae5y4XiytZW5Yx8QPEDTKxy2KhIxxNuoVwF1ObiaMfrMHUBrY04eg5ssMzNuiYb6mjvFA38mxPLIqQZ+H/RHNP1FgUuDekv56U+7XffWFpCjfGS2npGyhpZpket7kxMZmR1lREGjfEjkepGT3MnIqF79VaFioYaL1vZWF/+2h1r6Xzi5XAuZbihIZZm9RtZaZ0JMWP4hp7VQszCOtpU2Y3lTdlYYS9Tuu694uQSuGN+EOeijV34OD7d4kmQO+j2kA70bIT184ev+T9Au0dS0gVS3zcewNT2u7N/jPvrBYr66jGaI6X+grosseFBoQ9YBJA2bnR6pBJobIiVujuV4Olp4ktkEEVDhCTHxPA== 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)(36860700004)(376005)(1800799015)(7416005)(82310400014)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:43:59.5844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51db50f9-707e-4b18-a560-08dc49e7a2db 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: BN3PEPF0000B071.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134407_779509_E13B44BE X-CRM114-Status: GOOD ( 18.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 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 | 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 = { From patchwork Thu Mar 21 20:43:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599369 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 3B9E2C54E58 for ; Thu, 21 Mar 2024 20:44:25 +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=R70IjrZYWim1vfjXuoLvw58VQEQ9my1JRhD6mOduFjc=; b=kGEBwR9Z2EcaBA eetdy05s8zMkS5SRFHybraYpNT73P34X1+4JJ7Rd5yzHTvn1yoGycWPKyF3Fg2rXzSJNpIiRPpwiK 7qxEN3BuG0qiXjhpZTnZmL0gtV1hDQyuv0hWivt4A+a8S5V7jpdEM6NkRtwW5B/z1zTCkG8cb+BYh 9uxFxLjlt1vqHh/D98ZDiEdBFI7F85o6naHYOM3LWCwJyyfyDqf9m3kJGg/8s5S7IGtLgQJ37oGtc 3l4wGqfNqNjuulCiybEzckCnt/5IjaKErIvIkejgHd/1qR9bgLgClyzRvwfx2dbw3SLAWl+LjX+UZ XEICpCUUi+T1cdzTb/8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGl-00000004YyJ-3kSD; Thu, 21 Mar 2024 20:44:11 +0000 Received: from mail-bn7nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2009::601] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGh-00000004Ysa-3I2p for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mc7+ys6jwt6mpuj+AiPMMNlR7q47xqV5AmJL+jAFtDNWMkNjry4grG8OLLOnKQ8E3BphMRImq0CtKMBvwJ4lQ4P1/fmtS2Z/r8uw5dUSA5O1a2ToibYyYqiI3/vUHlsjoaApxHTB5S3lEvRlSVGKCEDfocLgplVIfFz3f1ghiU5foGSXOzuKVXJnrspzZCzMEOsorW7/7WyFqfO2cRvjSHvAecWZ+coaTY9417HmJF9N7ZilA6BnmGUuScle+vHrlZOFan+GeIdWvjC2xGY+/waSTEreue+k63RxaMTI931C+n7XexDSr2Zpr5nYBwnwjVOclQeagTRGtKreSUSTrA== 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=804TUvVriS611KMmwEEDVOyI7x92wBXQuMFTKBtWJTI=; b=eJ/1RzWXmboJf8HLpXYB6UlY6CH/bPhM36FAgm67rM4CK9W80g6c9Kz5boE0QvyaE+kACuTJl+/8T6LjKLMQ9hv/RNCJOq6+yHMswxpwv3qog58NQsSaAesOkhM83DrLyvpWIWUM3mHDoa9vvohHfHitk3SQDm6jKnOZLs3TbFrM6xJw0/67V3lfQba1rG5YH1YtGuDsj1ng1NETf9amhRxR6k8Mo9cse+XisDOJm45GQb4mX1U3ZySZdUCav9LPYGxxaYRcwdny6+q7vn3hfSC8xRDWju8jKOra7bNjhETfHokOccIKxnjr/Nb99xDVKSKgJkTfVILZM6z5xhtWYA== 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=804TUvVriS611KMmwEEDVOyI7x92wBXQuMFTKBtWJTI=; b=Brub0Qg7EOR+DddMJtPxJhZJpSVPPNU9nRT0gjFrGcPeDYvVu8MeYoan57CSvq/Jr9uQHBJxvui6XycGTYsTuuQ3oFy8fBzxEBFESU2lNQrMyEyxO2qijN9D1H2LWBOxmQlKHnlR7yy/BLGBZr538DskghWOBzhsmf3Mr3FkffM= Received: from BN1PR14CA0017.namprd14.prod.outlook.com (2603:10b6:408:e3::22) by IA1PR12MB7661.namprd12.prod.outlook.com (2603:10b6:208:426::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.23; Thu, 21 Mar 2024 20:44:01 +0000 Received: from BN3PEPF0000B370.namprd21.prod.outlook.com (2603:10b6:408:e3:cafe::fa) by BN1PR14CA0017.outlook.office365.com (2603:10b6:408:e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 21 Mar 2024 20:44:01 +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 BN3PEPF0000B370.mail.protection.outlook.com (10.167.243.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7430.0 via Frontend Transport; Thu, 21 Mar 2024 20:44:01 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Thu, 21 Mar 2024 15:44:00 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) 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:43:59 -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; Thu, 21 Mar 2024 15:43:58 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:40 -0700 Subject: [PATCH v3 2/9] drm: xlnx: zynqmp_dpsub: Update live format defines MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-2-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 Received-SPF: None (SATLEXMB05.amd.com: anatoliy.klymenko@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B370:EE_|IA1PR12MB7661:EE_ X-MS-Office365-Filtering-Correlation-Id: a7f8a6bf-4b6b-4982-a85c-08dc49e7a3ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RLY6kE8xPWrN7bEWMNzk8BPZjv2rb6gPAfqDDfE/pnD+Yt7l2sPI4e9wrWHnd41Eqae9+7nhncb+52KMFGG9JBzexBRfE2wxFD1hgQylkQcENb8CfbPPGv9L0g6NC9dttmCAM+2RtKgkXOVi4Gx9VuoZyNnL0s3AH1R2BnCtLOleGUQl76CSYMG/5pQns1qQT2k6Re+wu4AjT148a+SDgQCk5E9bm2NLKDixabPgHkszWZlD5UeAhZKRcXmtzoyERHyIR2rY5yMdhtJ9ejWXloFmZ6Iqv81H72LFEdcj/0JKHjpMonU6aaVbQW0AnGoMds/5yV+0hckvCBFgWvNU9VCQ5IFfhdtajMbD0ByG4Urd6Auha/GH3YPoTjpqc9Ef+HMiqNsWIq0kfFnSVMPryoo6ceeIkvb5W0462J9R3IwmnioV2U3TzzOps3F1HNfKfFn/Ba3fB1sAFqvcHldOD1YvYVfVyG1Di3MOCawro0AWzU5+pn78fNfubjoxL8+gKf3b9dyhJBN9pDBsdXY4CUEzmivXSxmcqS+xk8KWpul1QvyQfafslhe8a/GSDPsjmD/BK0UhAbfUgI14UeklQ3Wv7nEKGCRosPBAHc6cs8tMa3ikDF3EQE15jKWmlBwnpaaoEdy10C+Ca2TmOYETMHXgs1BRoq6wAxyJdpJgQ6TWfMzgy+xD929v5pRx37qHYx7ILC46pnDvlu0W6+wjk15/Wq6qc95Mvs/lG7Tfk5LL1lbAKJeMsKDeQw+WDOwNRjMARt0XEuFCSxsjPOk1iA== 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)(82310400014)(376005)(1800799015)(36860700004)(7416005)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:01.4739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7f8a6bf-4b6b-4982-a85c-08dc49e7a3ed 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: BN3PEPF0000B370.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7661 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134407_843526_4F139F20 X-CRM114-Status: GOOD ( 10.84 ) 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 Update live format defines to match DPSUB AV_BUF_LIVE_VID_CONFIG register layout. Reviewed-by: Laurent Pinchart Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_disp_regs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h b/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h index f92a006d5070..fa3935384834 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h @@ -165,10 +165,10 @@ #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_10 0x2 #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_12 0x3 #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_MASK GENMASK(2, 0) -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB 0x0 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444 0x1 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422 0x2 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YONLY 0x3 +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB (0x0 << 4) +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444 (0x1 << 4) +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422 (0x2 << 4) +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YONLY (0x3 << 4) #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_MASK GENMASK(5, 4) #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_CB_FIRST BIT(8) #define ZYNQMP_DISP_AV_BUF_PALETTE_MEMORY 0x400 From patchwork Thu Mar 21 20:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599375 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 58211C6FD1F for ; Thu, 21 Mar 2024 20:45:18 +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=VS92IsNqIMv/oiZlVju0GTEsSu/VChTPmsVdXHRbuhw=; b=zM323CCFtgIfTJ RgI4d3Ark2VppPZtq7WyOdDRs5c73bmuoXki7s3sY8WZDOKTFlZsIg5oxQnWiDTg9i5E7zCAlYQcW D6BrCbNmE1NxCVMZUc3jzOPHsVXidesfHbw1sAoVAkO5HDZf8HEEq9W9qN3zhAzCBR+EV8tfz5vJu 0XoPwwF53dYxh48omCqp7acJ3V4V2HQB+gmV9s6uFau078daDHIwjjrjmTB92yc29qgQ3J9QdRLDO ey2q07dmjzdEKMDa7jUvFlUuHJhmszjJDCV76ON9d1lC8/62slWgDJOg+4vE2xOP1v0K/u05GL8wd EcTYW9SpjWlVIVWM5f/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHb-00000004ZWy-2iWG; Thu, 21 Mar 2024 20:45:03 +0000 Received: from mail-bn8nam04on20601.outbound.protection.outlook.com ([2a01:111:f403:2408::601] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGo-00000004YxK-3PmZ for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELUJGs9YslPNQ4MAuteZ1On5VT51PPB9OTWvVhnG+lUEU6baJxnkLOg9a6/4dy+nfrZjHUDcYb8aO6gaLY/fSxyXazHZUyWRs0gVwxmQQ090UzUNqaAH6SjZ8IZCHqQOoMqyRIp7eOz9VTiL5pyqIvEfScyhRjc0LSVfCZ74LiA3rFZbdco5Nyu83BVLVMICqD2iEOh01nE3sD1dJDMsivE51uCQT57/fy6qowtL0eJxXMhmJMNw/+xtwqOqqcDs2Y/UhOLTHCJ6GiCxqXcX2o9aEsa3jduvhA9jxwx8v5BVagPgEXh4YFvhNXtXZu6F+YVj9d2INk3hMTJehA3zaQ== 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=RPa9xUcbPrlbx4CkiBTHF1HNkikikjFiBO5NxPXHIPE=; b=GBSw747B7iaeOcp0laUemLRwsLcnqG4j0TRglp9KV5R9TyhpXcVN3zTI4cJ1YsN38cLPkwWXaB/q6hc8OdobzW2N1R+o2mlo1JC5wndPGCeMs7wrg8MIdzkqoFjU0K/LD6bd/fCe87z4u4jefKv1ACAnBo+FYQJ8ZIzA+2KDRkF1+oy//q96AmDmifsFsVVhCHW3Zc0REIdBitmStGUNnXx7/jGJGxlhRA0dEihri0slQy561JTcNT2PGtjKoJxQ60REqZ3TNavQ5hO9FZ+qTyGJBZAv4YZcjcG8vsegmmQvYRKNvHUtaZJCvh0l+gwg4Ln/+pHm1x4WIuVkDu4j3Q== 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=RPa9xUcbPrlbx4CkiBTHF1HNkikikjFiBO5NxPXHIPE=; b=Od6tbx6fPy8OezmtlrKZKrPptewe2qAmu/LglkfrBDf2IifTr6Te60raHmAopQUpHmSr5Csn+if0Ejmt89au8Nv04HgGIA8V2GtRfKKTRYmO/7/3kHBvX4PUXWaxxmpvsiRdpnWOXwOf36gVMqSsq3MtLXg+bYyXlJSWYBdmewQ= Received: from BN9PR03CA0172.namprd03.prod.outlook.com (2603:10b6:408:f4::27) by SA0PR12MB4398.namprd12.prod.outlook.com (2603:10b6:806:9f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.31; Thu, 21 Mar 2024 20:44:06 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:408:f4:cafe::a6) by BN9PR03CA0172.outlook.office365.com (2603:10b6:408:f4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Thu, 21 Mar 2024 20:44:03 +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:02 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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:01 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) 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:01 -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; Thu, 21 Mar 2024 15:44:00 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:41 -0700 Subject: [PATCH v3 3/9] drm: xlnx: zynqmp_dpsub: Add connected live layer helper MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-3-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 Received-SPF: None (SATLEXMB05.amd.com: anatoliy.klymenko@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B077:EE_|SA0PR12MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c45738c-40ba-4896-3476-08dc49e7a4d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hKCyZ7W847d1RdohucFvVUyN0NYCpXzVcOz4WpIO7r0yutkOdRm50+rtVnIm57x7F9lVxhroCHuj7iyPBbRFCF4MZDEwBOE77avlrVve9neBgetY3Msf+J034285k73l6JDbZniH3E0D6ZpzLrmERPBWfnJ6Csi1Q3Z46n5KKrEiRYb2p9yEkcZLOHqzi3x1X8sJKAcV913usk9Qf/bT15K7ANi5KqQqb/q3ETe6ST9JSDOGkMT2c8frfeZwDPAqScdosKpUtLCxB21CG95JLJv3z+lNm5AtZjpo/LEOIoV57AP21dxp6sH2IqcWptVMEJLZKqO9AykChREWkx9UGVytv5/H6/KiUbbXTNh3ir30oxehh0suTs8y0wZPWppyOACG5D9q/9YJJQIlutw/ps+tRvtFiwhVy7/jMAcGKVy/MJupZD8kbIW+Nxs+vxQiFeQ1ZgHyl74i8ZC8S7mhzHBLlj4mmKDxunU7yWZKuz9NkxTwL0LPsc3w2XU9mcQStbhvBORLqJGjml6kQN5ec7/ew+XYY/+uHKzMxbMw25ONo86MJfGJR+rEu+TNVA5OWS8JIkYlDK74SWu1Y7WrElrqtTWYBQ3Y5J1aNbswZ/LkiesWwhuWXpMpcdqmQmAOkGQi4ScGix8vVgXkNslfGXjgasiuTiILlFA5GZ8m40AbKJ/mIHtx6Y6EgoS7rQHZImZ0WOGjGVjYQ59thVUzq8khmZSBZFdjN378eHX3xEIa926dWew8yr21t6CgR3gZR8dTaABqGVFpbCP5Fp/eTQ== 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)(82310400014)(36860700004)(376005)(1800799015)(7416005)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:02.8805 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c45738c-40ba-4896-3476-08dc49e7a4d0 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: SA0PR12MB4398 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134414_978863_6B5BE47C X-CRM114-Status: GOOD ( 14.62 ) 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..4faafdd76798 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 + * layer is 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); From patchwork Thu Mar 21 20:43:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599372 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 B1505C6FD1F for ; Thu, 21 Mar 2024 20:45:06 +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=sth5/0eHkFIhz9G4VS3MDDEYrZkjGq3hMAKj9AlH7Hw=; b=XSFsi5EqXSWMPN 5PkenMLDX3ljR+yGfqhGdaQnUf0WQzKiHRKPU+pgdzWy5vbALULQkjCbn9fYh2lK1Y4xy/Bs1RIA0 53y6rGzknA9MfHwjcizJCnzg3W3fNttDz/6GB6+2IfqNwUicmHxc1BbXE8GlgEFMV62Q1tQspj7Hd 41j19E9z2lGu2PfkqP7wJoeSrkxANIdmcq5oUTs0Ebq3xlvkarV8Qc+vBKmHJ1W/hANCfyju9sj8c N7ZIfJknzSVFzWYiApbQTIXs6sXgwjIqR34q4fNzm8xD2ZwYY4SzIR6PMYsLwGvpEeuAvP2Og5JGm zecwFiY1L8pRftzB7FAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHT-00000004ZRf-2cMD; Thu, 21 Mar 2024 20:44:55 +0000 Received: from mail-dm6nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:2417::601] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGm-00000004YxS-38ut for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WMTdeDsZWtQ1GPRTtzRsgPDF0iukcqvwB0lgxKw/h4N349BDizrHejnNr09cQu6otJtd4VACs/ApJx5Ly8Jz3V1GjzGplkCq0ZrjlJFfG7JYs4b0nSL8sXjm5CuiHH40oU5+T5l0ldUd4c+Tbb+wIAmubXCQa2NSVcL8xzurwS5t+Tt/fmGWIWeMfKYcAEbXhMHIdNe1GOHOaQBEAYkpiyGG3ki6G/8cJ6Czo87H0X5Rc5sSrhPrvtGa8uOZ0riFw1+KijYa116DVVwA7NPxu0vwyz4NZlFBUdA/+DD8OW11UtPA98sgIIC0/Ii3ZGf60/nAm+mrUEBus1woLTveHg== 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=Ah/6LdEJZTf4BK470vQw33mSmDi9MvVlPOfTcjV6iRg=; b=WNgnp7JeyPIHNEqFRiExkwdT/VwZl3nkvmdy7PUhPFNAiuZFtCGbsDk2EOD/+A/qYhP3ur5RCXNhlR3GthXjzeEZu2qp51Ve5B5Eex0BMDZ/4oIWZ7PjHPLelEU9KXTtdmnrd85mbCiKOxKWn8kzIlonaJHbQhZWWF+EqPRlyJEQ36aHeZADqUHDVSFl174RlKQbFUJxn2dq/vHM2Py1UtpdyfCUAn0ANtb4qNvtkbdYSNjH4AFuOkpsPXhKGcSEaXbM7GgIVCKXTxJDF5iKX+WXB9Ms9FHXECx+abiJ1Bk2JV+VTqoJfYPbFNjlPMzV/+GaUCA37gK3FT/1XnpKsQ== 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=Ah/6LdEJZTf4BK470vQw33mSmDi9MvVlPOfTcjV6iRg=; b=BodKRS2CSzKefWn2OeWELAFBbff/0TBdUF/wAAxeXotnphMtNQXoHyho/bgZGfe+rpoLEA1fFAYipird0vfnkFLmQmrChWhzzAhyZaOipWYCoCLzE/hld5+EogZdQHgNNpjMiybcT+57hqvlJWnzEObK5C6Uw63sNbNVpgx+YnY= Received: from BN9PR03CA0459.namprd03.prod.outlook.com (2603:10b6:408:139::14) by SN7PR12MB7909.namprd12.prod.outlook.com (2603:10b6:806:340::21) 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:05 +0000 Received: from BN3PEPF0000B36D.namprd21.prod.outlook.com (2603:10b6:408:139:cafe::be) by BN9PR03CA0459.outlook.office365.com (2603:10b6:408:139::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Thu, 21 Mar 2024 20:44: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 BN3PEPF0000B36D.mail.protection.outlook.com (10.167.243.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7430.0 via Frontend Transport; Thu, 21 Mar 2024 20:44:05 +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; Thu, 21 Mar 2024 15:44:03 -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; Thu, 21 Mar 2024 15:44:01 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:42 -0700 Subject: [PATCH v3 4/9] drm: xlnx: zynqmp_dpsub: Anounce supported input formats MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-4-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 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: BN3PEPF0000B36D:EE_|SN7PR12MB7909:EE_ X-MS-Office365-Filtering-Correlation-Id: 32bd1e40-7668-410b-d41f-08dc49e7a63a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLD62ZPj0c33drURpmrC9E2rvq88wv+2dUqO2u3oGDQZhk6O/ACxt01AO0XUf2eDS8B8UpdHH7wslZAAYUallM3n9sCCZjGiScXcqTrdHCsBlHBhYq8shP6+narXHE0OMW3L8iuwlIdw7IRXS79El9GBm36qAETD0apOQSt00B2j5Up8u54Hupl6kM1EIMtxr6VZuetp73O8zbw1eXinmdrm1Y1bAKrccU8TJGiPOhc2mK4SRNbo6eAT9ZQAd3nyF5IEykcPMgqmzf/mMy90FfvLFr745xXhDYHXQJiwwV2XVTWLw9pim4F8TJDKa5gmxz1OMgLpsqkH9l04L1mvCilvRvBfVWMksD9yDp09nJB310cTkyy0hImv/JU8ywk+n2Kc19TokmUzPZX6Ffje0xOkrR51VsP/6TqqBEUar9/gHC0mCUy4kzdX+QQqQ6PXDizO0nMQFeW9loXbGxrr9erSafYybuc5KP6BkmfEwfFJ6l1lLiz4piP1gV708s+XaN8ioQfFyY+pFIDhD/OVB4O86AK8PA6EQSYtkUaXLowqI7HHH9i+C9JyHgCnv8DdOS9nixhEzYntV4D0/yh/IYayhTRS1dM5MO9DuPn6ZKc0e94P1Ni39gZtmqR70E+tdkr63FJQQKJAG2gaJgpnO02dliehsyLx2Sy5+bHhcQ0lMfH3pUqXTwr1b77fLCdgVTPEcBuhxyCi+Knjwx2Dynue1ZPe7PkrNO3872kgSKR6/I52/8GrO2eaNp8gaI11enXI0gRNemTs2343L94e1g== 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)(82310400014)(36860700004)(1800799015)(376005)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:05.2570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32bd1e40-7668-410b-d41f-08dc49e7a63a 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: BN3PEPF0000B36D.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134412_983745_E32E493E X-CRM114-Status: GOOD ( 22.07 ) 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 DPSUB in bridge mode supports multiple input media bus formats. Announce the list of supported input media bus formats via drm_bridge.atomic_get_input_bus_fmts callback. Introduce a set of live input formats, supported by DPSUB. Rename zynqmp_disp_layer_drm_formats() to zynqmp_disp_layer_formats() to reflect semantics for both live and non-live layer format lists. Reviewed-by: Laurent Pinchart Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 76 +++++++++++++++++++++++++++++++++----- drivers/gpu/drm/xlnx/zynqmp_disp.h | 4 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 31 ++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_kms.c | 2 +- 4 files changed, 101 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index e6d26ef60e89..abdc3971b193 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -77,12 +78,14 @@ enum zynqmp_dpsub_layer_mode { /** * struct zynqmp_disp_format - Display subsystem format information * @drm_fmt: DRM format (4CC) + * @bus_fmt: Media bus format * @buf_fmt: AV buffer format * @swap: Flag to swap R & B for RGB formats, and U & V for YUV formats * @sf: Scaling factors for color components */ struct zynqmp_disp_format { u32 drm_fmt; + u32 bus_fmt; u32 buf_fmt; bool swap; const u32 *sf; @@ -182,6 +185,12 @@ static const u32 scaling_factors_565[] = { ZYNQMP_DISP_AV_BUF_5BIT_SF, }; +static const u32 scaling_factors_666[] = { + ZYNQMP_DISP_AV_BUF_6BIT_SF, + ZYNQMP_DISP_AV_BUF_6BIT_SF, + ZYNQMP_DISP_AV_BUF_6BIT_SF, +}; + static const u32 scaling_factors_888[] = { ZYNQMP_DISP_AV_BUF_8BIT_SF, ZYNQMP_DISP_AV_BUF_8BIT_SF, @@ -364,6 +373,41 @@ static const struct zynqmp_disp_format avbuf_gfx_fmts[] = { }, }; +/* List of live video layer formats */ +static const struct zynqmp_disp_format avbuf_live_fmts[] = { + { + .drm_fmt = DRM_FORMAT_RGB565, + .bus_fmt = MEDIA_BUS_FMT_RGB666_1X18, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_6 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB, + .sf = scaling_factors_666, + }, { + .drm_fmt = DRM_FORMAT_RGB888, + .bus_fmt = MEDIA_BUS_FMT_RGB888_1X24, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB, + .sf = scaling_factors_888, + }, { + .drm_fmt = DRM_FORMAT_YUV422, + .bus_fmt = MEDIA_BUS_FMT_UYVY8_1X16, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422, + .sf = scaling_factors_888, + }, { + .drm_fmt = DRM_FORMAT_YUV444, + .bus_fmt = MEDIA_BUS_FMT_VUY8_1X24, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444, + .sf = scaling_factors_888, + }, { + .drm_fmt = DRM_FORMAT_P210, + .bus_fmt = MEDIA_BUS_FMT_UYVY10_1X20, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_10 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422, + .sf = scaling_factors_101010, + }, +}; + static u32 zynqmp_disp_avbuf_read(struct zynqmp_disp *disp, int reg) { return readl(disp->avbuf.base + reg); @@ -883,16 +927,17 @@ zynqmp_disp_layer_find_format(struct zynqmp_disp_layer *layer, } /** - * zynqmp_disp_layer_drm_formats - Return the DRM formats supported by the layer + * zynqmp_disp_layer_formats - Return DRM or media bus formats supported by + * the layer * @layer: The layer * @num_formats: Pointer to the returned number of formats * - * Return: A newly allocated u32 array that stores all the DRM formats + * Return: A newly allocated u32 array that stores all DRM or media bus formats * supported by the layer. The number of formats in the array is returned * through the num_formats argument. */ -u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, - unsigned int *num_formats) +u32 *zynqmp_disp_layer_formats(struct zynqmp_disp_layer *layer, + unsigned int *num_formats) { unsigned int i; u32 *formats; @@ -903,7 +948,9 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, return NULL; for (i = 0; i < layer->info->num_formats; ++i) - formats[i] = layer->info->formats[i].drm_fmt; + formats[i] = layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE + ? layer->info->formats[i].drm_fmt + : layer->info->formats[i].bus_fmt; *num_formats = layer->info->num_formats; return formats; @@ -1131,6 +1178,11 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) .num_channels = 1, }, }; + static const struct zynqmp_disp_layer_info live_layer_info = { + .formats = avbuf_live_fmts, + .num_formats = ARRAY_SIZE(avbuf_live_fmts), + .num_channels = 0, + }; unsigned int i; int ret; @@ -1140,12 +1192,18 @@ 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. + + /* + * 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; + if (disp->dpsub->dma_enabled) { + layer->mode = ZYNQMP_DPSUB_LAYER_NONLIVE; + layer->info = &layer_info[i]; + } else { + layer->mode = ZYNQMP_DPSUB_LAYER_LIVE; + layer->info = &live_layer_info; + } 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 9b8b202224d9..88c285a12e23 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.h @@ -50,8 +50,8 @@ int zynqmp_disp_setup_clock(struct zynqmp_disp *disp, void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp, bool enable, u32 alpha); -u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, - unsigned int *num_formats); +u32 *zynqmp_disp_layer_formats(struct zynqmp_disp_layer *layer, + unsigned int *num_formats); 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, diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 4faafdd76798..e3b9eb3d9273 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1577,6 +1578,35 @@ static const struct drm_edid *zynqmp_dp_bridge_edid_read(struct drm_bridge *brid return drm_edid_read_ddc(connector, &dp->aux.ddc); } +static u32 *zynqmp_dp_bridge_default_bus_fmts(unsigned int *num_input_fmts) +{ + u32 *formats = kzalloc(sizeof(*formats), GFP_KERNEL); + + if (formats) + *formats = MEDIA_BUS_FMT_FIXED; + *num_input_fmts = !!formats; + + return formats; +} + +static u32 * +zynqmp_dp_bridge_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + struct zynqmp_dp *dp = bridge_to_dp(bridge); + struct zynqmp_disp_layer *layer; + + layer = zynqmp_dp_disp_connected_live_layer(dp); + if (layer) + return zynqmp_disp_layer_formats(layer, num_input_fmts); + else + return zynqmp_dp_bridge_default_bus_fmts(num_input_fmts); +} + static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { .attach = zynqmp_dp_bridge_attach, .detach = zynqmp_dp_bridge_detach, @@ -1589,6 +1619,7 @@ static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { .atomic_check = zynqmp_dp_bridge_atomic_check, .detect = zynqmp_dp_bridge_detect, .edid_read = zynqmp_dp_bridge_edid_read, + .atomic_get_input_bus_fmts = zynqmp_dp_bridge_get_input_bus_fmts, }; /* ----------------------------------------------------------------------------- diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c index 43bf416b33d5..bf9fba01df0e 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -152,7 +152,7 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dpsub *dpsub) unsigned int num_formats; u32 *formats; - formats = zynqmp_disp_layer_drm_formats(layer, &num_formats); + formats = zynqmp_disp_layer_formats(layer, &num_formats); if (!formats) return -ENOMEM; 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]; From patchwork Thu Mar 21 20:43:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599374 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 BB419C54E58 for ; Thu, 21 Mar 2024 20:45:11 +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=+8him/dpe7NcxtAQKIUr+LHfwnAOc0MuLTjHWGys7R0=; b=yU1pv7TVpK2Q4N 66p0741yp0WbBJCOLUhB7q4lCfXjJf0HciKzFFcUQbHohuzHIQdtoimlMRK+ypCaoNP/EOpD/D/i3 CTBoDcHcfIRFWxFczyGw62CU+Nt6gh1+QxIZuDcEYQ24T4Pfto6ckB8e9EgTskfgqRqm81C02AQ91 SfCRinH3CWijoIFbWLbwj1OQX+ay3JKUGMYazfrJKKaCMFziaw1SWqcEvtNDPIMIGha1p8QMyqFlV Fo0sL0jAhQbwcfx70A5CsijN78RkE4xRaKecE10vluzWnx5KK2OPqNtL/KYCRQQ/vLbGMAzr25hD6 GS8xvwPKujjmsk9U/MvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHX-00000004ZUT-3gDM; Thu, 21 Mar 2024 20:44:59 +0000 Received: from mail-bn7nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2009::601] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGo-00000004Z0u-0i1U for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cN5dPjdb1Fl64Ikk3mbP7j1bFyXZcCUgdMGhnTo3Rodz/AqXyrURE7+/j5e61YDNHu1m5TVxeANn9mcGpmRAVCxpbTwerdwgPSu0moLmx6vQpWZX03TEE69G33Qj6cp6E0U9m6hfXeImDyfoWZ0fN29nCfjOmI96HHCNgix0u1vvWN/L5ad7JoaMquqftDgvlWuabDd3XbG+IOY269siSQpJukfuBXp4erlfhTLstPD8eVQibg6swE+B5zq1vmqvZg21npxyaTiGSuRUww25tgZRUb6pBx/M/rd2ZmgabtzC4ZBCpBS5cix4Mq6IFnFQftX5cmdt4q0B0qkJTrhBEg== 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=hMLkSDZL4nR6b27lobc4CgWcFwW+v3szovkHGL/k90w=; b=YSv/IvQQKGOHL1vqo1DP6kG7+wVMbzU2yj8YUcKhwvDwZRWSVbXFb6EvKzHl2pySJKU0g3pN8iJlumLPz4QuiLyB4cfoM7RootnbaJE0FoUWUhgT+TSlxSYluDsKVkcg5mkmBoBFX6B8Mdadlqd5qeoIjoc9SCDzbFTQwTbGfQBRbrMVuwojod5c8Ol5EU5aOet0bV9aldw+G0fGX7Uf28zahSve6r9e9Dxc3xkvjpOniF2mGuvdTx1zfUtGOgP7hTjFIzJGJnk/RXbhB7+Eh1zEjvSqocIl3EB71n7uy02M/6SzhltPrOImCGh2Le5KJun8qdonPcLaMFA8gimkrw== 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=hMLkSDZL4nR6b27lobc4CgWcFwW+v3szovkHGL/k90w=; b=LzkbfCVcgicfX6b/bgGLjO7W7uSaPCKQYUhRQva/7o1xaumeX3InjKOxIILLZrJrWE+J8QfIqhhAfcf5I5smy8EdO5nlB58F4TkSLumCZ+E5cyVZ8s4mElQRLVL+ghLHb7bnHCRJ0BfQLHjEX5fTZKyAoZkRaASCQVDr2vnG0gA= Received: from BN1PR12CA0021.namprd12.prod.outlook.com (2603:10b6:408:e1::26) by SJ2PR12MB7894.namprd12.prod.outlook.com (2603:10b6:a03:4c6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.31; Thu, 21 Mar 2024 20:44:08 +0000 Received: from BN3PEPF0000B373.namprd21.prod.outlook.com (2603:10b6:408:e1:cafe::f9) by BN1PR12CA0021.outlook.office365.com (2603:10b6:408:e1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 21 Mar 2024 20:44:08 +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 BN3PEPF0000B373.mail.protection.outlook.com (10.167.243.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7430.0 via Frontend Transport; Thu, 21 Mar 2024 20:44:07 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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; Thu, 21 Mar 2024 15:44:06 -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:06 -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:05 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:44 -0700 Subject: [PATCH v3 6/9] drm: xlnx: zynqmp_dpsub: Set input live format MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-6-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: BN3PEPF0000B373:EE_|SJ2PR12MB7894:EE_ X-MS-Office365-Filtering-Correlation-Id: 86ae9ccd-74b6-4eb6-0f03-08dc49e7a7c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: deIKL7CCqXZZm6zJGDgiTtchZ50uQIdIjHNyC49Xn3FzYKMx0NpCY8a6cajHSOsfd2zKjkFhIN4VfPM+NwDFlcD4RHnFLeEfN5qOXtO7nCJ8C5le6qTjewWH6Gwo1ZDUXZgrdzH/puUnZsTdiB/Se8ZylDCZhwRdbU4rM/CyBU6ktGIqDMT9vjs7fTY8P4q/7yWWxpsn+uJdWZXMmdzdZXonz8tyQoIJD6lWVKpGpgfoNzANJbogcTrIeoUfUkLwxiIo2h/4ZaLgQBFbhNQeuOKD1q/kuSOJ6yz7FMth0VVlOAEIjcOPj9Sh7f5s9LKXx7b+vyGyCBRbgbI9PH1GJGKP8IozAUEzQLGR1JPbstchM/pyyQOc45PVrhyNW5vPE+NNNh+rxZLbX/axISOqPZtX1/8zwLRlsP4D6vBfmfzABhDvYzev6b8ZyJQUeeigClzFVB+qlFSiMzX3O49Stwt68NM68HPvQ0DCzlvMIDO1qwTQZcmi1FpvJu+O44tKp9ip/qbczH6G41dBByKZ+M7T/Gq/9fmGKY6ARfw70ClsyVw53AKYQfwhRGyixBew7N09kKLwWkWnX6l8gpK6w37fZbaRHlpkzRogs2JJdpQvzZzjwxLP7NewfIh7SDeIw0IqR2Gb5Y3m6FMvUlJ4xE9nRQ7oI14Z9P0avm3EXIKQsnAYWfN+MzNM6a8KtmcOX1xNanfKtNT7MMG2Za8ScDtzEmihCXs3aQLrJVZHGMDgO3BqjV5tQ070kKpo0HAXBBsdkHiJ6dJ0MFjy97bPgg== 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)(376005)(82310400014)(7416005)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:07.8537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86ae9ccd-74b6-4eb6-0f03-08dc49e7a7c7 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: BN3PEPF0000B373.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7894 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134414_525521_EF07594F X-CRM114-Status: GOOD ( 21.63 ) 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 Program live video input format according to selected media bus format. In the bridge mode of operation, DPSUB is connected to FPGA CRTC which almost certainly supports a single media bus format as its output. Expect this to be delivered via the new bridge atomic state. Program DPSUB registers accordingly. Update zynqmp_disp_layer_set_format() API to fit both live and non-live layer types. Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 66 +++++++++++++++++++++++++------------- drivers/gpu/drm/xlnx/zynqmp_disp.h | 2 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 13 +++++--- drivers/gpu/drm/xlnx/zynqmp_kms.c | 2 +- 4 files changed, 55 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 0c2b3f4bffa6..a385d22d428e 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -436,19 +436,28 @@ static void zynqmp_disp_avbuf_set_format(struct zynqmp_disp *disp, const struct zynqmp_disp_format *fmt) { unsigned int i; - u32 val; + u32 val, reg; - val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_FMT); - val &= zynqmp_disp_layer_is_video(layer) - ? ~ZYNQMP_DISP_AV_BUF_FMT_NL_VID_MASK - : ~ZYNQMP_DISP_AV_BUF_FMT_NL_GFX_MASK; - val |= fmt->buf_fmt; - zynqmp_disp_avbuf_write(disp, ZYNQMP_DISP_AV_BUF_FMT, val); + layer->disp_fmt = fmt; + if (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE) { + reg = ZYNQMP_DISP_AV_BUF_FMT; + val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_FMT); + val &= zynqmp_disp_layer_is_video(layer) + ? ~ZYNQMP_DISP_AV_BUF_FMT_NL_VID_MASK + : ~ZYNQMP_DISP_AV_BUF_FMT_NL_GFX_MASK; + val |= fmt->buf_fmt; + } else { + reg = zynqmp_disp_layer_is_video(layer) + ? ZYNQMP_DISP_AV_BUF_LIVE_VID_CONFIG + : ZYNQMP_DISP_AV_BUF_LIVE_GFX_CONFIG; + val = fmt->buf_fmt; + } + zynqmp_disp_avbuf_write(disp, reg, val); for (i = 0; i < ZYNQMP_DISP_AV_BUF_NUM_SF; i++) { - unsigned int reg = zynqmp_disp_layer_is_video(layer) - ? ZYNQMP_DISP_AV_BUF_VID_COMP_SF(i) - : ZYNQMP_DISP_AV_BUF_GFX_COMP_SF(i); + reg = zynqmp_disp_layer_is_video(layer) + ? ZYNQMP_DISP_AV_BUF_VID_COMP_SF(i) + : ZYNQMP_DISP_AV_BUF_GFX_COMP_SF(i); zynqmp_disp_avbuf_write(disp, reg, fmt->sf[i]); } @@ -902,25 +911,33 @@ static void zynqmp_disp_audio_disable(struct zynqmp_disp *disp) */ /** - * zynqmp_disp_layer_find_format - Find format information for a DRM format + * zynqmp_disp_layer_find_format - Find format information for a DRM or media + * bus format * @layer: The layer - * @drm_fmt: DRM format to search + * @drm_or_bus_format: DRM or media bus format * * Search display subsystem format information corresponding to the given DRM - * format @drm_fmt for the @layer, and return a pointer to the format - * descriptor. + * or media bus format @drm_or_bus_format for the @layer, and return a pointer + * to the format descriptor. Search key choice depends on @layer mode, for live + * layers search is done by zynqmp_disp_format.bus_fmt, and for non-live layers + * zynqmp_disp_format.drm_fmt is used. * * Return: A pointer to the format descriptor if found, NULL otherwise */ static const struct zynqmp_disp_format * zynqmp_disp_layer_find_format(struct zynqmp_disp_layer *layer, - u32 drm_fmt) + u32 drm_or_bus_format) { unsigned int i; + const struct zynqmp_disp_format *disp_format; for (i = 0; i < layer->info->num_formats; i++) { - if (layer->info->formats[i].drm_fmt == drm_fmt) - return &layer->info->formats[i]; + disp_format = &layer->info->formats[i]; + if ((layer->mode == ZYNQMP_DPSUB_LAYER_LIVE && + disp_format->bus_fmt == drm_or_bus_format) || + (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE && + disp_format->drm_fmt == drm_or_bus_format)) + return disp_format; } return NULL; @@ -992,20 +1009,25 @@ void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer) /** * zynqmp_disp_layer_set_format - Set the layer format * @layer: The layer - * @info: The format info + * @drm_or_bus_format: DRM or media bus format * * Set the format for @layer to @info. The layer must be disabled. */ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, - const struct drm_format_info *info) + u32 drm_or_bus_format) { unsigned int i; - layer->disp_fmt = zynqmp_disp_layer_find_format(layer, info->format); - layer->drm_fmt = info; + layer->disp_fmt = zynqmp_disp_layer_find_format(layer, drm_or_bus_format); + if (WARN_ON(!layer->disp_fmt)) + return; zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); + layer->drm_fmt = drm_format_info(layer->disp_fmt->drm_fmt); + if (!layer->drm_fmt) + return; + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) return; @@ -1013,7 +1035,7 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, * Set pconfig for each DMA channel to indicate they're part of a * video group. */ - for (i = 0; i < info->num_planes; i++) { + for (i = 0; i < layer->drm_fmt->num_planes; i++) { struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; struct xilinx_dpdma_peripheral_config pconfig = { .video_group = true, diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.h b/drivers/gpu/drm/xlnx/zynqmp_disp.h index 88c285a12e23..9f9a5f50ffbc 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.h @@ -55,7 +55,7 @@ u32 *zynqmp_disp_layer_formats(struct zynqmp_disp_layer *layer, 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); + u32 drm_or_bus_format); int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer, struct drm_plane_state *state); diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index e3b9eb3d9273..200e63636006 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1299,15 +1299,20 @@ static void zynqmp_dp_disp_enable(struct zynqmp_dp *dp, struct drm_bridge_state *old_bridge_state) { struct zynqmp_disp_layer *layer; - const struct drm_format_info *info; + struct drm_bridge_state *bridge_state; + u32 bus_fmt; layer = zynqmp_dp_disp_connected_live_layer(dp); if (!layer) return; - /* TODO: Make the format configurable. */ - info = drm_format_info(DRM_FORMAT_YUV422); - zynqmp_disp_layer_set_format(layer, info); + bridge_state = drm_atomic_get_new_bridge_state(old_bridge_state->base.state, + old_bridge_state->bridge); + if (WARN_ON(!bridge_state)) + return; + + bus_fmt = bridge_state->input_bus_cfg.format; + zynqmp_disp_layer_set_format(layer, bus_fmt); zynqmp_disp_layer_enable(layer); if (layer == dp->dpsub->layers[ZYNQMP_DPSUB_LAYER_GFX]) diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c index bf9fba01df0e..d96b3f3f2e3a 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -111,7 +111,7 @@ static void zynqmp_dpsub_plane_atomic_update(struct drm_plane *plane, if (old_state->fb) zynqmp_disp_layer_disable(layer); - zynqmp_disp_layer_set_format(layer, new_state->fb->format); + zynqmp_disp_layer_set_format(layer, new_state->fb->format->format); } zynqmp_disp_layer_update(layer, new_state); From patchwork Thu Mar 21 20:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599377 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 6F9A2C6FD1F for ; Thu, 21 Mar 2024 20:45:21 +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=Db65RBruO1AdXc36CTRf9gLmSRgQW2edaLirIo7NFNE=; b=JfX6q7H8hAG1Bu rGjC32OhoZxVKdqdZTF4f0UPQ/LwagQ3FDKy89g95d93QUs7fmUtJqlzRb84509+PqPYoqYgpnAlS 5uQcX4hjFXoN1fbt9XLLmNA+dMG+OeS0nTXZLW7vCujD0vfuLqS+To8CocAwPZIzIfsmAJ806paiN aUtR5PpDuDXwXULgqQSHHBPs09CDH8IMRhD6h/ZksELw3b9MuEmjt6z/I0FWMYNsWZAPhztzXTXLf qU95kK7fg3Sv4JoljUIpPHv2VJ71r2XTsunL8rK/iRO4bM7EU4fKnTKN6zex4t9pJgarU8VZYXlyO m8ufuqlquzqN1QdTT4xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHe-00000004ZYu-1QqR; Thu, 21 Mar 2024 20:45:06 +0000 Received: from mail-dm6nam11on20600.outbound.protection.outlook.com ([2a01:111:f403:2415::600] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGx-00000004Z7t-3y4F for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m01G96dn54T6cIbAY4bMM1qXsrGt6LUs0mj6+++0Mi+Y8IKhN5quEItTKKP77ApiBOY/bcwIQXj+5pPrWuG9g6C8tuukZktIbbPXAfOope3KmoFPedehV4dAuF5lhoU2Q91AiYPC3mC73aiVpTU2HL4HmgIbcZT/bFFsDf/VBZ/klOAXGtR5dCTgpsqw7CNOcv+Be/B5DbmTTDcRgLCNxF9ilTpm+vI5ScBCNywdqbHygoX9M/OzElm1lD/c4yRf+Zt+JE1K0/AXFogsWSfo0C6Pet0j2cBiVAO3VRJNlTQdPOJRZ3kDotym599BJroJmSGyW6ZSnq0g2YgbX0DTAA== 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=UR7l+OkffQKba4rEVoAcNglywMyVbJo8gFYVAmFw0hI=; b=Q69NQKaLKkStQyVLLyJMcs2wY7gFLxjUb1H/inoo59Bn/Q/ReOsrzjE5gBygzNqKhtZIWJ4HAl6AIaSIRyB53oT1k7uQOk/2C7gtAda/BhXfJnL17ogSzv7acTrZIRabZv3nmcEl9cfe8XGDvN+9yS+QPqEEV6Xdl6FSO//Ry8VmBzV+9KUKbyZkcOHjpuAV4wZEcBFIZClxA0dLz0N1YI12fNPwPr3iqAcq9FcYPsZsGZcJ63VQ9ruX2dIWKlFFcmhuKaJUekzF9B8TxtPq5CBovNJHeovBeXJnT3vbjNlvNfUOQRYYxKqGj+Mtl0VRFFanS/xmkBgPZiJlc3L2kQ== 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=UR7l+OkffQKba4rEVoAcNglywMyVbJo8gFYVAmFw0hI=; b=oqX+HZ1Cl3PRBjP18CqbMtaK15U7qPokuT0ujvfW68Bs9sXrvK7szzOHFNElwf7YO/mdG3pIP6yLwCUvQD3lOlhMmNkZy/MfV86ydrNVvWwy69se26g7V/dMfX+T6ZpfxYPD+p+w+IepKAOp9K33VydylSFplhdDiI+x28S3ke4= Received: from BN9PR03CA0157.namprd03.prod.outlook.com (2603:10b6:408:f4::12) by BY5PR12MB4131.namprd12.prod.outlook.com (2603:10b6:a03:212::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:17 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:408:f4:cafe::f6) by BN9PR03CA0157.outlook.office365.com (2603:10b6:408:f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Thu, 21 Mar 2024 20:44:16 +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:16 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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:08 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) 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:08 -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; Thu, 21 Mar 2024 15:44:06 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:45 -0700 Subject: [PATCH v3 7/9] drm/atomic-helper: Add select_output_bus_format callback MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-7-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_|BY5PR12MB4131:EE_ X-MS-Office365-Filtering-Correlation-Id: 72523a37-23a2-4f8e-e5db-08dc49e7acff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v2CgC+34DcYChLjnOoeZvazvHZE5CqhHHhLi36JPV8nAb9+EEi1HS11n9Mh1UbxytyLT6SX5WC5xm1AltODdqqq+TinLa7S2lKkWj50hNqwM5I3twZaHX2HMIAT+W+xsVqwZE1EACO5TKd9G/XH84p6bjlbZLXvuwv5tgb283pH6NC47dRHu7tA63BG9YxVKPXrXza6CxuDa1+tZ90lYIlfe4xsb1Savglv0A1ALDBuQtcbHutj6TGxQMRJmCln6MFoK39CAZYyZilnrzzvsK6fc9y00SsnOynr9XsK7rhOKBoxfpl9Mz2XuwyYt0WUPWscOKW6m+7d58fnH9GSVIlCnvukmAf6cLP/4ttyx2r7MwJlQcIF+ouUZDbUi6A8A9UAN71A+UynExl+ogYQutKtOlYv0cEftUXmzhBzv9krOuyrR2eAAA70ryO6l2phHk/Y0kZb/N+c2s3Cc7WwyuZWJG9nIPG/BNKt5YO7F+mC8hBUJTrybatyPJ6qYnRRc7joSijc5HR/Y7/rlDDFV7ZSLnvPnqqvMXClivFGbMZD2KUkOmD9naRQgrYqerzxsgoO+SzIRSZqTjJXbQz7WqzWLPWXohtcWnr/EBWRAEWp5SiIzhY3GB0KT+qVdiCK/SxtDrO6vbz+zplMyzf1RrtV7QVz57Tn5JnP7JyEDCzzaRdnFtmn0uUPvZ8P19eRoYTlFO3mRwm17x+sZxkl+4kHnTdXh7Vk1/RTI2rL3vMLTbknukXO2H4Vn67M/SIXKVN9fPFg55Y4bsrBIr3YviA== 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)(376005)(7416005)(82310400014)(36860700004)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:16.6461 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72523a37-23a2-4f8e-e5db-08dc49e7acff 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: BY5PR12MB4131 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134424_305478_AF24FEB1 X-CRM114-Status: GOOD ( 24.36 ) 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 optional drm_crtc_helper_funcs.select_output_bus_format callback. This callback allows to negotiate compatible media bus format on the link between CRTC and connected DRM encoder or DRM bridge chain. A good usage example is the CRTC implemented as FPGA soft IP. This kind of CRTC will most certainly support a single output media bus format, as supporting multiple runtime options consumes extra FPGA resources. A variety of options for the FPGA designs are usually achieved by synthesizing IP with different parameters. Add drm_helper_crtc_select_output_bus_format that wraps drm_crtc_helper_funcs.select_output_bus_format. Incorporate select_output_bus_format callback into the format negotiation stage to fix the input bus format of the first DRM bridge in the chain. Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/drm_bridge.c | 14 +++++++++++-- drivers/gpu/drm/drm_crtc_helper.c | 36 ++++++++++++++++++++++++++++++++ include/drm/drm_crtc_helper.h | 5 +++++ include/drm/drm_modeset_helper_vtables.h | 30 ++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 521a71c61b16..955ca108cd4b 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -879,7 +880,8 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, unsigned int i, num_in_bus_fmts = 0; struct drm_bridge_state *cur_state; struct drm_bridge *prev_bridge; - u32 *in_bus_fmts; + struct drm_crtc *crtc = crtc_state->crtc; + u32 *in_bus_fmts, in_fmt; int ret; prev_bridge = drm_bridge_get_prev_bridge(cur_bridge); @@ -933,7 +935,15 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, return -ENOMEM; if (first_bridge == cur_bridge) { - cur_state->input_bus_cfg.format = in_bus_fmts[0]; + in_fmt = drm_helper_crtc_select_output_bus_format(crtc, + crtc_state, + in_bus_fmts, + num_in_bus_fmts); + if (!in_fmt) { + kfree(in_bus_fmts); + return -ENOTSUPP; + } + cur_state->input_bus_cfg.format = in_fmt; cur_state->output_bus_cfg.format = out_bus_fmt; kfree(in_bus_fmts); return 0; diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 2dafc39a27cb..f2e12a3c4e5f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -1055,3 +1055,39 @@ int drm_helper_force_disable_all(struct drm_device *dev) return ret; } EXPORT_SYMBOL(drm_helper_force_disable_all); + +/** + * drm_helper_crtc_select_output_bus_format - Select output media bus format + * @crtc: The CRTC to query + * @crtc_state: The new CRTC state + * @supported_fmts: List of media bus format options to pick from + * @num_supported_fmts: Number of media bus formats in @supported_fmts list + * + * Encoder drivers may call this helper to give the connected CRTC a chance to + * select compatible or preffered media bus format to use over the CRTC encoder + * link. Encoders should provide list of supported input MEDIA_BUS_FMT_* for + * CRTC to pick from. CRTC driver is expected to select preferred media bus + * format from the list and, once enabled, generate the signal accordingly. + * + * Returns: + * Selected preferred media bus format or 0 if CRTC does not support any from + * @supported_fmts list. + */ +u32 drm_helper_crtc_select_output_bus_format(struct drm_crtc *crtc, + struct drm_crtc_state *crtc_state, + const u32 *supported_fmts, + unsigned int num_supported_fmts) +{ + if (!crtc || !supported_fmts || !num_supported_fmts) + return 0; + + if (!crtc->helper_private || + !crtc->helper_private->select_output_bus_format) + return supported_fmts[0]; + + return crtc->helper_private->select_output_bus_format(crtc, + crtc_state, + supported_fmts, + num_supported_fmts); +} +EXPORT_SYMBOL(drm_helper_crtc_select_output_bus_format); diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 8c886fc46ef2..b7eb52f3ce41 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h @@ -38,6 +38,7 @@ struct drm_atomic_state; struct drm_connector; struct drm_crtc; +struct drm_crtc_state; struct drm_device; struct drm_display_mode; struct drm_encoder; @@ -61,5 +62,9 @@ int drm_helper_connector_dpms(struct drm_connector *connector, int mode); void drm_helper_resume_force_mode(struct drm_device *dev); int drm_helper_force_disable_all(struct drm_device *dev); +u32 drm_helper_crtc_select_output_bus_format(struct drm_crtc *crtc, + struct drm_crtc_state *crtc_state, + const u32 *supported_fmts, + unsigned int num_supported_fmts); #endif diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index 881b03e4dc28..6d5a081e21a4 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -489,6 +489,36 @@ struct drm_crtc_helper_funcs { bool in_vblank_irq, int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); + + /** + * @select_output_bus_format + * + * Called by the connected DRM encoder to negotiate input media bus + * format. CRTC is expected to pick preferable media formats from the + * list provided by the DRM encoder. + * + * This callback is optional. + * + * Parameters: + * + * crtc: + * The CRTC. + * crcs_state: + * New CRTC state. + * supported_fmts: + * List of input bus formats supported by the encoder. + * num_supported_fmts: + * Number of formats in the list. + * + * Returns: + * + * Preferred bus format from the list or 0 if CRTC doesn't support any + * from the provided list. + */ + u32 (*select_output_bus_format)(struct drm_crtc *crtc, + struct drm_crtc_state *crtc_state, + const u32 *supported_fmts, + unsigned int num_supported_fmts); }; /** From patchwork Thu Mar 21 20:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599376 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 E7CF8C54E58 for ; Thu, 21 Mar 2024 20:45:19 +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=y/jbIt8cYgGMiIXaQVcGgYzPf/mxlg9IJiTeUSIr0xQ=; b=Nc5+zv1uURsNPg jKkLSOfncb2/muS8iwLrHDcu0ypcQJbRmNMGNAAbZxBplP67GnTFe2D+ekCRSi70DSUa/legIvD25 hnNJm8ko0TovCaYtYidKtFoHvNfHoGHfnBNcGRxQNyk9VQ6aqJi8Ud5tFtl7gaXb7gj9sgSCD8dGO We3O5EO5PJ28si5wW1/6qWZ9rrtMNAQOcwVxoH9V/f5UGpLrrTq+Pxu9b7zClIu57wXGVA4xCUWD/ JO7WCmpo2MKYvfSQlzkl2wekCFMpblejsasA8aD23aUz+uj3lUJKwfgKgtKqiFXr3MEKjnXFFMwX1 0lxwPms9OWl9PtvWeI5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHd-00000004ZY7-16pK; Thu, 21 Mar 2024 20:45:05 +0000 Received: from mail-co1nam11on20601.outbound.protection.outlook.com ([2a01:111:f403:2416::601] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPGp-00000004Z3G-39hM for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ecsCNoiwLkVtJ/LjF85sRiHYnZF80MsioqL1JYw9i5JCa3jYYRDnLaxLMG+1+iZhje7ry67VzemEd6GrctYfxDRGgPY03eakTwndmhzO/YRnqHpiiLJJPBrnGNwy6cH9gbTXu+mgaET+vFQ4fdfRNpF1/L6BSK/uq5b8YgbnOis1aPL9Sq2u2tWIDAvaC3KRfuVpFoguFFNj4VDQjW9W+2P45F13BYwHi93lJNCbgMQezd3FGkYC/IQtJrCHjS1tEjpy0pO14RUjDO7w9N8HIuH0hUyuR9PJt/U20LIDiqcsWKIjSNFSw6PTytNTAEN7kBGRcsE2nrrwLG6O+tAMqg== 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=gzFR8JuzwQFAHUgF/Kyf1Su9JFwzSXxWGVcOG23T+yk=; b=Wp8zTbCJqzElVEWv8JP4XfTgntdgHwAmxGSO58k3xMEFMbQI7Vh8tq4l9egQSupP5ZomXLA2xkgOXC0raxUsC77MsiaLPRpbKHSZVr1EGsjpjHItKfTaJ1N9PepRBRZCidxAP1V7x5cpq3oiLwVgKP2mlgXHgXt6u7BKCZRCmdTt5hI+KVQgFj1D3D8QBZkpWtkdvMNH4rhb+PmzrEeHK+0wowONcyrjAQwRMTWHC3Ob2O1IU2NAZwufrtbu93C9uJh9gy3IdBW9E4Q0z2c8PJEi4ELP7qM2j1HlNWv6KYUGFrdIgo06LN/Ky4hHJLJ8t3dtLNt4a63ixr6WsnvAEw== 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=gzFR8JuzwQFAHUgF/Kyf1Su9JFwzSXxWGVcOG23T+yk=; b=UDyWapnPaaRh/l1QIBnUQb8fvAfwT7aOojUhqJd1UKgMGU42uKhXL8LzcRIi82REVNm3qB7z5i3lHR9/j9RGsYMaXTVbQ5k2EeHWeuK6J0EumztB0WzKK0hu2uz8xz1HFbPP4a4WMxB1Nv8PIeVtg9hhfxcAcc7xPbjDg25ey04= Received: from BN9P220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::31) by SN7PR12MB8602.namprd12.prod.outlook.com (2603:10b6:806:26d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.34; Thu, 21 Mar 2024 20:44:11 +0000 Received: from BN3PEPF0000B36E.namprd21.prod.outlook.com (2603:10b6:408:13e:cafe::12) by BN9P220CA0026.outlook.office365.com (2603:10b6:408:13e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Thu, 21 Mar 2024 20:44:11 +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 BN3PEPF0000B36E.mail.protection.outlook.com (10.167.243.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7430.0 via Frontend Transport; Thu, 21 Mar 2024 20:44:10 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Thu, 21 Mar 2024 15:44:10 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) 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:09 -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; Thu, 21 Mar 2024 15:44:08 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:46 -0700 Subject: [PATCH v3 8/9] dt-bindings: xlnx: Add VTC and TPG bindings MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-8-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: BN3PEPF0000B36E:EE_|SN7PR12MB8602:EE_ X-MS-Office365-Filtering-Correlation-Id: 06a396c9-9a27-4147-6dce-08dc49e7a9a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PTAo4ZlofqVwJER+4jVpBqI7HFSvoNajV8qC525V/tLMbYGA/C4uYpiWNWx5xxylnju6j0UZQcT81xSGmwVHO6BCvgv0LvLnXUYW4q3Ml7+knNjSjyrkK5QNIaEXTvUtQCsPYJ95dQzIbg6V3bjsNw8ZV84HTu+DwyyP91fjYuDvJ/Ln6biP0DAaOXDp0N6vk8+sXOKOhCb6UQw0Xfeu4QQv4hVVFgw0V7vpTMTgMa2wdkNvLiobIeoVvm67Owr2SeI6sa/zK+Y45OItVU9+jTj6mlNtwI0WeU+8zPQhm8uu/YA8YLrKjpxbL40Slkq6ue5mQsH2XLHHi1sIWIyP1uTFdh1kSqjxAYlq/tt1uhN/7bbfmECaYuBdkgCnz6JReF0TUS4POkKb/u6aiOuMIJG0BvHbSnsthF6fKbg3UnyR/kx9oGlJrfRNE4q+PZNIfP5bK3eudLmdQCLZWoRdcE8Jci/KB+egb+fk38gy2/2q7w4udvrZu2DQg4Ek3oCr60c3QJrGakA06/Wh2DZPm0krMDK851EqPwODrbPA0iqjHnFpHBjD0o3Pq2BUMzXTOBveUwbxJfns79k7Sk04KzCzlYLbiV/bRUnxh9a/nSOhY4fbuheARnlGUAzjeKoXwjk5mvramwB2Ux4eRlaGDO9q78mH8V8OHiBDOQzJfn8/94LaGG3Y5gauexXYA+Iy8Hk7ltO0LCG2XKw/tQu1zSuqKAqKn5T6hvM9YOzkkNQ= 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)(82310400014)(376005)(36860700004)(7416005)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:10.9953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06a396c9-9a27-4147-6dce-08dc49e7a9a6 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: BN3PEPF0000B36E.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8602 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134416_333843_E30422A8 X-CRM114-Status: GOOD ( 21.83 ) 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 DO NOT MERGE. REFERENCE ONLY. Add binding for AMD/Xilinx Video Timing Controller and Test Pattern Generator. Copy media-bus-formats.h into dt-bindings/media to suplement TPG DT node. Signed-off-by: Anatoliy Klymenko --- .../bindings/display/xlnx/xlnx,v-tpg.yaml | 87 ++++++++++ .../devicetree/bindings/display/xlnx/xlnx,vtc.yaml | 65 ++++++++ include/dt-bindings/media/media-bus-format.h | 177 +++++++++++++++++++++ 3 files changed, 329 insertions(+) diff --git a/Documentation/devicetree/bindings/display/xlnx/xlnx,v-tpg.yaml b/Documentation/devicetree/bindings/display/xlnx/xlnx,v-tpg.yaml new file mode 100644 index 000000000000..df5ee5b547cf --- /dev/null +++ b/Documentation/devicetree/bindings/display/xlnx/xlnx,v-tpg.yaml @@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/xlnx/xlnx,v-tpg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx Video Test Pattern Generator (TPG) + +description: + AMD/Xilinx Video Test Pattern Generator IP is a soft IP designed to + generate test video signal in AXI4-Stream Video format. + https://docs.xilinx.com/r/en-US/pg103-v-tpg + +maintainers: + - Anatoliy Klymenko + +properties: + compatible: + description: + TPG versions backward-compatible with previous versions should list all + compatible versions in the newer to older order. + enum: ["xlnx,v-tpg-8.0", "xlnx,v-tpg-8.2"] + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + bus-format: + description: Output media bus format, one of MEDIA_BUS_FMT_* + maxItems: 1 + + xlnx,bridge: + description: Reference to Video Timing Controller + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: + Connections from and to external components in the video pipeline. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Sink port connected to downstream video IP. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Source port to connect to optional video signal source. + + required: + - port@0 + +required: + - compatible + - reg + - interrupts + - bus-format + - xlnx,bridge + - ports + +additionalProperties: false + +examples: + - | + #include + + tpg_0: tpg@40050000 { + compatible = "xlnx,v-tpg-8.0"; + reg = <0x40050000 0x10000>; + interrupts = <0 89 4>; + xlnx,bridge = <&vtc_3>; + bus-format = ; + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + tpg_out: endpoint { + remote-endpoint = <&dp_encoder>; + }; + }; + }; + }; + +... diff --git a/Documentation/devicetree/bindings/display/xlnx/xlnx,vtc.yaml b/Documentation/devicetree/bindings/display/xlnx/xlnx,vtc.yaml new file mode 100644 index 000000000000..51eb12cdcfdc --- /dev/null +++ b/Documentation/devicetree/bindings/display/xlnx/xlnx,vtc.yaml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/xlnx/xlnx,vtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Device-Tree for Xilinx Video Timing Controller(VTC) + +description: + Xilinx VTC is a general purpose video timing generator and detector. + The input side of this core automatically detects horizontal and + vertical synchronization, pulses, polarity, blanking timing and active pixels. + While on the output, it generates the horizontal and vertical blanking and + synchronization pulses used with a standard video system including support + for programmable pulse polarity. + + The core is commonly used with Video in to AXI4-Stream core to detect the + format and timing of incoming video data or with AXI4-Stream to Video out core + to generate outgoing video timing for downstream sinks like a video monitor. + + For details please refer to + https://docs.xilinx.com/r/en-US/pg016_v_tc + +maintainers: + - Sagar Vishal + +properties: + compatible: + const: "xlnx,bridge-v-tc-6.1" + + reg: + maxItems: 1 + + xlnx,pixels-per-clock: + description: Pixels per clock of the stream. + enum: [1, 2, 4] + + clocks: + minItems: 2 + + clock-names: + items: + - const: clk + - const: s_axi_aclk + +required: + - compatible + - reg + - xlnx,pixels-per-clock + - clocks + - clock-names + +additionalProperties: false + +examples: + - | + v_tc_0: v_tc@80010000 { + clock-names = "clk", "s_axi_aclk"; + clocks = <&clk_wiz_0>, <&misc_clk_0>; + compatible = "xlnx,bridge-v-tc-6.1"; + xlnx,pixels-per-clock = <1>; + reg = <0x80010000 0x10000>; + }; + +... diff --git a/include/dt-bindings/media/media-bus-format.h b/include/dt-bindings/media/media-bus-format.h new file mode 100644 index 000000000000..60fc6e11dabc --- /dev/null +++ b/include/dt-bindings/media/media-bus-format.h @@ -0,0 +1,177 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Media Bus API header + * + * Copyright (C) 2009, Guennadi Liakhovetski + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __LINUX_MEDIA_BUS_FORMAT_H +#define __LINUX_MEDIA_BUS_FORMAT_H + +/* + * These bus formats uniquely identify data formats on the data bus. Format 0 + * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where + * the data format is fixed. Additionally, "2X8" means that one pixel is + * transferred in two 8-bit samples, "BE" or "LE" specify in which order those + * samples are transferred over the bus: "LE" means that the least significant + * bits are transferred first, "BE" means that the most significant bits are + * transferred first, and "PADHI" and "PADLO" define which bits - low or high, + * in the incomplete high byte, are filled with padding bits. + * + * The bus formats are grouped by type, bus_width, bits per component, samples + * per pixel and order of subsamples. Numerical values are sorted using generic + * numerical sort order (8 thus comes before 10). + * + * As their value can't change when a new bus format is inserted in the + * enumeration, the bus formats are explicitly given a numerical value. The next + * free values for each category are listed below, update them when inserting + * new pixel codes. + */ + +#define MEDIA_BUS_FMT_FIXED 0x0001 + +/* RGB - next is 0x1026 */ +#define MEDIA_BUS_FMT_RGB444_1X12 0x1016 +#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 +#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 +#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003 +#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 +#define MEDIA_BUS_FMT_RGB565_1X16 0x1017 +#define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005 +#define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006 +#define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 +#define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 +#define MEDIA_BUS_FMT_RGB666_1X18 0x1009 +#define MEDIA_BUS_FMT_RGB666_2X9_BE 0x1025 +#define MEDIA_BUS_FMT_BGR666_1X18 0x1023 +#define MEDIA_BUS_FMT_RBG888_1X24 0x100e +#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015 +#define MEDIA_BUS_FMT_BGR666_1X24_CPADHI 0x1024 +#define MEDIA_BUS_FMT_RGB565_1X24_CPADHI 0x1022 +#define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010 +#define MEDIA_BUS_FMT_BGR888_1X24 0x1013 +#define MEDIA_BUS_FMT_BGR888_3X8 0x101b +#define MEDIA_BUS_FMT_GBR888_1X24 0x1014 +#define MEDIA_BUS_FMT_RGB888_1X24 0x100a +#define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b +#define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c +#define MEDIA_BUS_FMT_RGB888_3X8 0x101c +#define MEDIA_BUS_FMT_RGB888_3X8_DELTA 0x101d +#define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011 +#define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012 +#define MEDIA_BUS_FMT_RGB666_1X30_CPADLO 0x101e +#define MEDIA_BUS_FMT_RGB888_1X30_CPADLO 0x101f +#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d +#define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f +#define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 +#define MEDIA_BUS_FMT_RGB666_1X36_CPADLO 0x1020 +#define MEDIA_BUS_FMT_RGB888_1X36_CPADLO 0x1021 +#define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 +#define MEDIA_BUS_FMT_RGB161616_1X48 0x101a + +/* YUV (including grey) - next is 0x202f */ +#define MEDIA_BUS_FMT_Y8_1X8 0x2001 +#define MEDIA_BUS_FMT_UV8_1X8 0x2015 +#define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002 +#define MEDIA_BUS_FMT_VYUY8_1_5X8 0x2003 +#define MEDIA_BUS_FMT_YUYV8_1_5X8 0x2004 +#define MEDIA_BUS_FMT_YVYU8_1_5X8 0x2005 +#define MEDIA_BUS_FMT_UYVY8_2X8 0x2006 +#define MEDIA_BUS_FMT_VYUY8_2X8 0x2007 +#define MEDIA_BUS_FMT_YUYV8_2X8 0x2008 +#define MEDIA_BUS_FMT_YVYU8_2X8 0x2009 +#define MEDIA_BUS_FMT_Y10_1X10 0x200a +#define MEDIA_BUS_FMT_Y10_2X8_PADHI_LE 0x202c +#define MEDIA_BUS_FMT_UYVY10_2X10 0x2018 +#define MEDIA_BUS_FMT_VYUY10_2X10 0x2019 +#define MEDIA_BUS_FMT_YUYV10_2X10 0x200b +#define MEDIA_BUS_FMT_YVYU10_2X10 0x200c +#define MEDIA_BUS_FMT_Y12_1X12 0x2013 +#define MEDIA_BUS_FMT_UYVY12_2X12 0x201c +#define MEDIA_BUS_FMT_VYUY12_2X12 0x201d +#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e +#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f +#define MEDIA_BUS_FMT_Y14_1X14 0x202d +#define MEDIA_BUS_FMT_Y16_1X16 0x202e +#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f +#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010 +#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011 +#define MEDIA_BUS_FMT_YVYU8_1X16 0x2012 +#define MEDIA_BUS_FMT_YDYUYDYV8_1X16 0x2014 +#define MEDIA_BUS_FMT_UYVY10_1X20 0x201a +#define MEDIA_BUS_FMT_VYUY10_1X20 0x201b +#define MEDIA_BUS_FMT_YUYV10_1X20 0x200d +#define MEDIA_BUS_FMT_YVYU10_1X20 0x200e +#define MEDIA_BUS_FMT_VUY8_1X24 0x2024 +#define MEDIA_BUS_FMT_YUV8_1X24 0x2025 +#define MEDIA_BUS_FMT_UYYVYY8_0_5X24 0x2026 +#define MEDIA_BUS_FMT_UYVY12_1X24 0x2020 +#define MEDIA_BUS_FMT_VYUY12_1X24 0x2021 +#define MEDIA_BUS_FMT_YUYV12_1X24 0x2022 +#define MEDIA_BUS_FMT_YVYU12_1X24 0x2023 +#define MEDIA_BUS_FMT_YUV10_1X30 0x2016 +#define MEDIA_BUS_FMT_UYYVYY10_0_5X30 0x2027 +#define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 +#define MEDIA_BUS_FMT_UYYVYY12_0_5X36 0x2028 +#define MEDIA_BUS_FMT_YUV12_1X36 0x2029 +#define MEDIA_BUS_FMT_YUV16_1X48 0x202a +#define MEDIA_BUS_FMT_UYYVYY16_0_5X48 0x202b + +/* Bayer - next is 0x3021 */ +#define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 +#define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 +#define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 +#define MEDIA_BUS_FMT_SRGGB8_1X8 0x3014 +#define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 0x3015 +#define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 0x3016 +#define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 0x3017 +#define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 0x3018 +#define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 0x300b +#define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 0x300c +#define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 0x3009 +#define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 0x300d +#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE 0x3003 +#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE 0x3004 +#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE 0x3005 +#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE 0x3006 +#define MEDIA_BUS_FMT_SBGGR10_1X10 0x3007 +#define MEDIA_BUS_FMT_SGBRG10_1X10 0x300e +#define MEDIA_BUS_FMT_SGRBG10_1X10 0x300a +#define MEDIA_BUS_FMT_SRGGB10_1X10 0x300f +#define MEDIA_BUS_FMT_SBGGR12_1X12 0x3008 +#define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 +#define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 +#define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 +#define MEDIA_BUS_FMT_SBGGR14_1X14 0x3019 +#define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a +#define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b +#define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c +#define MEDIA_BUS_FMT_SBGGR16_1X16 0x301d +#define MEDIA_BUS_FMT_SGBRG16_1X16 0x301e +#define MEDIA_BUS_FMT_SGRBG16_1X16 0x301f +#define MEDIA_BUS_FMT_SRGGB16_1X16 0x3020 + +/* JPEG compressed formats - next is 0x4002 */ +#define MEDIA_BUS_FMT_JPEG_1X8 0x4001 + +/* Vendor specific formats - next is 0x5002 */ + +/* S5C73M3 sensor specific interleaved UYVY and JPEG */ +#define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001 + +/* HSV - next is 0x6002 */ +#define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001 + +/* + * This format should be used when the same driver handles + * both sides of the link and the bus format is a fixed + * metadata format that is not configurable from userspace. + * Width and height will be set to 0 for this format. + */ +#define MEDIA_BUS_FMT_METADATA_FIXED 0x7001 + +#endif /* __LINUX_MEDIA_BUS_FORMAT_H */ From patchwork Thu Mar 21 20:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13599378 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 6C5C8CD11BF for ; Thu, 21 Mar 2024 20:45:22 +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=URlq0uCGOOrTmXcYVwt5DMdR2pJNz46HbaWW5CujJqE=; b=kFeIhvdNvV/eOy q6J5GLjSdoKdbKt6yhbKfLjySei69v32JfWLnwjVuZ/YiivAvAJ6zVEkfQGA63lK4N84LgBnDGEM6 TF8h9wYsmd6ceTQrXyQvmE82UDHCwee5l2aOe8ciLqBF4bBepjFXT/Eh02lZm1lYw96spHx1GZO9H H8LId1R8atSIgfhSA2viPwaC3unrUvdkX1vEz62oVmLr4Q7GUHLaHiaFOpZNyjaxYQjPMFSvQIhyv 5AhKh+W0dvp+MaWWKROCW9KiBfNx8ns2kvpfjHo7M0yoc82uDH09Whh64uXcUKjI/lHHB8BaAKpdr 1rfT8A/sdV3r6pLHAHtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPHf-00000004Za2-3XGS; Thu, 21 Mar 2024 20:45:07 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnPH0-00000004ZAh-3GwS for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 20:44:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b68qf90bGeZDFJ9HRT1Q6gpWZi5uUJpFN6DPz5E0DoKI5WJZiHsxboSK12bMjCyhRmODwlQ2IFVAs2Jy95tY9Bzysw2i+MNF47Foea+pMV297+4nzYKFzi4p7N9tTzpN29EBveizVgajKWSvICpPoPpQFy0KFihPZ3vu8phCM5KBsGiebCbTc2yuULZv2h5BH7j14z6CFrDY4MuUi3PNBPgAouV+CfJ1G/ubchJXFxzu8mMc7Ith369WpD0NcAKLxaCS3UzfEiZV13B9fiXEAi6ne8XEA01egOZbUt2cFuecB0IXPvhzvQtMbPf+n59BWQfmrfiG+Nr8MjH7Wf084w== 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=Z94ce+/n0RvmiJVtVAbri9i36FVONgDviQgEhnE5AwI=; b=RObg36cKncE7Or377GUlA/TXYIUwmycPiD/mAoQCTkXe8PQd/Xg25qScjqLfnRavktgobvDr/fyIuJawyptJh8qC6FZ36Xvr+hvF2z+iykWcyoSNm0pFDYdLDDo27tHJyvEkYuD8ahmOdjmhxkZHoQrcb4tXJ9JWBbokx2uksjqg4rk0ZOzhGlK5QGwUluuUIJHyAsZqpbtuqpoNsYVmxP6eECHfd9rgpoaZLwG40OHqVHOISCNpjxGwtYvPACWb9z2xTNYQ6XmNvr+xAPdQhkL3LKWjOKBg+P7V06cuQcuvbATvdwef3NjU3dquFl8tLdH/ZEioWCfiIPGaAwsNuQ== 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=Z94ce+/n0RvmiJVtVAbri9i36FVONgDviQgEhnE5AwI=; b=JJAol3Z7AjeDc3Qos+xm4KzXZGPCstSdJjcEYtnHSAQ93s+ZLaBlFrg7srTp4qm4I8DgDCGCLZwmVXLrA0IObGgRyYh/DRq/q0jQdR2bZc6fw3CwPAJ5paJ598oJ0RyOvRr3pjGCbEN0XyeyGsUa3FOmV+G4IdQp/b9x48rr+aM= Received: from BN9PR03CA0683.namprd03.prod.outlook.com (2603:10b6:408:10e::28) by PH7PR12MB6980.namprd12.prod.outlook.com (2603:10b6:510:1ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.15; Thu, 21 Mar 2024 20:44:19 +0000 Received: from BN3PEPF0000B075.namprd04.prod.outlook.com (2603:10b6:408:10e:cafe::49) by BN9PR03CA0683.outlook.office365.com (2603:10b6:408:10e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 21 Mar 2024 20:44:16 +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 BN3PEPF0000B075.mail.protection.outlook.com (10.167.243.120) 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:16 +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:11 -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:11 -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:10 -0500 From: Anatoliy Klymenko Date: Thu, 21 Mar 2024 13:43:47 -0700 Subject: [PATCH v3 9/9] drm: xlnx: Intoduce TPG CRTC driver MIME-Version: 1.0 Message-ID: <20240321-dp-live-fmt-v3-9-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: BN3PEPF0000B075:EE_|PH7PR12MB6980:EE_ X-MS-Office365-Filtering-Correlation-Id: b333e939-0510-436e-8325-08dc49e7ad02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yEUKuwlrz8Tj7KA+noOmz+tsRIuA+hnCGhCjx70hpHDUuW4KX0rwlF0X+BzjYTIpMJtR0ozSzeLCHB+yrtOIZEB7SZX48FkeKuyYRpSZXSQ0LVy5ktlKui9jnoon3z6rZkvy0go1Nfd/k2Gpvsn0/pFqDf/oXTeStxoGeJGLpYjRKf7MYzc/DjILzdU0BtBea8XBMdNlWZQmrda8PasOd+E7p0r79ahdOb2vNrn9yCbjZVu2a/l1quTK0WR0uq8NSqlEx4B/hwdXwFRLINvSIG+pq3VD6uy546K+5ObBDs6M4LFzD1WYqKTwd3kVerRdJCbjGP+H+M/qilAHKqbOfnvQOwH+qwxvUorMpdLsxiUKG6RFxKKaUqAWK5itoSGo99cmkOx3eGncu+hoDRWpE1YVfQNFpK7FmuVpyRLbyGRKg6t4kRDO1sUT86PbatgGHfOYvMVkmxGt/26Tf9udbG7CU1dPvuiT4IblejBo6ymGWVlLbSxbEgIASlkTuywJhX0bcPoM4gPL0sBTVcZa8da/WBS29nn/LOFePo9K68AUIOzINTbZlW9q0zCkjIj/pjbA7MyY8qglwuwbsAR3cInorNjJAuhSJyage1QOtLKQ6sT9jqCBjBtE2ko98Ws4aVMoMmp4uJ6RrUSst2+W4YERXmCjsEz4uoajfw8GAxOzLBM4ma3bIgBlnq9EEUcvM/jj3vYPEfELsaQAYS7bGNxt4kSbWzNCGh5kUMeIvjo= 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)(1800799015)(36860700004)(82310400014)(376005)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 20:44:16.6788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b333e939-0510-436e-8325-08dc49e7ad02 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: BN3PEPF0000B075.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6980 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_134428_314933_8C151DB2 X-CRM114-Status: GOOD ( 20.25 ) 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 DO NOT MERGE. REFERENCE ONLY. Add CRTC driver based on AMD/Xilinx Video Test Pattern Generator IP. TPG based FPGA design represents minimalistic harness useful for testing links between FPGA based CRTC and external DRM encoders, both FPGA and hardened IP based. Add driver for AMD/Xilinx Video Timing Controller. The VTC, working in generator mode, suplements TPG with video timing signals. Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/Kconfig | 21 + drivers/gpu/drm/xlnx/Makefile | 4 + drivers/gpu/drm/xlnx/xlnx_tpg.c | 846 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/xlnx_vtc.c | 452 +++++++++++++++++++ drivers/gpu/drm/xlnx/xlnx_vtc.h | 101 +++++ drivers/gpu/drm/xlnx/xlnx_vtc_list.c | 160 +++++++ 6 files changed, 1584 insertions(+) diff --git a/drivers/gpu/drm/xlnx/Kconfig b/drivers/gpu/drm/xlnx/Kconfig index 68ee897de9d7..c40e98c1a5e6 100644 --- a/drivers/gpu/drm/xlnx/Kconfig +++ b/drivers/gpu/drm/xlnx/Kconfig @@ -15,3 +15,24 @@ config DRM_ZYNQMP_DPSUB This is a DRM/KMS driver for ZynqMP DisplayPort controller. Choose this option if you have a Xilinx ZynqMP SoC with DisplayPort subsystem. + +config DRM_XLNX_BRIDGE_VTC + bool "Xilinx DRM VTC Driver" + depends on OF + help + DRM brige driver for Xilinx Video Timing Controller. Choose + this option to make VTC a part of the CRTC in display pipeline. + Currently the support is added to the Xilinx Video Mixer and + Xilinx PL display CRTC drivers. This driver provides ability + to generate timings through the bridge layer. + +config DRM_XLNX_TPG + bool "Xilinx DRM TPG Driver" + depends on DRM && OF + select DRM_XLNX_BRIDGE_VTC + select VIDEOMODE_HELPERS + help + CRTC driver based on AMD/Xilinx Test Pattern Generator IP. Choose + this driver to enable Test Pattern Generator CRTC. This driver + implements simplistic CRTC with the single plane and is perfect for + testing PL to PS and PL to PL display output pipelines. diff --git a/drivers/gpu/drm/xlnx/Makefile b/drivers/gpu/drm/xlnx/Makefile index ea1422a39502..26fb3ad21fa9 100644 --- a/drivers/gpu/drm/xlnx/Makefile +++ b/drivers/gpu/drm/xlnx/Makefile @@ -1,2 +1,6 @@ zynqmp-dpsub-y := zynqmp_disp.o zynqmp_dpsub.o zynqmp_dp.o zynqmp_kms.o obj-$(CONFIG_DRM_ZYNQMP_DPSUB) += zynqmp-dpsub.o +xlnx-tpg-objs := xlnx_tpg.o +xlnx-tpg-$(CONFIG_DRM_XLNX_BRIDGE_VTC) += xlnx_vtc_list.o +obj-$(CONFIG_DRM_XLNX_TPG) += xlnx-tpg.o +obj-$(CONFIG_DRM_XLNX_BRIDGE_VTC) += xlnx_vtc.o diff --git a/drivers/gpu/drm/xlnx/xlnx_tpg.c b/drivers/gpu/drm/xlnx/xlnx_tpg.c new file mode 100644 index 000000000000..3056bf278414 --- /dev/null +++ b/drivers/gpu/drm/xlnx/xlnx_tpg.c @@ -0,0 +1,846 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Xilinx logicore test pattern generator driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. + * + * Author: Anatoliy Klymenko + * + * This driver introduces support for the test CRTC based on AMD/Xilinx + * Test Pattern Generator IP. The main goal of the driver is to enable + * simplistic FPGA design that could be used to test FPGA CRTC to external + * encoder IP connectivity. + * Reference: https://docs.xilinx.com/r/en-US/pg103-v-tpg + */ + +#include "xlnx_vtc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include