[PATCH IGT 09/11] lib: Add igt_psr_valid_connector() and change tests to use it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jim Bride <jim.bride@xxxxxxxxxxxxxxx>
---
 lib/igt_psr.c                    | 11 +++++++++++
 lib/igt_psr.h                    |  1 +
 tests/kms_frontbuffer_tracking.c | 12 +++++++-----
 tests/kms_psr_sink_crc.c         |  2 +-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 8dda659..178842e 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -127,3 +127,14 @@ void igt_psr_print_status(int fd)
         igt_debugfs_read(fd, "i915_edp_psr_status", buf);
         igt_info("PSR status:\n%s\n", buf);
 }
+
+/**
+ * igt_psr_valid_connector:
+ * @connector: a drmModeConnector pointer to check
+ *
+ * Returns true if connector is an eDP connector.
+ */
+bool igt_psr_valid_connector(drmModeConnectorPtr connector)
+{
+	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index d6db297..08bccef 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -33,5 +33,6 @@ bool igt_psr_possible(int fd);
 bool igt_psr_active(int fd);
 bool igt_psr_await_status(int fd, bool active);
 void igt_psr_print_status(int fd);
+bool igt_psr_valid_connector(drmModeConnectorPtr connector);
 
 #endif /* IGT_PSR_H */
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index ee611b9..6f52c49 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -424,11 +424,12 @@ static void init_mode_params(struct modeset_params *params, uint32_t crtc_id,
 static bool connector_get_mode(drmModeConnectorPtr c, drmModeModeInfoPtr *mode)
 {
 	*mode = NULL;
+	bool valid = igt_psr_valid_connector(c);
 
 	if (c->connection != DRM_MODE_CONNECTED || !c->count_modes)
 		return false;
 
-	if (c->connector_type == DRM_MODE_CONNECTOR_eDP && opt.no_edp)
+	if (valid && opt.no_edp)
 		return false;
 
 	if (opt.small_modes)
@@ -461,7 +462,7 @@ static bool find_connector(bool edp_only, bool pipe_a, uint32_t forbidden_id,
 	for (i = 0; i < drm.res->count_connectors; i++) {
 		c = drm.connectors[i];
 
-		if (edp_only && c->connector_type != DRM_MODE_CONNECTOR_eDP)
+		if (edp_only && !igt_psr_valid_connector(c))
 			continue;
 		if (pipe_a && !connector_supports_pipe_a(c))
 			continue;
@@ -1395,7 +1396,7 @@ static void setup_sink_crc(void)
 	drmModeConnectorPtr c;
 
 	c = get_connector(prim_mode_params.connector_id);
-	if (c->connector_type != DRM_MODE_CONNECTOR_eDP) {
+	if (!igt_psr_valid_connector(c)) {
 		igt_info("Sink CRC not supported: primary screen is not eDP\n");
 		sink_crc.supported = false;
 		return;
@@ -1531,8 +1532,9 @@ static bool psr_sink_has_support(void)
 
 static void setup_psr(void)
 {
-	if (get_connector(prim_mode_params.connector_id)->connector_type !=
-	    DRM_MODE_CONNECTOR_eDP) {
+	drmModeConnectorPtr c = get_connector(prim_mode_params.connector_id);
+	
+	if (!igt_psr_valid_connector(c)) {
 		igt_info("Can't test PSR: no usable eDP screen.\n");
 		return;
 	}
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index c9f7993..da8c173 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -103,7 +103,7 @@ static void setup_output(data_t *data)
 	for_each_pipe_with_valid_output(display, pipe, output) {
 		drmModeConnectorPtr c = output->config.connector;
 
-		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
+		if (!igt_psr_valid_connector(c))
 			continue;
 
 		igt_output_set_pipe(output, pipe);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux