From: Mohammed Thasleem <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: uma.shankar@intel.com, Mohammed Thasleem <mohammed.thasleem@intel.com>
Subject: [PATCH i-g-t] tests/intel/kms_pm_rpm: Test video playback across suspend/resume cycle
Date: Wed, 17 Jun 2026 02:31:08 +0530 [thread overview]
Message-ID: <20260616210109.21172-1-mohammed.thasleem@intel.com> (raw)
This test simulate video playback using multiple-buffer page-flip rotation,
suspend to idle (S0ix/FREEZE), resume, and verify that the display pipeline
and frame flipping are correctly restored.
Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
tests/intel/kms_pm_rpm.c | 179 +++++++++++++++++++++++++++++++++++++++
1 file changed, 179 insertions(+)
diff --git a/tests/intel/kms_pm_rpm.c b/tests/intel/kms_pm_rpm.c
index 60d0b2792..a4015516b 100644
--- a/tests/intel/kms_pm_rpm.c
+++ b/tests/intel/kms_pm_rpm.c
@@ -132,6 +132,11 @@
* SUBTEST: system-suspend-idle
* Description: Validate suspend-to-idle (S0ix) functionality.
*
+ * SUBTEST: system_suspend_idle_vpb_simulation
+ * Description: Simulate video playback using multiple-buffer page-flip rotation,
+ * suspend to idle (S0ix/FREEZE), resume, and verify that the
+ * display pipeline and frame flipping are correctly restored.
+ *
* SUBTEST: package-g7
* Description: Validate the package-g7 residency.
*/
@@ -176,6 +181,10 @@ static const struct {
{3840, 2160, 144, "4K@144"},
};
+typedef struct {
+ double r, g, b;
+} color_t;
+
/* Wait flags */
#define DONT_WAIT 0
#define WAIT_STATUS 1
@@ -198,6 +207,7 @@ struct mode_set_data {
drmModeModeInfo *mode;
igt_plane_t *primary;
struct igt_fb fb_white;
+ struct igt_fb fb_frame[3];
uint32_t devid;
int fw_fd;
};
@@ -1720,6 +1730,172 @@ static void test_package_g7(void)
cleanup();
}
+static void paint_rectangles(drmModeModeInfo *mode,
+ color_t *colors,
+ igt_fb_t *fb)
+{
+ cairo_t *cr = igt_get_cairo_ctx(drm_fd, fb);
+ int i, l = mode->hdisplay / 3;
+ int rows_remaining = mode->hdisplay % 3;
+
+ /* Paint 3 rectangles. */
+ for (i = 0; i < 3; i++) {
+ igt_paint_color(cr, i * l, 0, l, mode->vdisplay,
+ colors[i].r, colors[i].g, colors[i].b);
+ }
+
+ if (rows_remaining > 0)
+ igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
+ colors[i - 1].r, colors[i - 1].g,
+ colors[i - 1].b);
+
+ igt_put_cairo_ctx(cr);
+}
+
+static void create_color_fb(struct mode_set_data *data,
+ igt_fb_t *fb,
+ color_t *fb_color)
+{
+ int fb_id;
+
+ fb_id = igt_create_fb(drm_fd,
+ data->mode->hdisplay,
+ data->mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_MOD_LINEAR,
+ fb);
+ igt_assert(fb_id);
+ paint_rectangles(data->mode, fb_color, fb);
+}
+
+static void setup_videoplayback(struct mode_set_data *data)
+{
+ color_t red_green_blue[] = {
+ { 1.0, 0.0, 0.0 },
+ { 0.0, 1.0, 0.0 },
+ { 0.0, 0.0, 1.0 },
+ };
+ color_t red_green_red[] = {
+ { 1.0, 0.0, 0.0 },
+ { 0.0, 1.0, 0.0 },
+ { 1.0, 0.0, 0.0 },
+ };
+ color_t blue_red_green[] = {
+ { 0.0, 0.0, 1.0 },
+ { 1.0, 0.0, 0.0 },
+ { 0.0, 1.0, 0.0 },
+ };
+
+ create_color_fb(data, &data->fb_frame[0], red_green_blue);
+ create_color_fb(data, &data->fb_frame[1], red_green_red);
+ create_color_fb(data, &data->fb_frame[2], blue_red_green);
+}
+
+static void cleanup_videoplayback(struct mode_set_data *data)
+{
+ int i;
+
+ igt_plane_set_fb(data->primary, NULL);
+ igt_output_set_crtc(data->output, NULL);
+ igt_display_commit(&data->display);
+
+ for (i = 0; i < 3; i++) {
+ if (data->fb_frame[i].fb_id)
+ igt_remove_fb(drm_fd, &data->fb_frame[i]);
+ }
+}
+
+static void run_videoplayback_loop(struct mode_set_data *data)
+{
+ int delay;
+ int frame = 0;
+ time_t secs = 6;
+ time_t start = time(NULL);
+
+ igt_require(data->primary);
+ igt_require(data->mode);
+
+ /* One frame period in microseconds convention */
+ delay = (1000 * 1000) / data->mode->vrefresh;
+
+ while (time(NULL) - start < secs) {
+ igt_plane_set_fb(data->primary, &data->fb_frame[frame % 3]);
+ igt_display_commit(&data->display);
+ usleep(delay);
+ frame++;
+ }
+}
+
+static void configure_output(struct mode_set_data *data)
+{
+ igt_display_t *display = &data->display;
+ igt_output_t *output;
+ bool found = false;
+ igt_crtc_t *crtc;
+
+ /* If output is already configured, use it */
+ if (data->output && data->mode && data->primary)
+ return;
+
+ for_each_crtc_with_valid_output(display, crtc, output) {
+ drmModeConnectorPtr c = output->config.connector;
+
+ if (c->connector_type == DRM_MODE_CONNECTOR_eDP) {
+ igt_output_set_crtc(output, crtc);
+ if (!intel_pipe_output_combo_valid(display))
+ continue;
+
+ found = true;
+ break;
+ }
+ }
+
+ /* Fallback to any connected output */
+ if (!found) {
+ for_each_crtc_with_valid_output(display, crtc, output) {
+ igt_output_set_crtc(output, crtc);
+ if (!intel_pipe_output_combo_valid(display))
+ continue;
+
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ data->output = output;
+ data->mode = igt_output_get_mode(output);
+ data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ }
+}
+
+static void system_suspend_idle_vpb_simulation(int suspend_state,
+ int suspend_test)
+{
+ igt_require_f(default_mode_params,
+ "No connected output available for video-playback-suspend-idle\n");
+
+ configure_output(&ms_data);
+ setup_output_fb();
+
+ /* Create video playback framebuffers */
+ setup_videoplayback(&ms_data);
+
+ /* Pre-suspend video playback simulation */
+ igt_info("Running pre-suspend video playback...\n");
+ run_videoplayback_loop(&ms_data);
+
+ /* Suspend/resume cycle */
+ igt_info("Performing suspend/resume cycle...\n");
+ igt_system_suspend_autoresume(suspend_state, suspend_test);
+
+ /* Post-resume video playback simulation */
+ igt_info("Running post-resume video playback...\n");
+ run_videoplayback_loop(&ms_data);
+
+ cleanup_videoplayback(&ms_data);
+}
+
int rounds = 10;
bool stay = false;
@@ -1835,6 +2011,9 @@ int igt_main_args("", long_options, help_str, opt_handler, NULL)
igt_subtest("system-suspend-idle")
system_suspend_modeset_subtest(SUSPEND_STATE_FREEZE,
SUSPEND_TEST_NONE);
+ igt_subtest("system_suspend_idle_vpb_simulation")
+ system_suspend_idle_vpb_simulation(SUSPEND_STATE_FREEZE,
+ SUSPEND_TEST_NONE);
/* power-wake reference tests */
igt_subtest("pm-tiling") {
--
2.43.0
next reply other threads:[~2026-06-16 21:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 21:01 Mohammed Thasleem [this message]
2026-06-17 1:52 ` ✓ Xe.CI.BAT: success for tests/intel/kms_pm_rpm: Test video playback across suspend/resume cycle Patchwork
2026-06-17 1:59 ` ✓ i915.CI.BAT: " Patchwork
2026-06-17 7:41 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-17 9:28 ` [PATCH i-g-t] " Samala, Pranay
2026-06-18 0:10 ` ✗ i915.CI.Full: failure for " 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=20260616210109.21172-1-mohammed.thasleem@intel.com \
--to=mohammed.thasleem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=uma.shankar@intel.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