Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] tests/kms_dp_aux_dev: Factor out helper checking for sink detect errors
@ 2023-03-23 16:18 Imre Deak
  2023-03-23 16:18 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_dp_aux_dev: Treat ENXIO as a sink detect error Imre Deak
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Imre Deak @ 2023-03-23 16:18 UTC (permalink / raw)
  To: igt-dev

For clarity, factor out a helper to check if the AUX transfer failed
due to not detecting the sink being connected.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/kms_dp_aux_dev.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/kms_dp_aux_dev.c b/tests/kms_dp_aux_dev.c
index 850ec8e26..86e111bf2 100644
--- a/tests/kms_dp_aux_dev.c
+++ b/tests/kms_dp_aux_dev.c
@@ -42,6 +42,19 @@ static bool is_mst_connector(int drm_fd, uint32_t connector_id)
 				    NULL, NULL);
 }
 
+static bool sink_detect_error(int drm_fd, uint32_t connector_id, int error_code)
+{
+	switch (error_code) {
+	case ETIMEDOUT:
+		return true;
+	case EIO:
+		return is_mst_connector(drm_fd, connector_id) ||
+		       is_amdgpu_device(drm_fd);
+	default:
+		return false;
+	};
+}
+
 static bool test(int drm_fd, uint32_t connector_id)
 {
 	drmModeConnector *connector;
@@ -85,9 +98,7 @@ static bool test(int drm_fd, uint32_t connector_id)
 			 ret > 0 ? "success" : strerror(errno));
 
 		igt_assert(ret == sizeof(buf) ||
-			   errno == ETIMEDOUT ||
-			   (errno == EIO && (is_mst_connector(drm_fd, connector_id) ||
-			    is_amdgpu_device(drm_fd))));
+			   sink_detect_error(drm_fd, connector_id, errno));
 
 		close(fd);
 
-- 
2.37.1

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

end of thread, other threads:[~2023-03-23 23:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 16:18 [igt-dev] [PATCH i-g-t 1/2] tests/kms_dp_aux_dev: Factor out helper checking for sink detect errors Imre Deak
2023-03-23 16:18 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_dp_aux_dev: Treat ENXIO as a sink detect error Imre Deak
2023-03-23 23:11   ` Sripada, Radhakrishna
2023-03-23 17:12 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_dp_aux_dev: Factor out helper checking for sink detect errors Patchwork
2023-03-23 22:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-23 23:18   ` Imre Deak
2023-03-23 23:10 ` [igt-dev] [PATCH i-g-t 1/2] " Sripada, Radhakrishna

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