[RFC] [PATCH v1 1/2] tests/intel/kms_pm_vrsr: Add test to check primary panel

Samala, Pranay pranay.samala at intel.com
Tue Jun 24 03:52:16 UTC 2025


Hi Thasleem,

> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Mohammed
> Thasleem
> Sent: Tuesday, June 24, 2025 12:42 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Thasleem, Mohammed <mohammed.thasleem at intel.com>
> Subject: [RFC] [PATCH v1 1/2] tests/intel/kms_pm_vrsr: Add test to check
> primary panel
> 
> This test detect primary connected panel and does the flip on it.
> 
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
> ---
>  tests/intel/kms_pm_vrsr.c | 132 ++++++++++++++++++++++++++++++++++++++
>  tests/meson.build         |   1 +
>  2 files changed, 133 insertions(+)
>  create mode 100644 tests/intel/kms_pm_vrsr.c
> 
> diff --git a/tests/intel/kms_pm_vrsr.c b/tests/intel/kms_pm_vrsr.c new file mode
> 100644 index 000000000..671621a66
> --- /dev/null
> +++ b/tests/intel/kms_pm_vrsr.c
> @@ -0,0 +1,132 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +/**
> + * TEST: kms pm vrsr
> + * Category: Display
> + * Description: Tests to validate vram self refresh along with display flips.
> + * Driver requirement: xe
> + * Mega feature: Display Power Management  */
> +
> +#include <fcntl.h>
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +
> +/**
> + * SUBTEST: vram-self-refresh
> + * Description: This test validates display flips with vram self
> +refresh
> + *
> + */
> +
> +IGT_TEST_DESCRIPTION("This test validates display flips with vram self
> +refresh.");
> +
> +bool kms_poll_saved_state;
> +
> +typedef struct {
> +	int fd_xe;
> +	int debugfs_fd;
> +	uint32_t devid;
> +	char *debugfs_dump;
> +	igt_display_t display;
> +	struct igt_fb fb_white;
> +	drmModeModeInfo *mode;
> +	igt_output_t *output;
> +} device_t;
It would be more consistent to align the naming with the existing convention, 
such as data_t, rather than introducing device_t.

> +
> +static void vram_self_refresh(device_t *device);
> +
> +static void display_fini(device_t *device) {
> +	igt_display_fini(&device->display);
> +}
> +
> +static void setup_primary(device_t *device) {
> +	igt_plane_t *primary;
> +
> +	primary = igt_output_get_plane_type(device->output,
> +					    DRM_PLANE_TYPE_PRIMARY);
> +	igt_plane_set_fb(primary, NULL);
> +	igt_create_color_fb(device->fd_xe,
> +			    device->mode->hdisplay, device->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    DRM_FORMAT_MOD_LINEAR,
> +			    1.0, 1.0, 1.0,
> +			    &device->fb_white);
> +	igt_plane_set_fb(primary, &device->fb_white);
> +	igt_display_commit(&device->display);
> +}
> +
> +static void detect_primary_output(device_t *device) {
> +	igt_display_t *display = &device->display;
> +	igt_output_t *output;
> +	enum pipe pipe;
> +
> +	for_each_pipe_with_valid_output(display, pipe, output) {
> +		drmModeConnectorPtr c = output->config.connector;
> +
> +		if (c->connection != DRM_MODE_CONNECTED)
> +			continue;
> +
> +		igt_display_reset(display);
> +		igt_output_set_pipe(output, pipe);
> +
> +		if (!intel_pipe_output_combo_valid(display))
> +			continue;
> +
> +		device->output = output;
> +		device->mode = igt_output_get_mode(output);
> +
> +		break;
> +	}
If no valid output is found, skip the test gracefully.
This ensures the test only runs when appropriate hardware is present.

Something like this can be added
igt_require_f(device->output && device->mode, "No valid connected output found\n");

> +}
Use blank line here

> +static void cleanup(device_t *device)
> +{
> +	igt_plane_t *primary;
> +
> +	primary = igt_output_get_plane_type(device->output,
> +					    DRM_PLANE_TYPE_PRIMARY);
I think this primary plane structure can be used in device_t structure. Since it is initialized 
in detect_primary_output function, so no need to declare it again here.

> +	igt_plane_set_fb(primary, NULL);
> +	igt_display_commit(&device->display);
> +	igt_remove_fb(device->fd_xe, &device->fb_white); }
> +
> +
Avoid extra blank line

> +static void vram_self_refresh(device_t *device) {
> +	detect_primary_output(device);
> +	setup_primary(device);
> +	cleanup(device);
> +}
> +
> +igt_main
> +{
> +	device_t device = {};
> +
> +	igt_fixture {
> +		device.fd_xe = drm_open_driver_master(DRIVER_INTEL |
> DRIVER_XE);
> +		device.debugfs_fd = igt_debugfs_dir(device.fd_xe);
> +		igt_require(device.debugfs_fd != -1);
Skip the test with proper skip message as above

> +		kmstest_set_vt_graphics_mode();
> +		device.devid = intel_get_drm_devid(device.fd_xe);
> +		igt_display_require(&device.display, device.fd_xe);
> +	}
> +
> +	igt_describe("This test validates display flips with vram self refresh");
> +	igt_subtest("vram-self-refresh") {
> +		vram_self_refresh(&device);
> +	}
> +
> +	igt_fixture {
> +		close(device.debugfs_fd);
> +		display_fini(&device);
> +		drm_close_driver(device.fd_xe);
> +	}
> +
> +	igt_exit();
> +}
> diff --git a/tests/meson.build b/tests/meson.build index 55bcf57ec..3b8edfe89
> 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -265,6 +265,7 @@ intel_kms_progs = [
>  	'kms_pm_dc',
>  	'kms_pm_lpsp',
>  	'kms_pm_rpm',
> +        'kms_pm_vrsr',
>  	'kms_psr',
>  	'kms_psr2_sf',
>  	'kms_psr2_su',
> --
> 2.25.1



More information about the igt-dev mailing list