[igt-dev] [PATCH v3 1/3] tests/amdgpu/amd_psr: add interactive option of PSR visual confirm

Leo Li sunpeng.li at amd.com
Thu Apr 14 14:28:44 UTC 2022



On 2022-04-12 15:21, David Zhang wrote:
> [why & how]
> AMDGPU DM debugfs provides a debug option of PSR visual confirm,
> we'd make it an interactive option that provides capability to
> usermode to choose if or not to enable the PSR visual confirm.
> 
> - add interactive option "visual-confirm" and by-default we select
>    it as TRUE to enable visual confirm for PSR-SU test cases.
> - set PSR visual confirm debugfs if interactive debug option of
>    visual confirm set before any test run begins, and reset after
>    any test run ends.
> 
> changes in v2:
> ------------------
> - drop the "_dm_" from helpers of visual confirm debugfs set/get
> - drop the non-necessary visual confirm option check after set
>    and reset, before and after the test run, respectively
> - align the 2nd line code w/ previous line's opening brace
> 
> Cc: Rodrigo Siqueira <rodrigo.siqueira at amd.com>
> Cc: Harry Wentland <harry.wentland at amd.com>
> Cc: Leo Li <sunpeng.li at amd.com>
> Cc: Jay Pillai <aurabindo.pillai at amd.com>
> Cc: Wayne Lin <wayne.lin at amd.com>
> 
> Signed-off-by: David Zhang <dingchen.zhang at amd.com>
Reviewed-by: Leo Li <sunpeng.li at amd.com>

Thanks!
Leo

> ---
>   tests/amdgpu/amd_psr.c | 42 ++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/amdgpu/amd_psr.c b/tests/amdgpu/amd_psr.c
> index 58e40d2b..0ec50c9f 100644
> --- a/tests/amdgpu/amd_psr.c
> +++ b/tests/amdgpu/amd_psr.c
> @@ -62,6 +62,12 @@ typedef struct data {
>   	int h;
>   } data_t;
>   
> +struct {
> +	bool visual_confirm;
> +} opt = {
> +	.visual_confirm = true,	/* visual confirm debug option */
> +};
> +
>   static void draw_color_alpha(igt_fb_t *fb, int x, int y, int w, int h,
>   		             double r, double g, double b, double a)
>   {
> @@ -300,10 +306,31 @@ static void run_check_psr_su_mpo(data_t *data)
>   	for (int i = 0; i < N_MPO_TEST_RECT_FB; ++i)
>   		igt_remove_fb(data->fd, &rect_fb[i]);
>   	test_fini(data);
> -	close(data->fd);
>   }
>   
> -igt_main
> +const char *help_str =
> +"  --visual-confirm           PSR visual confirm debug option enable\n";
> +
> +struct option long_options[] = {
> +	{"visual-confirm",	optional_argument, NULL, 'v'},
> +	{ 0, 0, 0, 0 }
> +};
> +
> +static int opt_handler(int option, int option_index, void *data)
> +{
> +	switch (option) {
> +	case 'v':
> +		opt.visual_confirm = strtol(optarg, NULL, 0);
> +		igt_info(" PSR Visual Confirm %s\n", opt.visual_confirm ? "enabled" : "disabled");
> +		break;
> +	default:
> +		return IGT_OPT_HANDLER_ERROR;
> +	}
> +
> +	return IGT_OPT_HANDLER_SUCCESS;
> +}
> +
> +igt_main_args("", long_options, help_str, opt_handler, NULL)
>   {
>   	data_t data;
>   
> @@ -321,6 +348,13 @@ igt_main
>   		igt_display_require(&data.display, data.fd);
>   		igt_require(&data.display.is_atomic);
>   		igt_display_require_output(&data.display);
> +
> +		/* check if visual confirm option available */
> +		if (opt.visual_confirm) {
> +			igt_skip_on(!igt_amd_has_visual_confirm(data.fd));
> +			igt_skip_on_f(!igt_amd_set_visual_confirm(data.fd, VISUAL_CONFIRM_PSR),
> +				      "set PSR visual confirm failed\n");
> +		}
>   	}
>   
>   	igt_describe("Test whether PSR can be enabled with static screen");
> @@ -335,6 +369,10 @@ igt_main
>   
>   	igt_fixture
>   	{
> +		if (opt.visual_confirm) {
> +			igt_require_f(igt_amd_set_visual_confirm(data.fd, VISUAL_CONFIRM_DISABLE),
> +				      "reset PSR visual confirm option failed\n");
> +		}
>   		close(data.debugfs_fd);
>   		igt_display_fini(&data.display);
>   	}


More information about the igt-dev mailing list