From patchwork Sun May 19 13:07:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13667850 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 0909CC25B75 for ; Sun, 19 May 2024 13:07:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9E0810E24F; Sun, 19 May 2024 13:07:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="wltxjiI0"; dkim-atps=neutral Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2049.outbound.protection.outlook.com [40.107.100.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AD7D10E248; Sun, 19 May 2024 13:07:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/r7Xk9IYr24XKmLjs8910v5Q+R7ja+xBa0/DFjg/m3HLC46axRZbiIgwdCv3w+I31SjNW2GJSiqw7DJXQomSzVzNvgjY4anWD/iGKfeL5i08jECm2AA/9DjLwWM3lrTbtSe5UrQTOkMiOHmL3Xg8ShefBEarc7XmF6PekdlILZ7P+264CPRA7lgxhzvvl4tgmRtQosWDtsC3xqqRdv3u8RIVHv+br9JyJ72hxb8XT89xlHiYhp4SoU+YLU1G8wVas262yPuMevM8RQolgFzZEFbUufQ2ZDRU4qh2JXIiC0PpMSZoxPJM4DBBw2d04/CCvRYsM6S72cj1dkFJxpVqw== 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=DeydpEBtLYY7iYyMC2dyGgS1ZgQ/zw9g6SlfzPEarcc=; b=LY/goSqbHuXyQS6ifysszGD7Gaq2yEQ6OE0FHag41koOEU5u7PYCzVIWizN7jymRqMzx3leKSpmmNgH4qOx0cBAJhjmo4TgHgc88Dq6oiFRzGPPkM0fkugcyyzo4tTj0bZVpQ5B0LHDoqawOJWnFEYdMuIzZxBXnzy9WrFQ+ugEp03m5ob4+9iE3a5gBiT/9Jl8W1LGo/1iwP7FWTW4aMvGT0Nkrx+4fBGiEdsZ0oeiZ8xJUV91rIK9FhoI0efJkyRSnFjDNVFN0InAT4qtg4cyHe8MGfa5gpXjWtxu4LJGCT7jmvdGBW9MpzW+ujFH4+W2VNirw/SGJbYtk7PXmKw== 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=DeydpEBtLYY7iYyMC2dyGgS1ZgQ/zw9g6SlfzPEarcc=; b=wltxjiI0rOMxZ0Np0gVA5EkjsxXsCakpHKHtbb0M8pRxhQLIsSix7OT+9HX4YeeDQSsGPnmyMzvdVN16vTYiI1GvlkqHDTc5DXSVYyCuMo67szzxOgf0uDtYpcaitBhZc6E0tvC7Tx6L/dooe1KDjGp9zDfmGKUVG7HUTH16ePI= Received: from SJ0PR05CA0181.namprd05.prod.outlook.com (2603:10b6:a03:330::6) by SN7PR12MB7451.namprd12.prod.outlook.com (2603:10b6:806:29b::20) 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:07:32 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:a03:330:cafe::da) by SJ0PR05CA0181.outlook.office365.com (2603:10b6:a03:330::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.15 via Frontend Transport; Sun, 19 May 2024 13:07:32 +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:07:31 +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:07:30 -0500 From: Mario Limonciello To: CC: , , , Mario Limonciello , Mario Limonciello Subject: [PATCH 1/2] tests/amdgpu/amd_abm: Make set_abm_level return type int Date: Sun, 19 May 2024 08:07:16 -0500 Message-ID: <20240519130717.8087-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240519130717.8087-1-mario.limonciello@amd.com> References: <20240519130717.8087-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_|SN7PR12MB7451:EE_ X-MS-Office365-Filtering-Correlation-Id: 330046d3-33e7-4451-330b-08dc7804a4d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: qldB/Gx1xPjli150XCkpjGiMjfsDBOQ9T5cvY0CpetLGpUsDlRxj021+42eKs8cZPObomonOS09dqHgjDX1spKZYtXmTCLG9ijvFcIh6YY1V0+DpngExd5TLHsUmPx6oVKN8Ul2n7S2XVHCDh3IGryTIK2MursbsyAAAbpaPbpBfDIVY10j+B8AtfCk4uShdu4EfnBReXkpd52SAnDju2+B/0bWNkE5yzogCvSWIw22FW6Zm3p5NpAiHAQbgTHp7GpNI3Ixwol527MDcFThrxftgv9U37lbtq0nAkoHDiUHUkefClbNsBO8gnrgVI9Z4XwB5gAfkNIKZEmsQkVlJ3L8Rx8xtn0krpmqTMlV3pU5CMejeFR5gwpdSeaF4jxa2kFV09SuaoadOhfZpc6+/OD6FhepKeDLwL2jrsHVhSUvHVBNv9ZfThY53KMn/4tu3IvBSNEaRfSBcFCFlwkDAPuJO7sWKZ3Tt6ICuSNguNyzwyP7XPoGOiRrfj37thDVAlCZZq7TDPi+mBU+oebchBHDFzBi1pGxvA51NJaZ+wRVcEvGsA+8EhOCoi51x2OWoaEVvFNTOmVmUdiTtYUVSKuQdLWGTdO3T9Zn58edKFXnOvcnWTs19SIE9JN2V8iyxlA6vSFeuc5dUOssBhUb/wVMZeTCDXf6039l/M5ynF6zaD7aZvbtZQQM0OZlVuceSCwwNTy82g+KTh+jfHQdG5pJeiqK8LwHmi1QicSbsHbbRG2HojqsGpxgxRbHA81ErpV3MU9Q+N/q/U/PqeoWil7FfbjratozVlKZl2izkYaN8BI/R7u65deZBQxxN6pIhyGp4pgLqLZ8lgkjx39nm35+deMZnQajhOwUw75SEeSIEGxjBEPrEoeaEPFTo+IRtXa12MzOcAN4LN9MiUhD5i6bvFqwyKaZCgbLYR46F6D4m/yXur3f7unfGKV79vhV7YeDELEE1bmRjUgcy8MYuLbc3AnvLfocrsPhU9HO714c+zw8k9vREIt/fpWuLyvIy5xRFMOeUxZbr1hrHaPc3imvI/0lfXI+MmYLDKwDKTUryRLQ6QMvKKfI5XlT05CQSKRawHQ9pfM1htTyZiQ6nmAWs2VjhPH5xZHUkLXEv+pceI03XmiC7qFp3rFZuu2jcA78YpqchiPgFA31GeKD9yxI2q++JPq2QOeEQa8eyX97MS6WyeX3INzVNJMvDgcuWvHgp7Yyy6RS5F4KKdDX8qP5pDknf0e+37mEVBSwOMpLHoDLV0ra8ReN4iUKl2t//uFjDwJW8YelW6B12P5WNuEcg0HXyYOThL+31viWv1dp9mKvVUh3vlKeFkfkxrMx4h/fzOYdUTzGt+QlgEIKmCGGfjxKFhva6BpHg69gdURCp6nVF7RAbRpsMd3F47l/B 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)(36860700004)(82310400017)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 13:07:31.9024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 330046d3-33e7-4451-330b-08dc7804a4d3 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: SN7PR12MB7451 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" From: Mario Limonciello In order to bubble of cases of expeted errors on set_abm_level() change the return type to int. Signed-off-by: Mario Limonciello --- tests/amdgpu/amd_abm.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/tests/amdgpu/amd_abm.c b/tests/amdgpu/amd_abm.c index 2882c2c18..f74c3012c 100644 --- a/tests/amdgpu/amd_abm.c +++ b/tests/amdgpu/amd_abm.c @@ -104,10 +104,11 @@ static int backlight_write_brightness(int value) return 0; } -static void set_abm_level(data_t *data, igt_output_t *output, int level) +static int set_abm_level(data_t *data, igt_output_t *output, int level) { char buf[PATH_MAX]; int fd; + int ret; igt_assert(snprintf(buf, PATH_MAX, PANEL_POWER_SAVINGS_PATH, output->name) < PATH_MAX); @@ -116,8 +117,12 @@ static void set_abm_level(data_t *data, igt_output_t *output, int level) igt_assert(fd != -1); - igt_assert_eq(snprintf(buf, sizeof(buf), "%d", level), - write(fd, buf, 1)); + snprintf(buf, sizeof(buf), "%d", level); + ret = write(fd, buf, 1); + if (ret < 0) { + close(fd); + return ret; + } igt_assert_eq(close(fd), 0); @@ -129,6 +134,7 @@ static void set_abm_level(data_t *data, igt_output_t *output, int level) DRM_MODE_DPMS_OFF); kmstest_set_connector_dpms(data->drm_fd, output->config.connector, DRM_MODE_DPMS_ON); + return 0; } static int backlight_read_max_brightness(int *result) @@ -192,7 +198,8 @@ static void backlight_dpms_cycle(data_t *data) ret = backlight_read_max_brightness(&max_brightness); igt_assert_eq(ret, 0); - set_abm_level(data, output, 0); + ret = set_abm_level(data, output, 0); + igt_assert_eq(ret, 0); backlight_write_brightness(max_brightness / 2); usleep(100000); pwm_1 = read_target_backlight_pwm(data->drm_fd, output->name); @@ -223,7 +230,8 @@ static void backlight_monotonic_basic(data_t *data) brightness_step = max_brightness / 10; - set_abm_level(data, output, 0); + ret = set_abm_level(data, output, 0); + igt_assert_eq(ret, 0); backlight_write_brightness(max_brightness); usleep(100000); prev_pwm = read_target_backlight_pwm(data->drm_fd, output->name); @@ -257,7 +265,8 @@ static void backlight_monotonic_abm(data_t *data) brightness_step = max_brightness / 10; for (i = 1; i < 5; i++) { - set_abm_level(data, output, 0); + ret = set_abm_level(data, output, 0); + igt_assert_eq(ret, 0); backlight_write_brightness(max_brightness); usleep(100000); prev_pwm = read_target_backlight_pwm(data->drm_fd, output->name); @@ -289,14 +298,16 @@ static void abm_enabled(data_t *data) ret = backlight_read_max_brightness(&max_brightness); igt_assert_eq(ret, 0); - set_abm_level(data, output, 0); + ret = set_abm_level(data, output, 0); + igt_assert_eq(ret, 0); backlight_write_brightness(max_brightness); usleep(100000); prev_pwm = read_target_backlight_pwm(data->drm_fd, output->name); pwm_without_abm = prev_pwm; for (i = 1; i < 5; i++) { - set_abm_level(data, output, i); + ret = set_abm_level(data, output, i); + igt_assert_eq(ret, 0); usleep(100000); pwm = read_target_backlight_pwm(data->drm_fd, output->name); igt_assert(pwm <= prev_pwm); @@ -323,7 +334,8 @@ static void abm_gradual(data_t *data) igt_assert_eq(ret, 0); - set_abm_level(data, output, 0); + ret = set_abm_level(data, output, 0); + igt_assert_eq(ret, 0); backlight_write_brightness(max_brightness); sleep(convergence_delay); @@ -331,7 +343,8 @@ static void abm_gradual(data_t *data) curr = read_current_backlight_pwm(data->drm_fd, output->name); igt_assert_eq(prev_pwm, curr); - set_abm_level(data, output, 4); + ret = set_abm_level(data, output, 4); + igt_assert_eq(ret, 0); for (i = 0; i < 10; i++) { usleep(100000); pwm = read_current_backlight_pwm(data->drm_fd, output->name); From patchwork Sun May 19 13:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13667852 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 AE1DBC25B7A for ; Sun, 19 May 2024 13:07:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D635F10E25A; Sun, 19 May 2024 13:07:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="4wFsZREC"; dkim-atps=neutral Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2065.outbound.protection.outlook.com [40.107.93.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id EECBD10E248; Sun, 19 May 2024 13:07:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dZkqcWQ0D7nQ6Pxo4kbAde+IP14CvEvtJzWGeFuuDBWdJNjuxxxLszrIC9Bfnf1IB0iYTK9p/D/aC9jzzPUok6MLS7wo4KneRIF51/OWJA7dHlT9Jy9RnLfuTaH0dWChiEF/lvDMDlaPNojPiFnOpbdWkvi+rhZZDUees0xV5SFbC7wTtbTlUoFmwz/jOVKXVOSdE6yYwJuUG2W4N6biJbiUgTx+LHwRIhQjf7QcOzF8saNwQvVZ32i9mA4qzjQ3irW3ICkUy23S+W6J4tEccVzSIfHcbASgQ+V37PhPdpFZ7OV/Rv+yiavANI5Y6BuvwNmesToQUWYyPzAv23O2/Q== 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=zyC1wgfOhY6qig9W4AN7VfTwTvfaabGzMTMgpAxcRbk=; b=A7BAfq4Ac3DiXZxsIaywrUDQNXZnSnZUG3h3IZNCV8Ep5/WddksSmqA+o9SPujYxlLQ2DJ8NVd3Q2YoRruryXOb21z+C+9BV4GywLDFiIOIxKNU8yXbDy9tHPe/nydi778La8JYFabV7+sBbyQleacIkEq+qOKfOzT5G73oX/4hODNFd61nve8d3A+QqoBzWb8LDAIzpeGkudMB6u7nzf43PHDEqxlm8vGMGfOZk/Y+gBZ514GU6u5Qst5UR9Q3YZ7ySZ+B3V8nDC/ECo9Q61cdk6PIw7oiXo33+N2d8Fr/6OgpL22XYkf+9REfc+2mNGx7dnC6WwALW7imvFnz/yw== 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=zyC1wgfOhY6qig9W4AN7VfTwTvfaabGzMTMgpAxcRbk=; b=4wFsZRECjxrKw4oZYwgnf3iaLL9/DDi/66ZdyiYocGS2au2mSCwjjC8XfJl+qESsztJffyrUtOcpkjY4ibJLTe2CB0huyCxCd1sRrb7cSLHgCpBlKLVsSBqacDvzktJqDg0TjNgewjhAzpDBKmuPozsuYknqbyI81qx7iIlmxZQ= Received: from SJ0PR05CA0181.namprd05.prod.outlook.com (2603:10b6:a03:330::6) by DM4PR12MB7744.namprd12.prod.outlook.com (2603:10b6:8:100::14) 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:07:32 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:a03:330:cafe::ef) by SJ0PR05CA0181.outlook.office365.com (2603:10b6:a03:330::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.15 via Frontend Transport; Sun, 19 May 2024 13:07:32 +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:07:32 +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:07:31 -0500 From: Mario Limonciello To: CC: , , , Mario Limonciello , Mario Limonciello Subject: [PATCH 2/2] tests/amdgpu/amd_abm: Add support for panel_power_saving property Date: Sun, 19 May 2024 08:07:17 -0500 Message-ID: <20240519130717.8087-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240519130717.8087-1-mario.limonciello@amd.com> References: <20240519130717.8087-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_|DM4PR12MB7744:EE_ X-MS-Office365-Filtering-Correlation-Id: 780ec1bb-7d65-479f-b7eb-08dc7804a539 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|376005|36860700004; X-Microsoft-Antispam-Message-Info: lS4ckQJ9ldzVVrURLemB9OETj+XqSIk6ODEdH3YKSxkjtjKlRE6NNtOIPehNVslM9orW5VKKyf/wd8EF1FZehr/28jzr0zhwACRt9V0tZWlCLhlL1x+gI6YBpkU8K1fSPibwjXeBaRj4+tBNsg7LNdpYXJjkXBp9M2wdaUiUs7pnSsEBp0XVAyS13VWA4Q1bCL2vdJzsWLL4IDP1/yzZstcbefgdcYSQxi/lcIbEtxz6zQZlQzedx47fgGJRd1Kb5KE4H1uUMC4CXTMSMs1e1ndHtX1ate51wSrloEpOuRK4zs2pZ3yqBI5GgWLpYpWJFocb9uM1i4DpLmLItN09LGOQnn4aeZW2CduN1H6poayQoqA2jsJrlhGUVG6GSYJrt3aaL/mwZzvnR4lgdESaWhQ8vlTc11fKoZTBx298CV2+NSlyXGIGgSZHJxc3LxwS165Du0c89RViopWfeohGbD2cRrD8Vdmzg/r3nbti5OrDoRaQI+IlWpgEseY11QkqquCiNWKB4DMEGOcyzicDWTadlcH2McMHMfvfz0jyeqpXFLJRB+Oqm5RAG2H8qz2YoXz9R/t5XFrZXqlFl4flByXN6FuMQbMpo/QSl1byxrAO/1NznXmKPT8b5StVxPGar8+9M0wD1kQ+p3/4rrXVi6x/eBM/lhrB0aBYM3ga1VZx95IdtSI/pPI4JBvBU4wTopBhfgi5BzYsBdlUEsu7+yGWB4bse9Xl+mkdCr9gSysZV/Rm3t56wBeaK5vokYY9d3CKDDqjDFFxxKCqu8t3bXhGBEND3vkszQ+BaAWBmJdbqo64yedYuzxBn8YZeeoiXkD3iCDnRaiqWssddw0yVetGuDemsFYTUJumacnFtQa8w09C5wCkjN4djVPILMMt5R6bMcfa3XyN5gNuMJd5O1SyJSAKgVlBsmIsx7SjjH0f1WwrOfl22RxOsTwfp2VD4icL8lIOf+t2xTToiZg0L1+cYOL7t0a0wp9mzhwq2OYPfCe1g6sWftGT9Wfcd1PNXyewjYFQWiOwko8mvdKIlZvbV7ahqOfQ78GCoCU44zmb9fXpBcXoAnMMNeMyOqKqOFbubU6k6n7f660xC7sAWN5CVFRCDHGAwsjDZqqPn3dRh1WgO1olJngGfM19EqgRtdoZ5ddaYO1jQCTRUvughRNu1uCtStXFTpVorguFrpyVCol8No7RH8gBJDHNaAkKOnu5KSglM0ij190dv0PbjIkAncL+CDbS+LEq4AgZ1cBkSeuoDYSjYPviOvXhcniBvLjYcYEy9OX+sKvcgREj1RZgCfOhk74G4J/HKp3sNKCShOoDB8NzVvcO88EmQ0BeCOFYdUZOnBovotCTvk/nSSobqPQWi8TvRXDvP2J/qQ8= 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)(1800799015)(376005)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 13:07:32.5743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 780ec1bb-7d65-479f-b7eb-08dc7804a539 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: DM4PR12MB7744 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" From: Mario Limonciello When the "panel power saving" property is set to forbidden the compositor has indicated that userspace prefers to have color accuracy and fidelity instead of power saving. Verify that the sysfs file behaves as expected in this situation. Signed-off-by: Mario Limonciello --- tests/amdgpu/amd_abm.c | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/amdgpu/amd_abm.c b/tests/amdgpu/amd_abm.c index f74c3012c..971cda153 100644 --- a/tests/amdgpu/amd_abm.c +++ b/tests/amdgpu/amd_abm.c @@ -104,6 +104,32 @@ static int backlight_write_brightness(int value) return 0; } +static int toggle_panel_power_saving_prop(data_t *data, igt_output_t *output, bool forbid) +{ + uint32_t type = DRM_MODE_OBJECT_CONNECTOR; + bool prop_exists; + uint32_t prop_id; + + prop_exists = kmstest_get_property( + data->drm_fd, output->id, type, "panel power saving", + &prop_id, NULL, NULL); + + if (!prop_exists) + return -ENODEV; + + return drmModeObjectSetProperty(data->drm_fd, output->id, type, prop_id, forbid); +} + +static int allow_panel_power_saving(data_t *data, igt_output_t *output) +{ + return toggle_panel_power_saving_prop(data, output, false); +} + +static int forbid_panel_power_saving(data_t *data, igt_output_t *output) +{ + return toggle_panel_power_saving_prop(data, output, true); +} + static int set_abm_level(data_t *data, igt_output_t *output, int level) { char buf[PATH_MAX]; @@ -365,6 +391,43 @@ static void abm_gradual(data_t *data) } } + +static void abm_forbidden(data_t *data) +{ + igt_output_t *output; + enum pipe pipe; + int target, r; + + for_each_pipe_with_valid_output(&data->display, pipe, output) { + if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP) + continue; + + r = allow_panel_power_saving(data, output); + if (r == -ENODEV) { + igt_skip("No panel power saving prop\n"); + return; + } + igt_assert_eq(r, 0); + + target = 3; + r = set_abm_level(data, output, target); + igt_assert_eq(r, 0); + + r = forbid_panel_power_saving(data, output); + igt_assert_eq(r, 0); + + target = 0; + r = set_abm_level(data, output, target); + igt_assert_eq(r, -1); + + r = allow_panel_power_saving(data, output); + igt_assert_eq(r, 0); + + r = set_abm_level(data, output, target); + igt_assert_eq(r, 0); + } +} + igt_main { data_t data = {}; @@ -393,6 +456,8 @@ igt_main abm_enabled(&data); igt_subtest("abm_gradual") abm_gradual(&data); + igt_subtest("abm_forbidden") + abm_forbidden(&data); igt_fixture { igt_display_fini(&data.display);