[PATCH i-g-t v2 2/8] lib/igt_kms: Change output->pending_crtc_idx_mask to output->pending_pipe

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

 



igt_output_set_pipe with PIPE_ANY used to mean that we bind the output
to any pipe, but this is now a deprecated alias for PIPE_NONE, and
means the output will be unbound.

Because of this it's better to change output->pending_crtc_idx_mask to
an enum pipe, because only a single choice may be given for a pipe.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
---
 lib/igt_kms.c                 | 46 ++++++++++++++++++++-----------------------
 lib/igt_kms.h                 |  2 +-
 tests/kms_atomic_transition.c |  4 ++--
 tests/kms_busy.c              |  2 +-
 tests/kms_cursor_legacy.c     |  2 +-
 5 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 7bcafc072f70..a5db6bc493c2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1561,9 +1561,10 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
 static void igt_output_refresh(igt_output_t *output)
 {
 	igt_display_t *display = output->display;
-	unsigned long crtc_idx_mask;
+	unsigned long crtc_idx_mask = 0;
 
-	crtc_idx_mask = output->pending_crtc_idx_mask;
+	if (output->pending_pipe != PIPE_NONE)
+		crtc_idx_mask = 1 << output->pending_pipe;
 
 	kmstest_free_connector_config(&output->config);
 
@@ -1587,11 +1588,8 @@ static void igt_output_refresh(igt_output_t *output)
 						    BROADCAST_RGB_FULL);
 	}
 
-	if (output->config.pipe == PIPE_NONE)
-		return;
-
 	LOG(display, "%s: Selecting pipe %s\n", output->name,
-	    kmstest_pipe_name(output->config.pipe));
+	    kmstest_pipe_name(output->pending_pipe));
 }
 
 static bool
@@ -1830,7 +1828,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * a pipe is set with igt_output_set_pipe().
 		 */
 		output->force_reprobe = true;
-		output->pending_crtc_idx_mask = 0;
+		output->pending_pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
@@ -1960,10 +1958,12 @@ static void igt_display_refresh(igt_display_t *display)
 	for (i = 0; i < display->n_outputs; i++) {
 		output = &display->outputs[i];
 
-		if (pipes_in_use & output->pending_crtc_idx_mask)
-			goto report_dup;
+		if (output->pending_pipe != PIPE_NONE) {
+			if (pipes_in_use & (1 << output->pending_pipe))
+				goto report_dup;
 
-		pipes_in_use |= output->pending_crtc_idx_mask;
+			pipes_in_use |= 1 << output->pending_pipe;
+		}
 
 		if (output->force_reprobe)
 			igt_output_refresh(output);
@@ -1975,11 +1975,11 @@ report_dup:
 	for (; i > 0; i--) {
 		igt_output_t *b = &display->outputs[i - 1];
 
-		igt_assert_f(output->pending_crtc_idx_mask !=
-			     b->pending_crtc_idx_mask,
+		igt_assert_f(output->pending_pipe !=
+			     b->pending_pipe,
 			     "%s and %s are both trying to use pipe %s\n",
 			     igt_output_name(output), igt_output_name(b),
-			     kmstest_pipe_name(ffs(b->pending_crtc_idx_mask) - 1));
+			     kmstest_pipe_name(output->pending_pipe));
 	}
 }
 
@@ -1988,7 +1988,7 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 	igt_display_t *display = output->display;
 	enum pipe pipe;
 
-	if (!output->pending_crtc_idx_mask) {
+	if (output->pending_pipe == PIPE_NONE) {
 		/*
 		 * The user hasn't specified a pipe to use, return none.
 		 */
@@ -1998,7 +1998,7 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 		 * Otherwise, return the pending pipe (ie the pipe that should
 		 * drive this output after the commit()
 		 */
-		pipe = ffs(output->pending_crtc_idx_mask) - 1;
+		pipe = output->pending_pipe;
 	}
 
 	igt_assert(pipe >= 0 && pipe < display->n_pipes);
@@ -2051,7 +2051,7 @@ static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
 	for (i = 0; i < display->n_outputs; i++) {
 		igt_output_t *output = &display->outputs[i];
 
-		if (output->pending_crtc_idx_mask == (1 << pipe->pipe))
+		if (output->pending_pipe == pipe->pipe)
 			return output;
 	}
 
@@ -2860,22 +2860,18 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
 
 	igt_assert(output->name);
 
-	if (output->pending_crtc_idx_mask) {
+	if (output->pending_pipe != PIPE_NONE) {
 		old_pipe = igt_output_get_driving_pipe(output);
 
 		old_pipe->mode_changed = true;
 	}
 
-	if (pipe == PIPE_NONE) {
-		LOG(display, "%s: set_pipe(any)\n", igt_output_name(output));
-		output->pending_crtc_idx_mask = 0;
-	} else {
-		LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
-		    kmstest_pipe_name(pipe));
-		output->pending_crtc_idx_mask = 1 << pipe;
+	LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
+	    kmstest_pipe_name(pipe));
+	output->pending_pipe = pipe;
 
+	if (pipe != PIPE_NONE)
 		display->pipes[pipe].mode_changed = true;
-	}
 
 	output->config.pipe_changed = true;
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 62197dcfea7b..8dc118c961b7 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -361,7 +361,7 @@ typedef struct {
 	struct kmstest_connector_config config;
 	char *name;
 	bool force_reprobe;
-	unsigned long pending_crtc_idx_mask;
+	enum pipe pending_pipe;
 	bool use_override_mode;
 	drmModeModeInfo override_mode;
 } igt_output_t;
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 48823a09aed2..2ae75f2d6630 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -644,7 +644,7 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
 		event_mask |= 1 << pipe;
 
 		for_each_valid_output_on_pipe(display, pipe, output) {
-			if (output->pending_crtc_idx_mask)
+			if (output->pending_pipe != PIPE_NONE)
 				continue;
 
 			mode = igt_output_get_mode(output);
@@ -726,7 +726,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 			pipe_crcs[i] = igt_pipe_crc_new(display->drm_fd, i, INTEL_PIPE_CRC_SOURCE_AUTO);
 
 		for_each_valid_output_on_pipe(display, i, output) {
-			if (output->pending_crtc_idx_mask)
+			if (output->pending_pipe != PIPE_NONE)
 				continue;
 
 			igt_output_set_pipe(output, i);
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index f430beaf7373..0828a8b38a06 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -41,7 +41,7 @@ set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
 		drmModeModeInfoPtr mode;
 		igt_plane_t *primary;
 
-		if (output->pending_crtc_idx_mask)
+		if (output->pending_pipe != PIPE_NONE)
 			continue;
 
 		igt_output_set_pipe(output, pipe);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 65a001a9dec0..fc7526833673 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -155,7 +155,7 @@ static igt_output_t *set_fb_on_crtc(igt_display_t *display, enum pipe pipe, stru
 		drmModeModeInfoPtr mode;
 		igt_plane_t *primary;
 
-		if (output->pending_crtc_idx_mask)
+		if (output->pending_pipe != PIPE_NONE)
 			continue;
 
 		igt_output_set_pipe(output, pipe);
-- 
2.14.1

_______________________________________________
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