All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Starkey <rodrigosiqueiramelo@gmail.com>
To: Brian Starkey <Brian.Starkey@arm.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Petri Latvala <petri.latvala@intel.com>,
	Arkadiusz Hiler <arkadiusz.hiler@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	nd <nd@arm.com>
Subject: [PATCH V6 i-g-t 5/6] lib/igt_kms: Add igt_output_clone_pipe for cloning
Date: Wed, 12 Jun 2019 23:18:34 -0300	[thread overview]
Message-ID: <9f4a3f1d1c9df084ec2bf8e9b7475bbeda5f0985.1560374714.git.rodrigosiqueiramelo@gmail.com> (raw)
In-Reply-To: <cover.1560374714.git.rodrigosiqueiramelo@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5657 bytes --]

An output can be added as a clone of any other output(s) attached to a
pipe using igt_output_clone_pipe()

v5: Drop field out_fence_requested from struct igt_pipe (Brian Starkey)

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 lib/igt_kms.c | 100 +++++++++++++++++++++++++++++++-------------------
 lib/igt_kms.h |   4 ++
 2 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 140db346..b85a0404 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1765,6 +1765,17 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
 	igt_assert(display->log_shift >= 0);
 }
 
+static int igt_output_idx(igt_output_t *output)
+{
+	int i;
+
+	for (i = 0; i < output->display->n_outputs; i++)
+		if (&output->display->outputs[i] == output)
+			return i;
+
+	return -1;
+}
+
 static void igt_output_refresh(igt_output_t *output)
 {
 	igt_display_t *display = output->display;
@@ -2317,42 +2328,6 @@ void igt_display_fini(igt_display_t *display)
 	display->planes = NULL;
 }
 
-static void igt_display_refresh(igt_display_t *display)
-{
-	igt_output_t *output;
-	int i;
-
-	unsigned long pipes_in_use = 0;
-
-       /* Check that two outputs aren't trying to use the same pipe */
-	for (i = 0; i < display->n_outputs; i++) {
-		output = &display->outputs[i];
-
-		if (output->pending_pipe != PIPE_NONE) {
-			if (pipes_in_use & (1 << output->pending_pipe))
-				goto report_dup;
-
-			pipes_in_use |= 1 << output->pending_pipe;
-		}
-
-		if (output->force_reprobe)
-			igt_output_refresh(output);
-	}
-
-	return;
-
-report_dup:
-	for (; i > 0; i--) {
-		igt_output_t *b = &display->outputs[i - 1];
-
-		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(output->pending_pipe));
-	}
-}
-
 static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 {
 	igt_display_t *display = output->display;
@@ -2376,6 +2351,40 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 	return &display->pipes[pipe];
 }
 
+static void igt_display_refresh(igt_display_t *display)
+{
+	igt_output_t *output;
+	igt_pipe_t *pipe;
+	int i;
+
+	unsigned long pipes_in_use = 0;
+	unsigned long pending_crtc_idx_mask;
+
+	/* Check that outputs and pipes agree wrt. cloning */
+	for (i = 0; i < display->n_outputs; i++) {
+		output = &display->outputs[i];
+		pending_crtc_idx_mask = 1 << output->pending_pipe;
+
+		pipe = igt_output_get_driving_pipe(output);
+		if (pipe) {
+			igt_assert_f(pipe->outputs & (1 << igt_output_idx(output)),
+				     "Output %s not expected to be using pipe %s\n",
+				     igt_output_name(output),
+				     kmstest_pipe_name(pipe->pipe));
+
+			if (pipes_in_use & pending_crtc_idx_mask)
+				LOG(display, "Output %s clones pipe %s\n",
+				    igt_output_name(output),
+				    kmstest_pipe_name(pipe->pipe));
+		}
+
+		pipes_in_use |= pending_crtc_idx_mask;
+
+		if (output->force_reprobe)
+			igt_output_refresh(output);
+	}
+}
+
 static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int plane_idx)
 {
 	igt_require_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
@@ -3766,6 +3775,7 @@ void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode)
 	output->use_override_mode = !!mode;
 
 	if (pipe) {
+		igt_debug("overriding pipe mode in %s way\n", output->display->is_atomic ? "atomic" : "legacy");
 		if (output->display->is_atomic)
 			igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
 		else
@@ -3773,6 +3783,16 @@ void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode)
 	}
 }
 
