From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: Tom Chung <chiahsuan.chung@amd.com>, igt-dev@lists.freedesktop.org
Cc: Rodrigo.Siqueira@amd.com, alex.hung@amd.com
Subject: Re: [PATCH i-g-t] tests/amdgpu/amd_abm: Fix ABM level setting
Date: Tue, 2 Apr 2024 16:21:08 -0400 [thread overview]
Message-ID: <2f3c2441-885d-4036-8ec5-bf0292a07615@amd.com> (raw)
In-Reply-To: <20240402075208.21223-1-chiahsuan.chung@amd.com>
On 4/2/24 03:52, Tom Chung wrote:
> [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>
> ---
> 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..24783fb57 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 make new ABM level take effect.
s/make/have the
> + * DPMS off -> on transition is one of approaches.
s/of/of many
With that addressed:
Reviewed-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
> + */
> + 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);
--
Hamza
next prev parent reply other threads:[~2024-04-02 20:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 7:52 [PATCH i-g-t] tests/amdgpu/amd_abm: Fix ABM level setting Tom Chung
2024-04-02 11:11 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-04-02 11:40 ` ✓ CI.xeBAT: " Patchwork
2024-04-02 20:21 ` Hamza Mahfooz [this message]
2024-04-02 22:30 ` ✗ Fi.CI.IGT: failure " 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=2f3c2441-885d-4036-8ec5-bf0292a07615@amd.com \
--to=hamza.mahfooz@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alex.hung@amd.com \
--cc=chiahsuan.chung@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