From: Tom Chung <chiahsuan.chung@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <Rodrigo.Siqueira@amd.com>, <alex.hung@amd.com>,
<sunpeng.li@amd.com>, <chiahsuan.chung@amd.com>
Subject: [PATCH i-g-t] tests/amdgpu/amd_abm: Remove the modeset for ABM level setting
Date: Mon, 26 Aug 2024 16:25:14 +0800 [thread overview]
Message-ID: <20240826082520.25942-1-chiahsuan.chung@amd.com> (raw)
[Why]
Set the ABM level does not need to trigger the modeset to take effect.
[How]
Replace the DPMS off -> on transition in set_abm_level() with
atomic commit.
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
---
tests/amdgpu/amd_abm.c | 99 ++++++++++++++++++++++++++++++------------
1 file changed, 71 insertions(+), 28 deletions(-)
diff --git a/tests/amdgpu/amd_abm.c b/tests/amdgpu/amd_abm.c
index 2882c2c18..a85f444c4 100644
--- a/tests/amdgpu/amd_abm.c
+++ b/tests/amdgpu/amd_abm.c
@@ -39,9 +39,75 @@
typedef struct data {
igt_display_t display;
+ igt_plane_t *primary;
+ igt_output_t *output;
+ igt_pipe_t *pipe;
int drm_fd;
+ drmModeModeInfo *mode;
+ enum pipe pipe_id;
+ int w, h;
+ igt_fb_t ref_fb;
} data_t;
+/* Common test setup. */
+static void test_init(data_t *data)
+{
+ igt_display_t *display = &data->display;
+ drmModeConnectorPtr conn;
+ bool has_edp = false;
+ int i;
+
+ /* Skip test if no eDP connected. */
+ for (i = 0; i < display->n_outputs; i++) {
+ conn = display->outputs[i].config.connector;
+
+ if (conn->connector_type == DRM_MODE_CONNECTOR_eDP &&
+ conn->connection == DRM_MODE_CONNECTED) {
+ has_edp = true;
+ }
+ }
+ if (!has_edp)
+ igt_skip("No eDP connector found\n");
+
+ /* It doesn't matter which pipe we choose on amdpgu. */
+ data->pipe_id = PIPE_A;
+ data->pipe = &data->display.pipes[data->pipe_id];
+
+ igt_display_reset(display);
+
+ data->output = igt_get_single_output_for_pipe(display, data->pipe_id);
+ igt_require(data->output);
+ igt_info("output %s\n", data->output->name);
+
+ data->mode = igt_output_get_mode(data->output);
+ igt_assert(data->mode);
+ kmstest_dump_mode(data->mode);
+
+ data->primary =
+ igt_pipe_get_plane_type(data->pipe, DRM_PLANE_TYPE_PRIMARY);
+
+ igt_output_set_pipe(data->output, data->pipe_id);
+
+ data->w = data->mode->hdisplay;
+ data->h = data->mode->vdisplay;
+
+ data->ref_fb.fb_id = 0;
+
+ igt_create_color_fb(data->drm_fd, data->mode->hdisplay,
+ data->mode->vdisplay, DRM_FORMAT_XRGB8888, 0, 0.0, 0.6, 0.6, &data->ref_fb);
+}
+
+/* Common test cleanup. */
+static void test_fini(data_t *data)
+{
+ igt_display_t *display = &data->display;
+
+ igt_display_reset(display);
+ igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
+
+ if (data->ref_fb.fb_id)
+ igt_remove_fb(data->drm_fd, &data->ref_fb);
+}
static int read_current_backlight_pwm(int drm_fd, char *connector_name)
@@ -121,14 +187,9 @@ static void set_abm_level(data_t *data, igt_output_t *output, int level)
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);
+ igt_output_set_pipe(data->output, data->pipe_id);
+ igt_plane_set_fb(data->primary, &data->ref_fb);
+ igt_display_commit_atomic(&data->display, 0, 0);
}
static int backlight_read_max_brightness(int *result)
@@ -156,25 +217,6 @@ static int backlight_read_max_brightness(int *result)
return errno;
}
-static void test_init(data_t *data)
-{
- igt_display_t *display = &data->display;
- drmModeConnectorPtr conn;
- int i;
-
- for (i = 0; i < display->n_outputs; i++) {
- conn = display->outputs[i].config.connector;
-
- if (conn->connector_type == DRM_MODE_CONNECTOR_eDP &&
- conn->connection == DRM_MODE_CONNECTED) {
- return;
- }
- }
-
- igt_skip("No eDP connector found\n");
-}
-
-
static void backlight_dpms_cycle(data_t *data)
{
int ret;
@@ -354,7 +396,7 @@ static void abm_gradual(data_t *data)
igt_main
{
- data_t data = {};
+ data_t data = {0};
igt_skip_on_simulation();
igt_fixture {
@@ -382,6 +424,7 @@ igt_main
abm_gradual(&data);
igt_fixture {
+ test_fini(&data);
igt_display_fini(&data.display);
drm_close_driver(data.drm_fd);
}
--
2.43.0
next reply other threads:[~2024-08-26 8:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 8:25 Tom Chung [this message]
2024-08-26 18:03 ` [PATCH i-g-t] tests/amdgpu/amd_abm: Remove the modeset for ABM level setting Leo Li
2024-08-26 21:30 ` ✓ CI.xeBAT: success for " Patchwork
2024-08-26 21:43 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-08-27 3:23 ` ✗ CI.xeFULL: " 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=20240826082520.25942-1-chiahsuan.chung@amd.com \
--to=chiahsuan.chung@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alex.hung@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=sunpeng.li@amd.com \
/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