tests/pm_psr: Update pm_psr for new psr debug interface.
PATCH 1/2 tests/pm_psr: Update pm_psr for new psr debug interface.
Signed-off-by Rodrigo Vivi <[email protected]>
--- tests/pm_psr.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
tests/pm_psr.c +20 -7
@@ -32,6 +32,10 @@#include <errno.h> #include "drmtest.h" +#include "intel_chipset.h" +#include "igt_debugfs.h" + +#define HAS_PSR (dev) (IS_HASWELL(dev) | IS_BROADWELL(dev))#define SLEEP_DURATION 5000 // in milliseconds
@@ -41,22 +45,31 @@ 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 ); + 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_assert (ret !=0 ); + 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,14 +81,14 @@ 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 ); +igt_skip_on (!HAS_PSR (devid)); perf1 =get_perf (path);sleep (SLEEP_DURATION /1000 );
Signature · 1 line
1.9.3
PATCH 2/2 tests/kms_psr_sink_crc: Fix edp_psr debugfs interface run only on HAS_PSR.
Tests were broken on platforms that doesn't have psr or on new kernel that contains new interface. A lot more need to be done to get these tests really useful, but for now lets avoid it breaking tests framework.
Signed-off-by Rodrigo Vivi <[email protected]>
--- tests/kms_psr_sink_crc.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
tests/kms_psr_sink_crc.c +21 -10
@@ -37,6 +37,8 @@#include "igt_debugfs.h" #include "igt_kms.h" +#define HAS_PSR (dev) (IS_HASWELL(dev) | IS_BROADWELL(dev)) +enum tests {TEST_PAGE_FLIP ,TEST_MMAP_CPU ,
@@ -259,7 +261,7 @@ static void fill_render(data_t *data, uint32_t handle,gem_bo_busy (data->drm_fd, handle); } -static bool psr_sink_support (data_t *data) +static bool psr_enabled (data_t *data) {int ret;FILE *file;
@@ -269,14 +271,17 @@ static bool psr_sink_support(data_t *data)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_assert (ret !=0 ); + ret =fscanf (file,"Source_OK: %s\n" , str); +igt_assert (ret !=0 ); + ret =fscanf (file,"Enabled: %s\n" , str); +igt_assert (ret !=0 );fclose (file);return strcmp (str,"yes" ) ==0 ; } -static bool psr_enabled (data_t *data) +static bool psr_active (data_t *data) {int ret;FILE *file;
@@ -287,12 +292,18 @@ static bool psr_enabled(data_t *data) ret =fscanf (file,"Sink_Support: %s\n" , str);igt_assert (ret !=0 ); - ret =fscanf (file,"Source_OK: %s\n" , str);igt_assert (ret !=0 ); - ret =fscanf (file,"Enabled: %s\n" , str);igt_assert (ret !=0 ); + ret =fscanf (file,"Active: %s\n" , str); +igt_assert (ret !=0 ); + 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 );fclose (file);return strcmp (str,"yes" ) ==0 ;
@@ -301,7 +312,7 @@ static bool psr_enabled(data_t *data)static bool wait_psr_entry (data_t *data,int timeout) {while (timeout--) { -if (psr_enabled (data)) +if (psr_active (data))return true;sleep (1 ); }
@@ -513,8 +524,6 @@ static void test_sprite(data_t *data)igt_output_t *output;drmModeModeInfo *mode; -igt_skip_on (IS_HASWELL (data->devid)); -for_each_connected_output (display, output) {drmModeConnectorPtr c = output->config.connector;
@@ -593,7 +602,9 @@ igt_main data.devid =intel_get_drm_devid (data.drm_fd); -igt_require (psr_sink_support (&data)); +igt_skip_on (!HAS_PSR (data.devid)); + +igt_skip_on (!psr_enabled (&data)); data.bufmgr =drm_intel_bufmgr_gem_init (data.drm_fd,4096 );igt_assert (data.bufmgr);
Signature · 1 line
1.9.3
Quoted 10 lines · Rodrigo Vivi
Signed-off-by Rodrigo Vivi <[email protected]>--- tests/pm_psr.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)tests/pm_psr.c +0
-0
tests/pm_psr.c line 38
Quoted 7 lines
tests/pm_psr.c +4
-0@@ -32,6 +32,10 @@#include <errno.h> #include "drmtest.h" +#include "intel_chipset.h" +#include "igt_debugfs.h" + +#define HAS_PSR (dev) (IS_HASWELL(dev) | IS_BROADWELL(dev))
I don't like duplicating the HAS_PSR macros in the igt testcases. Instead they should check whether the debugfs file is there and whether PSR is there and skip accordingly.
-Daniel
Quoted 64 lines
tests/pm_psr.c +16
-7#define SLEEP_DURATION 5000 // in milliseconds@@ -41,22 +45,31 @@ 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 ); + 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_assert (ret !=0 ); + 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,14 +81,14 @@ 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 ); +igt_skip_on (!HAS_PSR (devid)); perf1 =get_perf (path);sleep (SLEEP_DURATION /1000 );Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch