Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_flip: Set duration for subtest from command line
Date: Wed, 13 Jun 2018 16:57:29 +0300	[thread overview]
Message-ID: <20180613135729.GL23723@intel.com> (raw)
In-Reply-To: <1528894714-15939-2-git-send-email-mika.kahola@intel.com>

On Wed, Jun 13, 2018 at 03:58:33PM +0300, Mika Kahola wrote:
> To reduce the execution time of kms_flip test on CI, let's move subtest
> duration parameter as command line option. The default subtest duration
> is 0 seconds meaning that the subtest is run only once.

Single iteration doesn't seem particularly robust. The flip tests for
example are checking for jitter and such so running it just once
probably means we're not actually testing anything.

> 
> The patch reduces the kms_flip binary mode execution time on Geminilake from
> 1189 seconds down to 307 seconds with default subtest duration.
> 
> No functional changes on subtests.
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  tests/kms_flip.c | 113 +++++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 77 insertions(+), 36 deletions(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index 3d6fe94..09aaac2 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -82,6 +82,8 @@
>  #define DRM_CAP_TIMESTAMP_MONOTONIC 6
>  #endif
>  
> +#define MAX_DURATION            60
> +
>  drmModeRes *resources;
>  int drm_fd;
>  static drm_intel_bufmgr *bufmgr;
> @@ -95,6 +97,13 @@ static drmModeConnector *last_connector;
>  
>  uint32_t *fb_ptr;
>  
> +/* Command line parameters. */
> +struct {
> +	int duration;
> +} opt = {
> +	.duration = 0,
> +};
> +
>  struct type_name {
>  	int type;
>  	const char *name;
> @@ -1518,56 +1527,89 @@ static void test_nonblocking_read(int in)
>  	close(fd);
>  }
>  
> +static int opt_handler(int option, int option_index, void *input)
> +{
> +	switch (option) {
> +	case 'd':
> +		opt.duration = strtol(optarg, NULL, 0);
> +
> +		if (opt.duration > MAX_DURATION) {
> +			igt_debug("limiting test duration from %ds to %ds\n",
> +				  opt.duration, MAX_DURATION);
> +			opt.duration = MAX_DURATION;
> +		}
> +
> +		if (opt.duration < 0) {
> +			igt_debug("limiting test duration from %ds to %ds\n",
> +				  opt.duration, 0);
> +			opt.duration = 0;
> +		}
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	return 0;
> +}
> +
> +const char *help_str =
> +	"  --duration test duration in seconds (default 0s)\n";
> +
>  int main(int argc, char **argv)
>  {
> +	struct option long_options[] = {
> +		{ "duration", required_argument, NULL, 'd'},
> +		{ 0, 0, 0, 0 }
> +	};
> +
>  	struct {
> -		int duration;
>  		int flags;
>  		const char *name;
>  	} tests[] = {
> -		{ 30, TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
> -		{ 30, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
> +		{ TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
> +		{ TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
>  					"blocking-wf_vblank" },
> -		{ 30,  TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
> +		{ TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
>  					"absolute-wf_vblank" },
> -		{ 30,  TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
> +		{ TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
>  					"blocking-absolute-wf_vblank" },
> -		{ 10, TEST_FLIP | TEST_BASIC, "plain-flip" },
> -		{ 30, TEST_FLIP | TEST_EBUSY , "busy-flip" },
> -		{ 30, TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
> -		{ 30, TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
> -		{ 30, TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
> +		{ TEST_FLIP | TEST_BASIC, "plain-flip" },
> +		{ TEST_FLIP | TEST_EBUSY , "busy-flip" },
> +		{ TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
> +		{ TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
> +		{ TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
>  			"plain-flip-fb-recreate" },
> -		{ 30, TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
> -		{ 20, TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
> -		{ 30,  TEST_FLIP | TEST_PAN, "flip-vs-panning" },
> -		{ 20, TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
> -		{ 30,  TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
> +		{ TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
> +		{ TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
> +		{ TEST_FLIP | TEST_PAN, "flip-vs-panning" },
> +		{ TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
> +		{ TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
>  					"flip-vs-expired-vblank" },
>  
> -		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
> -		      TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
> -		{ 10, TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
> +		{ TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
> +		  TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
> +		{ TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
>  					"flip-vs-wf_vblank" },
> -		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
> -			TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
> -		{ 30, TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
> -		{ 30, TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
> -		{ 1, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
> +		{ TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
> +		  TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
> +		{ TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
> +		{ TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
> +		{ TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
>  
> -		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
> +		{ TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
>  					"flip-vs-dpms-off-vs-modeset" },
> -		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
> +		{ TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
>  					"single-buffer-flip-vs-dpms-off-vs-modeset" },
> -		{ 30, TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
> -		{ 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
> -		{ 10, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
> -		{ 10, TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
> -		{ 0, TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
> +		{ TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
> +		{ TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
> +		{ TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
> +		{ TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
> +		{ TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
>  	};
>  	int i;
>  
> -	igt_subtest_init(argc, argv);
> +	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
> +				    opt_handler, NULL);
>  
>  	igt_fixture {
>  		drm_fd = drm_open_driver_master(DRIVER_ANY);
> @@ -1592,7 +1634,7 @@ int main(int argc, char **argv)
>  		igt_subtest_f("%s%s",
>  			      tests[i].flags & TEST_BASIC ? "basic-" : "",
>  			      tests[i].name)
> -			run_test(tests[i].duration, tests[i].flags);
> +			run_test(opt.duration, tests[i].flags);
>  
>  		if (tests[i].flags & TEST_NO_2X_OUTPUT)
>  			continue;
> @@ -1602,7 +1644,7 @@ int main(int argc, char **argv)
>  			continue;
>  
>  		igt_subtest_f( "2x-%s", tests[i].name)
> -			run_pair(tests[i].duration, tests[i].flags);
> +			run_pair(opt.duration, tests[i].flags);
>  	}
>  
>  	igt_fork_signal_helper();
> @@ -1614,7 +1656,7 @@ int main(int argc, char **argv)
>  			continue;
>  
>  		igt_subtest_f( "%s-interruptible", tests[i].name)
> -			run_test(tests[i].duration, tests[i].flags);
> +			run_test(opt.duration, tests[i].flags);
>  
>  		if (tests[i].flags & TEST_NO_2X_OUTPUT)
>  			continue;
> @@ -1624,7 +1666,7 @@ int main(int argc, char **argv)
>  			continue;
>  
>  		igt_subtest_f( "2x-%s-interruptible", tests[i].name)
> -			run_pair(tests[i].duration, tests[i].flags);
> +			run_pair(opt.duration, tests[i].flags);
>  	}
>  	igt_stop_signal_helper();
>  
> @@ -1632,6 +1674,5 @@ int main(int argc, char **argv)
>  	 * Let drm_fd leak, since it's needed by the dpms restore
>  	 * exit_handler and igt_exit() won't return.
>  	 */
> -
>  	igt_exit();
>  }
> -- 
> 2.7.4
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-06-13 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 12:58 [igt-dev] [PATCH i-g-t v2 0/2] tests/kms_flip: Binary mode optimizations Mika Kahola
2018-06-13 12:58 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_flip: Set duration for subtest from command line Mika Kahola
2018-06-13 13:57   ` Ville Syrjälä [this message]
2018-06-14 10:40     ` Mika Kahola
2018-06-13 12:58 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/kms_flip: Change 2x tests execution order Mika Kahola
2018-06-13 15:55 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip: Binary mode optimizations (rev3) Patchwork
2018-06-13 19:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-06-12 11:19 [igt-dev] [PATCH i-g-t 1/2] tests/kms_flip: Set duration for subtest from command line Mika Kahola
2018-06-13 11:30 ` [igt-dev] [PATCH i-g-t v2 " Mika Kahola
2018-06-13 12:07   ` Chris Wilson
2018-06-13 12:49     ` Mika Kahola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180613135729.GL23723@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mika.kahola@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox