From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, jani.nikula@intel.com,
Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t 1/4] lib/igt_params: Fall back to intel_display module parameters
Date: Tue, 24 Nov 2026 10:15:56 +0530 [thread overview]
Message-ID: <20261124044559.897167-2-jeevan.b@intel.com> (raw)
In-Reply-To: <20261124044559.897167-1-jeevan.b@intel.com>
With display split into a dedicated intel-display.ko, display module
parameters move from /sys/module/<driver>/parameters to
/sys/module/intel_display/parameters.
Add igt_display_params_open() to open the intel_display parameters
directory, and make igt_params_get()/igt_params_set() search the GPU
driver module first and then intel_display. Existing tests keep working
unchanged on kernels both with and without the dedicated display module.
igt_params_open() is unchanged.
Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
lib/igt_params.c | 83 +++++++++++++++++++++++++++++++++++++++++++++---
lib/igt_params.h | 1 +
2 files changed, 79 insertions(+), 5 deletions(-)
diff --git a/lib/igt_params.c b/lib/igt_params.c
index 3dad317a5..01494d17e 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <i915_drm.h>
@@ -123,7 +124,9 @@ static void igt_params_save(int dir, const char *name)
* @device: fd of the device
*
* This opens the module parameters directory (under sysfs) corresponding
- * to the device for use with igt_sysfs_set() and igt_sysfs_get().
+ * to the device for use with igt_sysfs_set() and igt_sysfs_get(). Only the
+ * parameters of the GPU driver module are covered; for the dedicated
+ * intel_display module see igt_display_params_open().
*
* Returns:
* The directory fd, or -1 on failure.
@@ -156,12 +159,77 @@ int igt_params_open(int device)
return params;
}
+#define INTEL_DISPLAY_PARAMS_PATH "/sys/module/intel_display/parameters"
+
+/**
+ * igt_display_params_open:
+ *
+ * Opens the module parameters directory of the dedicated intel-display.ko
+ * module (/sys/module/intel_display/parameters, the kernel exposes the module
+ * name with an underscore). On kernels where display is still built into the
+ * GPU driver module this directory does not exist.
+ *
+ * Parameters changed at runtime through the driver's debugfs
+ * (<driver>_params) are per DRM device and are not affected by the split.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_display_params_open(void)
+{
+ return open(INTEL_DISPLAY_PARAMS_PATH, O_RDONLY);
+}
+
+/* Is @device driven by a driver whose display code can live in intel_display? */
+static bool device_uses_intel_display(int device)
+{
+ drm_version_t version;
+ char name[32] = "";
+
+ memset(&version, 0, sizeof(version));
+ version.name_len = sizeof(name) - 1;
+ version.name = name;
+ if (ioctl(device, DRM_IOCTL_VERSION, &version))
+ return false;
+
+ return !strcmp(name, "i915") || !strcmp(name, "xe");
+}
+
+/*
+ * Open the params directory that holds @parameter: the GPU driver module
+ * first, then, for i915 and xe devices only, the intel_display module. This
+ * keeps tests working on kernels with and without a dedicated display module
+ * without touching intel_display parameters on other vendors' devices.
+ */
+static int params_open_for(int device, const char *parameter)
+{
+ int dir;
+
+ dir = igt_params_open(device);
+ if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+ return dir;
+ if (dir >= 0)
+ close(dir);
+
+ if (!device_uses_intel_display(device))
+ return -1;
+
+ dir = igt_display_params_open();
+ if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+ return dir;
+ if (dir >= 0)
+ close(dir);
+
+ return -1;
+}
+
/**
* __igt_params_get:
* @device: fd of the device
* @parameter: the name of the parameter to get
*
- * This reads the value of the modparam.
+ * This reads the value of the modparam. The GPU driver module is searched
+ * first and, for i915 and xe devices, the intel_display module second.
*
* Returns:
* A nul-terminated string, must be freed by caller after use, or NULL
@@ -172,7 +240,7 @@ char *__igt_params_get(int device, const char *parameter)
char *str;
int dir;
- dir = igt_params_open(device);
+ dir = params_open_for(device, parameter);
if (dir < 0)
return NULL;
@@ -189,7 +257,7 @@ static bool __igt_params_set(int device, const char *parameter,
int dir;
int ret;
- dir = igt_params_open(device);
+ dir = params_open_for(device, parameter);
if (dir < 0)
return false;
@@ -208,6 +276,9 @@ static bool __igt_params_set(int device, const char *parameter,
* @parameter: the name of the parameter to set
* @fmt: printf-esque format string
*
+ * The parameter is looked up in the GPU driver module first and, for i915
+ * and xe devices, in the intel_display module second.
+ *
* Returns true on success
*/
bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
@@ -230,7 +301,9 @@ bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
*
* Save original value to be restored by exit handler. Parameter is first
* searched at debugfs/dri/N/<device>_params and if not found will look for
- * parameter at /sys/module/<device>/parameters.
+ * parameter at /sys/module/<device>/parameters. If the parameter is not found
+ * there either, the dedicated intel_display module is searched at
+ * /sys/module/intel_display/parameters.
*
* Giving -1 here for default device will search for matching device from
* debugfs/dri/N where N go from 0 to 63. First device found from debugfs
diff --git a/lib/igt_params.h b/lib/igt_params.h
index 6494786f0..f2ec44d1f 100644
--- a/lib/igt_params.h
+++ b/lib/igt_params.h
@@ -27,6 +27,7 @@
#include <stdbool.h>
int igt_params_open(int device);
+int igt_display_params_open(void);
char *__igt_params_get(int device, const char *parameter);
--
2.43.0
next prev parent reply other threads:[~2026-11-24 4:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 4:45 [PATCH i-g-t 0/4] RFC: Add intel_display module support to module load tests Jeevan B
2026-11-24 4:45 ` Jeevan B [this message]
2026-11-24 4:45 ` [PATCH i-g-t 2/4] lib/igt_kmod: Handle the dedicated intel_display module Jeevan B
2026-11-24 4:45 ` [PATCH i-g-t 3/4] tests/intel/i915_module_load: Add intel_display module subtests Jeevan B
2026-11-24 4:45 ` [PATCH i-g-t 4/4] tests/intel/xe_module_load: " Jeevan B
2026-11-24 5:28 ` ✓ Xe.CI.BAT: success for RFC: Add intel_display module support to module load tests (rev2) Patchwork
2026-11-24 5:47 ` ✗ i915.CI.BAT: failure " 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=20261124044559.897167-2-jeevan.b@intel.com \
--to=jeevan.b@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=karthik.b.s@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