From patchwork Sun May 19 13:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13667849 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 5B75EC25B75 for ; Sun, 19 May 2024 13:06:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A10410E249; Sun, 19 May 2024 13:06:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="zFOBUKeM"; dkim-atps=neutral Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2068.outbound.protection.outlook.com [40.107.102.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id A702910E200; Sun, 19 May 2024 13:06:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HGY0Zb1d2y4zntPLSEsZhhUmo76AqYQ1vSjv2B2PO50vxZ7hoQklmnyEfP/FD5zReeWzXZCr5AgGWCHLoGO0NMXQq0Udad5o8FonePACj2fj7+iBDjeFSg3NqTZUiF1AHSbLQQOrkns7kckhP8u3RC6rpMAVhdt/oqW7jeoGCtUZF/PByZSnqEMlIVD2QHBswkiL0YzFfTudIegQxKD1TIuawSrK6fNHmbTi4y+j/Tp9plAAWQ/QvN8R8w4HiUTWQc5lEbSrk+JEuqLY9XtZlMyZ/CMJZYt6egFZhaGUGVi7yE6s/UKeBG8RG6QhQeHgXDuddPycPWz251xJ4wMjzQ== 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=U+0e7/5U5mxgtbXPbAdOsaM0T4CC3pVSWN+xSgNVZrI=; b=J5A05Wl7UakbIs5LFjQ4zgmTsCnhe4B0TflgwlS7jEhM0o2CtHjMunIS2+jvk8QUrDLEoXp/7RFsT3qMNE4sru6jRBw/LfnqsSIJki+ZxifFRdTYdycZcISH9YSAysGcb54SiKxP1nDm0apkdADHFFMQK19M8WFSlMR5IxD+4UPBcKjZn7H+kw0ZbDRR1UtcQ64AkQoXe9wDBEYuo8NGGxzeuxZxJi6WAI5+qoR61dhgsCyHKqjONf9FO5fexuUYK+6OGCdpBbbqbE07uLq3p5p2AkYKmbdYYTe19X5lRpcKJYHWtsOCcEfVLRctNSi8/3+wizYwo4ZUkqCEfSehBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U+0e7/5U5mxgtbXPbAdOsaM0T4CC3pVSWN+xSgNVZrI=; b=zFOBUKeMVH5IOMErZBOPnDujs99RTJz4vJH77Sn02S3Ad7HruD8tC+bNG7WmbGA7cDbEjUwrKqIqsEhwi9SnhL+36mgifegu5mWUdxnpnNxGrPLakfcn9c3NIda4PmdbG8RmwpsxpdfUaVfOF7qRiV8DuMezp9b42VJ6yMUihXQ= Received: from BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) by SJ0PR12MB5612.namprd12.prod.outlook.com (2603:10b6:a03:427::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Sun, 19 May 2024 13:06:28 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:a02:a8:cafe::35) by BYAPR03CA0005.outlook.office365.com (2603:10b6:a02:a8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.34 via Frontend Transport; Sun, 19 May 2024 13:06:28 +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 SJ5PEPF000001CC.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Sun, 19 May 2024 13:06:28 +0000 Received: from SITE-L-T34-2.amd.com (10.180.168.240) 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; Sun, 19 May 2024 08:06:27 -0500 From: Mario Limonciello To: CC: , , , Mario Limonciello Subject: [PATCH 1/2] drm: Introduce panel_power_saving drm property Date: Sun, 19 May 2024 08:06:09 -0500 Message-ID: <20240519130610.7773-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240519130610.7773-1-mario.limonciello@amd.com> References: <20240519130610.7773-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CC:EE_|SJ0PR12MB5612:EE_ X-MS-Office365-Filtering-Correlation-Id: 69464b19-779b-4bc5-1b62-08dc78047f33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|376005|1800799015; X-Microsoft-Antispam-Message-Info: pCYM4sRhCkefM/jFWUY9PEX0lz4KKRlV60IMGyB1LezzHl6Y1uayigVVBJujTN1Rfp+icAPfxPFVjX7kBW737cM8qEd+qpXFDxjBPGmLk1ZVjpb3uYvbx5cyNbtvMf+j148FDOPVs3mLv9FQbwHmjAw7Vgmf1zRRRMMXo57Ibc1cjQ3YLtNFmUmc3R8KZELIUlBo8ZAl9q1E1kyXE5P9bLlbDLnUa212Ed2HE5+qghM5k802nOhwY349bAop8NtUdf0i1sUdoHMd9rMGgDlxYqktjW97NTeRJjg42JkrWPWHMSbz3TL6yiOU8GWQQX4XsdwUmrfsvdF/wIeV5fW/XNKF/0mEJpYnLCeEpMwKdG5iMQeVSGeLHSb8oOE7+vQcRU65ysZgNti8m6CWB70xNZLOKuBv15WGCgaDeI5BEZutwOz3k1nCJpWNLpCAhBluYJqr20DUfM+u3ARi80vcjFRObiZH6rzNw2olR9TV+IZb7kQfesWcqkTWs065HCm1ydO7PP149yMHi+45Wr2XTRpmDftek19iiRVgneGKk5Yu5Eo6Y1sMjK11da4j8KigJbo9vv7qnT5tsShwacVtzaAbdg1PfnpAVG9fS8UOwzg7OfCh9VkoZk9Smdei6X99QMKKbyaV43ClJlZ+H2ovuysm1xulESjA2Ce0MpI1Iw4T5WBkHYFHhAoxFA0A7/sQ6Ku/RrMyFguisnTdD7xgfC1Yyaha7w5PG9S4XPVA7lRj5R0h49XybxSqtuGKAoUP0KmN5vWpCaCKM9JHNnmCDItHpaanFrB5eZaAosMJqEFEvoE8/X4VlvGI746Yw45TBKj+M9UD31iJjEKhEiBp2To2wCGleFPauXv0BFsQarrCkTEO/6LX6bzs6E5vcjiIQWcUYfkxNVgDk92hcd6lUGihUI20DwNJXjTbUvrQeG2XPRhW9J0WMkBIcEFKxY1ntA8rBcvJTlwjDOlh6mUGzA5T6n0cSp3lEQFvRjVrnXe5+GRUUbsWiJ4I6j8+xpX+7ofi7XvL3U5IK2JYpTUQ2xQB7eGO/GWMWX4UCtaBAermMj5kht7X7OUci5GLpFsOa/B63JgSjZsgW8oavLActAFC5xF/tPuuwt35V+JJkOuSFEbK2F0uC31jjAteREn1Kb+9XE/SpuPX5TZUw7VuxbNLxQuiObyNloIvrIk5m9NJf95SAAgTvqblqE9MSgKJ6ppS7PBhJXRVva6tAj1H+BnTfQEB3ZtEbntbZh5CxjyLumqgnbO9qFHG+WUxzlUaWwPHX9tM5GZXbrz54iMCflFEamTXNe5qjPuU68nUpJ4g+WTBSFIpcfxf7zUoURrrO3tQ9tW3t9T5OZN1e/uWY4YeZLWN/m1Oj+6xtSZWnXpbIlo6ifoVKeZ45+HtqQxR 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)(82310400017)(36860700004)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 13:06:28.7619 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69464b19-779b-4bc5-1b62-08dc78047f33 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: SJ5PEPF000001CC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5612 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The `panel_power_saving` DRM property is an optional property that can be added to a connector by a driver. This property is for compositors to indicate intent of allowing policy for the driver to use power saving features that may compromise color fidelity. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/drm_connector.c | 36 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 1 + include/drm/drm_mode_config.h | 6 ++++++ include/uapi/drm/drm_mode.h | 4 ++++ 4 files changed, 47 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 4d2df7f64dc5..ccf672c55e0c 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -961,6 +961,11 @@ static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = { { DRM_MODE_SCALE_ASPECT, "Full aspect" }, }; +static const struct drm_prop_enum_list drm_panel_power_saving_enum_list[] = { + { DRM_MODE_PANEL_POWER_SAVING_ALLOWED, "Allowed" }, + { DRM_MODE_PANEL_POWER_SAVING_FORBIDDEN, "Forbidden" }, +}; + static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { { DRM_MODE_PICTURE_ASPECT_NONE, "Automatic" }, { DRM_MODE_PICTURE_ASPECT_4_3, "4:3" }, @@ -1963,6 +1968,37 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev) } EXPORT_SYMBOL(drm_mode_create_scaling_mode_property); +/** + * drm_mode_create_panel_power_saving_property - create panel power saving property + * @dev: DRM device + * + * Called by a driver the first time it's needed, must be attached to desired + * connectors. + * + * Atomic drivers should use drm_mode_create_panel_power_saving_property() + * instead to correctly assign &drm_connector_state.panel_power_saving + * in the atomic state. + * + * Returns: %0 + */ +int drm_mode_create_panel_power_saving_property(struct drm_device *dev) +{ + struct drm_property *panel_power_saving; + + if (dev->mode_config.panel_power_saving) + return 0; + + panel_power_saving = + drm_property_create_enum(dev, 0, "panel power saving", + drm_panel_power_saving_enum_list, + ARRAY_SIZE(drm_panel_power_saving_enum_list)); + + dev->mode_config.panel_power_saving = panel_power_saving; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_panel_power_saving_property); + /** * DOC: Variable refresh properties * diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index fe88d7fc6b8f..4ea3f912c641 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -2025,6 +2025,7 @@ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector, u32 supported_colorspaces); int drm_mode_create_content_type_property(struct drm_device *dev); int drm_mode_create_suggested_offset_properties(struct drm_device *dev); +int drm_mode_create_panel_power_saving_property(struct drm_device *dev); int drm_connector_set_path_property(struct drm_connector *connector, const char *path); diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 973119a9176b..099ad2d8c5c1 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -954,6 +954,12 @@ struct drm_mode_config { */ struct drm_atomic_state *suspend_state; + /** + * @panel_power_saving: DRM ENUM property for type of + * Panel Power Saving. + */ + struct drm_property *panel_power_saving; + const struct drm_mode_config_helper_funcs *helper_private; }; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 7040e7ea80c7..82e565cc76fb 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -152,6 +152,10 @@ extern "C" { #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ +/* Panel power saving options */ +#define DRM_MODE_PANEL_POWER_SAVING_ALLOWED 0 /* Panel power savings features allowed */ +#define DRM_MODE_PANEL_POWER_SAVING_FORBIDDEN 1 /* Panel power savings features not allowed */ + /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 From patchwork Sun May 19 13:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13667848 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 31687C25B78 for ; Sun, 19 May 2024 13:06:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB21610E244; Sun, 19 May 2024 13:06:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="zqIX4AlH"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA78F10E23F; Sun, 19 May 2024 13:06:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8Ngk/XMx6wkS0pK8IPiw8LwCT9LZPpERzKYQm5O/ajcNfQMlm3h8ssYSpRXHDiNRZKPyce2xCjO6+r0HtcNE1OtGnmwPwEp8OIFnP0AAQpdT1hVsrDc0Ug5nJ35rvdjHHl9Dm0C2a90u0LUtvvRl9uoPWiPENkxxMoNfH7hRHe+YGZ5hDMqsMTtz3unHOeLtv7HoyCRTFHYuJlqKcE4Ya+TOMy8A4WaBe74hpI2AM2Kl9/TQRXe3W6pddDocany0PgTIENlDb6kfSd8DbQHYzZXh2brKYWWaAHj1RH7Au9TRz8qem7UkQYifhPAn70KD6frGzJGg2lqgKC2Y7sROA== 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=S0TA/AxFD8bnO6+8jjpVyYVqUNbVaIeriyEuUJexyv4=; b=b/7bW4oJ2o1t6IgoRtaoOspt7XlP16tQgQeODDF7x/vMtWQsCEqEl/ooQ6Mwd10ZiOZG9iK072LMNrYUwk9aro9cGM9K5ADKIpvEKqagDqKdXmCDJ5A+dDpF8qj5W8qPKpyPVClIV5WpfJTbSoNXN5qUPKVPVLljuWyk74bWBvdyDQr1oIH5Y0q8lCSiVNy5sS0O0bNsTFkEFIIbU8LWU+MUUbMvbqOJVEhNF7B6fEbdOG9oimdg1DzGU53hfkPyraTQT/EaVtUrq0TlUnl3cvxdfT8QX6+aWWdgOpdM9+c/E8vi2RPeNcZOeBwT2S/Ceu6XPQpfxwffT9dhkhLXDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S0TA/AxFD8bnO6+8jjpVyYVqUNbVaIeriyEuUJexyv4=; b=zqIX4AlHJqRz6UoH9XkhkIpkDy/IsToSET5Ckirl9LBEKHVO1rE30xxg79ny396SiIfjvoPSMh9F9MICTNRDiOoN63wL70ufaaXuzCdgGz5h5/Lqob6Kj1cYUpiGCzgFnkM2MBuwiIcAQf/GrVqhzW9uAIlUYT0Mh/K9ZV7boJg= Received: from BYAPR03CA0029.namprd03.prod.outlook.com (2603:10b6:a02:a8::42) by MW4PR12MB7119.namprd12.prod.outlook.com (2603:10b6:303:220::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.34; Sun, 19 May 2024 13:06:29 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:a02:a8:cafe::c7) by BYAPR03CA0029.outlook.office365.com (2603:10b6:a02:a8::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35 via Frontend Transport; Sun, 19 May 2024 13:06:29 +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 SJ5PEPF000001CC.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Sun, 19 May 2024 13:06:29 +0000 Received: from SITE-L-T34-2.amd.com (10.180.168.240) 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; Sun, 19 May 2024 08:06:27 -0500 From: Mario Limonciello To: CC: , , , Mario Limonciello Subject: [PATCH 2/2] drm/amd: Add panel_power_saving drm property to eDP connectors Date: Sun, 19 May 2024 08:06:10 -0500 Message-ID: <20240519130610.7773-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240519130610.7773-1-mario.limonciello@amd.com> References: <20240519130610.7773-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CC:EE_|MW4PR12MB7119:EE_ X-MS-Office365-Filtering-Correlation-Id: f9268a31-367e-49ce-53ca-08dc78047f6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: FlEuv+HlT429U0sj2GGHx48onC1lOPHobeY05PJuh85xNx+aP1x4XxEANlAPCwg5ScXNHsnu9FymkCMobIFYA6+OODALLshhMZ/W0iW4n8RKofTnQr0eq8M4JVOH/BCiypd0vp1eXX+QIIwnvOrpchuDgURbco/OC3xludCVwAaP/H3gR5YPkzc0xHwf5s9gN7ZAxW8DKfQFGoEdjKSl/MTbK0Ml6znwKT5CJvSrnajHDWuhgNmh4RMBUvq7prp1hI6vDi5BN0w1WEnxt6lnkelUSQAvvo9b5uVUlA8dW9DCJvGF8i3Pp/89acB1UjTMXBNdGJifP9Mw2n1e08ziTJmnDe5uka6kFFgd1cTxfJKYXNtCFT7jyVluqJyPIBsV7H+NTAnqN4IAvxKsPwHm85jSmadB1B8GfEB+H7+v69thm3BidNpPN4aMlsX1C2JgfNcUf3RcZyrf/Ee1NrPYlB8v8VtgTGLTX1LODxv9gESid1+uN91ITS8sK1gtP/EBX4WKkdfic5BV4b48ht17kBQuUSJzxOFEg0NOwl2qIpWiz4X6S7Yb91ewAFzC+7F/haJHKYyusHIllyDm1N9aIxXDRiz2FpkkjFHUQ79hLIelUHS7B3UDx/IaNMB8E/K91WKvIznWH9JxSULGMaze1VcW+ZTwPjQrMIkz91BPeonwERvO8eg4VYnOw7Etpp8hPjkf0G5k6ckk3G530K4iqGrg2f+TPzSjCkKXTDfc0D+6ZI9m75PYE7WFFq5FLc//V8KepZkBW81qfApM4FE7+H3ZTE9Q7LdU6Y7+qnn2y4ChSnX7avM3gTTwpbISDo0xWB6fbZNLY4i5C8mG/nzlgWp+4lAOGs7QSCmiUdh+2zZfNj4NTzR0SSEReCtnofWsDtlV74DMBtj8VPMbRVOpB8qKr+vdBJf+BLg8gu3T5Uzk06LUlJTp2WcAv4y+99Xa5/RzNNbHPY9wKSeCWYHUcTgywhAuHMTv5+jBQC43Y7+T6ot/AnkvbyybRIvlfgy4MP6QU9Q7+IIpezjQdpajaWZImJDHehOxcesEzcMhqI8A0+u9TOWZ2xBgxkkMqQYdz9ud+gmY0f2b9AC9AVIjxnqdWP0Q7YmPBn2ZP389jzcvlOmU/R5qz2GyotUQDedSVzeaqWOdrjpX5DJdi2m9E6ZMlhnnQFAqFyjdndUSTOQ7bPoMsFJT+lo6CGKckLt93zadWgN19WMaYYwsQOrdJ/i8rxkVMRHVwkfTltndQl95+68qblKGZYOSLu/3nzKW5z2AcvBPhCUy0P4ilnsG+I34yEWDHOPwnHuDvxzVv/0rwwORA6VZQ42Y0FOlQsw7FwDEjVSilFnOeAV52C9hUAQjg+F6YwRtPrD2XEe8faU= 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)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 13:06:29.1525 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9268a31-367e-49ce-53ca-08dc78047f6c 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: SJ5PEPF000001CC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7119 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When the `panel_power_saving` property is set to "Forbidden" ABM should be disabled immediately and any requests by sysfs to update will return an -EBUSY error. When the property is restored to "Allowed" the previous value of ABM will be restored. Signed-off-by: Mario Limonciello --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 3 ++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 36 ++++++++++++++++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 3ecc7ef95172..6e6531c93d81 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -1350,6 +1350,9 @@ int amdgpu_display_modeset_create_props(struct amdgpu_device *adev) "dither", amdgpu_dither_enum_list, sz); + if (adev->dc_enabled) + drm_mode_create_panel_power_saving_property(adev_to_drm(adev)); + return 0; } diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 01b0a331e4a6..f6b80018b136 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6421,6 +6421,12 @@ int amdgpu_dm_connector_atomic_set_property(struct drm_connector *connector, } else if (property == adev->mode_info.underscan_property) { dm_new_state->underscan_enable = val; ret = 0; + } else if (property == dev->mode_config.panel_power_saving) { + dm_new_state->abm_forbidden = val; + dm_new_state->abm_level = (val || !amdgpu_dm_abm_level) ? + ABM_LEVEL_IMMEDIATE_DISABLE : + amdgpu_dm_abm_level; + ret = 0; } return ret; @@ -6463,6 +6469,9 @@ int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector, } else if (property == adev->mode_info.underscan_property) { *val = dm_state->underscan_enable; ret = 0; + } else if (property == dev->mode_config.panel_power_saving) { + *val = dm_state->abm_forbidden; + ret = 0; } return ret; @@ -6489,9 +6498,12 @@ static ssize_t panel_power_savings_show(struct device *device, u8 val; drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); - val = to_dm_connector_state(connector->state)->abm_level == - ABM_LEVEL_IMMEDIATE_DISABLE ? 0 : - to_dm_connector_state(connector->state)->abm_level; + if (to_dm_connector_state(connector->state)->abm_forbidden) + val = 0; + else + val = to_dm_connector_state(connector->state)->abm_level == + ABM_LEVEL_IMMEDIATE_DISABLE ? 0 : + to_dm_connector_state(connector->state)->abm_level; drm_modeset_unlock(&dev->mode_config.connection_mutex); return sysfs_emit(buf, "%u\n", val); @@ -6515,10 +6527,16 @@ static ssize_t panel_power_savings_store(struct device *device, return -EINVAL; drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); - to_dm_connector_state(connector->state)->abm_level = val ?: - ABM_LEVEL_IMMEDIATE_DISABLE; + if (to_dm_connector_state(connector->state)->abm_forbidden) + ret = -EBUSY; + else + to_dm_connector_state(connector->state)->abm_level = val ?: + ABM_LEVEL_IMMEDIATE_DISABLE; drm_modeset_unlock(&dev->mode_config.connection_mutex); + if (ret) + return ret; + drm_kms_helper_hotplug_event(dev); return count; @@ -7689,6 +7707,14 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, aconnector->base.state->max_bpc = 16; aconnector->base.state->max_requested_bpc = aconnector->base.state->max_bpc; + if (connector_type == DRM_MODE_CONNECTOR_eDP && + (dc_is_dmcu_initialized(adev->dm.dc) || + adev->dm.dc->ctx->dmub_srv) && amdgpu_dm_abm_level < 0) { + drm_object_attach_property(&aconnector->base.base, + dm->ddev->mode_config.panel_power_saving, + DRM_MODE_PANEL_POWER_SAVING_ALLOWED); + } + if (connector_type == DRM_MODE_CONNECTOR_HDMIA) { /* Content Type is currently only implemented for HDMI. */ drm_connector_attach_content_type_property(&aconnector->base); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 09519b7abf67..43c3e5845a94 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -873,6 +873,7 @@ struct dm_connector_state { bool underscan_enable; bool freesync_capable; bool update_hdcp; + bool abm_forbidden; uint8_t abm_level; int vcpi_slots; uint64_t pbn;