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 6/6] kms_writeback: Add tests using a cloned output
Date: Wed, 12 Jun 2019 23:19:01 -0300	[thread overview]
Message-ID: <454e4369191d599d038196429af4a242f4f0e5fb.1560374714.git.rodrigosiqueiramelo@gmail.com> (raw)
In-Reply-To: <cover.1560374714.git.rodrigosiqueiramelo@gmail.com>


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

Update the connector search to also optionally attempt to find a
non-writeback connector to clone to.

Add a subtest which is the same as writeback-check-output, but also
clones to the second connector.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
[rebased and addressed comments by Maarten]
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 tests/kms_writeback.c | 64 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 59 insertions(+), 5 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 0f20dadd..ae536bbf 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -51,7 +51,8 @@ static drmModePropertyBlobRes *get_writeback_formats_blob(igt_output_t *output)
 	return blob;
 }
 
-static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
+static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
+				   int pipe, igt_output_t **clone)
 {
 	igt_fb_t input_fb, output_fb;
 	igt_plane_t *plane;
@@ -91,6 +92,30 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
 
 	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
 					    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	if (!ret && clone) {
+		/* Try and find a clone */
+		int i, newret;
+		*clone = NULL;
+
+		for (i = 0; i < display->n_outputs; i++) {
+			igt_output_t *second_output = &display->outputs[i];
+			if (output != second_output &&
+			    igt_pipe_connector_valid(pipe, second_output)) {
+
+				igt_output_clone_pipe(second_output, pipe);
+				igt_output_override_mode(output, &override_mode);
+				newret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
+								       DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+				igt_output_set_pipe(second_output, PIPE_NONE);
+				igt_debug("try_commit_atomic clone returned %d\n", newret);
+				if (!newret) {
+					*clone = second_output;
+					igt_debug("Selected clone %s\n", (*clone)->name);
+					break;
+				}
+			}
+		}
+	}
 	igt_plane_set_fb(plane, NULL);
 	igt_remove_fb(display->drm_fd, &input_fb);
 	igt_remove_fb(display->drm_fd, &output_fb);
@@ -98,7 +123,8 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
 	return !ret;
 }
 
-static igt_output_t *kms_writeback_get_output(igt_display_t *display)
+static igt_output_t *kms_writeback_get_output(igt_display_t *display, enum pipe *pipe,
+					      igt_output_t **clone)
 {
 	int i;
 
@@ -114,10 +140,16 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)
 		for (j = 0; j < igt_display_get_n_pipes(display); j++) {
 			igt_output_set_pipe(output, j);
 
-			if (check_writeback_config(display, output)) {
+			if (check_writeback_config(display, output, j, clone)) {
 				igt_debug("Using connector %u:%s on pipe %d\n",
 					  output->config.connector->connector_id,
 					  output->name, j);
+				if (clone && *clone)
+					igt_debug("Cloning to connector %u:%s\n",
+						  (*clone)->config.connector->connector_id,
+						  (*clone)->name);
+				if (pipe)
+					*pipe = j;
 				return output;
 			}
 		}
@@ -335,10 +367,11 @@ static void writeback_check_output(igt_output_t *output, igt_plane_t *plane,
 igt_main
 {
 	igt_display_t display;
-	igt_output_t *output;
+	igt_output_t *output, *clone;
 	igt_plane_t *plane;
 	igt_fb_t input_fb;
 	drmModeModeInfo mode;
+	enum pipe pipe;
 	int ret;
 
 	memset(&display, 0, sizeof(display));
@@ -353,7 +386,7 @@ igt_main
 
 		igt_require(display.is_atomic);
 
-		output = kms_writeback_get_output(&display);
+		output = kms_writeback_get_output(&display, &pipe, &clone);
 		igt_require(output);
 
 		if (output->use_override_mode)
@@ -431,6 +464,27 @@ igt_main
 		igt_remove_fb(display.drm_fd, &output_fb);
 	}
 
+	igt_subtest("writeback-check-output-clone") {
+		igt_fb_t output_fb;
+
+		igt_require(clone);
+
+		ret = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
+				    DRM_FORMAT_XRGB8888,
+				    igt_fb_mod_to_tiling(0),
+				    &output_fb);
+		igt_require(ret > 0);
+
+		igt_output_clone_pipe(clone, pipe);
+		igt_output_override_mode(clone, &mode);
+
+		writeback_check_output(output, plane, &input_fb, &output_fb);
+
+		igt_output_set_pipe(clone, PIPE_NONE);
+
+		igt_remove_fb(display.drm_fd, &output_fb);
+	}
+
 	igt_fixture {
 		igt_remove_fb(display.drm_fd, &input_fb);
 		igt_display_fini(&display);
-- 
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 6/6] kms_writeback: Add tests using a cloned output
Date: Wed, 12 Jun 2019 23:19:01 -0300	[thread overview]
Message-ID: <454e4369191d599d038196429af4a242f4f0e5fb.1560374714.git.rodrigosiqueiramelo@gmail.com> (raw)
In-Reply-To: <cover.1560374714.git.rodrigosiqueiramelo@gmail.com>


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

Update the connector search to also optionally attempt to find a
non-writeback connector to clone to.

Add a subtest which is the same as writeback-check-output, but also
clones to the second connector.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
[rebased and addressed comments by Maarten]
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 tests/kms_writeback.c | 64 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 59 insertions(+), 5 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 0f20dadd..ae536bbf 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -51,7 +51,8 @@ static drmModePropertyBlobRes *get_writeback_formats_blob(igt_output_t *output)
 	return blob;
 }
 