+void igt_output_clone_pipe(igt_output_t *output, enum pipe pipe)
+{
+	igt_display_t *display = output->display;
+	uint32_t current_clones = display->pipes[pipe].outputs;
+
+	igt_output_set_pipe(output, pipe);
+
+	display->pipes[pipe].outputs |= current_clones;
+}
+
 /*
  * igt_output_set_pipe:
  * @output: Target output for which the pipe is being set to
@@ -3789,11 +3809,15 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
 
 	igt_assert(output->name);
 
-	if (output->pending_pipe != PIPE_NONE)
+	if (output->pending_pipe != PIPE_NONE) {
 		old_pipe = igt_output_get_driving_pipe(output);
+		old_pipe->outputs &= ~(1 << igt_output_idx(output));
+	}
 
-	if (pipe != PIPE_NONE)
+	if (pipe != PIPE_NONE) {
 		pipe_obj = &display->pipes[pipe];
+		pipe_obj->outputs = (1 << igt_output_idx(output));
+	}
 
 	LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
 	    kmstest_pipe_name(pipe));
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index cacc6b90..676839bb 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -354,6 +354,8 @@ struct igt_pipe {
 	uint32_t crtc_id;
 
 	int32_t out_fence_fd;
+
+	uint32_t outputs;
 };
 
 typedef struct {
@@ -411,6 +413,8 @@ const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
 void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
+void igt_output_clone_pipe(igt_output_t *output, enum pipe pipe);
+
 igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx);
 igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type);
 int igt_output_count_plane_type(igt_output_t *output, int plane_type);
-- 
2.21.0

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

WARNING: multiple messages have this Message-ID (diff)
From: Brian Starkey <rodrigosiqueiramelo@gmail.com>
To: Brian Starkey <Brian.Starkey@arm.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Petri Latvala <petri.latvala@intel.com>,
	Arkadiusz Hiler <arkadiusz.hiler@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	nd <nd@arm.com>
Subject: [igt-dev] [PATCH V6 i-g-t 5/6] lib/igt_kms: Add igt_output_clone_pipe for cloning
Date: Wed, 12 Jun 2019 23:18:34 -0300	[thread overview]
Message-ID: <9f4a3f1d1c9df084ec2bf8e9b7475bbeda5f0985.1560374714.git.rodrigosiqueiramelo@gmail.com> (raw)
In-Reply-To: <cover.1560374714.git.rodrigosiqueiramelo@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5657 bytes --]

An output can be added as a clone of any other output(s) attached to a
pipe using igt_output_clone_pipe()

v5: Drop field out_fence_requested from struct igt_pipe (Brian Starkey)

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 lib/igt_kms.c | 100 +++++++++++++++++++++++++++++++-------------------
 lib/igt_kms.h |   4 ++
 2 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 140db346..b85a0404 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1765,6 +1765,17 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
 	igt_assert(display->log_shift >= 0);
 }
 
+static int igt_output_idx(igt_output_t *output)
+{
+	int i;
+
+	for (i = 0; i < output->display->n_outputs; i++)
+		if (&output->display->outputs[i] == output)
+			return i;
+
+	return -1;
+}
+
 static void igt_output_refresh(igt_output_t *output)
 {
 	igt_display_t *display = output->display;
@@ -2317,42 +2328,6 @@ void igt_display_fini(igt_display_t *display)
 	display->planes = NULL;
 }
 
-static void igt_display_refresh(igt_display_t *display)
-{
-	igt_output_t *output;
-	int i;
-
-	unsigned long pipes_in_use = 0;
-
-       /* Check that two outputs aren't trying to use the same pipe */
-	for (i = 0; i < display->n_outputs; i++) {
-		output = &display->outputs[i];
-
-		if (output->pending_pipe != PIPE_NONE) {
-			if (pipes_in_use & (1 << output->pending_pipe))
-				goto report_dup;
-
-			pipes_in_use |= 1 << output->pending_pipe;
-		}
-
-		if (output->force_reprobe)
-			igt_output_refresh(output);
-	}
-
-	return;
-
-report_dup:
-	for (; i > 0; i--) {
-		igt_output_t *b = &display->outputs[i - 1];
-
-		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(output->pending_pipe));
-	}
-}
-
 static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 {
 	igt_display_t *display = output->display;
@@ -2376,6 +2351,40 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 	return &display->pipes[pipe];
 }
 
