[i-g-t 1/2] DO_NOT_MERGE: Disable C-states before stating the subtest
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Fri Feb 16 07:50:01 UTC 2024
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_vrr.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 9de0ffc85..30ca85939 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -35,6 +35,7 @@
#include "sw_sync.h"
#include <fcntl.h>
#include <signal.h>
+#include <limits.h>
/**
* SUBTEST: flip-basic
@@ -269,6 +270,26 @@ static void set_vrr_on_pipe(data_t *data, enum pipe pipe,
NULL) == 0);
}
+static void set_cstates(bool enable) {
+ char path[PATH_MAX];
+ FILE *file;
+ int num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+
+ for (int cpu = 0; cpu < num_cpus; cpu++) {
+ for (int state = 0; state < 9; state++) {
+ snprintf(path, PATH_MAX, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/disable", cpu, state);
+
+ file = fopen(path, "w");
+ if (!file)
+ continue;
+
+ rewind(file);
+ fprintf(file, "%s\n", enable? "1" : "0");
+ fclose(file);
+ }
+ }
+}
+
/* Prepare the display for testing on the given pipe. */
static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
{
@@ -687,6 +708,9 @@ igt_main
igt_display_require(&data.display, data.drm_fd);
igt_require(data.display.is_atomic);
igt_display_require_output(&data.display);
+
+ if (is_intel_device(data.drm_fd))
+ set_cstates(false);
}
igt_describe("Tests that VRR is enabled and that the difference between flip "
@@ -731,6 +755,8 @@ igt_main
}
igt_fixture {
+ if (is_intel_device(data.drm_fd))
+ set_cstates(true);
igt_display_fini(&data.display);
drm_close_driver(data.drm_fd);
}
--
2.43.0
More information about the Intel-gfx-trybot
mailing list