-static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
+static bool check_writeback_config(igt_display_t *display, igt_output_t *output,
+				   int pipe, igt_output_t **clone)
 {
 	igt_fb_t input_fb, output_fb;
 	igt_plane_t *plane;
@@ -91,6 +92,30 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
 
 	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
 					    DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	if (!ret && clone) {
+		/* Try and find a clone */
+		int i, newret;
+		*clone = NULL;
+
+		for (i = 0; i < display->n_outputs; i++) {
+			igt_output_t *second_output = &display->outputs[i];
+			if (output != second_output &&
+			    igt_pipe_connector_valid(pipe, second_output)) {
+
+				igt_output_clone_pipe(second_output, pipe);
+				igt_output_override_mode(output, &override_mode);
+				newret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
+								       DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+				igt_output_set_pipe(second_output, PIPE_NONE);
+				igt_debug("try_commit_atomic clone returned %d\n", newret);
+				if (!newret) {
+					*clone = second_output;
+					igt_debug("Selected clone %s\n", (*clone)->name);
+					break;
+				}
+			}
+		}
+	}
 	igt_plane_set_fb(plane, NULL);
 	igt_remove_fb(display->drm_fd, &input_fb);
 	igt_remove_fb(display->drm_fd, &output_fb);
@@ -98,7 +123,8 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output)
 	return !ret;
 }
 
-static igt_output_t *kms_writeback_get_output(igt_display_t *display)
+static igt_output_t *kms_writeback_get_output(igt_display_t *display, enum pipe *pipe,
+					      igt_output_t **clone)
 {
 	int i;
 
@@ -114,10 +140,16 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)
 		for (j = 0; j < igt_display_get_n_pipes(display); j++) {
 			igt_output_set_pipe(output, j);
 
-			if (check_writeback_config(display, output)) {
+			if (check_writeback_config(display, output, j, clone)) {
 				igt_debug("Using connector %u:%s on pipe %d\n",
 					  output->config.connector->connector_id,
 					  output->name, j);
+				if (clone && *clone)
+					igt_debug("Cloning to connector %u:%s\n",
+						  (*clone)->config.connector->connector_id,
+						  (*clone)->name);
+				if (pipe)
+					*pipe = j;
 				return output;
 			}
 		}
@@ -335,10 +367,11 @@ static void writeback_check_output(igt_output_t *output, igt_plane_t *plane,
 igt_main
 {
 	igt_display_t display;
-	igt_output_t *output;
+	igt_output_t *output, *clone;
 	igt_plane_t *plane;
 	igt_fb_t input_fb;
 	drmModeModeInfo mode;
+	enum pipe pipe;
 	int ret;
 
 	memset(&display, 0, sizeof(display));
@@ -353,7 +386,7 @@ igt_main
 
 		igt_require(display.is_atomic);
 
-		output = kms_writeback_get_output(&display);
+		output = kms_writeback_get_output(&display, &pipe, &clone);
 		igt_require(output);
 
 		if (output->use_override_mode)
@@ -431,6 +464,27 @@ igt_main
 		igt_remove_fb(display.drm_fd, &output_fb);
 	}
 
+	igt_subtest("writeback-check-output-clone") {
+		igt_fb_t output_fb;
+
+		igt_require(clone);
+
+		ret = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
+				    DRM_FORMAT_XRGB8888,
+				    igt_fb_mod_to_tiling(0),
+				    &output_fb);
+		igt_require(ret > 0);
+
+		igt_output_clone_pipe(clone, pipe);
+		igt_output_override_mode(clone, &mode);
+
+		writeback_check_output(output, plane, &input_fb, &output_fb);
+
+		igt_output_set_pipe(clone, PIPE_NONE);
+
+		igt_remove_fb(display.drm_fd, &output_fb);
+	}
+
 	igt_fixture {
 		igt_remove_fb(display.drm_fd, &input_fb);
 		igt_display_fini(&display);
-- 
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:19 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 ` [PATCH V6 i-g-t 5/6] lib/igt_kms: Add igt_output_clone_pipe for cloning Brian Starkey
2019-06-13  2:18   ` [igt-dev] " 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 ` Brian Starkey [this message]
2019-06-13  2:19   ` [igt-dev] [PATCH V6 i-g-t 6/6] kms_writeback: Add tests using a cloned output 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=454e4369191d599d038196429af4a242f4f0e5fb.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.