+static void igt_display_refresh(igt_display_t *display)
+{
+	igt_output_t *output;
+	igt_pipe_t *pipe;
+	int i;
+
+	unsigned long pipes_in_use = 0;
+	unsigned long pending_crtc_idx_mask;
+
+	/* Check that outputs and pipes agree wrt. cloning */
+	for (i = 0; i < display->n_outputs; i++) {
+		output = &display->outputs[i];
+		pending_crtc_idx_mask = 1 << output->pending_pipe;
+
+		pipe = igt_output_get_driving_pipe(output);
+		if (pipe) {
+			igt_assert_f(pipe->outputs & (1 << igt_output_idx(output)),
+				     "Output %s not expected to be using pipe %s\n",
+				     igt_output_name(output),
+				     kmstest_pipe_name(pipe->pipe));
+
+			if (pipes_in_use & pending_crtc_idx_mask)
+				LOG(display, "Output %s clones pipe %s\n",
+				    igt_output_name(output),
+				    kmstest_pipe_name(pipe->pipe));
+		}
+
+		pipes_in_use |= pending_crtc_idx_mask;
+
+		if (output->force_reprobe)
+			igt_output_refresh(output);
+	}
+}
+
 static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int plane_idx)
 {
 	igt_require_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
@@ -3766,6 +3775,7 @@ void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode)
 	output->use_override_mode = !!mode;
 
 	if (pipe) {
+		igt_debug("overriding pipe mode in %s way\n", output->display->is_atomic ? "atomic" : "legacy");
 		if (output->display->is_atomic)
 			igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_MODE_ID, igt_output_get_mode(output), sizeof(*mode));
 		else
@@ -3773,6 +3783,16 @@ void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode)
 	}
 }
 
