diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-06-10 11:05:16 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-06-11 16:35:52 +0200 |
commit | 35554a1bcaaea55c1cfa88c0176c58d2fb3b8013 (patch) | |
tree | b84d0c5c2fe4e5721f0baf1d3560b71f1aacc028 | |
parent | 4e9df4fe5fef283c23e62fd7348fae4943a9fa6b (diff) |
Revert "Add rc6_residency_counter subtest"
This reverts commit 9a70e29f8380c2fc6f9b43757c68e24bf2619061.
Patch needs polish and after a quick irc discussion Ben&I agreed that
the revert is in order.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | tests/pm_rc6_residency.c | 138 |
1 files changed, 42 insertions, 96 deletions
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c index 550e3adf..197ab002 100644 --- a/tests/pm_rc6_residency.c +++ b/tests/pm_rc6_residency.c @@ -34,11 +34,9 @@ #include "drmtest.h" -#define NUMBER_OF_RC6_RESIDENCY 3 #define SLEEP_DURATION 3000 // in milliseconds #define RC6_FUDGE 900 // in milliseconds - static unsigned int readit(const char *path) { unsigned int ret; @@ -46,10 +44,8 @@ static unsigned int readit(const char *path) FILE *file; file = fopen(path, "r"); - if (file == NULL) { - fprintf(stderr, "Couldn't open %s (%d)\n", path, errno); - abort(); - } + igt_assert_f(file, + "Couldn't open %s (%d)\n", path, errno); scanned = fscanf(file, "%u", &ret); igt_assert(scanned == 1); @@ -58,112 +54,62 @@ static unsigned int readit(const char *path) return ret; } -static void read_rc6_residency( int value[], const char *name_of_rc6_residency[]) +igt_simple_main { const int device = drm_get_card(); - char *path ; - int ret; + char *path, *pathp, *pathpp; + int fd, ret; + unsigned int value1, value1p, value1pp, value2, value2p, value2pp; FILE *file; + int diff; - /* For some reason my ivb isn't idle even after syncing up with the gpu. - * Let's add a sleept just to make it happy. */ - sleep(5); + igt_skip_on_simulation(); + + /* Use drm_open_any to verify device existence */ + fd = drm_open_any(); + close(fd); ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_enable", device); igt_assert(ret != -1); - file = fopen(path, "r");//open + /* For some reason my ivb isn't idle even after syncing up with the gpu. + * Let's add a sleept just to make it happy. */ + sleep(5); + + file = fopen(path, "r"); igt_require(file); /* claim success if no rc6 enabled. */ if (readit(path) == 0) igt_success(); - for(unsigned int i = 0; i < 6; i++) - { - if(i == 3) - sleep(SLEEP_DURATION / 1000); - ret = asprintf(&path, "/sys/class/drm/card%d/power/%s_residency_ms",device,name_of_rc6_residency[i % 3] ); - igt_assert(ret != -1); - value[i] = readit(path); - } - free(path); -} - -static void rc6_residency_counter(int value[],const char * name_of_rc6_residency[]) -{ - unsigned int flag_counter,flag_support; - double counter_result = 0; - flag_counter = 0; - flag_support = 0; - - for(int flag = NUMBER_OF_RC6_RESIDENCY-1; flag >= 0 ; flag --) - { - unsigned int tmp_counter, tmp_support; - double counter; - counter = ((double)value[flag + 3] - (double)value[flag]) /(double) SLEEP_DURATION; - - if( counter > 0.9 ){ - counter_result = counter; - tmp_counter = 1; - } - else - tmp_counter = 0; - - if( value [flag + 3] == 0){ - tmp_support = 0; - printf("This machine doesn't support %s\n",name_of_rc6_residency[flag]); - } - else - tmp_support = 1; - - flag_counter = flag_counter + tmp_counter; - flag_counter = flag_counter << 1; - - flag_support = flag_support + tmp_support; - flag_support = flag_support << 1; - } - - printf("The residency counter : %f \n", counter_result); - - igt_assert_f(flag_counter != 0 , "The RC6 residency counter is not good.\n"); - igt_assert_f(flag_support != 0 , "This machine doesn't support any RC6 state!\n"); - igt_assert_f(counter_result <=1 , "Debug files must be wrong \n"); - - printf("This machine entry %s state.\n", name_of_rc6_residency[(flag_counter / 2) - 1]); -} - -static void rc6_residency_check(int value[]) -{ - unsigned int diff; - diff = (value[3] - value[0]) + - (value[4] - value[1]) + - (value[5] - value[2]); - - igt_assert_f(diff <= (SLEEP_DURATION + RC6_FUDGE),"Diff was too high. That is unpossible\n"); - igt_assert_f(diff >= (SLEEP_DURATION - RC6_FUDGE),"GPU was not in RC6 long enough. Check that " - "the GPU is as idle as possible(ie. no X, " - "running and running no other tests)\n"); -} - -igt_main -{ - int value[6]; - int fd; - const char * name_of_rc6_residency[3]={"rc6","rc6p","rc6pp"}; - - igt_skip_on_simulation(); - - /* Use drm_open_any to verify device existence */ - fd = drm_open_any(); - close(fd); + ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_residency_ms", device); + igt_assert(ret != -1); + ret = asprintf(&pathp, "/sys/class/drm/card%d/power/rc6p_residency_ms", device); + igt_assert(ret != -1); + ret = asprintf(&pathpp, "/sys/class/drm/card%d/power/rc6pp_residency_ms", device); + igt_assert(ret != -1); - read_rc6_residency(value, name_of_rc6_residency); + value1 = readit(path); + value1p = readit(pathp); + value1pp = readit(pathpp); + sleep(SLEEP_DURATION / 1000); + value2 = readit(path); + value2p = readit(pathp); + value2pp = readit(pathpp); - igt_subtest("rc6-residency-check") - rc6_residency_check(value); + free(pathpp); + free(pathp); + free(path); - igt_subtest("rc6-residency-counter") - rc6_residency_counter(value, name_of_rc6_residency); + diff = (value2pp - value1pp) + + (value2p - value1p) + + (value2 - value1); + igt_assert_f(diff <= (SLEEP_DURATION + RC6_FUDGE), + "Diff was too high. That is unpossible\n"); + igt_assert_f(diff >= (SLEEP_DURATION - RC6_FUDGE), + "GPU was not in RC6 long enough. Check that " + "the GPU is as idle as possible (ie. no X, " + "running and running no other tests)\n"); } |