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

2016-07-29 Thread Peter Antoine
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 
---
 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

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2016-08-01 Thread Chris Wilson
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 
> ---
>  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

> +
> + 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);

Still a large and arbitrary delay.

> + igt_assert_neq(res_ms, read_rc6_residency());

Still an assert rather than skipping when the user has disabled rc6.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2016-08-01 Thread Peter Antoine

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 
---
 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

Ok. Will fix.



+
+   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);

Distracted. Will fix.


Still a large and arbitrary delay.


+   igt_assert_neq(res_ms, read_rc6_residency());

Will change.


Still an assert rather than skipping when the user has disabled rc6.
-Chris




--
   Peter Antoine (Android Graphics Driver Software Engineer)
   -
   Intel Corporation (UK) Limited
   Registered No. 1134945 (England)
   Registered Office: Pipers Way, Swindon SN3 1RJ
   VAT No: 860 2173 47
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2016-08-01 Thread Peter Antoine

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 
---
 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.





+
+   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);


Still a large and arbitrary delay.


+   igt_assert_neq(res_ms, read_rc6_residency());


Still an assert rather than skipping when the user has disabled rc6.
-Chris




--
   Peter Antoine (Android Graphics Driver Software Engineer)
   -
   Intel Corporation (UK) Limited
   Registered No. 1134945 (England)
   Registered Office: Pipers Way, Swindon SN3 1RJ
   VAT No: 860 2173 47
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2016-08-01 Thread Chris Wilson
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 
> >>---
> >> 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2016-08-01 Thread Peter Antoine

On Mon, 1 Aug 2016, Chris Wilson wrote:


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 
---
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


Am I pulling from the wrong repo?

git clone git://anongit.freedesktop.org/xorg/app/intel-gpu-tools re_pull
Cloning into 're_pull'...
remote: Counting objects: 25319, done.
remote: Compressing objects: 100% (5802/5802), done.
remote: Total 25319 (delta 19840), reused 24789 (delta 19458)
Receiving objects: 100% (25319/25319), 16.67 MiB | 1.35 MiB/s, done.
Resolving deltas: 100% (19840/19840), done.
Checking connectivity... done.

Top 10 commits:
53b4dfd tests: Skip if we cannot reserve infinite fd for ourselves
5c10362 igt/gem_busy: Don't run hang tests under the hangchecker
b2e8d2c igt/gem_concurrent_blit: More subtest grouping
d199ad8 igt/gem_concurrent_all: Fix up copy sizes
9315399 docs: minimal docs for igt_vgem.c

I get 62 references to the following search:
:vimgrep _residen ./**/*.c

All in:
overlay/rc6.c
tests/pm_rc6_residency.c
tests/pm_rpm.c
tools/intel_reg_decode.c
tools/intel_residency.c

Only the first 3 yielding code. What am I missing?

Peter.






--
   Peter Antoine (Android Graphics Driver Software Engineer)
   -
   Intel Corporation (UK) Limited
   Registered No. 1134945 (England)
   Registered Office: Pipers Way, Swindon SN3 1RJ
   VAT No: 860 2173 47
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx