summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Zhang <quic_jesszhan@quicinc.com>2022-06-02 11:35:05 -0700
committerJessica Zhang <quic_jesszhan@quicinc.com>2022-06-14 13:08:50 -0700
commit02888400228efbb29437726aa04114575ea939c3 (patch)
treed99978e5f4242926de211da6f79947c4b346e551
parenta9b38b382f1e0c03d2eb0cd42c03cab5988c2854 (diff)
lib/igt_debugfs: Add IGT_CRC_SOURCE environmental variable
Adds support for the IGT_CRC_SOURCE environmental variable to make it easier for drivers to run tests using custom CRC sources. Example usage: `IGT_CRC_SOURCE=intf ./kms_pipe_crc_basic` If the IGT_CRC_SOURCE isn't set, use the original source that was passed in as a parameter to pipe_crc_new(). Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
-rw-r--r--lib/igt_debugfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 7e7ccf22..a56688a5 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -719,9 +719,15 @@ pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
igt_pipe_crc_t *pipe_crc;
char buf[128];
int debugfs;
+ const char *env_source;
igt_assert(source);
+ env_source = getenv("IGT_CRC_SOURCE");
+
+ if (!env_source)
+ env_source = source;
+
debugfs = igt_debugfs_dir(fd);
igt_assert(debugfs != -1);
@@ -736,7 +742,7 @@ pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
pipe_crc->fd = fd;
pipe_crc->dir = debugfs;
pipe_crc->pipe = pipe;
- pipe_crc->source = strdup(source);
+ pipe_crc->source = strdup(env_source);
igt_assert(pipe_crc->source);
pipe_crc->flags = flags;