Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_amd: Re-try display_require if require output is not valid
@ 2023-11-22 17:20 Hersen Wu
  2023-11-22 17:20 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hersen Wu @ 2023-11-22 17:20 UTC (permalink / raw)
  To: igt-dev, rodrigo.siqueira, aurabindo.pillai, alex.hung,
	hamza.mahfooz, sunpeng.li
  Cc: Hersen Wu, markyacoub

Add igt_amd_display_require_retry to re-try
igt_display_require.

At entry of each test, display setup is done by
igt_display_require and igt_display_require_output.
igt display require output may not be valid yet,
this will let test be skipped. By re-try
igt_display_require, require output could be valid.
This will fix test case intermittent skip issue.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
---
 lib/igt_amd.c | 19 +++++++++++++++++++
 lib/igt_amd.h | 16 ++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 247a42f37..c068f07e7 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -1298,3 +1298,22 @@ bool igt_amd_set_visual_confirm(int drm_fd, enum amdgpu_debug_visual_confirm opt
 
 	return res;
 }
+
+/**
+ * is_igt_amd_display_require_output_valid:
+ * @display: A pointer to an #igt_display_t structure
+ *
+ * Checks whether there's a valid @pipe/@output combination for the given @display
+ * Returns: true if a valid combination of @pipe and @output is found, or false
+ * if not found
+ */
+bool is_igt_amd_display_require_output_valid(igt_display_t *display)
+{
+	enum pipe pipe;
+	igt_output_t *output;
+
+	for_each_pipe_with_valid_output(display, pipe, output)
+		return true;
+
+	return false;
+}
diff --git a/lib/igt_amd.h b/lib/igt_amd.h
index 1e66348ad..529b3beba 100644
--- a/lib/igt_amd.h
+++ b/lib/igt_amd.h
@@ -202,4 +202,20 @@ bool igt_amd_set_visual_confirm(int drm_fd, enum amdgpu_debug_visual_confirm opt
 void igt_amd_get_mall_status(int drm_fd, bool *supported, bool *enabled);
 void igt_amd_get_subvp_status(int drm_fd, bool *supported, bool *enabled);
 bool igt_amd_output_has_odm_combine_segments(int drm_fd, char *connector_name);
+
+bool is_igt_amd_display_require_output_valid(igt_display_t *display);
+
+#define igt_amd_display_require_retry(display, fd, delay, retry_times) \
+	for (int j__ = 0; j__ < retry_times + 1; j__++) { \
+		igt_display_require(display, fd); \
+		if (is_igt_amd_display_require_output_valid(display)) { \
+			if (j__ > 0) \
+				igt_info("retry times:%d delay:%d seconds\n", j__, delay * j__); \
+			break; \
+		} \
+		if (j__ == retry_times) \
+			igt_skip("No valid crtc/connector combinations found.\n"); \
+		else \
+			sleep(delay); \
+	}
 #endif /* IGT_AMD_H */
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_kms: Re-try display_require if require output is not valid
@ 2023-08-11 22:12 Hersen Wu
  2023-08-11 22:12 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
  0 siblings, 1 reply; 8+ messages in thread
From: Hersen Wu @ 2023-08-11 22:12 UTC (permalink / raw)
  To: igt-dev, rodrigo.siqueira, aurabindo.pillai, alex.hung,
	stylon.wang, hamza.mahfooz, sunpeng.li
  Cc: Hersen Wu, markyacoub

Add igt_display_require_retry to re-try igt_display_require.

At entry of each test, display setup is done by
igt_display_require and igt_display_require_output.
igt display require output may not be valid yet,
this will let test be skipped. By re-try
igt_display_require, require output could be valid.
This will fix test case intermittent skip issue.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
---
 lib/igt_kms.c | 19 +++++++++++++++++++
 lib/igt_kms.h | 15 +++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e0959ccff..5506e2eb2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2862,6 +2862,25 @@ void igt_display_require_output(igt_display_t *display)
 	igt_skip("No valid crtc/connector combinations found.\n");
 }
 
