From: Tom Chung <chiahsuan.chung@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <Rodrigo.Siqueira@amd.com>, <alex.hung@amd.com>,
<hamza.mahfooz@amd.com>, <chiahsuan.chung@amd.com>
Subject: [PATCH i-g-t,v2] tests/amdgpu/amd_abm: Fix ABM level setting
Date: Wed, 3 Apr 2024 14:49:59 +0800 [thread overview]
Message-ID: <20240403064959.2069-1-chiahsuan.chung@amd.com> (raw)
[Why]
The ABM level does not take effect right after do the ABM level
set.
[How]
Trigger a full modeset to make new ABM level take effect right away
by setting DPMS off -> on transition.
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
---
v2: Modify some comments
tests/amdgpu/amd_abm.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/tests/amdgpu/amd_abm.c b/tests/amdgpu/amd_abm.c
index e56000e02..2882c2c18 100644
--- a/tests/amdgpu/amd_abm.c
+++ b/tests/amdgpu/amd_abm.c
@@ -104,13 +104,13 @@ static int backlight_write_brightness(int value)
return 0;
}
-static void set_abm_level(char *connector_name, int level)
+static void set_abm_level(data_t *data, igt_output_t *output, int level)
{
char buf[PATH_MAX];
int fd;
igt_assert(snprintf(buf, PATH_MAX, PANEL_POWER_SAVINGS_PATH,
- connector_name) < PATH_MAX);
+ output->name) < PATH_MAX);
fd = open(buf, O_WRONLY);
@@ -120,6 +120,15 @@ static void set_abm_level(char *connector_name, int level)
write(fd, buf, 1));
igt_assert_eq(close(fd), 0);
+
+ /**
+ * We need to trigger a full modeset to have the new ABM level take effect.
+ * DPMS off -> on transition is one of many approaches.
+ */
+ kmstest_set_connector_dpms(data->drm_fd, output->config.connector,
+ DRM_MODE_DPMS_OFF);
+ kmstest_set_connector_dpms(data->drm_fd, output->config.connector,
+ DRM_MODE_DPMS_ON);
}
static int backlight_read_max_brightness(int *result)
@@ -183,7 +192,7 @@ static void backlight_dpms_cycle(data_t *data)
ret = backlight_read_max_brightness(&max_brightness);
igt_assert_eq(ret, 0);
- set_abm_level(output->name, 0);
+ set_abm_level(data, output, 0);
backlight_write_brightness(max_brightness / 2);
usleep(100000);
pwm_1 = read_target_backlight_pwm(data->drm_fd, output->name);
@@ -214,7 +223,7 @@ static void backlight_monotonic_basic(data_t *data)
brightness_step = max_brightness / 10;
- set_abm_level(output->name, 0);
+ set_abm_level(data, output, 0);
backlight_write_brightness(max_brightness);
usleep(100000);
prev_pwm = read_target_backlight_pwm(data->drm_fd, output->name);
@@ -248,7 +257,7 @@ static void backlight_monotonic_abm(data_t *data)
brightness_step = max_brightness / 10;
for (i = 1; i < 5; i++) {
- set_abm_level(output->name, 0);
+ set_abm_level(data, output, 0);
backlight_write_brightness(max_brightness);
usleep(100000);
prev_pwm = read_target_backlight_pwm(data->drm_fd, output->name);
@@ -280,14 +289,14 @@ static void abm_enabled(data_t *data)
ret = backlight_read_max_brightness(&max_brightness);
igt_assert_eq(ret, 0);
- set_abm_level(output->name, 0);
+ set_abm_level(data, output, 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(output->name, i);
+ set_abm_level(data, output, i);
usleep(100000);
pwm = read_target_backlight_pwm(data->drm_fd, output->name);
igt_assert(pwm <= prev_pwm);
@@ -314,7 +323,7 @@ static void abm_gradual(data_t *data)
igt_assert_eq(ret, 0);
- set_abm_level(output->name, 0);
+ set_abm_level(data, output, 0);
backlight_write_brightness(max_brightness);
sleep(convergence_delay);
@@ -322,7 +331,7 @@ 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(output->name, 4);
+ set_abm_level(data, output, 4);
for (i = 0; i < 10; i++) {
usleep(100000);
pwm = read_current_backlight_pwm(data->drm_fd, output->name);
--
2.34.1
next reply other threads:[~2024-04-03 6:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 6:49 Tom Chung [this message]
2024-04-03 7:32 ` ✓ CI.xeBAT: success for tests/amdgpu/amd_abm: Fix ABM level setting (rev2) Patchwork
2024-04-03 7:35 ` ✓ Fi.CI.BAT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240403064959.2069-1-chiahsuan.chung@amd.com \
--to=chiahsuan.chung@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alex.hung@amd.com \
--cc=hamza.mahfooz@amd.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox