mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 18:06:13 +00:00
tests/pm_rc6_residency: sanitize the RC6 enabled mask check
The way the test checks for the RC6 enabled mask atm doesn't work: calling igt_success outside of any subtests doesn't have any effect. This means the test will run a 11 second idle loop for each RC6 state regardless if the platform supports these or have them enabled. Fix this by checking explicitly if a given RC6 state is enabled before reading out/checking the corresponding counter. With this fix we can also get rid of the GEN6/IVB checks, since the RC6 mask check makes them redundant. We still need the VLV/CHV checks, since media RC6 doesn't have a separate bit in the mask. Signed-off-by: Imre Deak <imre.deak@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
a76591a4be
commit
a2ce95eb9e
@ -38,6 +38,10 @@
|
|||||||
#define SLEEP_DURATION 3000 // in milliseconds
|
#define SLEEP_DURATION 3000 // in milliseconds
|
||||||
#define CODE_TIME 50 // in microseconfs
|
#define CODE_TIME 50 // in microseconfs
|
||||||
|
|
||||||
|
#define RC6_ENABLED 1
|
||||||
|
#define RC6P_ENABLED 2
|
||||||
|
#define RC6PP_ENABLED 4
|
||||||
|
|
||||||
struct residencies {
|
struct residencies {
|
||||||
int rc6;
|
int rc6;
|
||||||
int media_rc6;
|
int media_rc6;
|
||||||
@ -61,29 +65,33 @@ static unsigned int readit(const char *path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long get_rc6_enabled_mask(void)
|
||||||
|
{
|
||||||
|
unsigned long rc6_mask;
|
||||||
|
char *path;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_enable",
|
||||||
|
drm_get_card());
|
||||||
|
igt_assert_neq(ret, -1);
|
||||||
|
rc6_mask = readit(path);
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
return rc6_mask;
|
||||||
|
}
|
||||||
|
|
||||||
static int read_rc6_residency(const char *name_of_rc6_residency)
|
static int read_rc6_residency(const char *name_of_rc6_residency)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
const int device = drm_get_card();
|
const int device = drm_get_card();
|
||||||
char *path ;
|
char *path ;
|
||||||
int ret;
|
int ret;
|
||||||
FILE *file;
|
|
||||||
int value[2];
|
int value[2];
|
||||||
|
|
||||||
/* For some reason my ivb isn't idle even after syncing up with the gpu.
|
/* 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. */
|
* Let's add a sleept just to make it happy. */
|
||||||
sleep(5);
|
sleep(5);
|
||||||
|
|
||||||
ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_enable", device);
|
|
||||||
igt_assert_neq(ret, -1);
|
|
||||||
|
|
||||||
file = fopen(path, "r");
|
|
||||||
igt_require(file);
|
|
||||||
|
|
||||||
/* claim success if no rc6 enabled. */
|
|
||||||
if (readit(path) == 0)
|
|
||||||
igt_success();
|
|
||||||
|
|
||||||
for(i = 0; i < 2; i++)
|
for(i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
sleep(SLEEP_DURATION / 1000);
|
sleep(SLEEP_DURATION / 1000);
|
||||||
@ -109,20 +117,26 @@ static void residency_accuracy(unsigned int diff,
|
|||||||
"Sysfs RC6 residency counter is inaccurate.\n");
|
"Sysfs RC6 residency counter is inaccurate.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void measure_residencies(int devid, struct residencies *res)
|
static void measure_residencies(int devid, unsigned int rc6_mask,
|
||||||
|
struct residencies *res)
|
||||||
{
|
{
|
||||||
res->rc6 = read_rc6_residency("rc6");
|
if (rc6_mask & RC6_ENABLED)
|
||||||
if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
|
res->rc6 = read_rc6_residency("rc6");
|
||||||
|
|
||||||
|
if ((rc6_mask & RC6_ENABLED) &&
|
||||||
|
(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)))
|
||||||
res->media_rc6 = read_rc6_residency("media_rc6");
|
res->media_rc6 = read_rc6_residency("media_rc6");
|
||||||
|
|
||||||
if (IS_GEN6(devid) || IS_IVYBRIDGE(devid)) {
|
if (rc6_mask & RC6P_ENABLED)
|
||||||
res->rc6p = read_rc6_residency("rc6p");
|
res->rc6p = read_rc6_residency("rc6p");
|
||||||
|
|
||||||
|
if (rc6_mask & RC6PP_ENABLED)
|
||||||
res->rc6pp = read_rc6_residency("rc6pp");
|
res->rc6pp = read_rc6_residency("rc6pp");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
igt_main
|
igt_main
|
||||||
{
|
{
|
||||||
|
unsigned int rc6_mask;
|
||||||
int fd;
|
int fd;
|
||||||
int devid = 0;
|
int devid = 0;
|
||||||
struct residencies res;
|
struct residencies res;
|
||||||
@ -135,22 +149,29 @@ igt_main
|
|||||||
devid = intel_get_drm_devid(fd);
|
devid = intel_get_drm_devid(fd);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
measure_residencies(devid, &res);
|
rc6_mask = get_rc6_enabled_mask();
|
||||||
|
measure_residencies(devid, rc6_mask, &res);
|
||||||
}
|
}
|
||||||
|
|
||||||
igt_subtest("rc6-accuracy")
|
igt_subtest("rc6-accuracy") {
|
||||||
|
igt_skip_on(!(rc6_mask & RC6_ENABLED));
|
||||||
|
|
||||||
residency_accuracy(res.rc6, "rc6");
|
residency_accuracy(res.rc6, "rc6");
|
||||||
igt_subtest("media-rc6-accuracy")
|
}
|
||||||
if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
|
igt_subtest("media-rc6-accuracy") {
|
||||||
residency_accuracy(res.media_rc6, "media_rc6");
|
igt_skip_on(!((rc6_mask & RC6_ENABLED) &&
|
||||||
|
(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))));
|
||||||
|
|
||||||
|
residency_accuracy(res.media_rc6, "media_rc6");
|
||||||
|
}
|
||||||
igt_subtest("rc6p-accuracy") {
|
igt_subtest("rc6p-accuracy") {
|
||||||
if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid))
|
igt_skip_on(!(rc6_mask & RC6P_ENABLED));
|
||||||
igt_skip("This platform doesn't support RC6p\n");
|
|
||||||
residency_accuracy(res.rc6p, "rc6p");
|
residency_accuracy(res.rc6p, "rc6p");
|
||||||
}
|
}
|
||||||
igt_subtest("rc6pp-accuracy") {
|
igt_subtest("rc6pp-accuracy") {
|
||||||
if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid))
|
igt_skip_on(!(rc6_mask & RC6PP_ENABLED));
|
||||||
igt_skip("This platform doesn't support RC6pp\n");
|
|
||||||
residency_accuracy(res.rc6pp, "rc6pp");
|
residency_accuracy(res.rc6pp, "rc6pp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user