[Intel-gfx] [I-G-T 2/3] igt/gem_mocs_settings: adding RC6 testings
Peter Antoine
peter.antoine at intel.com
Fri Jul 29 09:34:34 UTC 2016
This change adds a RC6 test for the MOCS. The MOCS registers are loaded
and saved as part of the RC6 cycle but not all the registers are
saved/restored. This tests that those registers are correctly restored.
Signed-off-by: Peter Antoine <peter.antoine at intel.com>
---
tests/gem_mocs_settings.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/tests/gem_mocs_settings.c b/tests/gem_mocs_settings.c
index 4fb3a02..66d02d9 100644
--- a/tests/gem_mocs_settings.c
+++ b/tests/gem_mocs_settings.c
@@ -518,6 +518,59 @@ static void run_tests(unsigned mode)
intel_register_access_fini();
}
+static unsigned int readit(const char *path)
+{
+ unsigned int ret = 0;
+ int scanned = 0;
+ FILE *file;
+
+ file = fopen(path, "r");
+ igt_assert(file);
+ scanned = fscanf(file, "%u", &ret);
+ igt_assert_eq(scanned, 1);
+
+ fclose(file);
+
+ return ret;
+}
+
+static int read_rc6_residency(void)
+{
+ unsigned int residency;
+ const int device = drm_get_card();
+ static const char path_format[] =
+ "/sys/class/drm/card%d/power/rc6_residency_ms";
+ char path[sizeof(path_format)];
+ int ret;
+
+ ret = snprintf(path, sizeof(path)-1, path_format, device);
+
+ igt_assert_neq(ret, -1);
+ residency = readit(path);
+
+ return residency;
+}
+
+static void context_rc6_test(void)
+{
+ int fd = drm_open_driver(DRIVER_INTEL);
+ int res_ms;
+ uint32_t ctx_id = gem_context_create(fd);
+
+ igt_debug("RC6 Context Test\n");
+ check_control_registers(fd, I915_EXEC_RENDER, ctx_id, false);
+ check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
+
+ res_ms = read_rc6_residency();
+ sleep(3);
+ igt_assert_neq(res_ms, read_rc6_residency());
+
+ check_control_registers(fd, I915_EXEC_RENDER, ctx_id, false);
+ check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
+ close(fd);
+}
+
+
static void test_requirements(void)
{
int fd = drm_open_driver_master(DRIVER_INTEL);
@@ -537,6 +590,9 @@ igt_main
igt_subtest("mocs-settings")
run_tests(NONE);
+ igt_subtest("mocs-rc6")
+ context_rc6_test();
+
igt_subtest("mocs-reset")
run_tests(RESET);
--
1.9.1
More information about the Intel-gfx
mailing list