tests/kms_frontbuffer_tracking: Rework to prevent modesets!
cover tests/kms_frontbuffer_tracking: Rework to prevent modesets!
Now that FBC can be toggled at runtime, I wanted to make sure that we try to prevent modesets as much as we can.
Patch 4 is still experimental, and needs kernel support to work. Still wanted to add it, but can be skipped in reviews.
Maarten Lankhorst (5):
lib/igt_aux: Add igt_get_module_param_int. tests/kms_frontbuffer_tracking: Rework toggling drrs/fbc/psr. tests/kms_frontbuffer_tracking: Fix basic subtest tests/kms_frontbuffer_tracking: Add support for toggling edp psr
through debugfs, to prevent a modeset
tests/kms_frontbuffer_tracking: Remove redundant modesets during
subtest start, v2.
lib/igt_aux.c | 61 ++++++++++++++++++ lib/igt_aux.h | 3 + tests/kms_frontbuffer_tracking.c | 136 +++++++++++++++++++++++++++++---------- 3 files changed, 166 insertions(+), 34 deletions(-)
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 1/5 lib/igt_aux: Add igt_get_module_param_int.
This is useful for retrieving the current module parameter value, without having to write helper code for each callsite.
--- lib/igt_aux.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_aux.h | 3 +++ 2 files changed, 64 insertions(+)
lib/igt_aux.c +61 -0
@@ -1286,6 +1286,67 @@ void igt_set_module_param_int(const char *name, int val)igt_set_module_param (name, str); } +/** +* igt_set_module_param: +* @name: i915.ko parameter name +* +* This function returns the current value for the given i915.ko parameter. +* This value must be freed with free(). +* +* Please consider using igt_get_module_param_int() for the integer and bool +* parameters. +*/ +char *igt_get_module_param (const char *name) +{ +char file_path[PARAM_FILE_PATH_MAX_SZ ]; +char str[PARAM_VALUE_MAX_SZ ], *dup; +int fd; +ssize_t ret; + +igt_assert_f (strlen (name) <PARAM_NAME_MAX_SZ , +"Need to increase PARAM_NAME_MAX_SZ\n" ); +strcpy (file_path,MODULE_PARAM_DIR ); +strcpy (file_path +strlen (MODULE_PARAM_DIR ), name); + + fd =open (file_path,O_RDWR ); + ret =read (fd, str,sizeof (str)); +igt_assert (ret >0 ); +igt_assert_f (ret <PARAM_VALUE_MAX_SZ , +"Need to increase PARAM_VALUE_MAX_SZ\n" ); + str[ret] =0 ; + +igt_assert (close (fd) ==0 ); + + dup =strdup (str); +igt_assert (dup); +return dup; +} + +/** +* igt_get_module_param_int: +* @name: i915.ko parameter name +* +* This is a wrapper for igt_get_module_param() that returns an integer +* instead of a string. Please see igt_get_module_param(). +*/ +int igt_get_module_param_int (const char *name) +{ +char *val =igt_get_module_param (name); + +int ret; + +if (*val =='Y' ) + ret =1 ; +else if (*val =='N' ) + ret =0 ; +else + ret =strtoll (val,NULL ,10 ); + +free (val); + +return ret; +} +/** * igt_terminate_process: * @sig: Signal to send
lib/igt_aux.h +3 -0
@@ -284,6 +284,9 @@ double igt_stop_siglatency(struct igt_mean *result);void igt_set_module_param (const char *name,const char *val);void igt_set_module_param_int (const char *name,int val); +char *igt_get_module_param (const char *name); +int igt_get_module_param_int (const char *name); +int igt_terminate_process (int sig,const char *comm);void igt_lsof (const char *dpath);
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 2/5 tests/kms_frontbuffer_tracking: Rework toggling drrs/fbc/psr.
In reply to Maarten LankhorstAdd a helper <feature>_set for each function, and allow -1 to restore the initial value. This is useful for the basic subtest, which is run near the end.
--- tests/kms_frontbuffer_tracking.c | 63 +++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 20 deletions(-)
tests/kms_frontbuffer_tracking.c +43 -20
@@ -747,7 +747,7 @@ static void __debugfs_read(const char *param, char *buf, int len) buf[len] ='\0' ; } -static int __debugfs_write (const char *param,char *buf,int len) +static int __debugfs_write (const char *param,const char *buf,int len) {return igt_sysfs_write (drm.debugfs, param, buf, len -1 ); }
@@ -781,24 +781,54 @@ static void psr_print_status(void)igt_info ("PSR status:\n%s\n" , buf); } -static void drrs_set (unsigned int val) +static void drrs_set (int val) {char buf[2 ];int ret;igt_debug ("Manually %sabling DRRS. %u\n" , val ?"en" :"dis" , val); -snprintf (buf,sizeof (buf),"%d" , val); +snprintf (buf,sizeof (buf),"%d" , !!val); ret =debugfs_write ("i915_drrs_ctl" , buf);/* -* drrs_enable() is called on DRRS capable platform only, -* whereas drrs_disable() is called on all platforms. -* So handle the failure of debugfs_write only for drrs_enable(). +* enabling psr is done on DRRS capable platform only, +* whereas disabling/default is called on all platforms. +* So handle the failure of debugfs_write only when explicitly enabling drrs. */ -if (val) +if (val >0 )igt_assert_f (ret == (sizeof (buf) -1 ),"debugfs_write failed" ); } +static bool psr_set (int val) +{ +int oldval; +static int default_psr =-1 ; + + oldval =igt_get_module_param_int ("enable_psr" ); +if (default_psr ==-1 ) + default_psr = oldval; + +if (val ==-1 ) + val = default_psr; + +igt_set_module_param_int ("enable_psr" , val); + +return val != oldval; +} + +static void fbc_set (int val) +{ +static int default_fbc =-1 ; + +if (default_fbc ==-1 ) + default_fbc =igt_get_module_param_int ("enable_fbc" ); + +if (val ==-1 ) + val = default_fbc; + +igt_set_module_param_int ("enable_fbc" , val); +} +static bool is_drrs_high (void ) {char buf[MAX_DRRS_STATUS_BUF_LEN ];
@@ -963,13 +993,6 @@ static bool drrs_wait_until_rr_switch_to_low(void)return igt_wait (is_drrs_low (),5000 ,1 ); } -#define fbc_enable () igt_set_module_param_int("enable_fbc", 1) -#define fbc_disable () igt_set_module_param_int("enable_fbc", 0) -#define psr_enable () igt_set_module_param_int("enable_psr", 1) -#define psr_disable () igt_set_module_param_int("enable_psr", 0) -#define drrs_enable () drrs_set(1) -#define drrs_disable () drrs_set(0) -static void get_sink_crc (sink_crc_t *crc,bool mandatory) {int rc, errno_;
@@ -1198,9 +1221,9 @@ static void disable_features(const struct test_mode *t)if (t->feature ==FEATURE_DEFAULT )return ; -fbc_disable (); -psr_disable (); -drrs_disable (); +fbc_set (0 ); +psr_set (0 ); +drrs_set (0 ); }static void *busy_thread_func (void *data)
@@ -1830,11 +1853,11 @@ static void enable_features_for_test(const struct test_mode *t)return ;if (t->feature &FEATURE_FBC ) -fbc_enable (); +fbc_set (1 );if (t->feature &FEATURE_PSR ) -psr_enable (); +psr_set (1 );if (t->feature &FEATURE_DRRS ) -drrs_enable (); +drrs_set (1 ); }static void check_test_requirements (const struct test_mode *t)
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 3/5 tests/kms_frontbuffer_tracking: Fix basic subtest
In reply to Maarten LankhorstWhen running the entire binary, we have touched features before running the basic subtest. Restore them back to the defaults.
--- tests/kms_frontbuffer_tracking.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tests/kms_frontbuffer_tracking.c +5 -4
@@ -1218,9 +1218,6 @@ static void unset_all_crtcs(void)static void disable_features (const struct test_mode *t) { -if (t->feature ==FEATURE_DEFAULT ) -return ; -fbc_set (0 );psr_set (0 );drrs_set (0 );
@@ -1849,8 +1846,12 @@ static void set_region_for_test(const struct test_mode *t,static void enable_features_for_test (const struct test_mode *t) { -if (t->feature ==FEATURE_DEFAULT ) +if (t->feature ==FEATURE_DEFAULT ) { +fbc_set (-1 ); +psr_set (-1 ); +drrs_set (-1 );return ; + }if (t->feature &FEATURE_FBC )fbc_set (1 );
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 4/5 tests/kms_frontbuffer_tracking: Add support for toggling edp psr through debugfs.
In reply to Maarten LankhorstIt's harmful to write to enable_psr at runtime, and the patch that allows us to change i915_edp_psr_status with the panel running will require us to abandon the module parameter. Hence the userspace change needs to be put in IGT first before we can change it at kernel time.
Toggling it to debugfs will mean we can skip a modeset when changing our feature set.
--- tests/kms_frontbuffer_tracking.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
tests/kms_frontbuffer_tracking.c +19 -1
@@ -799,11 +799,29 @@ static void drrs_set(int val)igt_assert_f (ret == (sizeof (buf) -1 ),"debugfs_write failed" ); } +static void restore_psr_debugfs (int sig) +{ +debugfs_write ("i915_edp_psr_status" ,"-1" ); +} +static bool psr_set (int val) { -int oldval; +char buf[4 ]; +int ret, oldval;static int default_psr =-1 ; +snprintf (buf,sizeof (buf),"%i\n" , val); + + ret =debugfs_write ("i915_edp_psr_status" , buf); +if (ret != -EINVAL ) { +igt_assert (ret >0 || val <=0 ); + +if (ret >0 ) +igt_install_exit_handler (restore_psr_debugfs); + +return false; + } + oldval =igt_get_module_param_int ("enable_psr" );if (default_psr ==-1 ) default_psr = oldval;
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 5/5 tests/kms_frontbuffer_tracking: Remove redundant modesets during subtest start, v2.
In reply to Maarten LankhorstCRC capturing enables the display, then disables it again. With igt_display we can use igt_display_reset to restore the original state, without committing it to the hw.
All subtests first set their own state anyway, so we can save up on the number of commits.
Changes since v1:
- Try to avoid modesets for PSR if the kernel supports it, but otherwise force a modeset for the changes to take effect.
--- tests/kms_frontbuffer_tracking.c | 56 ++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 13 deletions(-)
tests/kms_frontbuffer_tracking.c +43 -13
@@ -1234,11 +1234,11 @@ static void unset_all_crtcs(void)igt_display_commit (&drm.display); } -static void disable_features (const struct test_mode *t) +static bool disable_features (const struct test_mode *t) {fbc_set (0 ); -psr_set (0 );drrs_set (0 ); +return psr_set (0 ); }static void *busy_thread_func (void *data)
@@ -1331,7 +1331,7 @@ static void init_blue_crc(enum pixel_format format, bool mandatory_sink_crc)print_crc ("Blue CRC: " , &blue_crcs[format].crc); -unset_all_crtcs (); +igt_display_reset (&drm.display);igt_remove_fb (drm.fd, &blue);
@@ -1383,7 +1383,7 @@ static void init_crcs(enum pixel_format format,print_crc ("" , &pattern->crcs[format][r]); } -unset_all_crtcs (); +igt_display_reset (&drm.display);for (r =0 ; r < pattern->n_rects; r++)igt_remove_fb (drm.fd, &tmp_fbs[r]);
@@ -1848,6 +1848,22 @@ static void enable_scnd_screen_and_wait(const struct test_mode *t)do_assertions (ASSERT_NO_ACTION_CHANGE ); } +static void enable_both_screens_and_wait (const struct test_mode *t) +{ +fill_fb_region (&prim_mode_params.primary,COLOR_PRIM_BG ); +fill_fb_region (&scnd_mode_params.primary,COLOR_SCND_BG ); + +__set_mode_for_params (&prim_mode_params); +__set_mode_for_params (&scnd_mode_params); + +igt_display_commit2 (&drm.display, drm.display.is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY ); + + wanted_crc = &blue_crcs[t->format].crc; +fbc_update_last_action (); + +do_assertions (ASSERT_NO_ACTION_CHANGE ); +} +static void set_region_for_test (const struct test_mode *t,struct fb_region *reg) {
@@ -1862,21 +1878,24 @@ static void set_region_for_test(const struct test_mode *t,do_assertions (ASSERT_NO_ACTION_CHANGE ); } -static void enable_features_for_test (const struct test_mode *t) +static bool enable_features_for_test (const struct test_mode *t) { +bool ret = false; +if (t->feature ==FEATURE_DEFAULT ) {fbc_set (-1 ); -psr_set (-1 );drrs_set (-1 ); -return ; +return psr_set (-1 ); }if (t->feature &FEATURE_FBC )fbc_set (1 );if (t->feature &FEATURE_PSR ) -psr_set (1 ); + ret =psr_set (1 );if (t->feature &FEATURE_DRRS )drrs_set (1 ); + +return ret; }static void check_test_requirements (const struct test_mode *t)
@@ -1960,28 +1979,40 @@ static void set_crtc_fbs(const struct test_mode *t)static void prepare_subtest_data (const struct test_mode *t,struct draw_pattern_info *pattern) { +bool need_modeset; +check_test_requirements (t);stop_busy_thread (); -disable_features (t); + need_modeset =disable_features (t);set_crtc_fbs (t);if (t->screen ==SCREEN_OFFSCREEN )fill_fb_region (&offscreen_fb,COLOR_OFFSCREEN_BG ); -unset_all_crtcs (); +igt_display_reset (&drm.display); +if (need_modeset) +igt_display_commit (&drm.display);init_blue_crc (t->format, t->feature &FEATURE_PSR );if (pattern)init_crcs (t->format, pattern, t->feature &FEATURE_PSR ); -enable_features_for_test (t); +igt_display_reset (&drm.display); + + need_modeset =enable_features_for_test (t); +if (need_modeset) +igt_display_commit (&drm.display); }static void prepare_subtest_screens (const struct test_mode *t) { -enable_prim_screen_and_wait (t); +if (t->pipes ==PIPE_DUAL ) +enable_both_screens_and_wait (t); +else +enable_prim_screen_and_wait (t); +if (t->screen ==SCREEN_PRIM ) {if (t->plane ==PLANE_CUR )set_region_for_test (t, &prim_mode_params.cursor);
@@ -1992,7 +2023,6 @@ static void prepare_subtest_screens(const struct test_mode *t)if (t->pipes ==PIPE_SINGLE )return ; -enable_scnd_screen_and_wait (t);if (t->screen ==SCREEN_SCND ) {if (t->plane ==PLANE_CUR )set_region_for_test (t, &scnd_mode_params.cursor);
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_frontbuffer_tracking: Rework to prevent modesets!
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: tests/kms_frontbuffer_tracking: Rework to prevent modesets!
URL : https://patchwork.freedesktop.org/series/39803/
State : success
== Summary ==
IGT patchset tested on top of latest successful build 89b915f5aa465d5c3498b170b1572fae20460491 tests/pm_rpm: Don't try to create an X-tiled ARGB8888 framebuffer
with latest DRM-Tip kernel build CI_DRM_3915da600bbe2441 drm-tip: 2018y-03m-12d-22h-06m-53s UTC integration manifest
No testlist changes.
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:434s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:383s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:533s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:299s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:513s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:516s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:498s fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:407s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:578s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:426s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:313s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:531s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:401s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:419s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:476s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:427s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:480s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:468s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:513s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:646s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:440s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:538s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:533s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:498s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:511s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:427s fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:399s Blacklisted hosts: fi-cfl-u total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:509s fi-cnl-drrs total:288 pass:256 dwarn:4 dfail:0 fail:0 skip:28 time:532s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1112/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for tests/kms_frontbuffer_tracking: Rework to prevent modesets!
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: tests/kms_frontbuffer_tracking: Rework to prevent modesets!
URL : https://patchwork.freedesktop.org/series/39803/
State : success
== Summary ==
---- Known issues:
Test gem_eio:
Subgroup in-flight-contexts:
incomplete -> PASS (shard-apl) fdo#105341
Test kms_atomic_transition:
Subgroup 1x-modeset-transitions-nonblocking-fencing:
fail -> PASS (shard-apl) fdo#103207
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
skip -> PASS (shard-snb) fdo#103375
Test kms_rotation_crc:
Subgroup sprite-rotation-180:
pass -> FAIL (shard-snb) fdo#105185
Test kms_sysfs_edid_timing:
warn -> PASS (shard-apl) fdo#100047
Test kms_vblank:
Subgroup pipe-a-ts-continuation-dpms-suspend:
pass -> INCOMPLETE (shard-hsw) fdo#103540fdo#105341 https://bugs.freedesktop.org/show_bug.cgi?id=105341
fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
shard-apl total:3473 pass:1831 dwarn:1 dfail:0 fail:7 skip:1634 time:12978s shard-hsw total:3447 pass:1766 dwarn:1 dfail:0 fail:2 skip:1676 time:10845s shard-snb total:3473 pass:1364 dwarn:1 dfail:0 fail:4 skip:2104 time:7191s
Blacklisted hosts:
shard-kbl total:3408 pass:1921 dwarn:1 dfail:1 fail:9 skip:1475 time:9526s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1112/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 1/5] lib/igt_aux: Add igt_get_module_param_int.
In reply to Maarten LankhorstQuoting Maarten Lankhorst (2018-03-12 17:30:09)
Quoted 2 lines
This is useful for retrieving the current module parameter value, without having to write helper code for each callsite.
See lib/igt_sysfs.c
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev