[Intel-gfx] [I-G-T 2/3] igt/gem_mocs_settings: adding RC6 tests

Chris Wilson chris at chris-wilson.co.uk
Mon Aug 1 10:11:55 UTC 2016


On Mon, Aug 01, 2016 at 11:03:48AM +0100, Peter Antoine wrote:
> On Mon, 1 Aug 2016, Chris Wilson wrote:
> 
> >On Fri, Jul 29, 2016 at 10:34:35AM +0100, Peter Antoine wrote:
> >>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);
> >
> >This is duplicating code from igt_sysfs.c
> 
> PS: Not in the current tree. The code is based on code from
> pm_rc6_residency.

Your tree is a couple of months out of date.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list