kms_rotation_crc: Remove useless comments
[platform/upstream/intel-gpu-tools.git] / tests / pm_rps.c
index 157f9e3..c1156a5 100644 (file)
@@ -306,37 +306,6 @@ static void load_helper_deinit(void)
                drm_intel_bufmgr_destroy(lh.bufmgr);
 }
 
-static void stop_rings(void)
-{
-       int fd;
-       static const char data[] = "0xf";
-
-       fd = igt_debugfs_open("i915_ring_stop", O_WRONLY);
-       igt_assert(fd >= 0);
-
-       igt_debug("injecting ring stop\n");
-       igt_assert(write(fd, data, sizeof(data)) == sizeof(data));
-
-       close(fd);
-}
-
-static bool rings_stopped(void)
-{
-       int fd;
-       static char buf[128];
-       unsigned long long val;
-
-       fd = igt_debugfs_open("i915_ring_stop", O_RDONLY);
-       igt_assert(fd >= 0);
-
-       igt_assert(read(fd, buf, sizeof(buf)) > 0);
-       close(fd);
-
-       sscanf(buf, "%llx", &val);
-
-       return (bool)val;
-}
-
 static void min_max_config(void (*check)(void))
 {
        int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2;
@@ -488,13 +457,19 @@ static void reset(void)
        int pre_freqs[NUMFREQ];
        int post_freqs[NUMFREQ];
 
+       /*
+        * quiescent_gpu upsets the gpu and makes it get pegged to max somehow.
+        * Don't ask.
+        */
+       sleep(10);
+
        igt_debug("Apply low load...\n");
        load_helper_run(LOW);
        stabilize_check(pre_freqs);
 
        igt_debug("Stop rings...\n");
-       stop_rings();
-       while (rings_stopped())
+       igt_set_stop_rings(STOP_RING_DEFAULTS);
+       while (igt_get_stop_rings())
                usleep(1000 * 100);
        igt_debug("Ring stop cleared\n");
 
@@ -516,6 +491,43 @@ static void reset(void)
        idle_check();
 }
 
+static void blocking(void)
+{
+       int pre_freqs[NUMFREQ];
+       int post_freqs[NUMFREQ];
+
+       int fd = drm_open_any();
+       igt_assert(fd >= 0);
+
+       /*
+        * quiescent_gpu upsets the gpu and makes it get pegged to max somehow.
+        * Don't ask.
+        */
+       sleep(10);
+
+       igt_debug("Apply low load...\n");
+       load_helper_run(LOW);
+       stabilize_check(pre_freqs);
+       load_helper_stop();
+
+       sleep(5);
+
+       igt_debug("Kick gpu hard ...\n");
+       /* This relies on the blocking waits in quiescent_gpu and the kernel
+        * boost logic to ramp the gpu to full load. */
+       gem_quiescent_gpu(fd);
+       gem_quiescent_gpu(fd);
+
+       igt_debug("Apply low load again...\n");
+       load_helper_run(LOW);
+       stabilize_check(post_freqs);
+       load_helper_stop();
+       matchit(pre_freqs, post_freqs);
+
+       igt_debug("Removing load...\n");
+       idle_check();
+}
+
 static void pm_rps_exit_handler(int sig)
 {
        if (origfreqs[MIN] > readval(stuff[MAX].filp)) {
@@ -577,4 +589,7 @@ igt_main
 
        igt_subtest("reset")
                reset();
+
+       igt_subtest("blocking")
+               blocking();
 }