+/**
+ * is_igt_display_require_output_valid:
+ * @display: A pointer to an #igt_display_t structure
+ *
+ * Checks whether there's a valid @pipe/@output combination for the given @display
+ * Returns: true if a valid combination of @pipe and @output is found, or false
+ * if not found
+ */
+bool is_igt_display_require_output_valid(igt_display_t *display)
+{
+	enum pipe pipe;
+	igt_output_t *output;
+
+	for_each_pipe_with_valid_output(display, pipe, output)
+		return true;
+
+	return false;
+}
+
 /**
  * igt_display_require_output_on_pipe:
  * @display: A pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 91355c910..f801b87e6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -485,6 +485,7 @@ int  igt_display_drop_events(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);
 void igt_display_require_output(igt_display_t *display);
 void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
+bool is_igt_display_require_output_valid(igt_display_t *display);
 
 const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
@@ -722,6 +723,20 @@ uint64_t igt_plane_get_prop(igt_plane_t *plane, enum igt_atomic_plane_properties
 		igt_plane_set_prop_changed(plane, prop); \
 	} while (0)
 
+#define igt_display_require_retry(display, fd, delay, retry_times) \
+	for (int j__ = 0; j__ < retry_times + 1; j__++) { \
+		igt_display_require(display, fd); \
+		if (is_igt_display_require_output_valid(display)) { \
+			if (j__ > 0) \
+				igt_info("retry times:%d delay:%d seconds\n", j__, delay * j__); \
+			break; \
+		} \
+		if (j__ == retry_times) \
+			igt_skip("No valid crtc/connector combinations found.\n"); \
+		else \
+			sleep(delay); \
+	}
+
 extern bool igt_plane_try_prop_enum(igt_plane_t *plane,
 				    enum igt_atomic_plane_properties prop,
 				    const char *val);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_kms: Re-try display_require if require output is not valid
@ 2023-08-10 14:52 Hersen Wu
  2023-08-10 14:52 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
  0 siblings, 1 reply; 8+ messages in thread
From: Hersen Wu @ 2023-08-10 14:52 UTC (permalink / raw)
  To: igt-dev, rodrigo.siqueira, aurabindo.pillai, alex.hung,
	stylon.wang, hamza.mahfooz, sunpeng.li
  Cc: Hersen Wu, markyacoub

Add igt_display_setup to re-try igt_display_require.

At entry of each test, display setup is done by
igt_display_require and igt_display_require_output.
igt display require output may not be valid yet,
this will let test be skipped. By re-try
igt_display_require, require output could be valid.
This will fix test case intermittent skip issue.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
---
 lib/igt_kms.c | 19 +++++++++++++++++++
 lib/igt_kms.h | 16 ++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e0959ccff..5506e2eb2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2862,6 +2862,25 @@ void igt_display_require_output(igt_display_t *display)
 	igt_skip("No valid crtc/connector combinations found.\n");
 }
 
+/**
+ * is_igt_display_require_output_valid:
+ * @display: A pointer to an #igt_display_t structure
+ *
+ * Checks whether there's a valid @pipe/@output combination for the given @display
+ * Returns: true if a valid combination of @pipe and @output is found, or false
+ * if not found
+ */
+bool is_igt_display_require_output_valid(igt_display_t *display)
+{
+	enum pipe pipe;
+	igt_output_t *output;
+
+	for_each_pipe_with_valid_output(display, pipe, output)
+		return true;
+
+	return false;
+}
+
 /**
  * igt_display_require_output_on_pipe:
  * @display: A pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 91355c910..350966214 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -485,6 +485,7 @@ int  igt_display_drop_events(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);
 void igt_display_require_output(igt_display_t *display);
 void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
+bool is_igt_display_require_output_valid(igt_display_t *display);
 
 const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
@@ -722,6 +723,21 @@ uint64_t igt_plane_get_prop(igt_plane_t *plane, enum igt_atomic_plane_properties
 		igt_plane_set_prop_changed(plane, prop); \
 	} while (0)
 
+#define IGT_DISPLAY_REQUIRE_OUTPUT_VALID_MAX_RETRY_TIMES 5
+
+#define igt_display_setup(display, fd, delay) \
+	for (int j__ = 0; j__ < IGT_DISPLAY_REQUIRE_OUTPUT_VALID_MAX_RETRY_TIMES; j__++) { \
+		igt_display_require(display, fd); \
+		if (is_igt_display_require_output_valid(display)) { \
+			if (j__ > 0) \
+				igt_info("retry times:%d delay:%d seconds\n", j__, delay * j__); \
+			break; \
+		} \
+		sleep(delay); \
+		if (j__ == IGT_DISPLAY_REQUIRE_OUTPUT_VALID_MAX_RETRY_TIMES - 1) \
+			igt_skip("No valid crtc/connector combinations found.\n"); \
+	}
+
 extern bool igt_plane_try_prop_enum(igt_plane_t *plane,
 				    enum igt_atomic_plane_properties prop,
 				    const char *val);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-22 22:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 17:20 [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_amd: Re-try display_require if require output is not valid Hersen Wu
2023-11-22 17:20 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
2023-11-22 21:23 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/2,i-g-t] lib/igt_amd: Re-try display_require if require output is not valid Patchwork
2023-11-22 22:37 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-08-11 22:12 [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_kms: " Hersen Wu
2023-08-11 22:12 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
2023-08-11 22:38   ` Alex Hung
2023-08-10 14:52 [igt-dev] [PATCH 1/2] [i-g-t] lib/igt_kms: Re-try display_require if require output is not valid Hersen Wu
2023-08-10 14:52 ` [igt-dev] [PATCH 2/2] [i-g-t] tests/amdgpu: Fix display tests be skipped intermittently Hersen Wu
2023-08-11 15:15   ` Wu, Hersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox