diff mbox

[01/12] tests/pm_psr: Update pm_psr for new psr debug interface.

Message ID 1409794206-2126-1-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Sept. 4, 2014, 1:29 a.m. UTC
v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/pm_psr.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

Comments

Daniel Vetter Sept. 4, 2014, 8:47 a.m. UTC | #1
On Wed, Sep 03, 2014 at 09:29:55PM -0400, Rodrigo Vivi wrote:
> v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

I'm not sure whether we should still keep this one here around given that
we have the full-blown crc based testcase, which also checks residency.
But your call.
-Daniel

> ---
>  tests/pm_psr.c | 30 +++++++++++++++++++++---------
>  1 file changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/pm_psr.c b/tests/pm_psr.c
> index 3ab7e7a..16ec3fa 100644
> --- a/tests/pm_psr.c
> +++ b/tests/pm_psr.c
> @@ -32,6 +32,8 @@
>  #include <errno.h>
>  
>  #include "drmtest.h"
> +#include "intel_chipset.h"
> +#include "igt_debugfs.h"
>  
>  #define SLEEP_DURATION 5000 // in milliseconds
>  
> @@ -41,22 +43,34 @@ static int get_perf(const char *path)
>  	FILE *file;
>  	char str[4];
>  
> -	file = fopen(path, "r");
> -	igt_assert(file);
> +	file = igt_debugfs_fopen("i915_edp_psr_status", "r");
> +	igt_require(file);
>  
>  	ret = fscanf(file, "Sink_Support: %s\n", str);
>  	igt_skip_on_f(ret == 0,
>  		      "i915_edp_psr_status format not supported by this test case\n");
> -	igt_require(strcmp(str, "yes") == 0);
> +	igt_skip_on_f(strcmp(str, "yes") != 0,
> +		      "PSR not supported on this platform\n");
> +
>  	ret = fscanf(file, "Source_OK: %s\n", str);
>  	igt_assert(ret != 0);
> -
>  	igt_require(strcmp(str, "yes") == 0);
>  
>  	ret = fscanf(file, "Enabled: %s\n", str);
>  	igt_assert(ret != 0);
>  	igt_assert(strcmp(str, "yes") == 0);
>  
> +	ret = fscanf(file, "Active: %s\n", str);
> +	igt_skip_on_f(ret == 0,
> +		      "i915_edp_psr_status format not supported by this test case\n");
> +
> +	ret = fscanf(file, "Busy frontbuffer bits: %s\n", str);
> +	igt_assert(ret != 0);
> +	ret = fscanf(file, "Re-enable work scheduled: %s\n", str);
> +	igt_assert(ret != 0);
> +	ret = fscanf(file, "HW Enabled & Active bit: %s\n", str);
> +	igt_assert(ret != 0);
> +
>  	ret = fscanf(file, "Performance_Counter: %i", &perf);
>  	igt_assert(ret != 0);
>  
> @@ -68,15 +82,13 @@ static int get_perf(const char *path)
>  
>  igt_simple_main
>  {
> -	int ret, perf1, perf2;
> -	int device = drm_get_card();
> +	int perf1, perf2;
> +	int drm_fd = drm_open_any();
> +	uint32_t devid = intel_get_drm_devid(drm_fd);
>  	char *path;
>  
>  	igt_skip_on_simulation();
>  
> -	ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_edp_psr_status", device);
> -	igt_assert(ret != -1);
> -
>  	perf1 = get_perf(path);
>  	sleep(SLEEP_DURATION / 1000);
>  	perf2 = get_perf(path);
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi Sept. 4, 2014, 8:03 p.m. UTC | #2
On Thu, Sep 4, 2014 at 1:47 AM, Daniel Vetter <daniel@ffwll.ch> wrote:

> On Wed, Sep 03, 2014 at 09:29:55PM -0400, Rodrigo Vivi wrote:
> > v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output.
> >
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> I'm not sure whether we should still keep this one here around given that
> we have the full-blown crc based testcase, which also checks residency.
> But your call.
>

Agree. I'm going to kill this test.



> -Daniel
>
> > ---
> >  tests/pm_psr.c | 30 +++++++++++++++++++++---------
> >  1 file changed, 21 insertions(+), 9 deletions(-)
> >
> > diff --git a/tests/pm_psr.c b/tests/pm_psr.c
> > index 3ab7e7a..16ec3fa 100644
> > --- a/tests/pm_psr.c
> > +++ b/tests/pm_psr.c
> > @@ -32,6 +32,8 @@
> >  #include <errno.h>
> >
> >  #include "drmtest.h"
> > +#include "intel_chipset.h"
> > +#include "igt_debugfs.h"
> >
> >  #define SLEEP_DURATION 5000 // in milliseconds
> >
> > @@ -41,22 +43,34 @@ static int get_perf(const char *path)
> >       FILE *file;
> >       char str[4];
> >
> > -     file = fopen(path, "r");
> > -     igt_assert(file);
> > +     file = igt_debugfs_fopen("i915_edp_psr_status", "r");
> > +     igt_require(file);
> >
> >       ret = fscanf(file, "Sink_Support: %s\n", str);
> >       igt_skip_on_f(ret == 0,
> >                     "i915_edp_psr_status format not supported by this
> test case\n");
> > -     igt_require(strcmp(str, "yes") == 0);
> > +     igt_skip_on_f(strcmp(str, "yes") != 0,
> > +                   "PSR not supported on this platform\n");
> > +
> >       ret = fscanf(file, "Source_OK: %s\n", str);
> >       igt_assert(ret != 0);
> > -
> >       igt_require(strcmp(str, "yes") == 0);
> >
> >       ret = fscanf(file, "Enabled: %s\n", str);
> >       igt_assert(ret != 0);
> >       igt_assert(strcmp(str, "yes") == 0);
> >
> > +     ret = fscanf(file, "Active: %s\n", str);
> > +     igt_skip_on_f(ret == 0,
> > +                   "i915_edp_psr_status format not supported by this
> test case\n");
> > +
> > +     ret = fscanf(file, "Busy frontbuffer bits: %s\n", str);
> > +     igt_assert(ret != 0);
> > +     ret = fscanf(file, "Re-enable work scheduled: %s\n", str);
> > +     igt_assert(ret != 0);
> > +     ret = fscanf(file, "HW Enabled & Active bit: %s\n", str);
> > +     igt_assert(ret != 0);
> > +
> >       ret = fscanf(file, "Performance_Counter: %i", &perf);
> >       igt_assert(ret != 0);
> >
> > @@ -68,15 +82,13 @@ static int get_perf(const char *path)
> >
> >  igt_simple_main
> >  {
> > -     int ret, perf1, perf2;
> > -     int device = drm_get_card();
> > +     int perf1, perf2;
> > +     int drm_fd = drm_open_any();
> > +     uint32_t devid = intel_get_drm_devid(drm_fd);
> >       char *path;
> >
> >       igt_skip_on_simulation();
> >
> > -     ret = asprintf(&path,
> "/sys/kernel/debug/dri/%d/i915_edp_psr_status", device);
> > -     igt_assert(ret != -1);
> > -
> >       perf1 = get_perf(path);
> >       sleep(SLEEP_DURATION / 1000);
> >       perf2 = get_perf(path);
> > --
> > 1.9.3
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
diff mbox

Patch

diff --git a/tests/pm_psr.c b/tests/pm_psr.c
index 3ab7e7a..16ec3fa 100644
--- a/tests/pm_psr.c
+++ b/tests/pm_psr.c
@@ -32,6 +32,8 @@ 
 #include <errno.h>
 
 #include "drmtest.h"
+#include "intel_chipset.h"
+#include "igt_debugfs.h"
 
 #define SLEEP_DURATION 5000 // in milliseconds
 
@@ -41,22 +43,34 @@  static int get_perf(const char *path)
 	FILE *file;
 	char str[4];
 
-	file = fopen(path, "r");
-	igt_assert(file);
+	file = igt_debugfs_fopen("i915_edp_psr_status", "r");
+	igt_require(file);
 
 	ret = fscanf(file, "Sink_Support: %s\n", str);
 	igt_skip_on_f(ret == 0,
 		      "i915_edp_psr_status format not supported by this test case\n");
-	igt_require(strcmp(str, "yes") == 0);
+	igt_skip_on_f(strcmp(str, "yes") != 0,
+		      "PSR not supported on this platform\n");
+
 	ret = fscanf(file, "Source_OK: %s\n", str);
 	igt_assert(ret != 0);
-
 	igt_require(strcmp(str, "yes") == 0);
 
 	ret = fscanf(file, "Enabled: %s\n", str);
 	igt_assert(ret != 0);
 	igt_assert(strcmp(str, "yes") == 0);
 
+	ret = fscanf(file, "Active: %s\n", str);
+	igt_skip_on_f(ret == 0,
+		      "i915_edp_psr_status format not supported by this test case\n");
+
+	ret = fscanf(file, "Busy frontbuffer bits: %s\n", str);
+	igt_assert(ret != 0);
+	ret = fscanf(file, "Re-enable work scheduled: %s\n", str);
+	igt_assert(ret != 0);
+	ret = fscanf(file, "HW Enabled & Active bit: %s\n", str);
+	igt_assert(ret != 0);
+
 	ret = fscanf(file, "Performance_Counter: %i", &perf);
 	igt_assert(ret != 0);
 
@@ -68,15 +82,13 @@  static int get_perf(const char *path)
 
 igt_simple_main
 {
-	int ret, perf1, perf2;
-	int device = drm_get_card();
+	int perf1, perf2;
+	int drm_fd = drm_open_any();
+	uint32_t devid = intel_get_drm_devid(drm_fd);
 	char *path;
 
 	igt_skip_on_simulation();
 
-	ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_edp_psr_status", device);
-	igt_assert(ret != -1);
-
 	perf1 = get_perf(path);
 	sleep(SLEEP_DURATION / 1000);
 	perf2 = get_perf(path);