From: Ray Wu <ray.wu@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <alex.hung@amd.com>, <sunpeng.li@amd.com>,
<chiahsuan.chung@amd.com>, <ray.wu@amd.com>
Subject: [PATCH i-g-t, v2 1/2] tests/amdgpu/amd_replay: fix operator precedence and typos
Date: Wed, 13 May 2026 15:03:21 +0800 [thread overview]
Message-ID: <20260513070631.3723466-2-ray.wu@amd.com> (raw)
In-Reply-To: <20260513070631.3723466-1-ray.wu@amd.com>
[Why]
Several existing replay subtests had logic bugs that silently disabled
their state checks:
- `test_mode == (A || B)` and `test_mode == A || B` do not check
whether test_mode matches A or B; both evaluate to a constant
truthy expression, so the guarded code always ran.
- Three igt_fail_on_f() range checks were written as
`state < N && state >= N+1`, which can never be true; the
assertions never fired regardless of replay_state.
Two "mdoe" typos in igt_describe() strings were also present.
[How]
- Rewrite the conditionals as `(test_mode == A) || (test_mode == B)`.
- Replace `&&` with `||` in the three range assertions so they fail
when state is outside the expected range.
- Fix the two typos.
Signed-off-by: Ray Wu <ray.wu@amd.com>
---
tests/amdgpu/amd_replay.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/tests/amdgpu/amd_replay.c b/tests/amdgpu/amd_replay.c
index 775bed190..4b795f5ba 100644
--- a/tests/amdgpu/amd_replay.c
+++ b/tests/amdgpu/amd_replay.c
@@ -236,14 +236,17 @@ static void page_flip_test(struct test_data *data, igt_output_t *output,
igt_require(ret == 0);
kmstest_wait_for_pageflip(data->fd);
- if (test_mode == (TEST_MODE_CONSTANT_LIVE || TEST_MODE_INTERMITTENT_LIVE)
- && frame_count > 5) {
+ if ((test_mode == TEST_MODE_CONSTANT_LIVE ||
+ test_mode == TEST_MODE_INTERMITTENT_LIVE) &&
+ frame_count > 5) {
/* Panel Replay state needs few frame to enter the live mode */
replay_state = igt_amd_read_replay_state(data->fd, output->name);
dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
igt_debug("replay_state live mode = 0x%X\n", replay_state);
- igt_fail_on_f(replay_state < REPLAY_STATE_4 && replay_state >= REPLAY_STATE_5,
- "State should be REPLAY_STATE_4 (Active with single frame update)\n");
+ igt_fail_on_f(replay_state < REPLAY_STATE_4 ||
+ replay_state >= REPLAY_STATE_5,
+ "State should be REPLAY_STATE_4 "
+ "(Active with single frame update)\n");
igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
}
@@ -302,15 +305,17 @@ static void run_check_replay(struct test_data *data, enum test_mode test_mode)
page_flip_test(data, output, test_mode, 20);
/* Check Panel Replay state in static screen */
- if (test_mode == TEST_MODE_STATIC_SCREEN || TEST_MODE_INTERMITTENT_LIVE) {
+ if (test_mode == TEST_MODE_STATIC_SCREEN ||
+ test_mode == TEST_MODE_INTERMITTENT_LIVE) {
/* Panel Replay state takes some time to settle its value on static screen */
sleep(1);
replay_state = igt_amd_read_replay_state(data->fd, output->name);
dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
igt_debug("replay_state static mode = 0x%X\n", replay_state);
- igt_fail_on_f(replay_state < REPLAY_STATE_3 && replay_state >= REPLAY_STATE_4,
- "State should be REPLAY_STATE_3 (Active)\n");
+ igt_fail_on_f(replay_state < REPLAY_STATE_3 ||
+ replay_state >= REPLAY_STATE_4,
+ "State should be REPLAY_STATE_3 (Active)\n");
igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
}
@@ -325,8 +330,9 @@ static void run_check_replay(struct test_data *data, enum test_mode test_mode)
dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
igt_debug("replay_state TEST_MODE_INTERMITTENT_LIVE after flip = 0x%X\n",
replay_state);
- igt_fail_on_f(replay_state < REPLAY_STATE_3 && replay_state >= REPLAY_STATE_4,
- "State should be REPLAY_STATE_3 (Active)\n");
+ igt_fail_on_f(replay_state < REPLAY_STATE_3 ||
+ replay_state >= REPLAY_STATE_4,
+ "State should be REPLAY_STATE_3 (Active)\n");
igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
}
@@ -439,10 +445,10 @@ int igt_main_args("", long_options, help_str, opt_handler, NULL)
igt_describe("Test whether Panel Replay can be enabled with static screen");
igt_subtest("replay_static_screen") run_check_replay(&data, TEST_MODE_STATIC_SCREEN);
- igt_describe("Test whether Panel Replay can be enabled with intermittent live mdoe");
+ igt_describe("Test whether Panel Replay can be enabled with intermittent live mode");
igt_subtest("replay_intermittent_live") run_check_replay(&data, TEST_MODE_INTERMITTENT_LIVE);
- igt_describe("Test whether Panel Replay can be enabled with constant live mdoe");
+ igt_describe("Test whether Panel Replay can be enabled with constant live mode");
igt_subtest("replay_constant_live") run_check_replay(&data, TEST_MODE_CONSTANT_LIVE);
igt_describe("Test whether Panel Replay can be enabled after resume from suspend");
--
2.43.0
next prev parent reply other threads:[~2026-05-13 7:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 7:03 [PATCH i-g-t, v2 0/2] tests/amdgpu/amd_replay: Add Replay Rate Control test Ray Wu
2026-05-13 7:03 ` Ray Wu [this message]
2026-05-13 7:03 ` [PATCH i-g-t, v2 2/2] tests/amdgpu/amd_replay: add Replay Rate Control IGT test Ray Wu
2026-05-13 16:43 ` ✓ i915.CI.BAT: success for tests/amdgpu/amd_replay: Add Replay Rate Control test (rev2) Patchwork
2026-05-13 17:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-14 15:45 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-14 17:13 ` ✗ i915.CI.Full: " 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=20260513070631.3723466-2-ray.wu@amd.com \
--to=ray.wu@amd.com \
--cc=alex.hung@amd.com \
--cc=chiahsuan.chung@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