[PATCH i-g-t 4/4] tests/intel/kms_big_joiner: add tests for force joiner

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Wed Mar 20 13:17:00 UTC 2024


On 3/10/2024 7:57 PM, Kunal Joshi wrote:
> add tests for force joiner
>
> Cc: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
> Cc: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
> Cc: Karthik B S <karthik.b.s at intel.com>
> Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
> ---
>   tests/intel/kms_big_joiner.c | 101 +++++++++++++++++++++++++++++------
>   1 file changed, 85 insertions(+), 16 deletions(-)
>
> diff --git a/tests/intel/kms_big_joiner.c b/tests/intel/kms_big_joiner.c
> index d4b0d1100..6017b30cd 100644
> --- a/tests/intel/kms_big_joiner.c
> +++ b/tests/intel/kms_big_joiner.c
> @@ -44,13 +44,20 @@
>    * SUBTEST: basic-bigjoiner
>    * Description: Verify the basic modeset on big joiner mode on all pipes
>    *
> + * SUBTEST: invalid-modeset-force-joiner
> + * Description: Verify if the modeset on the adjoining pipe is rejected when
> + *              the pipe is active with a force joiner modeset
> + *
> + * SUBTEST: basic-force-joiner
> + * Description: Verify the basic modeset on force joiner mode on all pipes
>    */
>   
> -IGT_TEST_DESCRIPTION("Test big joiner");
> +IGT_TEST_DESCRIPTION("Test big joiner / force joiner");
>   
>   #define INVALID_TEST_OUTPUT 2
>   
>   typedef struct {
> +	bool force_joiner_supported;
>   	int drm_fd;
>   	int big_joiner_output_count;
>   	int non_big_joiner_output_count;
> @@ -90,6 +97,17 @@ static igt_output_t *get_output_by_id_or_assert(data_t *data, uint64_t id)
>   	return NULL;
>   }
>   
> +static void toggle_force_joiner_on_all_non_big_joiner_outputs(data_t *data, bool toggle)
> +{
> +	int i;
> +	igt_output_t *output;
> +
> +	for (i = 0; i < data->non_big_joiner_output_count; i++) {
> +		output = get_output_by_id_or_assert(data, data->non_big_joiner_output[i]);
> +		igt_force_bigjoiner_enable(data->drm_fd, output->name, toggle);

Perhaps we should check if the force enable was success.


> +	}
> +}
> +
>   static enum pipe get_next_master_pipe(data_t *data, unsigned int available_pipe_mask)
>   {
>   	if ((data->master_pipes & available_pipe_mask) == 0)
> @@ -98,7 +116,7 @@ static enum pipe get_next_master_pipe(data_t *data, unsigned int available_pipe_
>   	return ffs(data->master_pipes & available_pipe_mask) - 1;
>   }
>   
> -static void test_single_joiner(data_t *data, int output_count)
> +static void test_single_joiner(data_t *data, int output_count, bool force_joiner)
>   {
>   	int i, ret;
>   	enum pipe pipe, master_pipe;
> @@ -110,7 +128,7 @@ static void test_single_joiner(data_t *data, int output_count)
>   	igt_fb_t fb;
>   	drmModeModeInfo *mode;
>   
> -	outputs = data->big_joiner_output;
> +	outputs = force_joiner ? data->non_big_joiner_output : data->big_joiner_output;
>   
>   	for (i = 0; i < output_count; i++) {
>   		output = get_output_by_id_or_assert(data, outputs[i]);
> @@ -121,7 +139,8 @@ static void test_single_joiner(data_t *data, int output_count)
>   			master_pipe = get_next_master_pipe(data, available_pipe_mask & attempt_mask);
>   			if (master_pipe == PIPE_NONE)
>   				continue;
> -			igt_info("Using pipe %s as master and %s slave for %s\n", kmstest_pipe_name(pipe), kmstest_pipe_name(pipe + 1), output->name);
> +			igt_info("Using pipe %s as master and %s slave for %s\n", kmstest_pipe_name(pipe),
> +					 kmstest_pipe_name(pipe + 1), output->name);
>   			igt_output_set_pipe(output, pipe);
>   			mode = igt_output_get_mode(output);
>   			primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> @@ -134,7 +153,7 @@ static void test_single_joiner(data_t *data, int output_count)
>   	}
>   }
>   
> -static void test_multi_joiner(data_t *data, int output_count)
> +static void test_multi_joiner(data_t *data, int output_count, bool force_joiner)

force_joiner is not used in this function.

Also there seem to be an overlap with test_single_joiner, so there seem 
to be some code we can take out as a separate function, without 
compromising readability.


>   {
>   	int i, ret;
>   	unsigned int available_pipe_mask;
> @@ -158,7 +177,8 @@ static void test_multi_joiner(data_t *data, int output_count)
>   			if (master_pipe == PIPE_NONE)
>   				continue;
>   
> -			igt_info("Using pipe %s as master %s slave for %s\n", kmstest_pipe_name(pipe), kmstest_pipe_name(pipe + 1), output->name);
> +			igt_info("Using pipe %s as master %s slave for %s\n", kmstest_pipe_name(pipe),
> +					 kmstest_pipe_name(pipe + 1), output->name);
>   			igt_output_set_pipe(output, pipe);
>   			mode = igt_output_get_mode(output);
>   			primary[i] = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> @@ -176,7 +196,7 @@ static void test_multi_joiner(data_t *data, int output_count)
>   }
>   
>   static void test_invalid_modeset_two_joiner(data_t *data,
> -					    bool combined)
> +					    bool combined,  bool force_joiner)