+void igt_output_clone_pipe(igt_output_t *output, enum pipe pipe)
+{
+	igt_display_t *display = output->display;
+	uint32_t current_clones = display->pipes[pipe].outputs;
+
+	igt_output_set_pipe(output, pipe);
+
+	display->pipes[pipe].outputs |= current_clones;
+}
+
 /*
  * igt_output_set_pipe:
  * @output: Target output for which the pipe is being set to
@@ -3789,11 +3809,15 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
 
 	igt_assert(output->name);
 
-	if (output->pending_pipe != PIPE_NONE)
+	if (output->pending_pipe != PIPE_NONE) {
 		old_pipe = igt_output_get_driving_pipe(output);
+		old_pipe->outputs &= ~(1 << igt_output_idx(output));
+	}
 
-	if (pipe != PIPE_NONE)
+	if (pipe != PIPE_NONE) {
 		pipe_obj = &display->pipes[pipe];
+		pipe_obj->outputs = (1 << igt_output_idx(output));
+	}
 
 	LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
 	    kmstest_pipe_name(pipe));
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index cacc6b90..676839bb 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -354,6 +354,8 @@ struct igt_pipe {
 	uint32_t crtc_id;
 
 	int32_t out_fence_fd;
+
+	uint32_t outputs;
 };
 
 typedef struct {
@@ -411,6 +413,8 @@ const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
 void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
+void igt_output_clone_pipe(igt_output_t *output, enum pipe pipe);
+
 igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx);
 igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type);
 int igt_output_count_plane_type(igt_output_t *output, int plane_type);
-- 
2.21.0

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-06-13  2:18 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13  2:14 [PATCH V6 i-g-t 0/6] igt: Add support for testing writeback connectors Rodrigo Siqueira
2019-06-13  2:14 ` [igt-dev] " Rodrigo Siqueira
2019-06-13  2:16 ` [PATCH V6 i-g-t 1/6] lib/igt_kms: Add writeback support Brian Starkey
2019-06-13  2:16   ` [Intel-gfx] " Brian Starkey
2019-06-13 14:54   ` Liviu Dudau
2019-06-13 14:54     ` [igt-dev] " Liviu Dudau
2019-06-18 21:56     ` Rodrigo Siqueira
2019-06-18 21:56       ` [igt-dev] " Rodrigo Siqueira
2019-07-03 12:15       ` Ser, Simon
2019-07-03 12:15         ` Ser, Simon
2019-07-09 14:32         ` Rodrigo Siqueira
2019-07-09 14:32           ` Rodrigo Siqueira
2019-07-09 14:42           ` Ser, Simon
2019-07-09 14:42             ` Ser, Simon
2019-07-09 15:07             ` Rodrigo Siqueira
2019-07-09 15:07               ` Rodrigo Siqueira
2019-07-10  8:48   ` Ser, Simon
2019-07-10  8:48     ` Ser, Simon
2019-06-13  2:16 ` [PATCH V6 i-g-t 2/6] kms_writeback: Add initial writeback tests Brian Starkey
2019-06-13  2:16   ` [igt-dev] " Brian Starkey
2019-07-10 11:57   ` Ser, Simon
2019-07-10 11:57     ` Ser, Simon
2019-07-12  2:44     ` Rodrigo Siqueira
2019-07-12  2:44       ` Rodrigo Siqueira
2019-07-12 11:40       ` Ser, Simon
2019-07-12 11:40         ` Ser, Simon
2019-07-17  1:21         ` Rodrigo Siqueira
2019-07-17  1:21           ` Rodrigo Siqueira
2019-07-17 13:00           ` Ser, Simon
2019-07-17 13:00             ` Ser, Simon
2019-07-16 15:22       ` Liviu.Dudau
2019-07-16 15:22         ` Liviu.Dudau
2019-07-17 11:46         ` Ser, Simon
2019-07-17 11:46           ` [Intel-gfx] " Ser, Simon
2019-07-18  9:49           ` Liviu.Dudau
2019-07-18  9:49             ` Liviu.Dudau
2019-07-18  9:56             ` Ser, Simon
2019-07-18  9:56               ` Ser, Simon
2019-07-18 11:15               ` Liviu.Dudau
2019-07-18 11:15                 ` Liviu.Dudau
2019-07-18 11:46                 ` Ser, Simon
2019-07-18 11:46                   ` Ser, Simon
2019-07-19  1:21                 ` Rodrigo Siqueira
2019-07-19  1:21                   ` Rodrigo Siqueira
2019-06-13  2:17 ` [PATCH V6 i-g-t 3/6] lib: Add function to hash a framebuffer Brian Starkey
2019-06-13  2:17   ` [Intel-gfx] " Brian Starkey
2019-07-10 15:30   ` [igt-dev] " Ser, Simon
2019-07-10 15:30     ` Ser, Simon
2019-07-10 15:34     ` Ser, Simon
2019-07-10 15:34       ` Ser, Simon
2019-07-12  2:49       ` Rodrigo Siqueira
2019-07-12  2:49         ` Rodrigo Siqueira
2019-07-12 12:17         ` Ser, Simon
2019-07-12 12:17           ` Ser, Simon
2019-07-17  1:25           ` Rodrigo Siqueira
2019-07-17  1:25             ` Rodrigo Siqueira
2019-06-13  2:17 ` [PATCH V6 i-g-t 4/6] kms_writeback: Add writeback-check-output Brian Starkey
2019-06-13  2:17   ` [igt-dev] " Brian Starkey
2019-07-12 12:34   ` Ser, Simon
2019-07-12 12:34     ` Ser, Simon
2019-06-13  2:18 ` Brian Starkey [this message]
2019-06-13  2:18   ` [igt-dev] [PATCH V6 i-g-t 5/6] lib/igt_kms: Add igt_output_clone_pipe for cloning Brian Starkey
2019-07-12 12:54   ` Ser, Simon
2019-07-12 12:54     ` Ser, Simon
2019-07-17  1:47     ` Rodrigo Siqueira
2019-07-17  1:47       ` Rodrigo Siqueira
2019-07-17 13:10       ` Ser, Simon
2019-07-17 13:10         ` Ser, Simon
2019-06-13  2:19 ` [PATCH V6 i-g-t 6/6] kms_writeback: Add tests using a cloned output Brian Starkey
2019-06-13  2:19   ` [igt-dev] " Brian Starkey
2019-06-13  3:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for igt: Add support for testing writeback connectors (rev6) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f4a3f1d1c9df084ec2bf8e9b7475bbeda5f0985.1560374714.git.rodrigosiqueiramelo@gmail.com \
    --to=rodrigosiqueiramelo@gmail.com \
    --cc=Brian.Starkey@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=arkadiusz.hiler@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nd@arm.com \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.