[igt-dev] [PATCH i-g-t v4] tests/kms_plane: Restrict the test execution to two pipes

Modem, Bhanuprakash bhanuprakash.modem at intel.com
Tue May 11 05:57:21 UTC 2021


> From: Patnana, Venkata Sai <venkata.sai.patnana at intel.com>
> Sent: Monday, May 10, 2021 6:44 PM
> To: igt-dev at lists.freedesktop.org
> Cc: B S, Karthik <karthik.b.s at intel.com>; Shankar, Uma
> <uma.shankar at intel.com>; Patnana, Venkata Sai <venkata.sai.patnana at intel.com>;
> Modem, Bhanuprakash <bhanuprakash.modem at intel.com>; Latvala, Petri
> <petri.latvala at intel.com>
> Subject: [PATCH i-g-t v4] tests/kms_plane: Restrict the test execution to two
> pipes
> 
> From: Patnana Venkata Sai <venkata.sai.patnana at intel.com>
> 
> v2: Moved to igt tests to dynamic (petri)
> v3: Implemented clamping in the tests directly
>     with an open-coded counting (petri)
> v4: Updated subtest as suggested(petri)
>     Updated Help string (Bhanu)
> Cc: Uma Shankar <uma.shankar at intel.com>
> Cc: Modem Bhanuprakash <bhanuprakash.modem at intel.com>
> Cc: Karthik B S <karthik.b.s at intel.com>
> Cc: Petri Latvala <petri.latvala at intel.com>
> Signed-off-by: Patnana Venkata Sai <venkata.sai.patnana at intel.com>
> ---
>  tests/kms_plane.c | 132 +++++++++++++++++++++++++++++++++-------------
>  1 file changed, 96 insertions(+), 36 deletions(-)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 9fe253a8c3..7729f45a15 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -39,6 +39,9 @@
>   */
>  #define LUT_MASK 0xf800
> 
> +/* restricted pipe count */
> +#define CRTC_RESTRICT_CNT 2
> +
>  typedef struct {
>  	float red;
>  	float green;
> @@ -60,6 +63,8 @@ typedef struct {
>  	bool extended;
>  } data_t;
> 
> +bool all_pipes;
Please make this "static" variable.
 
> +
>  static color_t red   = { 1.0f, 0.0f, 0.0f };
>  static color_t green = { 0.0f, 1.0f, 0.0f };
>  static color_t blue  = { 0.0f, 0.0f, 1.0f };
> @@ -1057,62 +1062,115 @@ test_pixel_formats(data_t *data, enum pipe pipe)
>  	igt_assert_f(result, "At least one CRC mismatch happened\n");
>  }
> 
> +static bool is_pipe_limit_reached(int count) {
> +	return count == CRTC_RESTRICT_CNT && !all_pipes;

Nothing wrong with this condition check, still I suggest to use ">=" for
extra precaution.
 
> +}
> +
>  static void
> -run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
> +run_tests_for_pipe_plane(data_t *data)
>  {
> +	enum pipe pipe;
> +	int count;
>  	igt_fixture {
>  		igt_require_pipe(&data->display, pipe);
>  		igt_require(data->display.pipes[pipe].n_planes > 0);
>  	}
> 
>  	igt_describe("verify the pixel formats for given plane and pipe");
> -	igt_subtest_f("pixel-format-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_pixel_formats(data, pipe);
> -
> +	igt_subtest_with_dynamic_f("pixel-format-planes") {

Subtest names are not meaning full to me. How about below suggestions?

igt_subtest_with_dynamic_f("something")
	igt_dynamic_f("pipe-%s-planes", pipe_name)

(OR)

igt_subtest_with_dynamic_f("plane-something")
	igt_dynamic_f("pipe-%s", pipe_name)

> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_pixel_formats(data, pipe);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
>  	igt_describe("verify the pixel formats for given plane and pipe with
> source clamping");
> -	igt_subtest_f("pixel-format-pipe-%s-planes-source-clamping",
> -		      kmstest_pipe_name(pipe)) {
> -		data->crop = 4;
> -		test_pixel_formats(data, pipe);
> +	igt_subtest_with_dynamic_f("pixel-format-planes-source-clamping") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe)) {
> +				data->crop = 4;
> +				test_pixel_formats(data, pipe);
> +			}
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
>  	}
> 
>  	data->crop = 0;
>  	igt_describe("verify plane position using two planes to create a fully
> covered screen");
> -	igt_subtest_f("plane-position-covered-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_position(data, pipe, 0);
> +	igt_subtest_with_dynamic_f("plane-position-covered-planes") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_position(data, pipe, 0);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
> 
>  	igt_describe("verify plane position using two planes to create a
> partially covered screen");
> -	igt_subtest_f("plane-position-hole-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_position(data, pipe,
> -				    TEST_POSITION_PARTIALLY_COVERED);
> +	igt_subtest_with_dynamic_f("plane-position-hole-planes") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_position(data, pipe,
> +				TEST_POSITION_PARTIALLY_COVERED);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
> 
>  	igt_describe("verify plane position using two planes to create a
> partially covered screen and"
>  		       "check for DPMS");
> -	igt_subtest_f("plane-position-hole-dpms-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_position(data, pipe,
> -				    TEST_POSITION_PARTIALLY_COVERED |
> -				    TEST_DPMS);
> +	igt_subtest_with_dynamic_f("plane-position-hole-dpms-planes") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_position(data, pipe,
> +				TEST_POSITION_PARTIALLY_COVERED | TEST_DPMS);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
> 
>  	igt_describe("verify plane panning at top-left position using primary
> plane");
> -	igt_subtest_f("plane-panning-top-left-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_panning(data, pipe, TEST_PANNING_TOP_LEFT);
> +	igt_subtest_with_dynamic_f("plane-panning-top-left-planes") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_panning(data, pipe, TEST_PANNING_TOP_LEFT);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
> 
>  	igt_describe("verify plane panning at bottom-right position using
> primary plane");
> -	igt_subtest_f("plane-panning-bottom-right-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_panning(data, pipe, TEST_PANNING_BOTTOM_RIGHT);
> +	igt_subtest_with_dynamic_f("plane-panning-bottom-right-planes") {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_panning(data, pipe,
> TEST_PANNING_BOTTOM_RIGHT);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
> 
>  	igt_describe("verify plane panning at bottom-right position using
> primary plane and executes system"
>  		       "suspend cycles");
> -	igt_subtest_f("plane-panning-bottom-right-suspend-pipe-%s-planes",
> -		      kmstest_pipe_name(pipe))
> -		test_plane_panning(data, pipe, TEST_PANNING_BOTTOM_RIGHT |
> -					       TEST_SUSPEND_RESUME);
> +	igt_subtest_with_dynamic_f("plane-panning-bottom-right-suspend-planes")
> {
> +		count = 0;
> +		for_each_pipe(&data->display, pipe) {
> +			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
> +				test_plane_panning(data, pipe,
> +				TEST_PANNING_BOTTOM_RIGHT |
> +				TEST_SUSPEND_RESUME);
> +			if (is_pipe_limit_reached(++count))
> +				break;
> +		}
> +	}
>  }
> 
>  static int opt_handler(int opt, int opt_index, void *_data)
> @@ -1123,6 +1181,9 @@ static int opt_handler(int opt, int opt_index, void
> *_data)
>  	case 'e':
>  		data->extended = true;
>  		break;
> +	case 'p':
> +		all_pipes = true;
> +		break;
>  	}
> 
>  	return IGT_OPT_HANDLER_SUCCESS;
> @@ -1130,18 +1191,18 @@ static int opt_handler(int opt, int opt_index, void
> *_data)
> 
>  static const struct option long_opts[] = {
>  	{ .name = "extended", .has_arg = false, .val = 'e', },
> +	{ .name = "all_pipes", .has_arg = false, .val = 'p', },
>  	{}
>  };
> 
>  static const char help_str[] =
> -	"  --extended\t\tRun the extended tests\n";
> +	"  --extended\t\tRun the extended tests\n"
> +	"  --all_pipes\t\tRun on all pipes.(Default it will Run only two
I think we need to use "-" instead of "_" for long_opts names
s/--all_pipes/--all-pipes/

> pipes)\n";
> 
>  static data_t data;
> 
>  igt_main_args("", long_opts, help_str, opt_handler, &data)
>  {
> -	enum pipe pipe;
> -
>  	igt_fixture {
>  		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
> 
> @@ -1151,8 +1212,7 @@ igt_main_args("", long_opts, help_str, opt_handler,
> &data)
>  		igt_display_require(&data.display, data.drm_fd);
>  	}
> 
> -	for_each_pipe_static(pipe)
> -		run_tests_for_pipe_plane(&data, pipe);
> +	run_tests_for_pipe_plane(&data);
> 
>  	igt_fixture {
>  		igt_display_fini(&data.display);
> --
> 2.25.1



More information about the igt-dev mailing list