Here too force_joiner is not used.


Regards,

Ankit

>   {
>   	int i, j, ret;
>   	uint64_t *outputs;
> @@ -209,7 +229,7 @@ static void test_invalid_modeset_two_joiner(data_t *data,
>   	}
>   }
>   
> -static void tets_big_joiner_on_last_pipe(data_t *data)
> +static void test_joiner_on_last_pipe(data_t *data, bool force_joiner)
>   {
>   	int i, len, ret;
>   	uint64_t *outputs;
> @@ -218,8 +238,8 @@ static void tets_big_joiner_on_last_pipe(data_t *data)
>   	igt_fb_t fb;
>   	drmModeModeInfo *mode;
>   
> -	len = data->big_joiner_output_count;
> -	outputs = data->big_joiner_output;
> +	len = force_joiner ? data->non_big_joiner_output_count : data->big_joiner_output_count;
> +	outputs = force_joiner ? data->non_big_joiner_output : data->big_joiner_output;
>   
>   	for (i = 0; i < len; i++) {
>   		igt_display_reset(&data->display);
> @@ -247,6 +267,7 @@ igt_main
>   	data_t data;
>   
>   	igt_fixture {
> +		data.force_joiner_supported = false;
>   		data.big_joiner_output_count = 0;
>   		data.non_big_joiner_output_count = 0;
>   		data.combined_output_count = 0;
> @@ -274,7 +295,10 @@ igt_main
>   				data.big_joiner_output[data.big_joiner_output_count++] = output->config.connector->connector_id;
>   				igt_output_override_mode(output, &connector->modes[0]);
>   			} else {
> -				data.non_big_joiner_output[data.non_big_joiner_output_count++] = output->config.connector->connector_id;
> +				if (has_force_joiner_debugfs(data.drm_fd, output)) {
> +					data.force_joiner_supported = true;
> +					data.non_big_joiner_output[data.non_big_joiner_output_count++] = output->config.connector->connector_id;
> +				}
>   			}
>   			data.output_count++;
>   		}
> @@ -297,10 +321,10 @@ igt_main
>   			igt_require_f(data.n_pipes > 1,
>   				      "Minimum 2 pipes required\n");
>   			igt_dynamic_f("single-joiner")
> -				test_single_joiner(&data, data.big_joiner_output_count);
> +				test_single_joiner(&data, data.big_joiner_output_count, false);
>   			if (data.big_joiner_output_count > 1)
>   				igt_dynamic_f("multi-joiner")
> -					test_multi_joiner(&data, data.big_joiner_output_count);
> +					test_multi_joiner(&data, data.big_joiner_output_count, false);
>   
>   	}
>   
> @@ -309,13 +333,58 @@ igt_main
>   		igt_require_f(data.n_pipes > 1, "Minimum of 2 pipes are required\n");
>   		if (data.big_joiner_output_count >= 1)
>   			igt_dynamic_f("big_joiner_on_last_pipe")
> -				tets_big_joiner_on_last_pipe(&data);
> +				test_joiner_on_last_pipe(&data, false);
>   		if (data.big_joiner_output_count > 1)
>   			igt_dynamic_f("invalid_combinations")
> -				test_invalid_modeset_two_joiner(&data, false);
> +				test_invalid_modeset_two_joiner(&data, false, false);
>   		if (data.combined_output_count)
>   			igt_dynamic_f("combined_output")
> -				test_invalid_modeset_two_joiner(&data, true);
> +				test_invalid_modeset_two_joiner(&data, true, false);
> +	}
> +
> +	igt_describe("Verify the basic modeset on big joiner mode on all pipes");
> +	igt_subtest_with_dynamic("basic-force-joiner") {
> +			igt_require_f(data.force_joiner_supported,
> +						 "force joiner not supported on this platform or none of the connected output supports it\n");
> +			igt_require_f(data.non_big_joiner_output_count > 0,
> +				      "No non big joiner output found\n");
> +			igt_require_f(data.n_pipes > 1,
> +				      "Minimum 2 pipes required\n");
> +			igt_dynamic_f("single") {
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
> +				test_single_joiner(&data, data.non_big_joiner_output_count, true);
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
> +
> +			}
> +			if (data.non_big_joiner_output_count > 1) {
> +				igt_dynamic_f("multi") {
> +					toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
> +					test_multi_joiner(&data, data.non_big_joiner_output_count, true);
> +					toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
> +				}
> +			}
> +	}
> +
> +	igt_subtest_with_dynamic("invalid-modeset-force-joiner") {
> +			igt_require_f(data.force_joiner_supported,
> +						 "force joiner not supported on this platform or none of the connected output supports it\n");
> +		igt_require_f(data.non_big_joiner_output_count > 0, "Non big joiner output not found\n");
> +		igt_require_f(data.n_pipes > 1, "Minimum of 2 pipes are required\n");
> +
> +		if (data.non_big_joiner_output_count >= 1) {
> +			igt_dynamic_f("big_joiner_on_last_pipe") {
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
> +				test_joiner_on_last_pipe(&data, true);
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
> +			}
> +		}
> +		if (data.non_big_joiner_output_count > 1) {
> +			igt_dynamic_f("invalid_combinations") {
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, true);
> +				test_invalid_modeset_two_joiner(&data, true, false);
> +				toggle_force_joiner_on_all_non_big_joiner_outputs(&data, false);
> +			}
> +		}
>   	}
>   
>   	igt_fixture {


More information about the igt-dev mailing list