tests/pm_psr: Update pm_psr for new psr debug interface.
PATCH 1/12 tests/pm_psr: Update pm_psr for new psr debug interface.
v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output.
--- tests/pm_psr.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
tests/pm_psr.c +21 -9
@@ -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);
Signature · 1 line
1.9.3
PATCH 2/12 tests/kms_sink_crc_basic: Use igt_debugfs_fopen
--- tests/kms_sink_crc_basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_sink_crc_basic.c +1 -1
@@ -52,7 +52,7 @@ typedef struct {static void get_crc (char *crc) {int ret; -FILE *file =fopen ("/sys/kernel/debug/dri/0/i915_sink_crc_eDP1" ,"r" ); +FILE *file =igt_debugfs_fopen ("i915_sink_crc_eDP1" ,"r" );igt_require (file); ret =fscanf (file,"%s\n" , crc);
Signature · 1 line
1.9.3
PATCH 3/12 tests/kms_sink_crc_basic: Simplify test by using igt_kms functions
In reply to Rodrigo Vivi--- tests/kms_sink_crc_basic.c | 150 +++++++++++++++------------------------------ 1 file changed, 48 insertions(+), 102 deletions(-)
tests/kms_sink_crc_basic.c +48 -102
@@ -34,20 +34,15 @@#include "igt_debugfs.h" #include "igt_kms.h" -enum color { -WHITE , -BLACK , -NUM_COLORS , -}; - -typedef struct { -struct kmstest_connector_config config; -struct igt_fb fb; -}connector_t ; +#define CRC_BLACK "000000000000" +#define CRC_RED "c10100000000" +#define CRC_GREEN "0000c1010000"typedef struct {int drm_fd; -drmModeRes *resources; +igt_display_t display; +struct igt_fb fb_green, fb_red; +igt_plane_t *primary; }data_t ;static void get_crc (char *crc) {
@@ -59,111 +54,64 @@ static void get_crc(char *crc) {igt_require (ret >0 );fclose (file); -} - -static uint32_t create_fb (data_t *data, -int w,int h, -double r,double g,double b, -struct igt_fb *fb) -{ -cairo_t *cr; -uint32_t fb_id; - - fb_id =igt_create_fb (data->drm_fd, w, h, -DRM_FORMAT_XRGB8888 ,I915_TILING_NONE , fb); -igt_assert (fb_id); - - cr =igt_get_cairo_ctx (data->drm_fd, fb); -igt_paint_color (cr,0 ,0 , w, h, r, g, b); -igt_assert (cairo_status (cr) ==0 ); -return fb_id; +/* Black screen is always invalid */ +igt_assert (strcmp (crc,CRC_BLACK ) !=0 ); } -static bool -connector_set_mode (data_t *data,connector_t *connector,drmModeModeInfo *mode, -enum color crtc_color) +static void basic_sink_crc_check (data_t *data) { -struct kmstest_connector_config *config = &connector->config; -unsigned int fb_id; -int ret; - -if (crtc_color ==WHITE ) - fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, -1.0 ,1.0 ,1.0 , &connector->fb); -else - fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, -0.0 ,0.0 ,0.0 , &connector->fb); -igt_assert (fb_id); - - ret =drmModeSetCrtc (data->drm_fd, - config->crtc->crtc_id, - connector->fb.fb_id, -0 ,0 ,/* x, y */ - &config->connector->connector_id, -1 , - mode); -igt_assert (ret ==0 ); - -return 0 ; -} - -static void basic_sink_crc_check (data_t *data,uint32_t connector_id) -{ -connector_t connector; -char ref_crc_white[12 ]; -char ref_crc_black[12 ]; -char crc_check[12 ]; - -igt_require (kmstest_get_connector_config (data->drm_fd, - connector_id, -1 <<0 , - &connector.config)); +char crc[12 ]; -/*Go White*/ -connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); +/* Go Green */ +igt_plane_set_fb (data->primary, &data->fb_green); +igt_display_commit (&data->display); -/* get reference crc for white color */ -get_crc (ref_crc_white); +/* It should be Green */ +get_crc (crc); +igt_assert (strcmp (crc,CRC_GREEN ) ==0 ); -/* Go Black */ -connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); +/* Go Red */ +igt_plane_set_fb (data->primary, &data->fb_red); +igt_display_commit (&data->display); -/* get reference crc for black color */ -get_crc (ref_crc_black); - -igt_assert (strcmp (ref_crc_black, ref_crc_white) !=0 ); - -/*Go White again*/ -connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); - -get_crc (crc_check); -igt_assert (strcmp (crc_check, ref_crc_white) ==0 ); - -/* Go Black again */ -connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); - -get_crc (crc_check); -igt_assert (strcmp (crc_check, ref_crc_black) ==0 ); - -kmstest_free_connector_config (&connector.config); +/* It should be Red */ +get_crc (crc); +igt_assert (strcmp (crc,CRC_RED ) ==0 ); }static void run_test (data_t *data) { -int i; -drmModeConnectorPtr c; -uint32_t connector_id =0 ; +igt_display_t *display = &data->display; +igt_output_t *output; +drmModeModeInfo *mode; -for (i =0 ; i < data->resources->count_connectors; i++) { - connector_id = data->resources->connectors[i]; - c =drmModeGetConnector (data->drm_fd, connector_id); +for_each_connected_output (display, output) { +drmModeConnectorPtr c = output->config.connector;if (c->connector_type != DRM_MODE_CONNECTOR_eDP || c->connection !=DRM_MODE_CONNECTED )continue ; -basic_sink_crc_check (data, connector_id); +igt_output_set_pipe (output,PIPE_ANY ); + + mode =igt_output_get_mode (output); + +igt_create_color_fb (data->drm_fd, + mode->hdisplay, mode->vdisplay, +DRM_FORMAT_XRGB8888 ,I915_TILING_X , +0.0 ,1.0 ,0.0 , + &data->fb_green); + +igt_create_color_fb (data->drm_fd, + mode->hdisplay, mode->vdisplay, +DRM_FORMAT_XRGB8888 ,I915_TILING_X , +1.0 ,0.0 ,0.0 , + &data->fb_red); + + data->primary =igt_output_get_plane (output,IGT_PLANE_PRIMARY ); + +basic_sink_crc_check (data);return ; }
@@ -179,11 +127,9 @@ igt_simple_main data.drm_fd =drm_open_any ();kmstest_set_vt_graphics_mode (); - - data.resources =drmModeGetResources (data.drm_fd); -igt_assert (data.resources); +igt_display_init (&data.display, data.drm_fd);run_test (&data); -drmModeFreeResources (data.resources); +igt_display_fini (&data.display); }
Signature · 1 line
1.9.3
PATCH 1/1 tests/kms_sink_crc_basic: Simplify test by using igt_kms functions
v2: sink CRC R, G and B might change depending on display. So let's split the colors and bitwise them.
--- tests/kms_sink_crc_basic.c | 175 +++++++++++++++++++++------------------------ 1 file changed, 82 insertions(+), 93 deletions(-)
tests/kms_sink_crc_basic.c +82 -93
@@ -34,20 +34,18 @@#include "igt_debugfs.h" #include "igt_kms.h" +#define CRC_BLACK "000000000000" +enum color { -WHITE , -BLACK , -NUM_COLORS , +RED , +GREEN , };typedef struct { -struct kmstest_connector_config config; -struct igt_fb fb; -}connector_t ; - -typedef struct {int drm_fd; -drmModeRes *resources; +igt_display_t display; +struct igt_fb fb_green, fb_red; +igt_plane_t *primary; }data_t ;static void get_crc (char *crc) {
@@ -59,111 +57,104 @@ static void get_crc(char *crc) {igt_require (ret >0 );fclose (file); -} - -static uint32_t create_fb (data_t *data, -int w,int h, -double r,double g,double b, -struct igt_fb *fb) -{ -cairo_t *cr; -uint32_t fb_id; - - fb_id =igt_create_fb (data->drm_fd, w, h, -DRM_FORMAT_XRGB8888 ,I915_TILING_NONE , fb); -igt_assert (fb_id); - cr =igt_get_cairo_ctx (data->drm_fd, fb); -igt_paint_color (cr,0 ,0 , w, h, r, g, b); -igt_assert (cairo_status (cr) ==0 ); - -return fb_id; +/* Black screen is always invalid */ +igt_assert (strcmp (crc,CRC_BLACK ) !=0 ); } -static bool -connector_set_mode (data_t *data,connector_t *connector,drmModeModeInfo *mode, -enum color crtc_color) +static void assert_color (char *crc,enum color color) { -struct kmstest_connector_config *config = &connector->config; -unsigned int fb_id; +char color_mask[5 ] ="FFFF\0" ; +char rs[5 ], gs[5 ], bs[5 ]; +unsigned int rh, gh, bh, mask;int ret; -if (crtc_color ==WHITE ) - fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, -1.0 ,1.0 ,1.0 , &connector->fb); -else - fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, -0.0 ,0.0 ,0.0 , &connector->fb); -igt_assert (fb_id); - - ret =drmModeSetCrtc (data->drm_fd, - config->crtc->crtc_id, - connector->fb.fb_id, -0 ,0 ,/* x, y */ - &config->connector->connector_id, -1 , - mode); -igt_assert (ret ==0 ); - -return 0 ; -} - -static void basic_sink_crc_check (data_t *data,uint32_t connector_id) -{ -connector_t connector; -char ref_crc_white[12 ]; -char ref_crc_black[12 ]; -char crc_check[12 ]; - -igt_require (kmstest_get_connector_config (data->drm_fd, - connector_id, -1 <<0 , - &connector.config)); - -/*Go White*/ -connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); +sscanf (color_mask,"%4x" , &mask); -/* get reference crc for white color */ -get_crc (ref_crc_white); +memcpy (rs, &crc[0 ],4 ); + rs[4 ] ='\0' ; + ret =sscanf (rs,"%4x" , &rh); +igt_require (ret >0 ); -/* Go Black */ -connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); +memcpy (gs, &crc[4 ],4 ); + gs[4 ] ='\0' ; + ret =sscanf (gs,"%4x" , &gh); +igt_require (ret >0 ); -/* get reference crc for black color */ -get_crc (ref_crc_black); +memcpy (bs, &crc[8 ],4 ); + bs[4 ] ='\0' ; + ret =sscanf (bs,"%4x" , &bh); +igt_require (ret >0 ); -igt_assert (strcmp (ref_crc_black, ref_crc_white) !=0 ); +switch (color) { +case RED : +igt_assert ((rh & mask) !=0 && + (gh & mask) ==0 && + (bh & mask) ==0 ); +break ; +case GREEN : +igt_assert ((rh & mask) ==0 && + (gh & mask) !=0 && + (bh & mask) ==0 ); +break ; +default : +igt_fail (-1 ); + } +} -/*Go White again*/ -connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); +static void basic_sink_crc_check (data_t *data) +{ +char crc[13 ]; -get_crc (crc_check); -igt_assert (strcmp (crc_check, ref_crc_white) ==0 ); +/* Go Green */ +igt_plane_set_fb (data->primary, &data->fb_green); +igt_display_commit (&data->display); -/* Go Black again */ -connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); +/* It should be Green */ +get_crc (crc); +assert_color (crc,GREEN ); -get_crc (crc_check); -igt_assert (strcmp (crc_check, ref_crc_black) ==0 ); +/* Go Red */ +igt_plane_set_fb (data->primary, &data->fb_red); +igt_display_commit (&data->display); -kmstest_free_connector_config (&connector.config); +/* It should be Red */ +get_crc (crc); +assert_color (crc,RED ); }static void run_test (data_t *data) { -int i; -drmModeConnectorPtr c; -uint32_t connector_id =0 ; +igt_display_t *display = &data->display; +igt_output_t *output; +drmModeModeInfo *mode; -for (i =0 ; i < data->resources->count_connectors; i++) { - connector_id = data->resources->connectors[i]; - c =drmModeGetConnector (data->drm_fd, connector_id); +for_each_connected_output (display, output) { +drmModeConnectorPtr c = output->config.connector;if (c->connector_type != DRM_MODE_CONNECTOR_eDP || c->connection !=DRM_MODE_CONNECTED )continue ; -basic_sink_crc_check (data, connector_id); +igt_output_set_pipe (output,PIPE_ANY ); + + mode =igt_output_get_mode (output); + +igt_create_color_fb (data->drm_fd, + mode->hdisplay, mode->vdisplay, +DRM_FORMAT_XRGB8888 ,I915_TILING_X , +0.0 ,1.0 ,0.0 , + &data->fb_green); + +igt_create_color_fb (data->drm_fd, + mode->hdisplay, mode->vdisplay, +DRM_FORMAT_XRGB8888 ,I915_TILING_X , +1.0 ,0.0 ,0.0 , + &data->fb_red); + + data->primary =igt_output_get_plane (output,IGT_PLANE_PRIMARY ); + +basic_sink_crc_check (data);return ; }
@@ -179,11 +170,9 @@ igt_simple_main data.drm_fd =drm_open_any ();kmstest_set_vt_graphics_mode (); - - data.resources =drmModeGetResources (data.drm_fd); -igt_assert (data.resources); +igt_display_init (&data.display, data.drm_fd);run_test (&data); -drmModeFreeResources (data.resources); +igt_display_fini (&data.display); }
Signature · 1 line
1.9.3
PATCH 1/1 tests/kms_sink_crc_basic: Wait 2 vblanks before grabing the new crc.
In reply to Rodrigo Vivi--- tests/kms_sink_crc_basic.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
tests/kms_sink_crc_basic.c +10 -5
@@ -48,9 +48,14 @@ typedef struct {igt_plane_t *primary; } data_t; -static void get_crc (char *crc) { +static void get_crc (data_t *data,char *crc) {int ret; -FILE *file =igt_debugfs_fopen ("i915_sink_crc_eDP1" ,"r" ); +FILE *file; + +igt_wait_for_vblank (data->drm_fd,0 ); +igt_wait_for_vblank (data->drm_fd,0 ); + + file =igt_debugfs_fopen ("i915_sink_crc_eDP1" ,"r" );igt_require (file); ret =fscanf (file,"%s\n" , crc);
@@ -111,7 +116,7 @@ static void basic_sink_crc_check(data_t *data)igt_display_commit (&data->display);/* It should be Green */ -get_crc (crc); +get_crc (data, crc);assert_color (crc,GREEN );/* Go Red */
@@ -119,7 +124,7 @@ static void basic_sink_crc_check(data_t *data)igt_display_commit (&data->display);/* It should be Red */ -get_crc (crc); +get_crc (data, crc);assert_color (crc,RED ); }
@@ -136,7 +141,7 @@ static void run_test(data_t *data) c->connection != DRM_MODE_CONNECTED)continue ; -igt_output_set_pipe (output,PIPE_ANY ); +igt_output_set_pipe (output,0 ); mode =igt_output_get_mode (output);
Signature · 1 line
1.9.3
PATCH 4/12 tests/kms_psr_sink_crc: Fix edp_psr debugfs interface
In reply to Rodrigo ViviTests 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.
v2: Doesn't duplicate kernel's HAS_PSR. skip based on debugfs output.
--- tests/kms_psr_sink_crc.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
tests/kms_psr_sink_crc.c +17 -10
@@ -258,7 +258,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;
@@ -268,14 +268,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;
@@ -286,12 +289,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 ;
@@ -300,7 +309,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 ); }
@@ -512,8 +521,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;
@@ -592,7 +599,7 @@ igt_main data.devid =intel_get_drm_devid (data.drm_fd); -igt_require (psr_sink_support (&data)); +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
PATCH 5/12 tests/kms_psr_sink_crc: Adding test debug options
In reply to Rodrigo ViviJust to make life easier and be eable to easily test with PSR disabled to know exactly what to expect when running it for real
--- tests/kms_psr_sink_crc.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
tests/kms_psr_sink_crc.c +21 -1
@@ -57,6 +57,11 @@ enum tests { TEST_SPRITE, }; +#define DEBUG_CRC 0 + +/* This is usefull to debug and know what should be expected */ +#define RUNNING_WITH_PSR_DISABLED 0 + typedef struct { int drm_fd; enum tests test;
@@ -264,6 +269,9 @@ static bool psr_enabled(data_t *data)FILE *file;char str[4 ]; +if (RUNNING_WITH_PSR_DISABLED ) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -284,6 +292,9 @@ static bool psr_active(data_t *data)FILE *file;char str[4 ]; +if (RUNNING_WITH_PSR_DISABLED ) +return true; + file =igt_debugfs_fopen ("i915_edp_psr_status" ,"r" );igt_require (file);
@@ -327,6 +338,16 @@ static void get_sink_crc(data_t *data, char *crc) {igt_require (ret >0 );fclose (file); + +if (DEBUG_CRC ) { +fprintf (stderr,"%s\n" , crc); +sleep (1 ); + } + +/* The important value was already taken. +* Now give a time for human eyes +*/ +usleep (300000 ); }static void test_crc (data_t *data)
@@ -342,7 +363,6 @@ static void test_crc(data_t *data) 1, 1) == 0); } -usleep (300000 );igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);
Signature · 1 line
1.9.3
PATCH 6/12 tests/kms_psr_sink_crc: Removing context tests.
In reply to Rodrigo ViviThis tests are unecessary. Mainly now with the software tracking for PSR.
--- tests/kms_psr_sink_crc.c | 69 +++--------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-)
tests/kms_psr_sink_crc.c +3 -66
@@ -47,12 +47,10 @@ enum tests {TEST_SETDOMAIN_WAIT_WRITE_CPU ,TEST_BLT ,TEST_RENDER , -TEST_CONTEXT ,TEST_PAGE_FLIP_AND_MMAP_CPU ,TEST_PAGE_FLIP_AND_MMAP_GTT ,TEST_PAGE_FLIP_AND_BLT ,TEST_PAGE_FLIP_AND_RENDER , -TEST_PAGE_FLIP_AND_CONTEXT ,TEST_CURSOR_MOVE , TEST_SPRITE, };
@@ -67,7 +65,6 @@ typedef struct {enum tests test;drmModeRes *resources;drm_intel_bufmgr *bufmgr; -drm_intel_context *ctx[2 ];uint32_t devid;uint32_t handle[2 ];uint32_t crtc_id;
@@ -91,12 +88,10 @@ static const char *tests_str(enum tests test) [TEST_SETDOMAIN_WAIT_WRITE_CPU] = "setdomain_wait_write_cpu", [TEST_BLT] = "blt", [TEST_RENDER] = "render", - [TEST_CONTEXT] = "context", [TEST_PAGE_FLIP_AND_MMAP_CPU] = "page_flip_and_mmap_cpu", [TEST_PAGE_FLIP_AND_MMAP_GTT] = "page_flip_and_mmap_gtt", [TEST_PAGE_FLIP_AND_BLT] = "page_flip_and_blt", [TEST_PAGE_FLIP_AND_RENDER] = "page_flip_and_render", - [TEST_PAGE_FLIP_AND_CONTEXT] = "page_flip_and_context", [TEST_CURSOR_MOVE] = "cursor_move", [TEST_SPRITE] = "sprite", };
@@ -206,31 +201,7 @@ static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo) buf->size =4096 ; } -static void exec_nop (data_t *data,uint32_t handle,drm_intel_context *context) -{ -drm_intel_bo *dst; -struct intel_batchbuffer *batch; - - dst =gem_handle_to_libdrm_bo (data->bufmgr, data->drm_fd,"" , handle); -igt_assert (dst); - - batch =intel_batchbuffer_alloc (data->bufmgr, data->devid); -igt_assert (batch); - -/* add the reloc to make sure the kernel will think we write to dst */ -BEGIN_BATCH (4 ,1 ); -OUT_BATCH (MI_BATCH_BUFFER_END ); -OUT_BATCH (MI_NOOP ); -OUT_RELOC (dst,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ,0 ); -OUT_BATCH (MI_NOOP ); -ADVANCE_BATCH (); - -intel_batchbuffer_flush_with_context (batch, context); -intel_batchbuffer_free (batch); -} - -static void fill_render (data_t *data,uint32_t handle, -drm_intel_context *context,unsigned char color) +static void fill_render (data_t *data,uint32_t handle,unsigned char color) {drm_intel_bo *src, *dst;struct intel_batchbuffer *batch;
@@ -254,7 +225,7 @@ static void fill_render(data_t *data, uint32_t handle, batch =intel_batchbuffer_alloc (data->bufmgr, data->devid);igt_assert (batch); -rendercopy (batch, context, +rendercopy (batch,NULL , &src_buf,0 ,0 ,1 ,1 , &dst_buf,0 ,0 );
@@ -444,13 +415,8 @@ static void test_crc(data_t *data)fill_blt (data, handle,0xff );break ;case TEST_RENDER : -case TEST_CONTEXT :case TEST_PAGE_FLIP_AND_RENDER : -case TEST_PAGE_FLIP_AND_CONTEXT : -fill_render (data, handle, - (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) ? - data->ctx[1 ] :NULL ,0xff ); +fill_render (data, handle,0xff );break ;case TEST_CURSOR_MOVE :igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id,1 ,2 ) ==0 );
@@ -499,42 +465,15 @@ static bool prepare_crtc(data_t *data, uint32_t connector_id)connector_set_mode (data, &data->config.default_mode, data->fb_id[1 ]); -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { - data->ctx[0 ] =drm_intel_gem_context_create (data->bufmgr); -igt_require (data->ctx[0 ]); - data->ctx[1 ] =drm_intel_gem_context_create (data->bufmgr); -igt_require (data->ctx[1 ]); - -exec_nop (data, data->handle[0 ], data->ctx[1 ]); -exec_nop (data, data->handle[0 ], data->ctx[0 ]); -exec_nop (data, data->handle[0 ], data->ctx[1 ]); -exec_nop (data, data->handle[0 ], data->ctx[0 ]); - } -/* scanout = fb[0] */ connector_set_mode (data, &data->config.default_mode, data->fb_id[0 ]); -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { -exec_nop (data, data->fb[0 ].gem_handle, data->ctx[0 ]); - } -kmstest_free_connector_config (&data->config);return true; } -static void finish_crtc (data_t *data) -{ -if (data->test ==TEST_CONTEXT || - data->test ==TEST_PAGE_FLIP_AND_CONTEXT ) { -drm_intel_gem_context_destroy (data->ctx[0 ]); -drm_intel_gem_context_destroy (data->ctx[1 ]); - } -} -static void test_sprite (data_t *data) {igt_display_t *display = &data->display;
@@ -600,8 +539,6 @@ static void run_test(data_t *data)continue ;test_crc (data); - -finish_crtc (data); } } }
Signature · 1 line
1.9.3
PATCH 7/12 tests/kms_psr_sink_crc: Cleaning up tests a bit
In reply to Rodrigo ViviThis is needed to be able to split tests in a matrix that tests different input/write methods and operations for different type of planes.
--- tests/kms_psr_sink_crc.c | 67 ------------------------------------------------ 1 file changed, 67 deletions(-)
tests/kms_psr_sink_crc.c +0 -67
@@ -41,16 +41,8 @@ enum tests {TEST_PAGE_FLIP ,TEST_MMAP_CPU ,TEST_MMAP_GTT , -TEST_MMAP_GTT_NO_BUSY , -TEST_MMAP_GTT_WAITING_NO_BUSY , -TEST_SETDOMAIN_WAIT_WRITE_GTT , -TEST_SETDOMAIN_WAIT_WRITE_CPU ,TEST_BLT ,TEST_RENDER , -TEST_PAGE_FLIP_AND_MMAP_CPU , -TEST_PAGE_FLIP_AND_MMAP_GTT , -TEST_PAGE_FLIP_AND_BLT , -TEST_PAGE_FLIP_AND_RENDER ,TEST_CURSOR_MOVE , TEST_SPRITE, };
@@ -82,16 +74,8 @@ static const char *tests_str(enum tests test) [TEST_PAGE_FLIP] = "page_flip", [TEST_MMAP_CPU] = "mmap_cpu", [TEST_MMAP_GTT] = "mmap_gtt", - [TEST_MMAP_GTT_NO_BUSY] = "mmap_gtt_no_busy", - [TEST_MMAP_GTT_WAITING_NO_BUSY] = "mmap_gtt_waiting_no_busy", - [TEST_SETDOMAIN_WAIT_WRITE_GTT] = "setdomain_wait_write_gtt", - [TEST_SETDOMAIN_WAIT_WRITE_CPU] = "setdomain_wait_write_cpu", [TEST_BLT] = "blt", [TEST_RENDER] = "render", - [TEST_PAGE_FLIP_AND_MMAP_CPU] = "page_flip_and_mmap_cpu", - [TEST_PAGE_FLIP_AND_MMAP_GTT] = "page_flip_and_mmap_gtt", - [TEST_PAGE_FLIP_AND_BLT] = "page_flip_and_blt", - [TEST_PAGE_FLIP_AND_RENDER] = "page_flip_and_render", [TEST_CURSOR_MOVE] = "cursor_move", [TEST_SPRITE] = "sprite", };
@@ -343,10 +327,6 @@ static void test_crc(data_t *data)igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, data->fb_id[1 ],0 ,NULL ) ==0 );break ; -case TEST_PAGE_FLIP_AND_MMAP_CPU : - handle = data->handle[1 ]; -igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 );case TEST_MMAP_CPU : ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); gem_set_domain(data->drm_fd, handle,
@@ -357,10 +337,6 @@ static void test_crc(data_t *data)sleep (1 );gem_sw_finish (data->drm_fd, handle);break ; -case TEST_PAGE_FLIP_AND_MMAP_GTT : - handle = data->handle[1 ]; -igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 );case TEST_MMAP_GTT : ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); gem_set_domain(data->drm_fd, handle,
@@ -369,53 +345,10 @@ static void test_crc(data_t *data)munmap (ptr,4096 );gem_bo_busy (data->drm_fd, handle);break ; -case TEST_MMAP_GTT_NO_BUSY : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_MMAP_GTT_WAITING_NO_BUSY : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_SETDOMAIN_WAIT_WRITE_GTT : - ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE ); -fill_blt (data, handle,0xff ); -igt_assert (wait_psr_entry (data,10 )); -get_sink_crc (data, ref_crc); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -break ; -case TEST_SETDOMAIN_WAIT_WRITE_CPU : - ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); -fill_blt (data, handle,0xff ); -igt_assert (wait_psr_entry (data,10 )); -get_sink_crc (data, ref_crc); -gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); -igt_info ("Sleeping for 10 sec...\n" ); -sleep (10 ); -memset (ptr,0xff ,4 ); -munmap (ptr,4096 ); -gem_sw_finish (data->drm_fd, handle); -break ;case TEST_BLT : -case TEST_PAGE_FLIP_AND_BLT :fill_blt (data, handle,0xff );break ;case TEST_RENDER : -case TEST_PAGE_FLIP_AND_RENDER :fill_render (data, handle,0xff );break ;case TEST_CURSOR_MOVE :
Signature · 1 line
1.9.3
PATCH 8/12 tests/kms_psr_sink_crc: Start splitting tests in test_planes and operations.
In reply to Rodrigo ViviThis will allow us to test input/write oprations on any kind of plane.
At this point PLANE_ONOF is just the new name of TEST_SPRITE and PLANE_MOVE is the one for TEST_CURSOR_MOVE. They will be extended and fixed on the following patche(s).
--- tests/kms_psr_sink_crc.c | 110 +++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 41 deletions(-)
tests/kms_psr_sink_crc.c +69 -41
@@ -37,24 +37,48 @@#include "igt_debugfs.h" #include "igt_kms.h" -enum tests { -TEST_PAGE_FLIP , -TEST_MMAP_CPU , -TEST_MMAP_GTT , -TEST_BLT , -TEST_RENDER , -TEST_CURSOR_MOVE , -TEST_SPRITE , -}; -#define DEBUG_CRC 0/* This is usefull to debug and know what should be expected */ #define RUNNING_WITH_PSR_DISABLED 0 +enum planes { +PRIMARY , +SPRITE , +CURSOR , +}; + +enum operations { +PAGE_FLIP , +MMAP_GTT , +MMAP_GTT_WAITING , +MMAP_CPU , +BLT , +RENDER , +PLANE_MOVE , +PLANE_ONOFF , +}; + +static const char *op_str (enum operations op) +{ +static const char *const name[] = { + [PAGE_FLIP ] ="page_flip" , + [MMAP_GTT ] ="mmap_gtt" , + [MMAP_GTT_WAITING ] ="mmap_gtt_waiting" , + [MMAP_CPU ] ="mmap_cpu" , + [BLT ] ="blt" , + [RENDER ] ="render" , + [PLANE_MOVE ] ="plane_move" , + [PLANE_ONOFF ] ="plane_onoff" , + }; + +return name[op]; +} + typedef struct { int drm_fd; - enum tests test; + enum planes test_plane; + enum operations op; drmModeRes *resources; drm_intel_bufmgr *bufmgr; uint32_t devid;
@@ -68,21 +92,6 @@ typedef struct {igt_plane_t *plane[2 ]; } data_t; -static const char *tests_str (enum tests test) -{ -static const char *const testss[] = { - [TEST_PAGE_FLIP ] ="page_flip" , - [TEST_MMAP_CPU ] ="mmap_cpu" , - [TEST_MMAP_GTT ] ="mmap_gtt" , - [TEST_BLT ] ="blt" , - [TEST_RENDER ] ="render" , - [TEST_CURSOR_MOVE ] ="cursor_move" , - [TEST_SPRITE ] ="sprite" , - }; - -return testss[test]; -} - static uint32_t create_fb(data_t *data, int w, int h, double r, double g, double b,
@@ -311,7 +320,7 @@ static void test_crc(data_t *data)char ref_crc[12 ];char crc[12 ]; -if (data->test ==TEST_CURSOR_MOVE ) { +if (data->op ==PLANE_MOVE ) {igt_assert (drmModeSetCursor (data->drm_fd, data->crtc_id, handle,64 ,64 ) ==0 ); igt_assert(drmModeMoveCursor(data->drm_fd, data->crtc_id,
@@ -321,13 +330,13 @@ static void test_crc(data_t *data)igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc); -switch (data->test) { +switch (data->op) {void *ptr; -case TEST_PAGE_FLIP : +case PAGE_FLIP :igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, data->fb_id[1 ],0 ,NULL ) ==0 );break ; -case TEST_MMAP_CPU : +case MMAP_CPU : ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE );gem_set_domain (data->drm_fd, handle,I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU );
@@ -337,7 +346,8 @@ static void test_crc(data_t *data)sleep (1 );gem_sw_finish (data->drm_fd, handle);break ; -case TEST_MMAP_GTT : +case MMAP_GTT : +case MMAP_GTT_WAITING : ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE );gem_set_domain (data->drm_fd, handle,I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );
@@ -345,16 +355,16 @@ static void test_crc(data_t *data)munmap (ptr,4096 );gem_bo_busy (data->drm_fd, handle);break ; -case TEST_BLT : +case BLT :fill_blt (data, handle,0xff );break ; -case TEST_RENDER : +case RENDER :fill_render (data, handle,0xff );break ; -case TEST_CURSOR_MOVE : +case PLANE_MOVE :igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id,1 ,2 ) ==0 );break ; -case TEST_SPRITE : +case PLANE_ONOFF :igt_plane_set_fb (data->plane[0 ], &data->fb[0 ]);igt_display_commit (&data->display);igt_plane_set_fb (data->plane[1 ], &data->fb[1 ]);
@@ -382,7 +392,7 @@ static bool prepare_crtc(data_t *data, uint32_t connector_id) 0.0, 1.0, 0.0, &data->fb[0]);igt_assert (data->fb_id[0 ]); -if (data->test ==TEST_CURSOR_MOVE ) +if (data->op ==PLANE_MOVE )create_cursor_fb (data, &data->fb[0 ]); data->fb_id[1] = create_fb(data,
@@ -452,7 +462,7 @@ static void run_test(data_t *data)* crtcs = IS_VALLEYVIEW(data->devid)? 2 : 1; */ int crtcs =1 ; -if (data->test ==TEST_SPRITE ) { +if (data->op ==PLANE_ONOFF ) {test_sprite (data);return ; }
@@ -477,7 +487,7 @@ static void run_test(data_t *data) }data_t data = {}; -enum tests test; +enum operations op; igt_main {
@@ -498,9 +508,27 @@ igt_maindisplay_init (&data); } -for (test =TEST_PAGE_FLIP ; test <=TEST_SPRITE ; test++) { - igt_subtest_f("%s", tests_str(test)) { - data.test = test; + +for (op =PAGE_FLIP ; op <=RENDER ; op++) { + igt_subtest_f("primary_%s", op_str(op)) { + data.test_plane =PRIMARY ; + data.op = op; +run_test (&data); + } + } + +for (op =PLANE_ONOFF ; op <=PLANE_ONOFF ; op++) { + igt_subtest_f("sprite_%s", op_str(op)) { + data.test_plane =SPRITE ; + data.op = op; +run_test (&data); + } + } + +for (op =PLANE_MOVE ; op <=PLANE_MOVE ; op++) { + igt_subtest_f("cursor_%s", op_str(op)) { + data.test_plane =CURSOR ; + data.op = op;run_test (&data); } }
Signature · 1 line
1.9.3
PATCH 9/12 tests/kms_psr_sink_crc: Fix all testcases.
In reply to Rodrigo ViviIn order to get all test cases fixed and the matrix planes-operations working it was needed to use the common new igt kms functions for all cases. Previously only sprite testcase was using it.
Fixed the fb colors in a way to make tests more clear and be impossible to see black screen during the tests.
--- tests/kms_psr_sink_crc.c | 269 ++++++++++++++++++----------------------------- 1 file changed, 101 insertions(+), 168 deletions(-)
tests/kms_psr_sink_crc.c +101 -168
@@ -27,8 +27,6 @@#include <stdio.h> #include <string.h> -#include "drm_fourcc.h" -#include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h"
@@ -79,88 +77,37 @@ typedef struct {int drm_fd;enum planes test_plane;enum operations op; -drmModeRes *resources; -drm_intel_bufmgr *bufmgr;uint32_t devid; -uint32_t handle[2 ];uint32_t crtc_id; -uint32_t crtc_idx; -uint32_t fb_id[3 ]; -struct kmstest_connector_config config;igt_display_t display; -struct igt_fb fb[2 ]; -igt_plane_t *plane[2 ]; +drm_intel_bufmgr *bufmgr; +struct igt_fb fb_green, fb_white; +igt_plane_t *primary, *sprite, *cursor; } data_t; -static uint32_t create_fb (data_t *data, -int w,int h, -double r,double g,double b, -struct igt_fb *fb) +static void create_cursor_fb (data_t *data) { -uint32_t fb_id;cairo_t *cr; +uint32_t fb_id; - fb_id =igt_create_fb (data->drm_fd, w, h, -DRM_FORMAT_XRGB8888 ,I915_TILING_X , fb); + fb_id =igt_create_fb (data->drm_fd,64 ,64 , +DRM_FORMAT_ARGB8888 ,I915_TILING_NONE , + &data->fb_white);igt_assert (fb_id); - cr =igt_get_cairo_ctx (data->drm_fd, fb); -igt_paint_color (cr,0 ,0 , w, h, r, g, b); -igt_assert (cairo_status (cr) ==0 ); -cairo_destroy (cr); - -return fb_id; -} - -static void create_cursor_fb (data_t *data,struct igt_fb *fb) -{ -cairo_t *cr; - - data->fb_id[2 ] =igt_create_fb (data->drm_fd,64 ,64 , -DRM_FORMAT_ARGB8888 ,I915_TILING_NONE , - fb); -igt_assert (data->fb_id[2 ]); - - cr =igt_get_cairo_ctx (data->drm_fd, fb); + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb_white);igt_paint_color_alpha (cr,0 ,0 ,64 ,64 ,1.0 ,1.0 ,1.0 ,1.0 );igt_assert (cairo_status (cr) ==0 ); } -static bool -connector_set_mode (data_t *data,drmModeModeInfo *mode,uint32_t fb_id) -{ -struct kmstest_connector_config *config = &data->config; -int ret; - -#if 0 -fprintf (stdout,"Using pipe %s, %dx%d\n" ,kmstest_pipe_name (config->pipe), - mode->hdisplay, mode->vdisplay); -#endif - - ret =drmModeSetCrtc (data->drm_fd, - config->crtc->crtc_id, - fb_id, -0 ,0 ,/* x, y */ - &config->connector->connector_id, -1 , - mode); -igt_assert (ret ==0 ); - -return 0 ; -} -static void display_init (data_t *data) {igt_display_init (&data->display, data->drm_fd); - data->resources =drmModeGetResources (data->drm_fd); -igt_assert (data->resources); }static void display_fini (data_t *data) {igt_display_fini (&data->display); -drmModeSetCursor (data->drm_fd, data->crtc_id,0 ,0 ,0 ); -drmModeFreeResources (data->resources); }static void fill_blt (data_t *data,uint32_t handle,unsigned char color)
@@ -316,112 +263,105 @@ static void get_sink_crc(data_t *data, char *crc) {static void test_crc (data_t *data) { -uint32_t handle = data->handle[0 ]; +uint32_t handle = data->fb_white.gem_handle; +igt_plane_t *test_plane; +void *ptr;char ref_crc[12 ];char crc[12 ]; -if (data->op ==PLANE_MOVE ) { -igt_assert (drmModeSetCursor (data->drm_fd, data->crtc_id, - handle,64 ,64 ) ==0 ); -igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id, -1 ,1 ) ==0 ); +igt_plane_set_fb (data->primary, &data->fb_green); +igt_display_commit (&data->display); + +/* Setting a secondary fb/plane */ +switch (data->test_plane) { +case PRIMARY :default : test_plane = data->primary;break ; +case SPRITE : test_plane = data->sprite;break ; +case CURSOR : test_plane = data->cursor;break ; } +igt_plane_set_fb (test_plane, &data->fb_white); +igt_display_commit (&data->display);igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);switch (data->op) { -void *ptr;case PAGE_FLIP : +/* Only in use when testing primary plane */ igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 ); + data->fb_green.fb_id,0 ,NULL ) ==0 );break ; -case MMAP_CPU : - ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); +case MMAP_GTT : + ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE );gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); -sleep (1 ); +I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );memset (ptr,0 ,4 );munmap (ptr,4096 ); -sleep (1 ); -gem_sw_finish (data->drm_fd, handle);break ; -case MMAP_GTT :case MMAP_GTT_WAITING : ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE );gem_set_domain (data->drm_fd, handle,I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); + +/* Printing white on white so the screen shouldn't change */ memset (ptr,0xff ,4 ); +get_sink_crc (data, crc); +igt_assert (strcmp (ref_crc, crc) ==0 ); + +fprintf (stdout,"Waiting 10s...\n" ); +sleep (10 ); + +/* Now lets print black to change the screen */ +memset (ptr,0 ,4 );munmap (ptr,4096 ); -gem_bo_busy (data->drm_fd, handle); +break ; +case MMAP_CPU : + ptr =gem_mmap__cpu (data->drm_fd, handle,4096 ,PROT_WRITE ); +gem_set_domain (data->drm_fd, handle, +I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); +memset (ptr,0 ,4 ); +munmap (ptr,4096 ); +gem_sw_finish (data->drm_fd, handle);break ;case BLT : -fill_blt (data, handle,0xff ); +fill_blt (data, handle,0 );break ;case RENDER : -fill_render (data, handle,0xff ); +fill_render (data, handle,0 );break ;case PLANE_MOVE : -igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id,1 ,2 ) ==0 ); +/* Only in use when testing Sprite and Cursor */ +igt_plane_set_position (test_plane,1 ,1 ); +igt_display_commit (&data->display);break ;case PLANE_ONOFF : -igt_plane_set_fb (data->plane[0 ], &data->fb[0 ]); -igt_display_commit (&data->display); -igt_plane_set_fb (data->plane[1 ], &data->fb[1 ]); +/* Only in use when testing Sprite and Cursor */ +igt_plane_set_fb (test_plane,NULL );igt_display_commit (&data->display);break ; } - -igt_wait_for_vblank (data->drm_fd, data->crtc_idx); -get_sink_crc (data, crc);igt_assert (strcmp (ref_crc, crc) !=0 ); } -static bool prepare_crtc (data_t *data,uint32_t connector_id) -{ -if (!kmstest_get_connector_config (data->drm_fd, - connector_id, -1 << data->crtc_idx, - &data->config)) -return false; - - data->fb_id[0 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -0.0 ,1.0 ,0.0 , &data->fb[0 ]); -igt_assert (data->fb_id[0 ]); - -if (data->op ==PLANE_MOVE ) -create_cursor_fb (data, &data->fb[0 ]); - - data->fb_id[1 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -1.0 ,0.0 ,0.0 , &data->fb[1 ]); -igt_assert (data->fb_id[1 ]); - - data->handle[0 ] = data->fb[0 ].gem_handle; - data->handle[1 ] = data->fb[1 ].gem_handle; - -/* scanout = fb[1] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[1 ]); +static void test_cleanup (data_t *data) { +igt_plane_set_fb (data->primary,NULL ); +if (data->test_plane ==SPRITE ) +igt_plane_set_fb (data->sprite,NULL ); +if (data->test_plane ==CURSOR ) +igt_plane_set_fb (data->cursor,NULL ); -/* scanout = fb[0] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[0 ]); +igt_display_commit (&data->display); -kmstest_free_connector_config (&data->config); - -return true; +igt_remove_fb (data->drm_fd, &data->fb_green); +igt_remove_fb (data->drm_fd, &data->fb_white); } -static void test_sprite (data_t *data) +static void run_test (data_t *data) {igt_display_t *display = &data->display;igt_output_t *output;drmModeModeInfo *mode; +uint32_t white_h, white_v;for_each_connected_output (display, output) {drmModeConnectorPtr c = output->config.connector;
@@ -431,6 +371,7 @@ static void test_sprite(data_t *data)continue ;igt_output_set_pipe (output,PIPE_ANY ); + data->crtc_id = output->config.crtc->crtc_id; mode =igt_output_get_mode (output);
@@ -438,51 +379,45 @@ static void test_sprite(data_t *data) mode->hdisplay, mode->vdisplay,DRM_FORMAT_XRGB8888 ,I915_TILING_X ,0.0 ,1.0 ,0.0 , - &data->fb[0]); - -igt_create_color_fb (data->drm_fd, - mode->hdisplay/2 , mode->vdisplay/2 , -DRM_FORMAT_XRGB8888 ,I915_TILING_X , -1.0 ,0.0 ,0.0 , - &data->fb[1 ]); + &data->fb_green); + + data->primary =igt_output_get_plane (output,IGT_PLANE_PRIMARY ); +igt_plane_set_fb (data->primary,NULL ); + + white_h = mode->hdisplay; + white_v = mode->vdisplay; + +switch (data->test_plane) { +case SPRITE : + data->sprite =igt_output_get_plane (output, +IGT_PLANE_2 ); +igt_plane_set_fb (data->sprite,NULL ); +/* To make it different for human eyes let's make +* sprite visible in only one quarter of the primary +*/ + white_h = white_h/2 ; + white_v = white_v/2 ; +case PRIMARY : +igt_create_color_fb (data->drm_fd, + white_h, white_v, +DRM_FORMAT_XRGB8888 ,I915_TILING_X , +1.0 ,1.0 ,1.0 , + &data->fb_white); +break ; +case CURSOR : + data->cursor =igt_output_get_plane (output, +IGT_PLANE_CURSOR ); +igt_plane_set_fb (data->cursor,NULL ); +create_cursor_fb (data); +igt_plane_set_position (data->cursor,0 ,0 ); +break ; + } - data->plane[0 ] =igt_output_get_plane (output,0 ); - data->plane[1 ] =igt_output_get_plane (output,1 ); +igt_display_commit (&data->display);test_crc (data); - } -} - -static void run_test (data_t *data) -{ -int i, n; -drmModeConnectorPtr c; -/* Baytrail supports per-pipe PSR configuration, however PSR on -* PIPE_B isn't working properly. So let's keep it disabled for now. -* crtcs = IS_VALLEYVIEW(data->devid)? 2 : 1; */ -int crtcs =1 ; - -if (data->op ==PLANE_ONOFF ) { -test_sprite (data); -return ; - } -for (i =0 ; i < data->resources->count_connectors; i++) { -uint32_t connector_id = data->resources->connectors[i]; - c =drmModeGetConnector (data->drm_fd, connector_id); - -if (c->connector_type != DRM_MODE_CONNECTOR_eDP || - c->connection !=DRM_MODE_CONNECTED ) -continue ; -for (n =0 ; n < crtcs; n++) { - data->crtc_idx = n; - data->crtc_id = data->resources->crtcs[n]; - -if (!prepare_crtc (data, connector_id)) -continue ; - -test_crc (data); - } +test_cleanup (data); } }
@@ -496,7 +431,6 @@ igt_main igt_fixture { data.drm_fd =drm_open_any ();kmstest_set_vt_graphics_mode (); - data.devid =intel_get_drm_devid (data.drm_fd);igt_skip_on (!psr_enabled (&data));
@@ -508,7 +442,6 @@ igt_maindisplay_init (&data); } -for (op =PAGE_FLIP ; op <=RENDER ; op++) { igt_subtest_f("primary_%s", op_str(op)) { data.test_plane =PRIMARY ;
@@ -517,7 +450,7 @@ igt_main } } -for (op =PLANE_ONOFF ; op <=PLANE_ONOFF ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("sprite_%s", op_str(op)) { data.test_plane =SPRITE ; data.op = op;
@@ -525,7 +458,7 @@ igt_main } } -for (op =PLANE_MOVE ; op <=PLANE_MOVE ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("cursor_%s", op_str(op)) { data.test_plane =CURSOR ; data.op = op;
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 09/12] tests/kms_psr_sink_crc: Fix all testcases.
Quoted 6 lines · Daniel Vetter
Quoted 1 line · Rodrigo Vivi
In order to get all test cases fixed and the matrix planes-operations
working
Quoted 3 lines
it was needed to use the common new igt kms functions for all cases. Previously only sprite testcase was using it.
Quoted 9 lines
Quoted 1 line
Fixed the fb colors in a way to make tests more clear and be impossible
to see
Quoted 3 lines
black screen during the tests.
Signed-off-by Rodrigo Vivi <[email protected]>Ok, everything changed ;-) So a bit hard to review just as a patch and so just a few comments on top:
I'm sorry about that.... I got surprised I could split all in 9 patches, but I know this one staid ugly.
Quoted 5 lines
- Looks good overall, but the gold standard is whether it'll catch bugs. So if you remove some of the frontbuffer tracking (as little as possible in each test) and the new testcase catches it all, then I think we're good.
It is already catching something, what is good! :) and not broken anymore!
Quoted 5 lines
- I think we should have a residency check before we grab a new crc, to make sure that we're really again (or if the kernel is buggy, still) in psr mode.
yeah, but residency check is bad for vlv/chv.
Quoted 9 lines
- Checking for mismatching crc is risky, see the comment in a different reply in this thread.
But overall looks good so probably best to just push these patches and then fixup anything missing afterwards. I'll read through the entire test again once it all landed to double-check we haven't missed anything really important.
cool. Thanks!
Quoted 4 lines
Aside: A suspend/resume testcase might be useful, if it can reliably reproduce the issue you're working on. But again, follow-up.
For sure. I just saw we have igt_system_suspend_autoresume. I'll definetely add another test using it.
Quoted 446 lines
-Daniel
Quoted 2 lines
--- tests/kms_psr_sink_crc.c | 269++++++++++++++++++-----------------------------
Quoted 56 lines
1 file changed, 101 insertions(+), 168 deletions(-)tests/kms_psr_sink_crc.c +8
-21@@ -27,8 +27,6 @@#include <stdio.h> #include <string.h> -#include "drm_fourcc.h" -#include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" @@ -79,88 +77,37 @@ typedef struct {int drm_fd;enum planes test_plane;enum operations op; -drmModeRes *resources; -drm_intel_bufmgr *bufmgr;uint32_t devid; -uint32_t handle[2 ];uint32_t crtc_id; -uint32_t crtc_idx; -uint32_t fb_id[3 ]; -struct kmstest_connector_config config;igt_display_t display; -struct igt_fb fb[2 ]; -igt_plane_t *plane[2 ]; +drm_intel_bufmgr *bufmgr; +struct igt_fb fb_green, fb_white; +igt_plane_t *primary, *sprite, *cursor; } data_t; -static uint32_t create_fb (data_t *data, -int w,int h, -double r,double g,double b, -struct igt_fb *fb) +static void create_cursor_fb (data_t *data) { -uint32_t fb_id;cairo_t *cr; +uint32_t fb_id; - fb_id =igt_create_fb (data->drm_fd, w, h, -DRM_FORMAT_XRGB8888 ,I915_TILING_X , fb); + fb_id =igt_create_fb (data->drm_fd,64 ,64 , +DRM_FORMAT_ARGB8888 ,I915_TILING_NONE , + &data->fb_white);igt_assert (fb_id); - cr =igt_get_cairo_ctx (data->drm_fd, fb); -igt_paint_color (cr,0 ,0 , w, h, r, g, b); -igt_assert (cairo_status (cr) ==0 ); -cairo_destroy (cr);tests/kms_psr_sink_crc.c typedef struct { · line 120
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-10- -return fb_id; -} - -static void create_cursor_fb (data_t *data,struct igt_fb *fb) -{ -cairo_t *cr; - - data->fb_id[2] = igt_create_fb(data->drm_fd, 64, 64, - DRM_FORMAT_ARGB8888,
I915_TILING_NONE,Quoted 7 lines
tests/kms_psr_sink_crc.c +1
-4- fb); -igt_assert (data->fb_id[2 ]); - - cr =igt_get_cairo_ctx (data->drm_fd, fb); + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb_white);igt_paint_color_alpha (cr,0 ,0 ,64 ,64 ,1.0 ,1.0 ,1.0 ,1.0 );igt_assert (cairo_status (cr) ==0 );tests/kms_psr_sink_crc.c typedef struct {
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-8} -static bool -connector_set_mode (data_t *data,drmModeModeInfo *mode,uint32_t fb_id) -{ -struct kmstest_connector_config *config = &data->config; -int ret; - -#if 0 - fprintf(stdout, "Using pipe %s, %dx%d\n",
kmstest_pipe_name(config->pipe),tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char
Quoted 31 lines
tests/kms_psr_sink_crc.c +0
-19- mode->hdisplay, mode->vdisplay); -#endif - - ret =drmModeSetCrtc (data->drm_fd, - config->crtc->crtc_id, - fb_id, -0 ,0 ,/* x, y */ - &config->connector->connector_id, -1 , - mode); -igt_assert (ret ==0 ); - -return 0 ; -} -static void display_init (data_t *data) {igt_display_init (&data->display, data->drm_fd); - data->resources =drmModeGetResources (data->drm_fd); -igt_assert (data->resources); }static void display_fini (data_t *data) {igt_display_fini (&data->display); -drmModeSetCursor (data->drm_fd, data->crtc_id,0 ,0 ,0 ); -drmModeFreeResources (data->resources); }static void fill_blt (data_t *data,uint32_t handle,unsigned char color)@@ -316,112 +263,105 @@ static void get_sink_crc(data_t *data, char*crc) {
Quoted 27 lines
tests/kms_psr_sink_crc.c +13
-6static void test_crc (data_t *data) { -uint32_t handle = data->handle[0 ]; +uint32_t handle = data->fb_white.gem_handle; +igt_plane_t *test_plane; +void *ptr;char ref_crc[12 ];char crc[12 ]; -if (data->op ==PLANE_MOVE ) { -igt_assert (drmModeSetCursor (data->drm_fd, data->crtc_id, - handle,64 ,64 ) ==0 ); -igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id, -1 ,1 ) ==0 ); +igt_plane_set_fb (data->primary, &data->fb_green); +igt_display_commit (&data->display); + +/* Setting a secondary fb/plane */ +switch (data->test_plane) { +case PRIMARY :default : test_plane = data->primary;break ; +case SPRITE : test_plane = data->sprite;break ; +case CURSOR : test_plane = data->cursor;break ; } +igt_plane_set_fb (test_plane, &data->fb_white); +igt_display_commit (&data->display);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +2
-2igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);switch (data->op) { -void *ptr;case PAGE_FLIP : +/* Only in use when testing primary plane */ igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 ); + data->fb_green.fb_id, 0, NULL)== 0);
tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 3 lines
tests/kms_psr_sink_crc.c +0
-2break ; -case MMAP_CPU : - ptr = gem_mmap__cpu(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char · line 293
Quoted 2 lines
tests/kms_psr_sink_crc.c +2
-0+case MMAP_GTT : + ptr = gem_mmap__gtt(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 12 lines
tests/kms_psr_sink_crc.c +1
-5gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); -sleep (1 ); +I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );memset (ptr,0 ,4 );munmap (ptr,4096 ); -sleep (1 ); -gem_sw_finish (data->drm_fd, handle);break ; -case MMAP_GTT :case MMAP_GTT_WAITING : ptr = gem_mmap__gtt(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 4 lines
tests/kms_psr_sink_crc.c +2
-0gem_set_domain (data->drm_fd, handle,I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); + +/* Printing white on white so the screen shouldn't change */
Quoted 4 lines
tests/kms_psr_sink_crc.c +3
-0memset (ptr,0xff ,4 ); +get_sink_crc (data, crc); +igt_assert (strcmp (ref_crc, crc) ==0 ); +tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +8
-1+fprintf (stdout,"Waiting 10s...\n" ); +sleep (10 ); + +/* Now lets print black to change the screen */ +memset (ptr,0 ,4 );munmap (ptr,4096 ); -gem_bo_busy (data->drm_fd, handle); +break ; +case MMAP_CPU : + ptr = gem_mmap__cpu(data->drm_fd, handle, 4096,
PROT_WRITE);Quoted 6 lines
tests/kms_psr_sink_crc.c +5
-0+gem_set_domain (data->drm_fd, handle, +I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); +memset (ptr,0 ,4 ); +munmap (ptr,4096 ); +gem_sw_finish (data->drm_fd, handle);break ;tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +2
-3case BLT : -fill_blt (data, handle,0xff ); +fill_blt (data, handle,0 );break ;case RENDER : -fill_render (data, handle,0xff ); +fill_render (data, handle,0 );break ;case PLANE_MOVE : - igt_assert(drmModeMoveCursor(data->drm_fd, data->crtc_id,1, 2) == 0);
Quoted 90 lines
tests/kms_psr_sink_crc.c +17
-42+/* Only in use when testing Sprite and Cursor */ +igt_plane_set_position (test_plane,1 ,1 ); +igt_display_commit (&data->display);break ;case PLANE_ONOFF : -igt_plane_set_fb (data->plane[0 ], &data->fb[0 ]); -igt_display_commit (&data->display); -igt_plane_set_fb (data->plane[1 ], &data->fb[1 ]); +/* Only in use when testing Sprite and Cursor */ +igt_plane_set_fb (test_plane,NULL );igt_display_commit (&data->display);break ; } - -igt_wait_for_vblank (data->drm_fd, data->crtc_idx); -get_sink_crc (data, crc);igt_assert (strcmp (ref_crc, crc) !=0 ); } -static bool prepare_crtc (data_t *data,uint32_t connector_id) -{ -if (!kmstest_get_connector_config (data->drm_fd, - connector_id, -1 << data->crtc_idx, - &data->config)) -return false; - - data->fb_id[0 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -0.0 ,1.0 ,0.0 , &data->fb[0 ]); -igt_assert (data->fb_id[0 ]); - -if (data->op ==PLANE_MOVE ) -create_cursor_fb (data, &data->fb[0 ]); - - data->fb_id[1 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -1.0 ,0.0 ,0.0 , &data->fb[1 ]); -igt_assert (data->fb_id[1 ]); - - data->handle[0 ] = data->fb[0 ].gem_handle; - data->handle[1 ] = data->fb[1 ].gem_handle; - -/* scanout = fb[1] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[1 ]); +static void test_cleanup (data_t *data) { +igt_plane_set_fb (data->primary,NULL ); +if (data->test_plane ==SPRITE ) +igt_plane_set_fb (data->sprite,NULL ); +if (data->test_plane ==CURSOR ) +igt_plane_set_fb (data->cursor,NULL ); -/* scanout = fb[0] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[0 ]); +igt_display_commit (&data->display); -kmstest_free_connector_config (&data->config); - -return true; +igt_remove_fb (data->drm_fd, &data->fb_green); +igt_remove_fb (data->drm_fd, &data->fb_white); } -static void test_sprite (data_t *data) +static void run_test (data_t *data) {igt_display_t *display = &data->display;igt_output_t *output;drmModeModeInfo *mode; +uint32_t white_h, white_v;for_each_connected_output (display, output) {drmModeConnectorPtr c = output->config.connector;@@ -431,6 +371,7 @@ static void test_sprite(data_t *data)continue ;igt_output_set_pipe (output,PIPE_ANY ); + data->crtc_id = output->config.crtc->crtc_id; mode =igt_output_get_mode (output);@@ -438,51 +379,45 @@ static void test_sprite(data_t *data) mode->hdisplay, mode->vdisplay,DRM_FORMAT_XRGB8888 ,I915_TILING_X , 0.0, 1.0, 0.0,tests/kms_psr_sink_crc.c static void test_sprite(data_t *data) · line 384
Quoted 10 lines
tests/kms_psr_sink_crc.c +3
-7- &data->fb[0]); - -igt_create_color_fb (data->drm_fd, - mode->hdisplay/2 , mode->vdisplay/2 , -DRM_FORMAT_XRGB8888 ,I915_TILING_X , -1.0 ,0.0 ,0.0 , - &data->fb[1 ]); + &data->fb_green); + + data->primary = igt_output_get_plane(output,
IGT_PLANE_PRIMARY);tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 12 lines
tests/kms_psr_sink_crc.c +12
-0+igt_plane_set_fb (data->primary,NULL ); + + white_h = mode->hdisplay; + white_v = mode->vdisplay; + +switch (data->test_plane) { +case SPRITE : + data->sprite =igt_output_get_plane (output, +IGT_PLANE_2 ); +igt_plane_set_fb (data->sprite,NULL ); +/* To make it different for human eyes let's make +* sprite visible in only one quarter of the primary
tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 7 lines
tests/kms_psr_sink_crc.c +7
-0+*/ + white_h = white_h/2 ; + white_v = white_v/2 ; +case PRIMARY : + igt_create_color_fb(data->drm_fd, + white_h, white_v, + DRM_FORMAT_XRGB8888,
I915_TILING_X,tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 6 lines
tests/kms_psr_sink_crc.c +6
-0+1.0 ,1.0 ,1.0 , + &data->fb_white); +break ; +case CURSOR : + data->cursor = igt_output_get_plane(output, +
IGT_PLANE_CURSOR);Quoted 10 lines
tests/kms_psr_sink_crc.c +6
-2+igt_plane_set_fb (data->cursor,NULL ); +create_cursor_fb (data); +igt_plane_set_position (data->cursor,0 ,0 ); +break ; + } - data->plane[0 ] =igt_output_get_plane (output,0 ); - data->plane[1 ] =igt_output_get_plane (output,1 ); +igt_display_commit (&data->display);tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-9test_crc (data); - } -} - -static void run_test (data_t *data) -{ -int i, n; -drmModeConnectorPtr c; -/* Baytrail supports per-pipe PSR configuration, however PSR on -* PIPE_B isn't working properly. So let's keep it disabled for now.
Quoted 65 lines
tests/kms_psr_sink_crc.c +3
-28-* crtcs = IS_VALLEYVIEW(data->devid)? 2 : 1; */ -int crtcs =1 ; - -if (data->op ==PLANE_ONOFF ) { -test_sprite (data); -return ; - } -for (i =0 ; i < data->resources->count_connectors; i++) { -uint32_t connector_id = data->resources->connectors[i]; - c =drmModeGetConnector (data->drm_fd, connector_id); - -if (c->connector_type != DRM_MODE_CONNECTOR_eDP || - c->connection !=DRM_MODE_CONNECTED ) -continue ; -for (n =0 ; n < crtcs; n++) { - data->crtc_idx = n; - data->crtc_id = data->resources->crtcs[n]; - -if (!prepare_crtc (data, connector_id)) -continue ; - -test_crc (data); - } +test_cleanup (data); } }@@ -496,7 +431,6 @@ igt_main igt_fixture { data.drm_fd =drm_open_any ();kmstest_set_vt_graphics_mode (); - data.devid =intel_get_drm_devid (data.drm_fd);igt_skip_on (!psr_enabled (&data));@@ -508,7 +442,6 @@ igt_maindisplay_init (&data); } -for (op =PAGE_FLIP ; op <=RENDER ; op++) { igt_subtest_f("primary_%s", op_str(op)) { data.test_plane =PRIMARY ;@@ -517,7 +450,7 @@ igt_main } } -for (op =PLANE_ONOFF ; op <=PLANE_ONOFF ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("sprite_%s", op_str(op)) { data.test_plane =SPRITE ; data.op = op;@@ -525,7 +458,7 @@ igt_main } } -for (op =PLANE_MOVE ; op <=PLANE_MOVE ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("cursor_%s", op_str(op)) { data.test_plane =CURSOR ; data.op = op; --1.9.3
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/12] tests/kms_psr_sink_crc: Fix all testcases.
adding suspend_autoresume on primary tests like this:
@ -470,6 +472,8 @@ igt_main
data.test_plane = PRIMARY;
data.op = op;
run_test(&data);+ igt_system_suspend_autoresume();
+ run_test(&data);
on BDW I got these results:
vivijim rdvivi-seattle tests$ sudo ./kms_psr_sink_crc
IGT-Version: 1.7-gd4b43f0 (x86_64) (Linux: 3.17.0-rc2+ x86_64)
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:44:03 2014 Subtest primary_page_flip: SUCCESS
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:44:40 2014 Subtest primary_mmap_gtt: SUCCESS
Waiting 10s...
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:45:27 2014 Waiting 10s...
Subtest primary_mmap_gtt_waiting: SUCCESS
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:46:13 2014 Subtest primary_mmap_cpu: SUCCESS
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:46:50 2014 Subtest primary_blt: SUCCESS
rtcwake: wakeup from "mem" using /dev/rtc0 at Fri Sep 5 00:47:27 2014 Subtest primary_render: SUCCESS
on HSW I couldn't test because suspend/resume breaks even with psr disabled. I'm going to check more tomorrow..
But regarding the suspend resume test, how do you suggest to organize it? Extra loops for all current cases?
suspend_{primary, sprite, cursor}_{page_flip, mmap_gtt, etc}? I believe the test will take so long to finish on this case what is bad for qa alghouth it is the complete one. What do you think?
Quoted 522 lines · Rodrigo Vivi
Quoted 6 lines · Daniel Vetter
Quoted 1 line · Rodrigo Vivi
In order to get all test cases fixed and the matrix planes-operations
working
Quoted 3 lines
it was needed to use the common new igt kms functions for all cases. Previously only sprite testcase was using it.
Quoted 9 lines
Quoted 1 line
Fixed the fb colors in a way to make tests more clear and be impossible
to see
Quoted 3 lines
black screen during the tests.
Signed-off-by Rodrigo Vivi <[email protected]>Ok, everything changed ;-) So a bit hard to review just as a patch and so just a few comments on top:
I'm sorry about that.... I got surprised I could split all in 9 patches, but I know this one staid ugly.
Quoted 5 lines
- Looks good overall, but the gold standard is whether it'll catch bugs. So if you remove some of the frontbuffer tracking (as little as possible in each test) and the new testcase catches it all, then I think we're good.
It is already catching something, what is good! :) and not broken anymore!
Quoted 5 lines
- I think we should have a residency check before we grab a new crc, to make sure that we're really again (or if the kernel is buggy, still) in psr mode.
yeah, but residency check is bad for vlv/chv.
Quoted 9 lines
- Checking for mismatching crc is risky, see the comment in a different reply in this thread.
But overall looks good so probably best to just push these patches and then fixup anything missing afterwards. I'll read through the entire test again once it all landed to double-check we haven't missed anything really important.
cool. Thanks!
Quoted 4 lines
Aside: A suspend/resume testcase might be useful, if it can reliably reproduce the issue you're working on. But again, follow-up.
For sure. I just saw we have
igt_system_suspend_autoresume. I'll definetely add another test using it.Quoted 433 lines
-Daniel
Quoted 2 lines
--- tests/kms_psr_sink_crc.c | 269++++++++++++++++++-----------------------------
Quoted 56 lines
1 file changed, 101 insertions(+), 168 deletions(-)tests/kms_psr_sink_crc.c +8
-21@@ -27,8 +27,6 @@#include <stdio.h> #include <string.h> -#include "drm_fourcc.h" -#include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" @@ -79,88 +77,37 @@ typedef struct {int drm_fd;enum planes test_plane;enum operations op; -drmModeRes *resources; -drm_intel_bufmgr *bufmgr;uint32_t devid; -uint32_t handle[2 ];uint32_t crtc_id; -uint32_t crtc_idx; -uint32_t fb_id[3 ]; -struct kmstest_connector_config config;igt_display_t display; -struct igt_fb fb[2 ]; -igt_plane_t *plane[2 ]; +drm_intel_bufmgr *bufmgr; +struct igt_fb fb_green, fb_white; +igt_plane_t *primary, *sprite, *cursor; } data_t; -static uint32_t create_fb (data_t *data, -int w,int h, -double r,double g,double b, -struct igt_fb *fb) +static void create_cursor_fb (data_t *data) { -uint32_t fb_id;cairo_t *cr; +uint32_t fb_id; - fb_id =igt_create_fb (data->drm_fd, w, h, -DRM_FORMAT_XRGB8888 ,I915_TILING_X , fb); + fb_id =igt_create_fb (data->drm_fd,64 ,64 , +DRM_FORMAT_ARGB8888 ,I915_TILING_NONE , + &data->fb_white);igt_assert (fb_id); - cr =igt_get_cairo_ctx (data->drm_fd, fb); -igt_paint_color (cr,0 ,0 , w, h, r, g, b); -igt_assert (cairo_status (cr) ==0 ); -cairo_destroy (cr);tests/kms_psr_sink_crc.c typedef struct { · line 120
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-10- -return fb_id; -} - -static void create_cursor_fb (data_t *data,struct igt_fb *fb) -{ -cairo_t *cr; - - data->fb_id[2] = igt_create_fb(data->drm_fd, 64, 64, - DRM_FORMAT_ARGB8888,
I915_TILING_NONE,Quoted 7 lines
tests/kms_psr_sink_crc.c +1
-4- fb); -igt_assert (data->fb_id[2 ]); - - cr =igt_get_cairo_ctx (data->drm_fd, fb); + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb_white);igt_paint_color_alpha (cr,0 ,0 ,64 ,64 ,1.0 ,1.0 ,1.0 ,1.0 );igt_assert (cairo_status (cr) ==0 );tests/kms_psr_sink_crc.c typedef struct {
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-8} -static bool -connector_set_mode (data_t *data,drmModeModeInfo *mode,uint32_t fb_id) -{ -struct kmstest_connector_config *config = &data->config; -int ret; - -#if 0 - fprintf(stdout, "Using pipe %s, %dx%d\n",
kmstest_pipe_name(config->pipe),Quoted 20 lines
tests/kms_psr_sink_crc.c +0
-17- mode->hdisplay, mode->vdisplay); -#endif - - ret =drmModeSetCrtc (data->drm_fd, - config->crtc->crtc_id, - fb_id, -0 ,0 ,/* x, y */ - &config->connector->connector_id, -1 , - mode); -igt_assert (ret ==0 ); - -return 0 ; -} -static void display_init (data_t *data) {igt_display_init (&data->display, data->drm_fd); - data->resources =drmModeGetResources (data->drm_fd); -igt_assert (data->resources);tests/kms_psr_sink_crc.c typedef struct {
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-2}static void display_fini (data_t *data) {igt_display_fini (&data->display); -drmModeSetCursor (data->drm_fd, data->crtc_id,0 ,0 ,0 ); -drmModeFreeResources (data->resources); } static void fill_blt(data_t *data, uint32_t handle, unsigned charcolor)
tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char
Quoted 1 line
tests/kms_psr_sink_crc.c +0
-0@@ -316,112 +263,105 @@ static void get_sink_crc(data_t *data, char*crc) {
Quoted 27 lines
tests/kms_psr_sink_crc.c +13
-6static void test_crc (data_t *data) { -uint32_t handle = data->handle[0 ]; +uint32_t handle = data->fb_white.gem_handle; +igt_plane_t *test_plane; +void *ptr;char ref_crc[12 ];char crc[12 ]; -if (data->op ==PLANE_MOVE ) { -igt_assert (drmModeSetCursor (data->drm_fd, data->crtc_id, - handle,64 ,64 ) ==0 ); -igt_assert (drmModeMoveCursor (data->drm_fd, data->crtc_id, -1 ,1 ) ==0 ); +igt_plane_set_fb (data->primary, &data->fb_green); +igt_display_commit (&data->display); + +/* Setting a secondary fb/plane */ +switch (data->test_plane) { +case PRIMARY :default : test_plane = data->primary;break ; +case SPRITE : test_plane = data->sprite;break ; +case CURSOR : test_plane = data->cursor;break ; } +igt_plane_set_fb (test_plane, &data->fb_white); +igt_display_commit (&data->display);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +2
-2igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc);switch (data->op) { -void *ptr;case PAGE_FLIP : +/* Only in use when testing primary plane */ igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, - data->fb_id[1 ],0 ,NULL ) ==0 ); + data->fb_green.fb_id, 0, NULL)== 0);
tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 3 lines
tests/kms_psr_sink_crc.c +0
-2break ; -case MMAP_CPU : - ptr = gem_mmap__cpu(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char · line 293
Quoted 2 lines
tests/kms_psr_sink_crc.c +2
-0+case MMAP_GTT : + ptr = gem_mmap__gtt(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 12 lines
tests/kms_psr_sink_crc.c +1
-5gem_set_domain (data->drm_fd, handle, -I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); -sleep (1 ); +I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );memset (ptr,0 ,4 );munmap (ptr,4096 ); -sleep (1 ); -gem_sw_finish (data->drm_fd, handle);break ; -case MMAP_GTT :case MMAP_GTT_WAITING : ptr = gem_mmap__gtt(data->drm_fd, handle, 4096,
PROT_WRITE);tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 4 lines
tests/kms_psr_sink_crc.c +2
-0gem_set_domain (data->drm_fd, handle,I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT ); + +/* Printing white on white so the screen shouldn't change */
Quoted 4 lines
tests/kms_psr_sink_crc.c +3
-0memset (ptr,0xff ,4 ); +get_sink_crc (data, crc); +igt_assert (strcmp (ref_crc, crc) ==0 ); +tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +8
-1+fprintf (stdout,"Waiting 10s...\n" ); +sleep (10 ); + +/* Now lets print black to change the screen */ +memset (ptr,0 ,4 );munmap (ptr,4096 ); -gem_bo_busy (data->drm_fd, handle); +break ; +case MMAP_CPU : + ptr = gem_mmap__cpu(data->drm_fd, handle, 4096,
PROT_WRITE);Quoted 6 lines
tests/kms_psr_sink_crc.c +5
-0+gem_set_domain (data->drm_fd, handle, +I915_GEM_DOMAIN_CPU ,I915_GEM_DOMAIN_CPU ); +memset (ptr,0 ,4 ); +munmap (ptr,4096 ); +gem_sw_finish (data->drm_fd, handle);break ;tests/kms_psr_sink_crc.c static void get_sink_crc(data_t *data, char *crc) {
Quoted 10 lines
tests/kms_psr_sink_crc.c +2
-3case BLT : -fill_blt (data, handle,0xff ); +fill_blt (data, handle,0 );break ;case RENDER : -fill_render (data, handle,0xff ); +fill_render (data, handle,0 );break ;case PLANE_MOVE : - igt_assert(drmModeMoveCursor(data->drm_fd, data->crtc_id,1, 2) == 0);
Quoted 90 lines
tests/kms_psr_sink_crc.c +17
-42+/* Only in use when testing Sprite and Cursor */ +igt_plane_set_position (test_plane,1 ,1 ); +igt_display_commit (&data->display);break ;case PLANE_ONOFF : -igt_plane_set_fb (data->plane[0 ], &data->fb[0 ]); -igt_display_commit (&data->display); -igt_plane_set_fb (data->plane[1 ], &data->fb[1 ]); +/* Only in use when testing Sprite and Cursor */ +igt_plane_set_fb (test_plane,NULL );igt_display_commit (&data->display);break ; } - -igt_wait_for_vblank (data->drm_fd, data->crtc_idx); -get_sink_crc (data, crc);igt_assert (strcmp (ref_crc, crc) !=0 ); } -static bool prepare_crtc (data_t *data,uint32_t connector_id) -{ -if (!kmstest_get_connector_config (data->drm_fd, - connector_id, -1 << data->crtc_idx, - &data->config)) -return false; - - data->fb_id[0 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -0.0 ,1.0 ,0.0 , &data->fb[0 ]); -igt_assert (data->fb_id[0 ]); - -if (data->op ==PLANE_MOVE ) -create_cursor_fb (data, &data->fb[0 ]); - - data->fb_id[1 ] =create_fb (data, - data->config.default_mode.hdisplay, - data->config.default_mode.vdisplay, -1.0 ,0.0 ,0.0 , &data->fb[1 ]); -igt_assert (data->fb_id[1 ]); - - data->handle[0 ] = data->fb[0 ].gem_handle; - data->handle[1 ] = data->fb[1 ].gem_handle; - -/* scanout = fb[1] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[1 ]); +static void test_cleanup (data_t *data) { +igt_plane_set_fb (data->primary,NULL ); +if (data->test_plane ==SPRITE ) +igt_plane_set_fb (data->sprite,NULL ); +if (data->test_plane ==CURSOR ) +igt_plane_set_fb (data->cursor,NULL ); -/* scanout = fb[0] */ -connector_set_mode (data, &data->config.default_mode, - data->fb_id[0 ]); +igt_display_commit (&data->display); -kmstest_free_connector_config (&data->config); - -return true; +igt_remove_fb (data->drm_fd, &data->fb_green); +igt_remove_fb (data->drm_fd, &data->fb_white); } -static void test_sprite (data_t *data) +static void run_test (data_t *data) {igt_display_t *display = &data->display;igt_output_t *output;drmModeModeInfo *mode; +uint32_t white_h, white_v;for_each_connected_output (display, output) {drmModeConnectorPtr c = output->config.connector;@@ -431,6 +371,7 @@ static void test_sprite(data_t *data)continue ;igt_output_set_pipe (output,PIPE_ANY ); + data->crtc_id = output->config.crtc->crtc_id; mode =igt_output_get_mode (output);@@ -438,51 +379,45 @@ static void test_sprite(data_t *data) mode->hdisplay, mode->vdisplay,DRM_FORMAT_XRGB8888 ,I915_TILING_X , 0.0, 1.0, 0.0,tests/kms_psr_sink_crc.c static void test_sprite(data_t *data) · line 384
Quoted 10 lines
tests/kms_psr_sink_crc.c +3
-7- &data->fb[0]); - -igt_create_color_fb (data->drm_fd, - mode->hdisplay/2 , mode->vdisplay/2 , -DRM_FORMAT_XRGB8888 ,I915_TILING_X , -1.0 ,0.0 ,0.0 , - &data->fb[1 ]); + &data->fb_green); + + data->primary = igt_output_get_plane(output,
IGT_PLANE_PRIMARY);tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 12 lines
tests/kms_psr_sink_crc.c +12
-0+igt_plane_set_fb (data->primary,NULL ); + + white_h = mode->hdisplay; + white_v = mode->vdisplay; + +switch (data->test_plane) { +case SPRITE : + data->sprite =igt_output_get_plane (output, +IGT_PLANE_2 ); +igt_plane_set_fb (data->sprite,NULL ); +/* To make it different for human eyes let's make +* sprite visible in only one quarter of the primary
tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 7 lines
tests/kms_psr_sink_crc.c +7
-0+*/ + white_h = white_h/2 ; + white_v = white_v/2 ; +case PRIMARY : + igt_create_color_fb(data->drm_fd, + white_h, white_v, + DRM_FORMAT_XRGB8888,
I915_TILING_X,tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 6 lines
tests/kms_psr_sink_crc.c +6
-0+1.0 ,1.0 ,1.0 , + &data->fb_white); +break ; +case CURSOR : + data->cursor = igt_output_get_plane(output, +
IGT_PLANE_CURSOR);Quoted 10 lines
tests/kms_psr_sink_crc.c +6
-2+igt_plane_set_fb (data->cursor,NULL ); +create_cursor_fb (data); +igt_plane_set_position (data->cursor,0 ,0 ); +break ; + } - data->plane[0 ] =igt_output_get_plane (output,0 ); - data->plane[1 ] =igt_output_get_plane (output,1 ); +igt_display_commit (&data->display);tests/kms_psr_sink_crc.c static void test_sprite(data_t *data)
Quoted 10 lines
tests/kms_psr_sink_crc.c +0
-9test_crc (data); - } -} - -static void run_test (data_t *data) -{ -int i, n; -drmModeConnectorPtr c; -/* Baytrail supports per-pipe PSR configuration, however PSR on -* PIPE_B isn't working properly. So let's keep it disabled for now.
Quoted 65 lines
tests/kms_psr_sink_crc.c +3
-28-* crtcs = IS_VALLEYVIEW(data->devid)? 2 : 1; */ -int crtcs =1 ; - -if (data->op ==PLANE_ONOFF ) { -test_sprite (data); -return ; - } -for (i =0 ; i < data->resources->count_connectors; i++) { -uint32_t connector_id = data->resources->connectors[i]; - c =drmModeGetConnector (data->drm_fd, connector_id); - -if (c->connector_type != DRM_MODE_CONNECTOR_eDP || - c->connection !=DRM_MODE_CONNECTED ) -continue ; -for (n =0 ; n < crtcs; n++) { - data->crtc_idx = n; - data->crtc_id = data->resources->crtcs[n]; - -if (!prepare_crtc (data, connector_id)) -continue ; - -test_crc (data); - } +test_cleanup (data); } }@@ -496,7 +431,6 @@ igt_main igt_fixture { data.drm_fd =drm_open_any ();kmstest_set_vt_graphics_mode (); - data.devid =intel_get_drm_devid (data.drm_fd);igt_skip_on (!psr_enabled (&data));@@ -508,7 +442,6 @@ igt_maindisplay_init (&data); } -for (op =PAGE_FLIP ; op <=RENDER ; op++) { igt_subtest_f("primary_%s", op_str(op)) { data.test_plane =PRIMARY ;@@ -517,7 +450,7 @@ igt_main } } -for (op =PLANE_ONOFF ; op <=PLANE_ONOFF ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("sprite_%s", op_str(op)) { data.test_plane =SPRITE ; data.op = op;@@ -525,7 +458,7 @@ igt_main } } -for (op =PLANE_MOVE ; op <=PLANE_MOVE ; op++) { +for (op =MMAP_GTT ; op <=PLANE_ONOFF ; op++) { igt_subtest_f("cursor_%s", op_str(op)) { data.test_plane =CURSOR ; data.op = op; --1.9.3
Quoted 14 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/12] tests/kms_psr_sink_crc: Fix all testcases.
Quoted 28 lines · Rodrigo Vivi
adding
suspend_autoresumeon primary tests like this:
@ -470,6 +472,8 @@igt_maindata.test_plane = PRIMARY; data.op = op; run_test(&data);(quoted diff) +2
-0+ igt_system_suspend_autoresume(); + run_test(&data);on BDW I got these results:
vivijim rdvivi-seattle tests$ sudo ./kms_psr_sink_crc
IGT-Version: 1.7-gd4b43f0 (x86_64) (Linux: 3.17.0-rc2+x86_64)
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:44:03 2014 Subtestprimary_page_flip: SUCCESS
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:44:40 2014 Subtestprimary_mmap_gtt: SUCCESS
Waiting 10s...
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:45:27 2014 Waiting 10s...
Subtestprimary_mmap_gtt_waiting: SUCCESS
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:46:13 2014 Subtestprimary_mmap_cpu: SUCCESS
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:46:50 2014 Subtestprimary_blt: SUCCESS
rtcwake: wakeup from "mem" using/dev/rtc0at Fri Sep 5 00:47:27 2014 Subtestprimary_render: SUCCESS
Quoted 8 lines
on HSW I couldn't test because suspend/resume breaks even with psr disabled. I'm going to check more tomorrow..
But regarding the suspend resume test, how do you suggest to organize it? Extra loops for all current cases?
suspend_{primary, sprite, cursor}_{page_flip,mmap_gtt, etc}? I believe the test will take so long to finish on this case what is bad for qa alghouth it is the complete one. What do you think?
I think we don't need the full set of tests also with system suspend. I think just one test which catches the current bug is good enough, after all if psr is set up correctly it should work the same at runtime than over s/r. And since this is a test I'd just copypaste the relevant subtest (if it doesn't integrate quickly into the existing code), not worth at all to make a big fuzz.
And we have lots of resume tests already, they "only" take about 30 second. Only important to have "suspend" somewhere in the subtest name so that all system suspend tests can easily be filtered out/selected. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 10/12 tests/kms_psr_sink_crc: Check color ref CRC
In reply to Rodrigo ViviBlack screen is forbidden on this test. So let's fail if sink crc shows it is back.
Also there are many cases where we know for shure it should be all green, so let's check for them.
--- tests/kms_psr_sink_crc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
tests/kms_psr_sink_crc.c +19 -0
@@ -35,6 +35,9 @@#include "igt_debugfs.h" #include "igt_kms.h" +#define CRC_BLACK "000000000000" +#define CRC_GREEN "0000c1010000" +#define DEBUG_CRC 0/* This is usefull to debug and know what should be expected */
@@ -259,6 +262,9 @@ static void get_sink_crc(data_t *data, char *crc) {* Now give a time for human eyes */ usleep (300000 ); + +/* Black screen is always invalid */ +igt_assert (strcmp (crc,CRC_BLACK ) !=0 ); }static void test_crc (data_t *data)
@@ -272,6 +278,15 @@ static void test_crc(data_t *data)igt_plane_set_fb (data->primary, &data->fb_green);igt_display_commit (&data->display); +/* Confirm that screen became Green */ +get_sink_crc (data, ref_crc); +igt_assert (strcmp (ref_crc,CRC_GREEN ) ==0 ); + +/* Confirm screen stays Green after PSR got active */ +igt_assert (wait_psr_entry (data,10 )); +get_sink_crc (data, ref_crc); +igt_assert (strcmp (ref_crc,CRC_GREEN ) ==0 ); +/* Setting a secondary fb/plane */ switch (data->test_plane) {case PRIMARY :default : test_plane = data->primary;break ;
@@ -281,14 +296,18 @@ static void test_crc(data_t *data)igt_plane_set_fb (test_plane, &data->fb_white);igt_display_commit (&data->display); +/* Confirm it is not Green anymore */ igt_assert (wait_psr_entry (data,10 ));get_sink_crc (data, ref_crc); +igt_assert (strcmp (ref_crc,CRC_GREEN ) !=0 );switch (data->op) {case PAGE_FLIP :/* Only in use when testing primary plane */ igt_assert (drmModePageFlip (data->drm_fd, data->crtc_id, data->fb_green.fb_id,0 ,NULL ) ==0 ); +get_sink_crc (data, crc); +igt_assert (strcmp (crc,CRC_GREEN ) ==0 );break ;case MMAP_GTT : ptr =gem_mmap__gtt (data->drm_fd, handle,4096 ,PROT_WRITE );
Signature · 1 line
1.9.3
PATCH 11/12 tests/kms_psr_sink_crc: Fix blt submission
In reply to Rodrigo ViviPutting back a missing dword.
--- tests/kms_psr_sink_crc.c | 1 + 1 file changed, 1 insertion(+)
tests/kms_psr_sink_crc.c +1 -0
@@ -125,6 +125,7 @@ static void fill_blt(data_t *data, uint32_t handle, unsigned char color)COLOR_BLIT_COPY_BATCH_START (0 );OUT_BATCH ((1 <<24 ) | (0xf0 <<16 ) |0 ); +OUT_BATCH (0 );OUT_BATCH (1 <<16 |4 );OUT_RELOC (dst,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ,0 );OUT_BATCH (color);
Signature · 1 line
1.9.3
PATCH 12/12 tests/kms_psr_sink_crc: Wait 2 vblanks before grabing the new crc.
In reply to Rodrigo Vivi--- tests/kms_psr_sink_crc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tests/kms_psr_sink_crc.c +4 -1
@@ -246,6 +246,9 @@ static void get_sink_crc(data_t *data, char *crc) {int ret;FILE *file; +igt_wait_for_vblank (data->drm_fd,0 ); +igt_wait_for_vblank (data->drm_fd,0 ); + file =igt_debugfs_fopen ("i915_sink_crc_eDP1" ,"r" );igt_require (file);
@@ -390,7 +393,7 @@ static void run_test(data_t *data) c->connection != DRM_MODE_CONNECTED)continue ; -igt_output_set_pipe (output,PIPE_ANY ); +igt_output_set_pipe (output,0 ); data->crtc_id = output->config.crtc->crtc_id; mode =igt_output_get_mode (output);
Signature · 1 line
1.9.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Rodrigo Vivi
v2: Doesn't duplicate kernel's
HAS_PSR. skip based on debugfs output.Signed-off-by Rodrigo Vivi <[email protected]>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.
Quoted 97 lines
-Daniel
Quoted 19 lines
--- tests/pm_psr.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)tests/pm_psr.c +2
-0@@ -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;tests/pm_psr.c static int get_perf(const char *path) · line 51
Quoted 10 lines
tests/pm_psr.c +2
-2char 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 thistest case\n");
Quoted 6 lines
tests/pm_psr.c +3
-1-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 );tests/pm_psr.c static int get_perf(const char *path)
Quoted 10 lines
tests/pm_psr.c +3
-1-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 thistest case\n");
Quoted 15 lines
tests/pm_psr.c +8
-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,15 +82,13 @@ static int get_perf(const char *path) igt_simple_main {tests/pm_psr.c static int get_perf(const char *path) · line 77
Quoted 10 lines
tests/pm_psr.c +3
-3-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);
Quoted 8 lines
tests/pm_psr.c +0
-3-igt_assert (ret !=-1 ); - perf1 =get_perf (path);sleep (SLEEP_DURATION /1000 ); perf2 =get_perf (path); --1.9.3
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tests: Kill pm_psr
In reply to a message not in the archivekms_psr_sink_crc check psr activity, residency and exit for screen updates. So this test is useless.
--- tests/Makefile.sources | 1 - tests/pm_psr.c | 86 -------------------------------------------------- 2 files changed, 87 deletions(-) delete mode 100644 tests/pm_psr.c
tests/Makefile.sources +0 -1
@@ -146,7 +146,6 @@ TESTS_progs = \ kms_force_connector \ kms_sink_crc_basic \ kms_fence_pin_leak \ - pm_psr \ prime_udl \ $(NULL)
tests/pm_psr.c deleted +0 -86
86 lines not on this page · raw message
Signature · 1 line
1.9.3