[igt-dev] [v3 i-g-t] tests/kms_flip: Restrict the hang tests execution to two pipes

Petri Latvala petri.latvala at intel.com
Fri Mar 26 12:01:59 UTC 2021


On Thu, Mar 11, 2021 at 02:30:47AM +0530, Bhanuprakash Modem wrote:
> To save the CI execution time, instead of running on all pipes
> restrict the hang tests execution to two pipes.
> 
> If we want to execute on all pipes, we need to pass an extra
> argument "-e" indicates extended.
> 
> Example: ./build/tests/kms_flip -e --r flip-vs-modeset-vs-hang
> 
> v2, v3:
> * Fix the typo in args handler (Petri)
> 
> Cc: Uma Shankar <uma.shankar at intel.com>
> Cc: Petri Latvala <petri.latvala at intel.com>
> Cc: Karthik B S <karthik.b.s at intel.com>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>

Reviewed-by: Petri Latvala <petri.latvala at intel.com>


> ---
>  tests/kms_flip.c | 52 +++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 45 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index e0d009d22..d273c9027 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -85,6 +85,10 @@
>  #define DRM_CAP_TIMESTAMP_MONOTONIC 6
>  #endif
>  
> +/* restricted pipe count */
> +#define CRTC_RESTRICT_CNT 2
> +static bool all_pipes = false;
> +
>  drmModeRes *resources;
>  int drm_fd;
>  static struct buf_ops *bops;
> @@ -1435,10 +1439,17 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
>  		__run_test_on_crtc_set(o, crtc_idxs, crtc_count, duration_ms);
>  }
>  
> +static int limit_crtc_count(int count_crtcs)
> +{
> +	return (count_crtcs > CRTC_RESTRICT_CNT)?
> +			CRTC_RESTRICT_CNT : count_crtcs;
> +}
> +
>  static int run_test(int duration, int flags)
>  {
>  	struct test_output o;
>  	int i, n, modes = 0;
> +	int count_crtcs;
>  
>  	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
>  	igt_require(!(flags & TEST_FENCE_STRESS) ||
> @@ -1447,9 +1458,14 @@ static int run_test(int duration, int flags)
>  	resources = drmModeGetResources(drm_fd);
>  	igt_require(resources);
>  
> +	count_crtcs = resources->count_crtcs;
> +	/* Limit the execution to 2 CRTCs for hang tests */
> +	if(!!(flags & TEST_HANG) && !all_pipes)
> +		count_crtcs = limit_crtc_count(count_crtcs);
> +
>  	/* Count output configurations to scale test runtime. */
>  	for (i = 0; i < resources->count_connectors; i++) {
> -		for (n = 0; n < resources->count_crtcs; n++) {
> +		for (n = 0; n < count_crtcs; n++) {
>  			memset(&o, 0, sizeof(o));
>  			o.count = 1;
>  			o._connector[0] = resources->connectors[i];
> @@ -1471,7 +1487,7 @@ static int run_test(int duration, int flags)
>  
>  	/* Find any connected displays */
>  	for (i = 0; i < resources->count_connectors; i++) {
> -		for (n = 0; n < resources->count_crtcs; n++) {
> +		for (n = 0; n < count_crtcs; n++) {
>  			int crtc_idx;
>  
>  			memset(&o, 0, sizeof(o));
> @@ -1494,6 +1510,7 @@ static int run_pair(int duration, int flags)
>  {
>  	struct test_output o;
>  	int i, j, m, n, modes = 0;
> +	int count_crtcs;
>  
>  	igt_require((flags & TEST_HANG) == 0 || !is_wedged(drm_fd));
>  	igt_require(!(flags & TEST_FENCE_STRESS) ||
> @@ -1502,11 +1519,16 @@ static int run_pair(int duration, int flags)
>  	resources = drmModeGetResources(drm_fd);
>  	igt_require(resources);
>  
> +	count_crtcs = resources->count_crtcs;
> +	/* Limit the execution to 2 CRTCs for hang tests */
> +	if(!!(flags & TEST_HANG) && !all_pipes)
> +		count_crtcs = limit_crtc_count(count_crtcs);
> +
>  	/* Find a pair of connected displays */
>  	for (i = 0; i < resources->count_connectors; i++) {
> -		for (n = 0; n < resources->count_crtcs; n++) {
> +		for (n = 0; n < count_crtcs; n++) {
>  			for (j = i + 1; j < resources->count_connectors; j++) {
> -				for (m = n + 1; m < resources->count_crtcs; m++) {
> +				for (m = n + 1; m < count_crtcs; m++) {
>  					memset(&o, 0, sizeof(o));
>  					o.count = 2;
>  					o._connector[0] = resources->connectors[i];
> @@ -1533,9 +1555,9 @@ static int run_pair(int duration, int flags)
>  
>  	/* Find a pair of connected displays */
>  	for (i = 0; i < resources->count_connectors; i++) {
> -		for (n = 0; n < resources->count_crtcs; n++) {
> +		for (n = 0; n < count_crtcs; n++) {
>  			for (j = i + 1; j < resources->count_connectors; j++) {
> -				for (m = n + 1; m < resources->count_crtcs; m++) {
> +				for (m = n + 1; m < count_crtcs; m++) {
>  					int crtc_idxs[2];
>  
>  					memset(&o, 0, sizeof(o));
> @@ -1604,7 +1626,23 @@ static void test_nonblocking_read(int in)
>  	close(fd);
>  }
>  
> -igt_main
> +static int opt_handler(int opt, int opt_index, void *data)
> +{
> +	switch (opt) {
> +		case 'e':
> +			all_pipes = true;
> +			break;
> +		default:
> +			return IGT_OPT_HANDLER_ERROR;
> +	}
> +
> +	return IGT_OPT_HANDLER_SUCCESS;
> +}
> +
> +const char *help_str =
> +	"  -e \tRun on all pipes. (By default subtests will run on two pipes)\n";
> +
> +igt_main_args("e", NULL, help_str, opt_handler, NULL)
>  {
>  	struct {
>  		int duration;
> -- 
> 2.20.1
> 


More information about the igt-dev mailing list