summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zhang <dingchen.zhang@amd.com>2022-04-18 17:32:51 -0400
committerDavid Zhang <dingchen.zhang@amd.com>2022-04-20 16:33:38 -0400
commit4793c44900d117230f1d24d5811401ec8353565d (patch)
tree18fd10c6f7c0c8cce293b72875d072e4dbef6a86
parenta44d1d4c9e7198a2d59d7dcaae38e340f7cadcf9 (diff)
tests/amdgpu/amd_psr: add interactive option of PSR visual confirm
[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@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Jay Pillai <aurabindo.pillai@amd.com> Cc: Wayne Lin <wayne.lin@amd.com> Signed-off-by: David Zhang <dingchen.zhang@amd.com> Reviewed-by: Leo Li <sunpeng.li@amd.com>
-rw-r--r--tests/amdgpu/amd_psr.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/tests/amdgpu/amd_psr.c b/tests/amdgpu/amd_psr.c
index 58e40d2bf943..0ec50c9f5c7f 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);
}