tests/intel/kms_pm_warm_boot: Add test to validate warm reboot
PATCH 1/1 tests/intel/kms_pm_warm_boot: Add test to validate warm reboot
This test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
3. Run post-reboot test to validate display parameters match baseline
--- tests/intel/kms_pm_warm_boot.c | 200 +++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 201 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.c
tests/intel/kms_pm_warm_boot.c new file +200 -0
@@ -0,0 +1,200 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2025 Intel Corporation +*/ + +/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe +* Mega feature: Display Power Management +*/ + +#include "igt.h" +#include "igt_kms.h" +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt" +#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" ); + +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) +{ +igt_display_t *display = &device->display; +igt_output_t *output; +enum pipe pipe; + +igt_display_reset (display); + +for_each_pipe_with_valid_output (display, pipe, output) { +igt_output_set_pipe (output, pipe); + +if (!intel_pipe_output_combo_valid (display)) +continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + device->pipe = pipe; + +break ; + } + +igt_require_f (device->output && device->mode, +"No valid connected output found\n" ); +} + +static void setup_primary (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline (device_t *device) +{ +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); + +igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); +fprintf (fp,"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->pipe, + device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) +{ +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_id = device->output->config.connector->connector_id; + conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" +"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); +} + +static void read_baseline (char *buf,size_t sz) +{ +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp); +} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); +} + +igt_main +{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); + +igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device); + +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + +igt_assert_f (strcmp (saved, current) ==0 ,"Display parameters mismatched.\n" ); + +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE ); + +cleanup (&device); + } + + igt_fixture { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}
tests/meson.build +1 -0
@@ -269,6 +269,7 @@ intel_kms_progs = [ 'kms_pm_dc', 'kms_pm_lpsp', 'kms_pm_rpm', + 'kms_pm_warm_boot', 'kms_psr', 'kms_psr2_sf', 'kms_psr2_su',
Signature · 1 line
2.25.1
PATCH 1/1 tests/intel/kms_pm_warm_boot: Add warm reboot test
This test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
3. Run post-reboot test to validate display parameters match baseline
v2: Replace each_pipe_with_valid_output with for_each_valid_output_on_crtc.
--- tests/intel/kms_pm_warm_boot.c | 202 +++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 203 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.c
tests/intel/kms_pm_warm_boot.c new file +202 -0
@@ -0,0 +1,202 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2026 Intel Corporation +*/ + +/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe +* Mega feature: Display Power Management +*/ + +#include "igt.h" +#include "igt_kms.h" +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt" +#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" ); + +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) +{ +igt_output_t *output; +igt_crtc_t *crtc; +enum pipe pipe; + +for_each_crtc (&device->display, crtc) { + pipe = crtc->pipe; +for_each_valid_output_on_crtc (&device->display, crtc, output) { + +igt_display_reset (&device->display); + +igt_output_set_crtc (output,igt_crtc_for_pipe (&device->display, pipe)); +if (!intel_pipe_output_combo_valid (&device->display)) +continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + device->pipe = pipe; + +break ; + } + } + +igt_require_f (device->output && device->mode,"No valid connected output found\n" ); +} + +static void setup_primary (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline (device_t *device) +{ +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); + +igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); +fprintf (fp,"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->pipe, + device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) +{ +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_id = device->output->config.connector->connector_id; + conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" +"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); +} + +static void read_baseline (char *buf,size_t sz) +{ +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp); +} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); +} + +int igt_main (void ) +{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture() { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); + +igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device); + +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + +igt_assert_f (strcmp (saved, current) ==0 ,"Display parameters mismatched.\n" ); + +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE ); + +cleanup (&device); + } + + igt_fixture() { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}
tests/meson.build +1 -0
@@ -271,6 +271,7 @@ intel_kms_progs = [ 'kms_pm_backlight', 'kms_pm_dc', 'kms_pm_lpsp', + 'kms_pm_warm_boot', 'kms_pm_rpm', 'kms_psr', 'kms_psr2_sf',
Signature · 1 line
2.48.1
Re: [PATCH i-g-t] tests/intel/kms_pm_warm_boot: Add warm reboot test
Hi Mohammed,
On 2026-08-27 at 07:21:09 +0530, Mohammed Thasleem wrote:
please add version after PATCH:
[PATCH v2 i-g-t] tests/intel/kms_pm_warm_boot: Add warm reboot test
you can make it with git -v2
Quoted 173 lines
This test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
3. Run post-reboot test to validate display parameters match baselinev2: Replace
each_pipe_with_valid_outputwithfor_each_valid_output_on_crtc.Signed-off-by Mohammed Thasleem <[email protected]>--- tests/intel/kms_pm_warm_boot.c | 202 +++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 203 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.ctests/intel/kms_pm_warm_boot.c new file +150
-0@@ -0,0 +1,202 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2026 Intel Corporation +*/ + +/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe +* Mega feature: Display Power Management +*/ + +#include "igt.h" +#include "igt_kms.h" +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt" +#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" ); + +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) +{ +igt_output_t *output; +igt_crtc_t *crtc; +enum pipe pipe; + +for_each_crtc (&device->display, crtc) { + pipe = crtc->pipe; +for_each_valid_output_on_crtc (&device->display, crtc, output) { + +igt_display_reset (&device->display); + +igt_output_set_crtc (output,igt_crtc_for_pipe (&device->display, pipe)); +if (!intel_pipe_output_combo_valid (&device->display)) +continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + device->pipe = pipe; + +break ; + } + } + +igt_require_f (device->output && device->mode,"No valid connected output found\n" ); +} + +static void setup_primary (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline (device_t *device) +{ +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); + +igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); +fprintf (fp,"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->pipe, + device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) +{ +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_id = device->output->config.connector->connector_id; + conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" +"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); +} + +static void read_baseline (char *buf,size_t sz) +{ +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp);
tests/intel/kms_pm_warm_boot.c line 160
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); +} + +int igt_main (void )
This cause compilation error locally:
FAILED: tests/kms_pm_warm_boot.p/intel_kms_pm_warm_boot.c.o
cc -Itests/kms_pm_warm_boot.p ...../tests/intel/kms_pm_warm_boot.c:160:18: error: macro "igt_main" passed 1 arguments, but takes just 0
160 | int igt_main(void)
| ^
In file included from ../lib/drmtest.h:39,
This should be:
int igt_main()
If this compile on your computer, please first update your branch, rebase on current master and try recompile.
Regards,
Kamil
Quoted 57 lines
tests/intel/kms_pm_warm_boot.c new file +42
-0+{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture() { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); + +igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device); + +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + +igt_assert_f (strcmp (saved, current) ==0 ,"Display parameters mismatched.\n" ); + +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE ); + +cleanup (&device); + } + + igt_fixture() { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}tests/meson.build +1
-0@@ -271,6 +271,7 @@ intel_kms_progs = [ 'kms_pm_backlight', 'kms_pm_dc', 'kms_pm_lpsp', + 'kms_pm_warm_boot', 'kms_pm_rpm', 'kms_psr', 'kms_psr2_sf',Signature · 1 line
2.48.1
RE: [PATCH i-g-t] tests/intel/kms_pm_warm_boot: Add warm reboot test
In reply to Mohammed ThasleemHi @Thasleem, Mohammed,
Quoted 155 lines
-----Original Message-----
From: igt-dev <[email protected]> On Behalf Of Mohammed Thasleem
Sent: 27 August 2026 07:21
To: [email protected]
Cc: Joshi, Kunal1 <[email protected]>; Thasleem, Mohammed <[email protected]>
Subject: [PATCH i-g-t] tests/intel/kms_pm_warm_boot: Add warm reboot testThis test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
3. Run post-reboot test to validate display parameters match baselinev2: Replace
each_pipe_with_valid_outputwithfor_each_valid_output_on_crtc.Signed-off-by Mohammed Thasleem <[email protected]>--- tests/intel/kms_pm_warm_boot.c | 202 +++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 203 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.c(quoted diff) +0
-0
b/tests/intel/kms_pm_warm_boot.cnew file mode 100644 index 000000000..d50656b91tests/intel/kms_pm_warm_boot.c new file +50
-0@@ -0,0 +1,202 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2026 Intel Corporation +*/ + +/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe +* Mega feature: Display Power Management */ + +#include "igt.h" +#include "igt_kms.h" +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt" +#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" ); + +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) { +igt_output_t *output; +igt_crtc_t *crtc; +enum pipe pipe; + +for_each_crtc (&device->display, crtc) { + pipe = crtc->pipe; +for_each_valid_output_on_crtc (&device->display, crtc, output){
tests/intel/kms_pm_warm_boot.c new file +4
-0+ +igt_display_reset (&device->display); + + igt_output_set_crtc(output,
igt_crtc_for_pipe(&device->display, pipe));tests/intel/kms_pm_warm_boot.c new file +1
-0+ if (!intel_pipe_output_combo_valid(&device-Quoted 1 line
display))
tests/intel/kms_pm_warm_boot.c new file +5
-0+continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);tests/intel/kms_pm_warm_boot.c new file +33
-0+ device->pipe = pipe; + +break ; + } + } + + igt_require_f(device->output && device->mode, "No valid connected +output found\n"); } + +static void setup_primary(device_t *device) { +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline(device_t *device) { +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); + +igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector-Quoted 1 line
connector_type;tests/intel/kms_pm_warm_boot.c new file +22
-0+ conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); +fprintf (fp,"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->pipe, + device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) { +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector-Quoted 1 line
connector_type;
tests/intel/kms_pm_warm_boot.c line 121
Quoted 1 line
tests/intel/kms_pm_warm_boot.c new file +1
-0+ conn_id = device->output->config.connector->connector_id;
After a reboot, the DRM driver is reloaded and connectors are recreated. The IDs are allocated again from scratch. If the initialization order remains identical, you might see the same connector_id, but there is no kernel guarantee that it will remain the same. So, I feel you can drop this connector_id alone as it is not a guaranteed behavior. Regards,
Sowmiya.
Quoted 94 lines
tests/intel/kms_pm_warm_boot.c new file +8
-0+ conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" + "pipe=%d conn_id=%u type=%d(%s)mode=%dx%d@%d\n",
tests/intel/kms_pm_warm_boot.c new file +71
-0+ device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); } + +static void read_baseline (char *buf,size_t sz) { +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp); +} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); } + +int igt_main (void ) +{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture() { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); + +igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device); + +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + + igt_assert_f(strcmp(saved, current) == 0, "Display parameters +mismatched.\n"); + +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE ); + +cleanup (&device); + } + + igt_fixture() { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}tests/meson.build index renamed from tests/meson.build +0
-01ac89bab7..084280081 100644
tests/meson.build +1
-1@@ -271,6 +271,7 @@ intel_kms_progs = [ 'kms_pm_backlight', 'kms_pm_dc', 'kms_pm_lpsp', + 'kms_pm_warm_boot', 'kms_pm_rpm', 'kms_psr', 'kms_psr2_sf', --2.48.1
Re: [PATCH i-g-t] tests/intel/kms_pm_warm_boot: Add warm reboot test
In reply to Mohammed ThasleemQuoted 3 lines · Mohammed Thasleem
This test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
I think you need to be more elaborate than that. What does "stability across warm reboot" mean? What is the goal here, and how does the capture/compare achieve that goal?
Quoted 3 lines
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
So there's no point in making this a test that gets run in CI?
Quoted 7 lines
3. Run post-reboot test to validate display parameters match baseline
v2: Replace
each_pipe_with_valid_outputwithfor_each_valid_output_on_crtc.Signed-off-by Mohammed Thasleem <[email protected]>--- tests/intel/kms_pm_warm_boot.c | 202 +++++++++++++++++++++++++++++++++
Why intel specific?
Quoted 20 lines
tests/meson.build | 1 + 2 files changed, 203 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.ctests/intel/kms_pm_warm_boot.c new file +10
-0@@ -0,0 +1,202 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2026 Intel Corporation +*/ + +/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe
tests/intel/kms_pm_warm_boot.c line 20
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+* Mega feature: Display Power Management +*/ + +#include "igt.h" +#include "igt_kms.h" +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt"
This is not a great way to manage temp files.
tests/intel/kms_pm_warm_boot.c line 32
Quoted 12 lines
tests/intel/kms_pm_warm_boot.c new file +12
-0+#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" );
It really is an anti-pattern to have "This test validates" in test descriptions. I see it elsewhere too, and it gets copy-pasted. Obviously each test validates something.
Quoted 14 lines
tests/intel/kms_pm_warm_boot.c new file +14
-0+ +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) +{ +igt_output_t *output;
tests/intel/kms_pm_warm_boot.c line 56
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+igt_crtc_t *crtc; +enum pipe pipe; + +for_each_crtc (&device->display, crtc) { + pipe = crtc->pipe; +for_each_valid_output_on_crtc (&device->display, crtc, output) { + +igt_display_reset (&device->display); + +igt_output_set_crtc (output,igt_crtc_for_pipe (&device->display, pipe));
You already have the crtc, there's no point in this crtc->pipe->crtc dance.
tests/intel/kms_pm_warm_boot.c line 63
Quoted 7 lines
tests/intel/kms_pm_warm_boot.c new file +7
-0+if (!intel_pipe_output_combo_valid (&device->display)) +continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + device->pipe = pipe;
If you need to store something, store the crtc pointer, not the pipe.
Quoted 30 lines
tests/intel/kms_pm_warm_boot.c new file +30
-0+ +break ; + } + } + +igt_require_f (device->output && device->mode,"No valid connected output found\n" ); +} + +static void setup_primary (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline (device_t *device) +{ +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); +
tests/intel/kms_pm_warm_boot.c line 103
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); + fprintf(fp, "pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n", + device->pipe,
Pipe is an Intel thing, this should really use the CRTC index.
Quoted 66 lines
tests/intel/kms_pm_warm_boot.c new file +66
-0+ device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) +{ +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_id = device->output->config.connector->connector_id; + conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" +"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); +} + +static void read_baseline (char *buf,size_t sz) +{ +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp); +} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); +} + +int igt_main (void ) +{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture() { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); +
tests/intel/kms_pm_warm_boot.c line 179
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device);
So only save it when the file doesn't already exist?
tests/intel/kms_pm_warm_boot.c line 190
Quoted 11 lines
tests/intel/kms_pm_warm_boot.c new file +11
-0+ +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + +igt_assert_f (strcmp (saved, current) ==0 ,"Display parameters mismatched.\n" );
I don't yet understand the idea of the test, really, but if there's a mismatch, this is going to be incredibly unhelpful output for debugging anything.
tests/intel/kms_pm_warm_boot.c line 193
Quoted 3 lines
tests/intel/kms_pm_warm_boot.c new file +3
-0+ +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE );
Only remove it when the comparison succeeded.
IOW, if there's a mismatch, for whatever reason, this test will never recover on its own due to the non-overwrite and non-remove policies, and will need a manual intervention?
Quoted 21 lines
tests/intel/kms_pm_warm_boot.c new file +9
-0+ +cleanup (&device); + } + + igt_fixture() { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}tests/meson.build +1
-0@@ -271,6 +271,7 @@ intel_kms_progs = [ 'kms_pm_backlight', 'kms_pm_dc', 'kms_pm_lpsp', + 'kms_pm_warm_boot', 'kms_pm_rpm', 'kms_psr', 'kms_psr2_sf',
Signature · 1 line
Jani Nikula, Intel
Hi Mohammed,
On 2025-12-10 at 17:13:44 +0530, Mohammed Thasleem wrote:
I have few more nits, see below.
Quoted 26 lines
This test validates display subsystem stability across warm reboot by capturing baseline display parameters (outputs, pipes, connectors, modes) before reboot and comparing them after reboot.
1. Run pre-reboot test to save baseline.
2. Perform manual system reboot.
3. Run post-reboot test to validate display parameters match baselineSigned-off-by Mohammed Thasleem <[email protected]>--- tests/intel/kms_pm_warm_boot.c | 200 +++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 201 insertions(+) create mode 100644 tests/intel/kms_pm_warm_boot.ctests/intel/kms_pm_warm_boot.c new file +5
-0@@ -0,0 +1,200 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2025 Intel Corporation +*/ +
tests/intel/kms_pm_warm_boot.c line 15
Quoted 10 lines
tests/intel/kms_pm_warm_boot.c new file +10
-0+/** +* TEST: kms pm warm reboot +* Category: Display +* Description: This test validates warm reboot. +* Driver requirement: xe +* Mega feature: Display Power Management +*/ + +#include "igt.h" +#include "igt_kms.h"
Move this igt headers after system ones.
tests/intel/kms_pm_warm_boot.c line 18
Quoted 3 lines
tests/intel/kms_pm_warm_boot.c new file +3
-0+#include <unistd.h> +#include <string.h> +#include <errno.h>
Sort headers alphabetically.
Regards,
Kamil
Quoted 197 lines
tests/intel/kms_pm_warm_boot.c new file +182
-0+ +#define PARAM_FILE "/var/tmp/igt_warm_reboot_params.txt" +#define BUF_SIZE 1024 + +/** +* SUBTEST: warm-reboot-before +* Description: Save baseline display parameters before warm reboot. +* +* SUBTEST: warm-reboot-after +* Description: Validate display parameters after warm reboot. +* +*/ + +IGT_TEST_DESCRIPTION ("This test validates warm reboot" ); + +typedef struct { +int fd; +igt_display_t display; +igt_output_t *output; +drmModeModeInfo *mode; +igt_plane_t *primary; +struct igt_fb fb_test; +enum pipe pipe; +}device_t ; + +static void detect_primary_output (device_t *device) +{ +igt_display_t *display = &device->display; +igt_output_t *output; +enum pipe pipe; + +igt_display_reset (display); + +for_each_pipe_with_valid_output (display, pipe, output) { +igt_output_set_pipe (output, pipe); + +if (!intel_pipe_output_combo_valid (display)) +continue ; + + device->output = output; + device->mode =igt_output_get_mode (output); + device->primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + device->pipe = pipe; + +break ; + } + +igt_require_f (device->output && device->mode, +"No valid connected output found\n" ); +} + +static void setup_primary (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); + +igt_create_color_fb (device->fd, + device->mode->hdisplay, + device->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , +0.2 ,0.3 ,0.4 , + &device->fb_test); + +igt_plane_set_fb (device->primary, &device->fb_test); +igt_display_commit (&device->display); +} + +static void save_baseline (device_t *device) +{ +int conn_type =-1 ; +const char *conn_type_name ="unknown" ; +FILE *fp =fopen (PARAM_FILE ,"w" ); + +igt_require_f (fp,"Unable to open param file for writing\n" ); + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_type_name =kmstest_connector_type_str (conn_type); + } + +fprintf (fp,"n_outputs=%d\n" , device->display.n_outputs); +fprintf (fp,"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->pipe, + device->output->config.connector ? + device->output->config.connector->connector_id :0 , + conn_type, conn_type_name, + device->mode->hdisplay, device->mode->vdisplay, + device->mode->vrefresh); + +fclose (fp); +} + +static void collect_current (device_t *device,char *buf,size_t sz) +{ +int conn_type =-1 , ret; +const char *conn_type_name ="unknown" ; +uint32_t conn_id =0 ; + +if (device->output->config.connector) { + conn_type = device->output->config.connector->connector_type; + conn_id = device->output->config.connector->connector_id; + conn_type_name =kmstest_connector_type_str (conn_type); + } + + +/* Write display basic config details */ + ret =snprintf (buf, sz, +"n_outputs=%d\n" +"pipe=%d conn_id=%u type=%d(%s) mode=%dx%d@%d\n" , + device->display.n_outputs, + device->pipe, + conn_id, + conn_type, conn_type_name, + device->mode->hdisplay, + device->mode->vdisplay, + device->mode->vrefresh); + +if (ret <0 || (size_t )ret >= sz) +igt_warn ("%s(): buffer truncated\n" , __func__); +} + +static void read_baseline (char *buf,size_t sz) +{ +FILE *fp =fopen (PARAM_FILE ,"r" ); + +igt_require_f (fp,"Baseline missing. Run first time to create.\n" ); + +fread (buf,1 , sz -1 , fp); + buf[sz -1 ] ='\0' ; +fclose (fp); +} + +static void cleanup (device_t *device) +{ +igt_plane_set_fb (device->primary,NULL ); +igt_display_commit (&device->display); +igt_remove_fb (device->fd, &device->fb_test); +} + +igt_main +{ +device_t device = {0 }; +char saved[BUF_SIZE ] = {0 }; +char current[BUF_SIZE ] = {0 }; + + igt_fixture { + device.fd =drm_open_driver_master (DRIVER_ANY ); +igt_require (device.fd >=0 ); + +igt_display_require (&device.display, device.fd); + } + + igt_subtest("warm-reboot-before") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); + +if (access (PARAM_FILE ,F_OK ) ==-1 ) +save_baseline (&device); + +cleanup (&device); + } + + igt_subtest("warm-reboot-after") { +detect_primary_output (&device); +setup_primary (&device); +collect_current (&device, current,sizeof (current)); +read_baseline (saved,sizeof (saved)); + +igt_assert_f (strcmp (saved, current) ==0 ,"Display parameters mismatched.\n" ); + +if (strcmp (saved, current) ==0 ) +remove (PARAM_FILE ); + +cleanup (&device); + } + + igt_fixture { +igt_display_fini (&device.display); +drm_close_driver (device.fd); + } +}tests/meson.build +1
-0@@ -269,6 +269,7 @@ intel_kms_progs = [ 'kms_pm_dc', 'kms_pm_lpsp', 'kms_pm_rpm', + 'kms_pm_warm_boot', 'kms_psr', 'kms_psr2_sf', 'kms_psr2_su',Signature · 1 line
2.25.1