All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support
@ 2017-01-20 17:45 Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct Robert Foss
                   ` (31 more replies)
  0 siblings, 32 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

This series implements dynamic plane count support in lib/igt_kms and modifies
all of the tests that rely on a static plane count.

Currently it has has gone through incomplete testing on vc4 (many tests are intel only)
and intel (on intel-ci).

This series can be found in branch dyn_n_planes_$VERSION:
https://git.collabora.com/cgit/user/robertfoss/intel-gpu-tools.git/

Currently known issues:
 * kms_plane_multiple: Currently fails

Changes since rfc:
 Rebased on upstream/master

 * igt_debugfs:
  - Change read to read at most MAX_LINE_LEN
 * igt_kms:
  - Actually fix typo
  - Removed unused function declaration
  - Set free'd pointer to NULL after free
  - Check allocations for failures
  - Rework kmstest_crtc and kmstest_plane to support dyn n_planes
 * kms_cursor_legacy:
  - Added support for dyn n_planes
 * kms_cursor_legacy:
  - Switch to using for_each_pipe construct
 * kms_plane_lowres:
  - Added support for dyn n_planes
 * kms_plane_multiple:
  - Set free'd pointer to NULL after free
  - Check allocations for failures

Robert Foss (32):
  lib/igt_kms: Add index property to kmstest_plane struct
  lib/igt_kms: Avoid depencency on static plane count
  lib/igt_kms: Rename kmstest properties nplanes and plane
  lib/igt_kms: Implement dynamic plane count support
  tests/kms_atomic_transition: Add support for dynamic number of planes
  tests/kms_busy: Add support for dynamic number of planes
  tests/kms_chv_cursor_fail: Add support for dynamic number of planes
  tests/kms_crtc_background_color: Add support for dynamic number of
    planes
  tests/kms_cursor_crc: Add support for dynamic number of planes
  tests/kms_cursor_legacy: Add support for dynamic number of planes
  tests/kms_fbc_crc: Add support for dynamic number of planes
  tests/kms_fence_pin_leak: Add support for dynamic number of planes
  tests/kms_flip_event_leak: Add support for dynamic number of planes
  tests/kms_legacy_colorkey: Add support for dynamic number of planes
  tests/kms_mmap_write_crc: Add support for dynamic number of planes
  tests/kms_mmio_vs_cs_flip: Add support for dynamic number of planes
  tests/kms_panel_fitting: Add support for dynamic number of planes
  tests/kms_pipe_color: Add support for dynamic number of planes
  tests/kms_plane: Add support for dynamic number of planes
  tests/kms_plane_multiple: Add support for dynamic number of planes
  tests/kms_plane_scaling: Add support for dynamic number of planes
  tests/kms_properties: Add support for dynamic number of planes
  tests/kms_psr_sink_crc: Add support for dynamic number of planes
  tests/kms_pwrite_crc: Add support for dynamic number of planes
  tests/kms_rmfb: Add support for dynamic number of planes
  tests/kms_rotation_crc: Add support for dynamic number of planes
  tests/kms_sink_crc_basic: Add support for dynamic number of planes
  tests/kms_universal_plane: Add support for dynamic number of planes
  tests/kms_vblank: Add support for dynamic number of planes
  tests/prime_mmap_kms: Add support for dynamic number of planes
  tests/kms_ccs: Add support for dynamic number of planes
  tests/kms_plane_lowres: Add support for dynamic number of planes

 lib/igt_kms.c                     | 210 +++++++++++++++++++++++++-------------
 lib/igt_kms.h                     |  39 +++----
 tests/kms_atomic_transition.c     |  27 +++--
 tests/kms_busy.c                  |   2 +-
 tests/kms_ccs.c                   |   4 +-
 tests/kms_chv_cursor_fail.c       |   6 +-
 tests/kms_crtc_background_color.c |   2 +-
 tests/kms_cursor_crc.c            |  12 +--
 tests/kms_cursor_legacy.c         |  32 +++---
 tests/kms_fbc_crc.c               |   9 +-
 tests/kms_fence_pin_leak.c        |   2 +-
 tests/kms_flip_event_leak.c       |   2 +-
 tests/kms_legacy_colorkey.c       |   4 +-
 tests/kms_mmap_write_crc.c        |   2 +-
 tests/kms_mmio_vs_cs_flip.c       |   6 +-
 tests/kms_panel_fitting.c         |  16 +--
 tests/kms_pipe_color.c            |   4 +-
 tests/kms_plane.c                 |  94 +++++++++--------
 tests/kms_plane_lowres.c          |  35 +++++--
 tests/kms_plane_multiple.c        | 209 +++++++++++++++++++++++--------------
 tests/kms_plane_scaling.c         |  14 +--
 tests/kms_properties.c            |   6 +-
 tests/kms_psr_sink_crc.c          |  52 +++++-----
 tests/kms_pwrite_crc.c            |   2 +-
 tests/kms_rmfb.c                  |   2 +-
 tests/kms_rotation_crc.c          |  63 ++++++------
 tests/kms_sink_crc_basic.c        |   2 +-
 tests/kms_universal_plane.c       |  18 ++--
 tests/kms_vblank.c                |   4 +-
 tests/prime_mmap_kms.c            |   2 +-
 30 files changed, 508 insertions(+), 374 deletions(-)

-- 
2.11.0

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

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

* [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-23 10:21   ` Mika Kahola
  2017-01-20 17:45 ` [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count Robert Foss
                   ` (30 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add an index property which helps accessing the corresponding
igt_plane_t structure through the igt_*_get_plane() functions.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c            | 12 ++++++------
 lib/igt_kms.h            |  1 +
 tests/kms_plane_lowres.c |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d104734a..e1abcf0d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1244,21 +1244,21 @@ static int parse_planes(FILE *fid, struct kmstest_plane *plane)
 {
 	char tmp[256];
 	int nplanes;
-	int ovl;
 
-	ovl = 0;
 	nplanes = 0;
 	while (fgets(tmp, 256, fid) != NULL) {
 		igt_assert_neq(nplanes, IGT_MAX_PLANES);
 		if (strstr(tmp, "type=PRI") != NULL) {
-			get_plane(tmp, IGT_PLANE_PRIMARY, &plane[nplanes]);
+			get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, &plane[nplanes]);
+			plane[nplanes].index = nplanes;
 			nplanes++;
 		} else if (strstr(tmp, "type=OVL") != NULL) {
-			get_plane(tmp, IGT_PLANE_2 + ovl, &plane[nplanes]);
-			ovl++;
+			get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, &plane[nplanes]);
+			plane[nplanes].index = nplanes;
 			nplanes++;
 		} else if (strstr(tmp, "type=CUR") != NULL) {
-			get_plane(tmp, IGT_PLANE_CURSOR, &plane[nplanes]);
+			get_plane(tmp, DRM_PLANE_TYPE_CURSOR, &plane[nplanes]);
+			plane[nplanes].index = nplanes;
 			nplanes++;
 			break;
 		}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 64414a24..d6cf8338 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -136,6 +136,7 @@ struct kmstest_connector_config {
 struct kmstest_plane {
 	int id;
 	int plane;
+	int index;
 	int pos_x;
 	int pos_y;
 	int width;
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 93aefdaa..858cc482 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -185,7 +185,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 	igt_skip_on(crtc.nplanes == 0);
 
 	for (i = 0; i < crtc.nplanes; i++)
-		data->plane[i] = igt_output_get_plane(output, crtc.plane[i].plane);
+		data->plane[i] = igt_output_get_plane(output, crtc.plane[i].index);
 
 	mode = igt_output_get_mode(output);
 
-- 
2.11.0

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

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

* [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-23 10:31   ` Mika Kahola
  2017-01-20 17:45 ` [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane Robert Foss
                   ` (29 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Rework kmstest_crtc and kmstest_plane structs and their usage
to not depend on a static plane count.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 47 ++++++++++++++++++++++++++++++-----------------
 lib/igt_kms.h |  4 ++--
 2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e1abcf0d..922bba63 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1227,7 +1227,7 @@ static void get_plane(char *str, int type, struct kmstest_plane *plane)
 	int ret;
 	char buf[256];
 
-	plane->plane = type;
+	plane->type = type;
 	ret = sscanf(str + 12, "%d%*c %*s %[^n]s",
 		     &plane->id,
 		     buf);
@@ -1240,31 +1240,36 @@ static void get_plane(char *str, int type, struct kmstest_plane *plane)
 	igt_assert_eq(ret, 2);
 }
 
-static int parse_planes(FILE *fid, struct kmstest_plane *plane)
+static int parse_planes(FILE *fid, struct kmstest_plane *planes)
 {
 	char tmp[256];
-	int nplanes;
+	int n_planes;
 
-	nplanes = 0;
+	n_planes = 0;
 	while (fgets(tmp, 256, fid) != NULL) {
-		igt_assert_neq(nplanes, IGT_MAX_PLANES);
 		if (strstr(tmp, "type=PRI") != NULL) {
-			get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, &plane[nplanes]);
-			plane[nplanes].index = nplanes;
-			nplanes++;
+			if (planes) {
+				get_plane(tmp, DRM_PLANE_TYPE_PRIMARY, &planes[n_planes]);
+				planes[n_planes].index = n_planes;
+			}
+			n_planes++;
 		} else if (strstr(tmp, "type=OVL") != NULL) {
-			get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, &plane[nplanes]);
-			plane[nplanes].index = nplanes;
-			nplanes++;
+			if (planes) {
+				get_plane(tmp, DRM_PLANE_TYPE_OVERLAY, &planes[n_planes]);
+				planes[n_planes].index = n_planes;
+			}
+			n_planes++;
 		} else if (strstr(tmp, "type=CUR") != NULL) {
-			get_plane(tmp, DRM_PLANE_TYPE_CURSOR, &plane[nplanes]);
-			plane[nplanes].index = nplanes;
-			nplanes++;
+			if (planes) {
+				get_plane(tmp, DRM_PLANE_TYPE_CURSOR, &planes[n_planes]);
+				planes[n_planes].index = n_planes;
+			}
+			n_planes++;
 			break;
 		}
 	}
 
-	return nplanes;
+	return n_planes;
 }
 
 static void parse_crtc(char *info, struct kmstest_crtc *crtc)
@@ -1304,7 +1309,12 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc)
 			if (strstr(tmp, "active=yes") != NULL) {
 				crtc->active = true;
 				parse_crtc(tmp, crtc);
-				crtc->nplanes = parse_planes(fid, crtc->plane);
+
+				crtc->nplanes = parse_planes(fid, NULL);
+				crtc->plane = calloc(crtc->nplanes, sizeof(*crtc->plane));
+				fseek(fid, 0, SEEK_END);
+				fseek(fid, 0, SEEK_SET);
+				parse_planes(fid, crtc->plane);
 
 				if (crtc->pipe != pipe)
 					crtc = NULL;
@@ -1330,7 +1340,10 @@ void igt_assert_plane_visible(enum pipe pipe, bool visibility)
 	kmstest_get_crtc(pipe, &crtc);
 
 	visible = true;
-	for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
+	for (i = 0; i < crtc.nplanes; i++) {
+		if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
+			continue;
+
 		if (crtc.plane[i].pos_x > crtc.width) {
 			visible = false;
 			break;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index d6cf8338..44602fdd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -135,8 +135,8 @@ struct kmstest_connector_config {
 
 struct kmstest_plane {
 	int id;
-	int plane;
 	int index;
+	int type;
 	int pos_x;
 	int pos_y;
 	int width;
@@ -150,7 +150,7 @@ struct kmstest_crtc {
 	int width;
 	int height;
 	int nplanes;
-	struct kmstest_plane plane[IGT_MAX_PLANES];
+	struct kmstest_plane *plane;
 };
 
 /**
-- 
2.11.0

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

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

* [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-23 10:33   ` Mika Kahola
  2017-01-20 17:45 ` [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (28 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Rename these properties to have them use the same naming convention
as the igt_*_t structs.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c            | 16 +++++++++-------
 lib/igt_kms.h            |  4 ++--
 tests/kms_plane_lowres.c | 10 +++++-----
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 922bba63..8fa40c28 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1310,11 +1310,13 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc)
 				crtc->active = true;
 				parse_crtc(tmp, crtc);
 
-				crtc->nplanes = parse_planes(fid, NULL);
-				crtc->plane = calloc(crtc->nplanes, sizeof(*crtc->plane));
+				crtc->n_planes = parse_planes(fid, NULL);
+				crtc->planes = calloc(crtc->n_planes, sizeof(*crtc->planes));
+				igt_assert_f(crtc->planes, "Failed to allocate memory for %d planes\n", crtc->n_planes);
+
 				fseek(fid, 0, SEEK_END);
 				fseek(fid, 0, SEEK_SET);
-				parse_planes(fid, crtc->plane);
+				parse_planes(fid, crtc->planes);
 
 				if (crtc->pipe != pipe)
 					crtc = NULL;
@@ -1340,14 +1342,14 @@ void igt_assert_plane_visible(enum pipe pipe, bool visibility)
 	kmstest_get_crtc(pipe, &crtc);
 
 	visible = true;
-	for (i = 0; i < crtc.nplanes; i++) {
-		if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
+	for (i = 0; i < crtc.n_planes; i++) {
+		if (crtc.planes[i].type == DRM_PLANE_TYPE_PRIMARY)
 			continue;
 
-		if (crtc.plane[i].pos_x > crtc.width) {
+		if (crtc.planes[i].pos_x > crtc.width) {
 			visible = false;
 			break;
-		} else if (crtc.plane[i].pos_y > crtc.height) {
+		} else if (crtc.planes[i].pos_y > crtc.height) {
 			visible = false;
 			break;
 		}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 44602fdd..859c79aa 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -149,8 +149,8 @@ struct kmstest_crtc {
 	bool active;
 	int width;
 	int height;
-	int nplanes;
-	struct kmstest_plane *plane;
+	int n_planes;
+	struct kmstest_plane *planes;
 };
 
 /**
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 858cc482..424ecb97 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -181,11 +181,11 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 	igt_output_set_pipe(output, pipe);
 
 	kmstest_get_crtc(pipe, &crtc);
-	igt_skip_on(crtc.nplanes > data->display.pipes[pipe].n_planes);
-	igt_skip_on(crtc.nplanes == 0);
+	igt_skip_on(crtc.n_planes > data->display.pipes[pipe].n_planes);
+	igt_skip_on(crtc.n_planes == 0);
 
-	for (i = 0; i < crtc.nplanes; i++)
-		data->plane[i] = igt_output_get_plane(output, crtc.plane[i].index);
+	for (i = 0; i < crtc.n_planes; i++)
+		data->plane[i] = igt_output_get_plane(output, crtc.planes[i].index);
 
 	mode = igt_output_get_mode(output);
 
@@ -198,7 +198,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 	igt_plane_set_fb(data->plane[0], &data->fb[0]);
 
 	/* yellow sprite plane in lower left corner */
-	for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
+	for (i = IGT_PLANE_2; i < crtc.n_planes; i++) {
 		if (data->plane[i]->is_cursor)
 			size = 64;
 		else
-- 
2.11.0

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

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

* [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (2 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-23 11:00   ` Mika Kahola
  2017-01-20 17:45 ` [PATCH i-g-t v1 05/32] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
                   ` (27 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

In upcoming drm-misc-next changes, the number of planes per pipe has
been increased as more than one primary plane can be associated with
a pipe.

The simple fix for this would be to simply bump hardcoded value for
number of frames per pipe.
But a better solution would be to add support for dynamic number of
planes per pipe to i-g-t.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 157 +++++++++++++++++++++++++++++++++++++++-------------------
 lib/igt_kms.h |  32 ++++--------
 2 files changed, 114 insertions(+), 75 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8fa40c28..58e62e2b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -347,24 +347,17 @@ int kmstest_pipe_to_index(char pipe)
  *
  * Returns: String represnting @pipe, e.g. "plane1".
  */
-const char *kmstest_plane_name(enum igt_plane plane)
+const char *kmstest_plane_type_name(int plane_type)
 {
 	static const char *names[] = {
-		[IGT_PLANE_1] = "plane1",
-		[IGT_PLANE_2] = "plane2",
-		[IGT_PLANE_3] = "plane3",
-		[IGT_PLANE_4] = "plane4",
-		[IGT_PLANE_5] = "plane5",
-		[IGT_PLANE_6] = "plane6",
-		[IGT_PLANE_7] = "plane7",
-		[IGT_PLANE_8] = "plane8",
-		[IGT_PLANE_9] = "plane9",
-		[IGT_PLANE_CURSOR] = "cursor",
+		[DRM_PLANE_TYPE_OVERLAY] = "overlay",
+		[DRM_PLANE_TYPE_PRIMARY] = "primary",
+		[DRM_PLANE_TYPE_CURSOR] = "cursor",
 	};
 
-	igt_assert(plane < ARRAY_SIZE(names) && names[plane]);
+	igt_assert(plane_type < ARRAY_SIZE(names) && names[plane_type]);
 
-	return names[plane];
+	return names[plane_type];
 }
 
 static const char *mode_stereo_name(const drmModeModeInfo *mode)
@@ -1532,14 +1525,17 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	for (i = 0; i < display->n_pipes; i++) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
-		int p = IGT_PLANE_2;
+		int p = 1;
 		int j, type;
-		uint8_t n_planes = 0;
+		uint8_t last_plane = 0, n_planes = 0;
 		uint64_t prop_value;
 
 		pipe->crtc_id = resources->crtcs[i];
 		pipe->display = display;
 		pipe->pipe = i;
+		pipe->plane_cursor = -1;
+		pipe->plane_primary = -1;
+		pipe->planes = NULL;
 
 		get_crtc_property(display->drm_fd, pipe->crtc_id,
 				    "background_color",
@@ -1565,6 +1561,27 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 
 		igt_atomic_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
 
+		/* count number of valid planes */
+		for (j = 0; j < plane_resources->count_planes; j++) {
+			drmModePlane *drm_plane;
+
+			drm_plane = drmModeGetPlane(display->drm_fd,
+						    plane_resources->planes[j]);
+			igt_assert(drm_plane);
+
+			if (!(drm_plane->possible_crtcs & (1 << i))) {
+				drmModeFreePlane(drm_plane);
+				continue;
+            }
+
+		    n_planes++;
+		}
+
+		igt_assert_lte(0, n_planes);
+		pipe->planes = calloc(sizeof(igt_plane_t), n_planes);
+		igt_assert_f(pipe->planes, "Failed to allocate memory for %d planes\n", n_planes);
+		last_plane = n_planes - 1;
+
 		/* add the planes that can be used with that pipe */
 		for (j = 0; j < plane_resources->count_planes; j++) {
 			drmModePlane *drm_plane;
@@ -1582,21 +1599,24 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 						  plane_resources->planes[j]);
 			switch (type) {
 			case DRM_PLANE_TYPE_PRIMARY:
-				plane = &pipe->planes[IGT_PLANE_PRIMARY];
-				plane->is_primary = 1;
-				plane->index = IGT_PLANE_PRIMARY;
+				if (pipe->plane_primary == -1) {
+					plane = &pipe->planes[0];
+					plane->index = 0;
+					pipe->plane_primary = 0;
+				} else {
+					plane = &pipe->planes[p];
+					plane->index = p++;
+				}
 				break;
 			case DRM_PLANE_TYPE_CURSOR:
-				/*
-				 * Cursor should be the highest index in our
-				 * internal list, but we don't know what that
-				 * is yet.  Just stick it in the last slot
-				 * for now and we'll move it later, if
-				 * necessary.
-				 */
-				plane = &pipe->planes[IGT_PLANE_CURSOR];
-				plane->is_cursor = 1;
-				plane->index = IGT_PLANE_CURSOR;
+				if (pipe->plane_cursor == -1) {
+					plane = &pipe->planes[last_plane];
+					plane->index = last_plane;
+					pipe->plane_cursor = last_plane;
+				} else {
+					plane = &pipe->planes[p];
+					plane->index = p++;
+				}
 				display->has_cursor_plane = true;
 				break;
 			default:
@@ -1605,7 +1625,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 				break;
 			}
 
-			n_planes++;
+			plane->type = type;
 			plane->pipe = pipe;
 			plane->drm_plane = drm_plane;
 
@@ -1626,7 +1646,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * At the bare minimum, we should expect to have a primary
 		 * plane
 		 */
-		igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane);
+		igt_assert(pipe->planes[pipe->plane_primary].drm_plane);
 
 		if (display->has_cursor_plane) {
 			/*
@@ -1634,11 +1654,11 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			 * only 1 sprite, that's the wrong slot and we need to
 			 * move it down.
 			 */
-			if (p != IGT_PLANE_CURSOR) {
+			if (p != last_plane) {
 				pipe->planes[p] =
-					pipe->planes[IGT_PLANE_CURSOR];
+					pipe->planes[last_plane];
 				pipe->planes[p].index = p;
-				memset(&pipe->planes[IGT_PLANE_CURSOR], 0,
+				memset(&pipe->planes[last_plane], 0,
 				       sizeof *plane);
 			}
 		} else {
@@ -1646,7 +1666,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			plane = &pipe->planes[p];
 			plane->pipe = pipe;
 			plane->index = p;
-			plane->is_cursor = true;
+			plane->type = DRM_PLANE_TYPE_CURSOR;
 		}
 
 		pipe->n_planes = n_planes;
@@ -1654,9 +1674,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		for_each_plane_on_pipe(display, i, plane)
 			plane->fb_changed = true;
 
-		/* make sure we don't overflow the plane array */
-		igt_assert_lte(pipe->n_planes, IGT_MAX_PLANES);
-
 		pipe->mode_changed = true;
 	}
 
@@ -1709,6 +1726,9 @@ static void igt_pipe_fini(igt_pipe_t *pipe)
 			plane->drm_plane = NULL;
 		}
 	}
+
+	free(pipe->planes);
+	pipe->planes = NULL;
 }
 
 static void igt_output_fini(igt_output_t *output)
@@ -1797,20 +1817,41 @@ static igt_pipe_t *igt_output_get_driving_pipe(igt_output_t *output)
 	return &display->pipes[pipe];
 }
 
-static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, enum igt_plane plane)
+static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int plane_idx)
 {
-	int idx;
+	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
+		"Valid pipe->planes plane_idx not found, plane_idx=%d n_planes=%d",
+		plane_idx, pipe->n_planes);
 
-	/* Cursor plane is always the highest index */
-	if (plane == IGT_PLANE_CURSOR)
-		idx = pipe->n_planes - 1;
-	else {
-		igt_assert_f(plane >= 0 && plane < (pipe->n_planes),
-			     "plane=%d\n", plane);
-		idx = plane;
+	return &pipe->planes[plane_idx];
+}
+
+
+igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type)
+{
+	int i, plane_idx = -1;
+
+	switch(plane_type) {
+	case DRM_PLANE_TYPE_CURSOR:
+		plane_idx = pipe->plane_cursor;
+		break;
+	case DRM_PLANE_TYPE_PRIMARY:
+		plane_idx = pipe->plane_primary;
+		break;
+	case DRM_PLANE_TYPE_OVERLAY:
+		for(i = 0; i < pipe->n_planes; i++)
+			if (pipe->planes[i].type == DRM_PLANE_TYPE_OVERLAY)
+			    plane_idx = i;
+		break;
+	default:
+		break;
 	}
 
-	return &pipe->planes[idx];
+	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
+		"Valid pipe->planes idx not found. plane_idx=%d plane_type=%d n_planes=%d\n",
+		plane_idx, plane_type, pipe->n_planes);
+
+	return &pipe->planes[plane_idx];
 }
 
 static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
@@ -2155,9 +2196,9 @@ static int igt_plane_commit(igt_plane_t *plane,
 			    enum igt_commit_style s,
 			    bool fail_on_error)
 {
-	if (plane->is_cursor && s == COMMIT_LEGACY) {
+	if (plane->type == DRM_PLANE_TYPE_CURSOR && s == COMMIT_LEGACY) {
 		return igt_cursor_commit_legacy(plane, pipe, fail_on_error);
-	} else if (plane->is_primary && s == COMMIT_LEGACY) {
+	} else if (plane->type == DRM_PLANE_TYPE_PRIMARY && s == COMMIT_LEGACY) {
 		return igt_primary_plane_commit_legacy(plane, pipe,
 						       fail_on_error);
 	} else {
@@ -2374,7 +2415,9 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)
 			plane->position_changed = false;
 			plane->size_changed = false;
 
-			if (s != COMMIT_LEGACY || !(plane->is_primary || plane->is_cursor))
+			if (s != COMMIT_LEGACY ||
+			    !(plane->type == DRM_PLANE_TYPE_PRIMARY ||
+			      plane->type == DRM_PLANE_TYPE_CURSOR))
 				plane->rotation_changed = false;
 		}
 	}
@@ -2654,14 +2697,24 @@ void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode)
 	igt_require(output->config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
 }
 
-igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane)
+igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx)
+{
+	igt_pipe_t *pipe;
+
+	pipe = igt_output_get_driving_pipe(output);
+	igt_assert(pipe);
+
+	return igt_pipe_get_plane(pipe, plane_idx);
+}
+
+igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type)
 {
 	igt_pipe_t *pipe;
 
 	pipe = igt_output_get_driving_pipe(output);
 	igt_assert(pipe);
 
-	return igt_pipe_get_plane(pipe, plane);
+	return igt_pipe_get_plane_type(pipe, plane_type);
 }
 
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 859c79aa..dc172ec9 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -57,25 +57,7 @@ enum pipe {
         I915_MAX_PIPES
 };
 const char *kmstest_pipe_name(enum pipe pipe);
-int kmstest_pipe_to_index(char pipe);
-
-/* We namespace this enum to not conflict with the Android i915_drm.h */
-enum igt_plane {
-	IGT_PLANE_1 = 0,
-	IGT_PLANE_PRIMARY = IGT_PLANE_1,
-	IGT_PLANE_2,
-	IGT_PLANE_3,
-	IGT_PLANE_4,
-	IGT_PLANE_5,
-	IGT_PLANE_6,
-	IGT_PLANE_7,
-	IGT_PLANE_8,
-	IGT_PLANE_9,
-	IGT_PLANE_CURSOR, /* IGT_PLANE_CURSOR is always the last plane. */
-	IGT_MAX_PLANES,
-};
-
-const char *kmstest_plane_name(enum igt_plane plane);
+const char *kmstest_plane_type_name(int plane_type);
 
 enum port {
         PORT_A = 0,
@@ -257,8 +239,7 @@ typedef struct {
 	igt_pipe_t *pipe;
 	int index;
 	/* capabilities */
-	unsigned int is_primary       : 1;
-	unsigned int is_cursor        : 1;
+	int type;
 	/* state tracking */
 	unsigned int fb_changed       : 1;
 	unsigned int position_changed : 1;
@@ -293,8 +274,11 @@ struct igt_pipe {
 	igt_display_t *display;
 	enum pipe pipe;
 	bool enabled;
+
 	int n_planes;
-	igt_plane_t planes[IGT_MAX_PLANES];
+	int plane_cursor;
+	int plane_primary;
+	igt_plane_t *planes;
 
 	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
 
@@ -354,7 +338,9 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
 void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
 void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode);
-igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane);
+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);
+igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type);
 bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
 			   uint32_t *prop_id, uint64_t *value,
 			   drmModePropertyPtr *prop);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 05/32] tests/kms_atomic_transition: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (3 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 06/32] tests/kms_busy: " Robert Foss
                   ` (26 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 851ffc95..5fdb6175 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -120,7 +120,8 @@ static void set_sprite_wh(igt_display_t *display, enum pipe pipe,
 	for_each_plane_on_pipe(display, pipe, plane) {
 		int i = plane->index;
 
-		if (plane->is_primary || plane->is_cursor)
+		if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+		    plane->type == DRM_PLANE_TYPE_CURSOR)
 			continue;
 
 		parms[i].width = w;
@@ -156,20 +157,16 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 	for_each_plane_on_pipe(display, pipe, plane) {
 		int i = plane->index;
 
-		if (plane->is_primary)
+		if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
 			parms[i].fb = plane->fb;
-		else if (plane->is_cursor)
-			parms[i].fb = argb_fb;
-		else
-			parms[i].fb = sprite_fb;
-
-		if (plane->is_primary) {
 			parms[i].width = mode->hdisplay;
 			parms[i].height = mode->vdisplay;
-		} else if (plane->is_cursor) {
+		} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+			parms[i].fb = argb_fb;
 			parms[i].width = cursor_width;
 			parms[i].height = cursor_height;
-		}
+		} else
+			parms[i].fb = sprite_fb;
 	}
 
 	igt_create_fb(display->drm_fd, cursor_width, cursor_height,
@@ -273,7 +270,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	drmModeModeInfo *mode, override_mode;
 	igt_plane_t *plane;
 	uint32_t iter_max = 1 << display->pipes[pipe].n_planes, i;
-	struct plane_parms parms[IGT_MAX_PLANES];
+	struct plane_parms parms[display->pipes[pipe].n_planes];
 	bool skip_test = false;
 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
 
@@ -421,7 +418,8 @@ static unsigned set_combinations(igt_display_t *display, unsigned mask, struct i
 		igt_output_set_pipe(output, PIPE_NONE);
 
 	for_each_pipe(display, pipe) {
-		igt_plane_t *plane = &display->pipes[pipe].planes[IGT_PLANE_PRIMARY];
+		igt_plane_t *plane = igt_pipe_get_plane_type(&display->pipes[pipe],
+			DRM_PLANE_TYPE_PRIMARY);
 		drmModeModeInfo *mode = NULL;
 
 		if (!(mask & (1 << pipe))) {
@@ -462,7 +460,7 @@ static void refresh_primaries(igt_display_t *display)
 
 	for_each_pipe(display, pipe)
 		for_each_plane_on_pipe(display, pipe, plane)
-			if (plane->is_primary && plane->fb)
+			if (plane->type == DRM_PLANE_TYPE_PRIMARY && plane->fb)
 				plane->fb_changed = true;
 }
 
@@ -506,7 +504,8 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 				    DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &fbs[1]);
 
 	for_each_pipe(display, i) {
-		igt_plane_t *plane = &display->pipes[i].planes[IGT_PLANE_PRIMARY];
+		igt_pipe_t *pipe = &display->pipes[i];
+		igt_plane_t *plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
 		drmModeModeInfo *mode = NULL;
 
 		if (is_i915_device(display->drm_fd))
-- 
2.11.0

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

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

* [PATCH i-g-t v1 06/32] tests/kms_busy: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (4 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 05/32] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 07/32] tests/kms_chv_cursor_fail: " Robert Foss
                   ` (25 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_busy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index 1ae5d7fb..e6276927 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -53,7 +53,7 @@ set_fb_on_crtc(igt_display_t *dpy, int pipe, struct igt_fb *fb)
 				      LOCAL_I915_FORMAT_MOD_X_TILED,
 				      fb);
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, fb);
 
 		return output;
-- 
2.11.0

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

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

* [PATCH i-g-t v1 07/32] tests/kms_chv_cursor_fail: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (5 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 06/32] tests/kms_busy: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 08/32] tests/kms_crtc_background_color: " Robert Foss
                   ` (24 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_chv_cursor_fail.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_chv_cursor_fail.c b/tests/kms_chv_cursor_fail.c
index 0158580c..ce6e8df6 100644
--- a/tests/kms_chv_cursor_fail.c
+++ b/tests/kms_chv_cursor_fail.c
@@ -65,7 +65,7 @@ static void cursor_disable(data_t *data)
 	igt_output_t *output = data->output;
 	igt_plane_t *cursor;
 
-	cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
 	igt_plane_set_fb(cursor, NULL);
 }
 
@@ -242,7 +242,7 @@ static void prepare_crtc(data_t *data)
 			      LOCAL_DRM_FORMAT_MOD_NONE,
 			      &data->primary_fb);
 
-	primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, &data->primary_fb);
 
 	igt_display_commit(display);
@@ -277,7 +277,7 @@ static void cleanup_crtc(data_t *data)
 
 	igt_remove_fb(data->drm_fd, &data->primary_fb);
 
-	primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
 
 	igt_output_set_pipe(data->output, PIPE_ANY);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 08/32] tests/kms_crtc_background_color: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (6 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 07/32] tests/kms_chv_cursor_fail: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 09/32] tests/kms_cursor_crc: " Robert Foss
                   ` (23 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_crtc_background_color.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index 537d4ce6..d6dd8d90 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -136,7 +136,7 @@ static void test_crtc_background(data_t *data)
 
 		igt_output_set_pipe(output, pipe);
 
-		plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_require(plane->pipe->background_property);
 
 		prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 09/32] tests/kms_cursor_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (7 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 08/32] tests/kms_crtc_background_color: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 10/32] tests/kms_cursor_legacy: " Robert Foss
                   ` (22 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_cursor_crc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index ff931607..4851e18f 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -92,7 +92,7 @@ static void cursor_enable(data_t *data)
 	igt_output_t *output = data->output;
 	igt_plane_t *cursor;
 
-	cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
 	igt_plane_set_fb(cursor, &data->fb);
 	igt_plane_set_size(cursor, data->curw, data->curh);
 }
@@ -102,7 +102,7 @@ static void cursor_disable(data_t *data)
 	igt_output_t *output = data->output;
 	igt_plane_t *cursor;
 
-	cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
 	igt_plane_set_fb(cursor, NULL);
 }
 
@@ -120,7 +120,7 @@ static void do_single_test(data_t *data, int x, int y)
 	/* Hardware test */
 	igt_paint_test_pattern(cr, data->screenw, data->screenh);
 	cursor_enable(data);
-	cursor = igt_output_get_plane(data->output, IGT_PLANE_CURSOR);
+	cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
 	igt_plane_set_position(cursor, x, y);
 	igt_display_commit(display);
 	igt_wait_for_vblank(data->drm_fd, data->pipe);
@@ -174,7 +174,7 @@ static void do_fail_test(data_t *data, int x, int y, int expect)
 	/* Hardware test */
 	igt_paint_test_pattern(cr, data->screenw, data->screenh);
 	cursor_enable(data);
-	cursor = igt_output_get_plane(data->output, IGT_PLANE_CURSOR);
+	cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
 	igt_plane_set_position(cursor, x, y);
 	ret = igt_display_try_commit2(display, COMMIT_LEGACY);
 
@@ -301,7 +301,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
 			    0.0, 0.0, 0.0,
 			    &data->primary_fb);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, &data->primary_fb);
 
 	igt_display_commit(display);
@@ -342,7 +342,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
 
 	igt_remove_fb(data->drm_fd, &data->primary_fb);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
 
 	igt_output_set_pipe(output, PIPE_ANY);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 10/32] tests/kms_cursor_legacy: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (8 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 09/32] tests/kms_cursor_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 11/32] tests/kms_fbc_crc: " Robert Foss
                   ` (21 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_cursor_legacy.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5e9f5f39..e3ef6821 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -166,7 +166,7 @@ static igt_output_t *set_fb_on_crtc(igt_display_t *display, int pipe, struct igt
 			      mode->hdisplay, mode->vdisplay,
 			      DRM_FORMAT_XRGB8888, I915_TILING_NONE, fb_info);
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, fb_info);
 
 		return output;
@@ -180,7 +180,7 @@ static void set_cursor_on_pipe(igt_display_t *display, enum pipe pipe, struct ig
 	igt_plane_t *plane, *cursor = NULL;
 
 	for_each_plane_on_pipe(display, pipe, plane) {
-		if (!plane->is_cursor)
+		if (plane->type != DRM_PLANE_TYPE_CURSOR)
 			continue;
 
 		cursor = plane;
@@ -250,13 +250,14 @@ static enum pipe find_connected_pipe(igt_display_t *display, bool second)
 	return pipe;
 }
 
-static void flip_nonblocking(igt_display_t *display, enum pipe pipe, bool atomic, struct igt_fb *fb)
+static void flip_nonblocking(igt_display_t *display, enum pipe pipe_id, bool atomic, struct igt_fb *fb)
 {
-	igt_plane_t *primary = &display->pipes[pipe].planes[IGT_PLANE_PRIMARY];
+	igt_pipe_t *pipe = &display->pipes[pipe_id];
+	igt_plane_t *primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
 
 	if (!atomic) {
 		/* Schedule a nonblocking flip for the next vblank */
-		do_or_die(drmModePageFlip(display->drm_fd, display->pipes[pipe].crtc_id, fb->fb_id,
+		do_or_die(drmModePageFlip(display->drm_fd, pipe->crtc_id, fb->fb_id,
 					DRM_MODE_PAGE_FLIP_EVENT, fb));
 	} else {
 		igt_plane_set_fb(primary, fb);
@@ -283,12 +284,13 @@ static bool cursor_slowpath(enum flip_test mode)
 	return true;
 }
 
-static void transition_nonblocking(igt_display_t *display, enum pipe pipe,
+static void transition_nonblocking(igt_display_t *display, enum pipe pipe_id,
 				   struct igt_fb *prim_fb, struct igt_fb *argb_fb,
 				   bool hide_sprite)
 {
-	igt_plane_t *primary = &display->pipes[pipe].planes[IGT_PLANE_PRIMARY];
-	igt_plane_t *sprite = &display->pipes[pipe].planes[IGT_PLANE_2];
+	igt_pipe_t *pipe = &display->pipes[pipe_id];
+	igt_plane_t *primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_t *sprite = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_OVERLAY);
 
 	if (hide_sprite) {
 		igt_plane_set_fb(primary, prim_fb);
@@ -354,7 +356,7 @@ static void prepare_flip_test(igt_display_t *display,
 	if (mode == flip_test_atomic_transitions ||
 	    mode == flip_test_atomic_transitions_varying_size) {
 		igt_require(display->pipes[flip_pipe].n_planes > 1 &&
-			    !display->pipes[flip_pipe].planes[IGT_PLANE_2].is_cursor);
+		            display->pipes[flip_pipe].planes[1].type != DRM_PLANE_TYPE_CURSOR);
 
 		igt_create_color_pattern_fb(display->drm_fd, prim_fb->width, prim_fb->height,
 					    DRM_FORMAT_ARGB8888, 0, .1, .1, .1, argb_fb);
@@ -843,7 +845,7 @@ static void nonblocking_modeset_vs_cursor(igt_display_t *display, int loops)
 	arg[0].flags |= DRM_MODE_CURSOR_BO;
 
 	for_each_plane_on_pipe(display, pipe, plane) {
-		if (!plane->is_cursor)
+		if (plane->type != DRM_PLANE_TYPE_CURSOR)
 			continue;
 
 		cursor = plane;
@@ -983,7 +985,7 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
 			 * in the same commit.
 			 */
 
-			igt_plane_set_fb(igt_output_get_plane(output, IGT_PLANE_PRIMARY), &fb_info);
+			igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), &fb_info);
 			igt_output_set_pipe(output2, (nloops & 1) ? PIPE_NONE : pipe2);
 			igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_NONBLOCK, NULL);
 		}
@@ -1283,6 +1285,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 	unsigned vblank_start;
 	enum pipe pipe = find_connected_pipe(display, false);
 	igt_pipe_crc_t *pipe_crc;
+	igt_pipe_t *pipe_connected = &display->pipes[pipe];
+	igt_plane_t *plane_primary = igt_pipe_get_plane_type(pipe_connected, DRM_PLANE_TYPE_PRIMARY);
 	igt_crc_t crcs[3];
 
 	if (atomic)
@@ -1314,10 +1318,10 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 	  * setting the correct cache level, else we get a stall in the
 	  * page flip handler.
 	  */
-	igt_plane_set_fb(&display->pipes[pipe].planes[IGT_PLANE_PRIMARY], &fb_info[1]);
+	igt_plane_set_fb(plane_primary, &fb_info[1]);
 	igt_display_commit2(display, COMMIT_UNIVERSAL);
 
-	igt_plane_set_fb(&display->pipes[pipe].planes[IGT_PLANE_PRIMARY], &fb_info[0]);
+	igt_plane_set_fb(plane_primary, &fb_info[0]);
 	igt_display_commit2(display, COMMIT_UNIVERSAL);
 
 	/* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
@@ -1343,7 +1347,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
 
 		igt_assert_lte(vblank_start + 1, get_vblank(display->drm_fd, pipe, 0));
 
-		igt_plane_set_fb(&display->pipes[pipe].planes[IGT_PLANE_PRIMARY], &fb_info[0]);
+		igt_plane_set_fb(plane_primary, &fb_info[0]);
 		igt_display_commit2(display, COMMIT_UNIVERSAL);
 
 		igt_assert_crc_equal(&crcs[i], &crcs[2]);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 11/32] tests/kms_fbc_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (9 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 10/32] tests/kms_cursor_legacy: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 12/32] tests/kms_fence_pin_leak: " Robert Foss
                   ` (20 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_fbc_crc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index a696e124..d2c76fb1 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -372,7 +372,7 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
 	igt_output_t *output = data->output;
 	igt_pipe_crc_t *pipe_crc;
 
-	data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	data->primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 
 	create_fbs(data, true, data->fb);
 
@@ -457,10 +457,11 @@ static void finish_crtc(data_t *data, enum test_mode mode)
 static void reset_display(data_t *data)
 {
 	igt_display_t *display = &data->display;
-	enum pipe pipe;
+	enum pipe pipe_type;
 
-	for_each_pipe(display, pipe) {
-		igt_plane_t *plane = &display->pipes[pipe].planes[IGT_PLANE_PRIMARY];
+	for_each_pipe(display, pipe_type) {
+        igt_pipe_t *pipe = &display->pipes[pipe_type];
+		igt_plane_t *plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
 
 		if (plane->fb)
 			igt_plane_set_fb(plane, NULL);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 12/32] tests/kms_fence_pin_leak: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (10 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 11/32] tests/kms_fbc_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 13/32] tests/kms_flip_event_leak: " Robert Foss
                   ` (19 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_fence_pin_leak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index 6301e01a..8bbd5563 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -115,7 +115,7 @@ static void run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_output_set_pipe(output, pipe);
 
 	mode = igt_output_get_mode(output);
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
 			    DRM_FORMAT_XRGB8888,
-- 
2.11.0

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

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

* [PATCH i-g-t v1 13/32] tests/kms_flip_event_leak: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (11 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 12/32] tests/kms_fence_pin_leak: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 14/32] tests/kms_legacy_colorkey: " Robert Foss
                   ` (18 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_flip_event_leak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c
index f22af0f0..f1a8abd8 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -50,7 +50,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
 	/* select the pipe we want to use */
 	igt_output_set_pipe(output, pipe);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	mode = igt_output_get_mode(output);
 
 	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
-- 
2.11.0

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

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

* [PATCH i-g-t v1 14/32] tests/kms_legacy_colorkey: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (12 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 13/32] tests/kms_flip_event_leak: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 15/32] tests/kms_mmap_write_crc: " Robert Foss
                   ` (17 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_legacy_colorkey.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_legacy_colorkey.c b/tests/kms_legacy_colorkey.c
index 25f98aad..150520ce 100644
--- a/tests/kms_legacy_colorkey.c
+++ b/tests/kms_legacy_colorkey.c
@@ -55,8 +55,10 @@ igt_simple_main
 
 	for_each_pipe(&display, p) {
 		for_each_plane_on_pipe(&display, p, plane) {
+			bool is_valid = (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+			                 plane->type == DRM_PLANE_TYPE_CURSOR);
 			test_plane(plane->drm_plane->plane_id,
-				   (plane->is_cursor || plane->is_primary) ? -ENOENT : 0);
+				   is_valid ? -ENOENT : 0);
 
 			max_id = max(max_id, plane->drm_plane->plane_id);
 		}
-- 
2.11.0

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

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

* [PATCH i-g-t v1 15/32] tests/kms_mmap_write_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (13 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 14/32] tests/kms_legacy_colorkey: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 16/32] tests/kms_mmio_vs_cs_flip: " Robert Foss
                   ` (16 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_mmap_write_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_mmap_write_crc.c b/tests/kms_mmap_write_crc.c
index eb8586d1..8a1331cc 100644
--- a/tests/kms_mmap_write_crc.c
+++ b/tests/kms_mmap_write_crc.c
@@ -177,7 +177,7 @@ static void prepare_crtc(data_t *data)
 			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
 			    1.0, 1.0, 1.0, &data->fb[0]);
 
-	data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	igt_plane_set_fb(data->primary, &data->fb[0]);
 	igt_display_commit(display);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 16/32] tests/kms_mmio_vs_cs_flip: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (14 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 15/32] tests/kms_mmap_write_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 17/32] tests/kms_panel_fitting: " Robert Foss
                   ` (15 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_mmio_vs_cs_flip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_mmio_vs_cs_flip.c b/tests/kms_mmio_vs_cs_flip.c
index 2f64f633..09217b31 100644
--- a/tests/kms_mmio_vs_cs_flip.c
+++ b/tests/kms_mmio_vs_cs_flip.c
@@ -191,7 +191,7 @@ static void make_gpu_busy(data_t *data, uint32_t flip_handle)
  * supposed to be.
  */
 static void
-test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane plane)
+test_plane(data_t *data, igt_output_t *output, enum pipe pipe, int plane)
 {
 	struct igt_fb red_fb, green_fb, blue_fb;
 	drmModeModeInfo *mode;
@@ -201,7 +201,7 @@ test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane pl
 
 	igt_output_set_pipe(output, pipe);
 
-	primary = igt_output_get_plane(output, 0);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	sprite = igt_output_get_plane(output, plane);
 
 	mode = igt_output_get_mode(output);
@@ -455,7 +455,7 @@ static void
 run_plane_test(data_t *data)
 {
 	igt_output_t *output;
-	enum igt_plane plane = 1; /* testing with one sprite is enough */
+	int plane = 1; /* testing with one sprite is enough */
 	int valid_tests = 0;
 	enum pipe pipe;
 
-- 
2.11.0

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

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

* [PATCH i-g-t v1 17/32] tests/kms_panel_fitting: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (15 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 16/32] tests/kms_mmio_vs_cs_flip: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 18/32] tests/kms_pipe_color: " Robert Foss
                   ` (14 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_panel_fitting.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 1b350762..e145a2df 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -76,10 +76,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 * there's no way (that works) to light up a pipe with only a sprite
 	 * plane enabled at the moment.
 	 */
-	if (!plane->is_primary) {
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, &data->fb1);
 	}
 
@@ -116,10 +116,10 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 		data->fb_id3 = 0;
 	}
 
-	if (!plane->is_primary) {
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
 	}
 
@@ -174,7 +174,7 @@ static void test_panel_fitting(data_t *d)
 		/* Set up display to enable panel fitting */
 		mode->hdisplay = 640;
 		mode->vdisplay = 480;
-		d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		d->plane1 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_LEGACY);
 
 		/* disable panel fitting */
@@ -189,7 +189,7 @@ static void test_panel_fitting(data_t *d)
 		prepare_crtc(d, output, pipe, d->plane1, &native_mode, COMMIT_LEGACY);
 
 		/* Set up fb2->plane2 mapping. */
-		d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+		d->plane2 = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
 		igt_plane_set_fb(d->plane2, &d->fb2);
 
 		/* enable sprite plane */
@@ -226,8 +226,8 @@ test_panel_fitting_fastset(igt_display_t *display, const enum pipe pipe, igt_out
 	igt_output_override_mode(output, &mode);
 	igt_output_set_pipe(output, pipe);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-	sprite = igt_output_get_plane(output, IGT_PLANE_2);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	sprite = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
 
 	igt_create_color_fb(display->drm_fd, mode.hdisplay, mode.vdisplay,
 			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
-- 
2.11.0

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

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

* [PATCH i-g-t v1 18/32] tests/kms_pipe_color: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (16 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 17/32] tests/kms_panel_fitting: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 19/32] tests/kms_plane: " Robert Foss
                   ` (13 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_pipe_color.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_pipe_color.c b/tests/kms_pipe_color.c
index 1aff7d54..c7a5d2f1 100644
--- a/tests/kms_pipe_color.c
+++ b/tests/kms_pipe_color.c
@@ -857,9 +857,9 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 		igt_require(p < data->display.n_pipes);
 
 		pipe = &data->display.pipes[p];
-		igt_require(pipe->n_planes >= IGT_PLANE_PRIMARY);
+		igt_require(pipe->n_planes >= 0);
 
-		primary = &pipe->planes[IGT_PLANE_PRIMARY];
+		primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
 
 		data->pipe_crc = igt_pipe_crc_new(primary->pipe->pipe,
 						  INTEL_PIPE_CRC_SOURCE_AUTO);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 19/32] tests/kms_plane: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (17 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 18/32] tests/kms_pipe_color: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 20/32] tests/kms_plane_multiple: " Robert Foss
                   ` (12 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_plane.c | 94 ++++++++++++++++++++++++++++++-------------------------
 1 file changed, 52 insertions(+), 42 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index e843a170..14c444fc 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -150,7 +150,7 @@ enum {
 static void
 test_plane_position_with_output(data_t *data,
 				enum pipe pipe,
-				enum igt_plane plane,
+				int plane,
 				igt_output_t *output,
 				unsigned int flags)
 {
@@ -170,7 +170,7 @@ test_plane_position_with_output(data_t *data,
 	igt_output_set_pipe(output, pipe);
 
 	mode = igt_output_get_mode(output);
-	primary = igt_output_get_plane(output, 0);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	sprite = igt_output_get_plane(output, plane);
 
 	create_fb_for_mode__position(data, mode, 100, 100, 64, 64,
@@ -222,7 +222,7 @@ test_plane_position_with_output(data_t *data,
 }
 
 static void
-test_plane_position(data_t *data, enum pipe pipe, enum igt_plane plane,
+test_plane_position(data_t *data, enum pipe pipe, int plane,
 		    unsigned int flags)
 {
 	igt_output_t *output;
@@ -294,7 +294,7 @@ enum {
 static void
 test_plane_panning_with_output(data_t *data,
 			       enum pipe pipe,
-			       enum igt_plane plane,
+			       int plane,
 			       igt_output_t *output,
 			       unsigned int flags)
 {
@@ -348,7 +348,7 @@ test_plane_panning_with_output(data_t *data,
 }
 
 static void
-test_plane_panning(data_t *data, enum pipe pipe, enum igt_plane plane,
+test_plane_panning(data_t *data, enum pipe pipe, int plane,
             unsigned int flags)
 {
 	igt_output_t *output;
@@ -367,47 +367,57 @@ test_plane_panning(data_t *data, enum pipe pipe, enum igt_plane plane,
 }
 
 static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, enum igt_plane plane)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
 {
-	igt_subtest_f("plane-position-covered-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_position(data, pipe, plane,
-				    TEST_POSITION_FULLY_COVERED);
-
-	igt_subtest_f("plane-position-hole-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_position(data, pipe, plane, 0);
-
-	igt_subtest_f("plane-position-hole-dpms-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_position(data, pipe, plane,
-				    TEST_DPMS);
-
-	igt_subtest_f("plane-panning-top-left-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_panning(data, pipe, plane, TEST_PANNING_TOP_LEFT);
-
-	igt_subtest_f("plane-panning-bottom-right-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_panning(data, pipe, plane,
-				   TEST_PANNING_BOTTOM_RIGHT);
-
-	igt_subtest_f("plane-panning-bottom-right-suspend-pipe-%s-plane-%d",
-		      kmstest_pipe_name(pipe), plane)
-		test_plane_panning(data, pipe, plane,
-				   TEST_PANNING_BOTTOM_RIGHT |
-				   TEST_SUSPEND_RESUME);
-}
+	igt_subtest_f("plane-position-covered-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_position(data, pipe, plane,
+					    TEST_POSITION_FULLY_COVERED);
+	}
 
-static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
-{
-	int plane;
+	igt_subtest_f("plane-position-hole-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_position(data, pipe, plane, 0);
+	}
+
+	igt_subtest_f("plane-position-hole-dpms-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_position(data, pipe, plane,
+					    TEST_DPMS);
+	}
+
+	igt_subtest_f("plane-panning-top-left-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_panning(data, pipe, plane, TEST_PANNING_TOP_LEFT);
+	}
 
-	for (plane = 1; plane < IGT_MAX_PLANES; plane++)
-		run_tests_for_pipe_plane(data, pipe, plane);
+	igt_subtest_f("plane-panning-bottom-right-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_panning(data, pipe, plane,
+					   TEST_PANNING_BOTTOM_RIGHT);
+	}
+
+	igt_subtest_f("plane-panning-bottom-right-suspend-pipe-%s-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int plane = 1; plane < n_planes; plane++)
+			test_plane_panning(data, pipe, plane,
+					   TEST_PANNING_BOTTOM_RIGHT |
+					   TEST_SUSPEND_RESUME);
+	}
 }
 
+
 static data_t data;
 
 igt_main
@@ -425,7 +435,7 @@ igt_main
 	}
 
 	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
-		run_tests_for_pipe(&data, pipe);
+		run_tests_for_pipe_plane(&data, pipe);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 20/32] tests/kms_plane_multiple: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (18 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 19/32] tests/kms_plane: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 21/32] tests/kms_plane_scaling: " Robert Foss
                   ` (11 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_plane_multiple.c | 209 ++++++++++++++++++++++++++++-----------------
 1 file changed, 131 insertions(+), 78 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 2b43f0c5..7e08c1a4 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -47,8 +47,8 @@ typedef struct {
 	int drm_fd;
 	igt_display_t display;
 	igt_pipe_crc_t *pipe_crc;
-	igt_plane_t *plane[IGT_MAX_PLANES];
-	struct igt_fb fb[IGT_MAX_PLANES];
+	igt_plane_t **plane;
+	struct igt_fb *fb;
 } data_t;
 
 typedef struct {
@@ -70,20 +70,35 @@ struct {
 /*
  * Common code across all tests, acting on data_t
  */
-static void test_init(data_t *data, enum pipe pipe)
+static void test_init(data_t *data, enum pipe pipe, int max_planes)
 {
 	data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	data->plane = malloc(max_planes * sizeof(data->plane));
+	igt_assert_f(data->plane != NULL, "Failed to allocate memory for planes\n");
+
+	data->fb = malloc(max_planes * sizeof(struct igt_fb));
+	igt_assert_f(data->fb != NULL, "Failed to allocate memory for FBs\n");
 }
 
 static void test_fini(data_t *data, igt_output_t *output, int max_planes)
 {
-	for (int i = IGT_PLANE_PRIMARY; i <= max_planes; i++)
-		igt_plane_set_fb(data->plane[i], NULL);
+	for (int i = 0; i <= max_planes; i++) {
+		igt_plane_t *plane = data->plane[i];
+		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+			continue;
+		igt_plane_set_fb(plane, NULL);
+	}
 
 	/* reset the constraint on the pipe */
 	igt_output_set_pipe(output, PIPE_ANY);
 
 	igt_pipe_crc_free(data->pipe_crc);
+
+	free(data->plane);
+	data->plane = NULL;
+	free(data->fb);
+	data->fb = NULL;
 }
 
 static void
@@ -91,11 +106,13 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
 	      color_t *color, uint64_t tiling, igt_crc_t *crc /* out */)
 {
 	drmModeModeInfo *mode;
+	igt_plane_t *primary;
 	int ret, n;
 
 	igt_output_set_pipe(output, pipe);
 
-	data->plane[IGT_PLANE_PRIMARY] = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	data->plane[primary->index] = primary;
 
 	mode = igt_output_get_mode(output);
 
@@ -103,9 +120,9 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
 			    DRM_FORMAT_XRGB8888,
 			    LOCAL_DRM_FORMAT_MOD_NONE,
 			    color->red, color->green, color->blue,
-			    &data->fb[IGT_PLANE_PRIMARY]);
+			    &data->fb[primary->index]);
 
-	igt_plane_set_fb(data->plane[IGT_PLANE_PRIMARY], &data->fb[IGT_PLANE_PRIMARY]);
+	igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
 
 	ret = igt_display_try_commit2(&data->display,
 				      atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -128,29 +145,35 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
  */
 
 static void
-create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
+create_fb_for_mode_position(data_t *data, igt_output_t *output, drmModeModeInfo *mode,
 			    color_t *color, int *rect_x, int *rect_y,
 			    int *rect_w, int *rect_h, uint64_t tiling,
 			    int max_planes)
 {
 	unsigned int fb_id;
 	cairo_t *cr;
+	igt_plane_t *primary;
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	fb_id = igt_create_fb(data->drm_fd,
 			      mode->hdisplay, mode->vdisplay,
 			      DRM_FORMAT_XRGB8888,
 			      tiling,
-			      &data->fb[IGT_PLANE_PRIMARY]);
+			      &data->fb[primary->index]);
 	igt_assert(fb_id);
 
-	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb[IGT_PLANE_PRIMARY]);
+	cr = igt_get_cairo_ctx(data->drm_fd, &data->fb[primary->index]);
 	igt_paint_color(cr, rect_x[0], rect_y[0],
 			mode->hdisplay, mode->vdisplay,
 			color->red, color->green, color->blue);
 
-	for (int i = IGT_PLANE_2; i <= max_planes; i++)
+	for (int i = 0; i <= max_planes; i++) {
+		if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY)
+			continue;
 		igt_paint_color(cr, rect_x[i], rect_y[i],
 				rect_w[i], rect_h[i], 0.0, 0.0, 0.0);
+		}
 
 	igt_assert(cairo_status(cr) == 0);
 	cairo_destroy(cr);
@@ -158,37 +181,52 @@ create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
 
 
 static void
-prepare_planes(data_t *data, enum pipe pipe, color_t *color,
+prepare_planes(data_t *data, enum pipe pipe_id, color_t *color,
 	       uint64_t tiling, int max_planes, igt_output_t *output)
 {
 	drmModeModeInfo *mode;
-	int x[IGT_MAX_PLANES];
-	int y[IGT_MAX_PLANES];
-	int size[IGT_MAX_PLANES];
+	igt_pipe_t *pipe;
+	igt_plane_t *primary;
+	int *x;
+	int *y;
+	int *size;
 	int i;
 
-	igt_output_set_pipe(output, pipe);
+	igt_output_set_pipe(output, pipe_id);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	pipe = primary->pipe;
+
+	x = malloc(pipe->n_planes * sizeof(*x));
+	igt_assert_f(x, "Failed to allocate %d bytes for variable x\n", pipe->n_planes * sizeof(*x));
+	y = malloc(pipe->n_planes * sizeof(*y));
+	igt_assert_f(x, "Failed to allocate %d bytes for variable y\n", pipe->n_planes * sizeof(*y));
+	size = malloc(pipe->n_planes * sizeof(*size));
+	igt_assert_f(x, "Failed to allocate %d bytes for variable size\n", pipe->n_planes * sizeof(*size));
 
 	mode = igt_output_get_mode(output);
 
 	/* planes with random positions */
-	x[IGT_PLANE_PRIMARY] = 0;
-	y[IGT_PLANE_PRIMARY] = 0;
-	for (i = IGT_PLANE_2; i <= max_planes; i++) {
-		if (i == IGT_PLANE_CURSOR)
+	x[primary->index] = 0;
+	y[primary->index] = 0;
+	for (i = 1; i <= max_planes; i++) {
+		igt_plane_t *plane = igt_output_get_plane(output, i);
+
+		if (plane->type == DRM_PLANE_TYPE_CURSOR)
 			size[i] = SIZE_CURSOR;
+		else if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+			continue;
 		else
 			size[i] = SIZE_PLANE;
 
 		x[i] = rand() % (mode->hdisplay - size[i]);
 		y[i] = rand() % (mode->vdisplay - size[i]);
 
-		data->plane[i] = igt_output_get_plane(output, i);
+		data->plane[i] = plane;
 
 		igt_create_color_fb(data->drm_fd,
 				    size[i], size[i],
-				    data->plane[i]->is_cursor ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
-				    data->plane[i]->is_cursor ? LOCAL_DRM_FORMAT_MOD_NONE : tiling,
+				    data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
+				    data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? LOCAL_DRM_FORMAT_MOD_NONE : tiling,
 				    color->red, color->green, color->blue,
 				    &data->fb[i]);
 
@@ -197,10 +235,10 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color,
 	}
 
 	/* primary plane */
-	data->plane[IGT_PLANE_PRIMARY] = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-	create_fb_for_mode_position(data, mode, color, x, y,
+	data->plane[primary->index] = primary;
+	create_fb_for_mode_position(data, output, mode, color, x, y,
 				    size, size, tiling, max_planes);
-	igt_plane_set_fb(data->plane[IGT_PLANE_PRIMARY], &data->fb[IGT_PLANE_PRIMARY]);
+	igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
 }
 
 static void
@@ -232,7 +270,7 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 		 igt_output_name(output), kmstest_pipe_name(pipe), max_planes,
 		 info, opt.seed);
 
-	test_init(data, pipe);
+	test_init(data, pipe, max_planes);
 
 	test_grab_crc(data, output, pipe, true, &blue, tiling,
 		      &test.reference_crc);
@@ -298,7 +336,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 		 igt_output_name(output), kmstest_pipe_name(pipe), max_planes,
 		 info, opt.seed);
 
-	test_init(data, pipe);
+	test_init(data, pipe, max_planes);
 
 	test_grab_crc(data, output, pipe, false, &blue, tiling,
 		      &test.reference_crc);
@@ -367,54 +405,71 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
 }
 
 static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
 {
-	igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_DRM_FORMAT_MOD_NONE);
-
-	igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
-
-	igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
-
-	igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
-
-	igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
-
-	igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
-
-	igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
-
-	igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d",
-		      kmstest_pipe_name(pipe), max_planes)
-		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
-}
+	igt_subtest_f("legacy-pipe-%s-tiling-none-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, false, planes,
+				LOCAL_DRM_FORMAT_MOD_NONE);
+	}
 
-static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
-{
-	for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++)
-		run_tests_for_pipe_plane(data, pipe, planes);
+	igt_subtest_f("atomic-pipe-%s-tiling-none-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, true, planes,
+				LOCAL_I915_FORMAT_MOD_X_TILED);
+	}
+
+	igt_subtest_f("legacy-pipe-%s-tiling-x-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, false, planes,
+				LOCAL_I915_FORMAT_MOD_X_TILED);
+	}
+
+	igt_subtest_f("atomic-pipe-%s-tiling-x-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, true, planes,
+				LOCAL_I915_FORMAT_MOD_X_TILED);
+	}
+
+	igt_subtest_f("legacy-pipe-%s-tiling-y-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, false, planes,
+				LOCAL_I915_FORMAT_MOD_Y_TILED);
+	}
+
+	igt_subtest_f("atomic-pipe-%s-tiling-y-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, true, planes,
+				LOCAL_I915_FORMAT_MOD_Y_TILED);
+	}
+
+	igt_subtest_f("legacy-pipe-%s-tiling-yf-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, false, planes,
+				LOCAL_I915_FORMAT_MOD_Yf_TILED);
+	}
+
+	igt_subtest_f("atomic-pipe-%s-tiling-yf-planes",
+		      kmstest_pipe_name(pipe)) {
+		int n_planes = data->display.pipes[pipe].n_planes;
+		for (int planes = 0; planes < n_planes; planes++)
+			test_plane_position(data, pipe, true, planes,
+				LOCAL_I915_FORMAT_MOD_Yf_TILED);
+	}
 }
 
 static data_t data;
@@ -461,15 +516,13 @@ int main(int argc, char *argv[])
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
 		kmstest_set_vt_graphics_mode();
-
 		igt_require_pipe_crc();
 		igt_display_init(&data.display, data.drm_fd);
 	}
 
 	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
-		run_tests_for_pipe(&data, pipe);
+		run_tests_for_pipe_plane(&data, pipe);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 21/32] tests/kms_plane_scaling: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (19 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 20/32] tests/kms_plane_multiple: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 22/32] tests/kms_properties: " Robert Foss
                   ` (10 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_plane_scaling.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 368da09f..18ba86c9 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -85,10 +85,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	 * there's no way (that works) to light up a pipe with only a sprite
 	 * plane enabled at the moment.
 	 */
-	if (!plane->is_primary) {
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, &data->fb1);
 	}
 
@@ -128,10 +128,10 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 		data->fb_id3 = 0;
 	}
 
-	if (!plane->is_primary) {
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
 	}
 
@@ -207,7 +207,7 @@ static void test_plane_scaling(data_t *d)
 		igt_assert(d->fb_id3);
 
 		/* Set up display with plane 1 */
-		d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		d->plane1 = igt_output_get_plane(output, 1);
 		prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL);
 
 		if (primary_plane_scaling) {
@@ -227,7 +227,7 @@ static void test_plane_scaling(data_t *d)
 		}
 
 		/* Set up fb2->plane2 mapping. */
-		d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+		d->plane2 = igt_output_get_plane(output, 2);
 		igt_plane_set_fb(d->plane2, &d->fb2);
 
 		/* 2nd plane windowed */
@@ -263,7 +263,7 @@ static void test_plane_scaling(data_t *d)
 		}
 
 		/* Set up fb3->plane3 mapping. */
-		d->plane3 = igt_output_get_plane(output, IGT_PLANE_3);
+		d->plane3 = igt_output_get_plane(output, 3);
 		igt_plane_set_fb(d->plane3, &d->fb3);
 
 		/* 3rd plane windowed - no scaling */
-- 
2.11.0

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

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

* [PATCH i-g-t v1 22/32] tests/kms_properties: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (20 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 21/32] tests/kms_plane_scaling: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 23/32] tests/kms_psr_sink_crc: " Robert Foss
                   ` (9 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_properties.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index 2650672d..a86371c0 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -38,7 +38,7 @@ static void prepare_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *o
 
 	igt_output_set_pipe(output, pipe);
 
-	igt_plane_set_fb(igt_output_get_plane(output, IGT_PLANE_PRIMARY), fb);
+	igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), fb);
 
 	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 }
@@ -163,8 +163,8 @@ static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igt
 	prepare_pipe(display, pipe, output, &fb);
 
 	for_each_plane_on_pipe(display, pipe, plane) {
-		igt_info("Testing plane properties on %s.%s (output: %s)\n",
-			 kmstest_pipe_name(pipe), kmstest_plane_name(plane->index), output->name);
+		igt_info("Testing plane properties on %s.#%d-%s (output: %s)\n",
+			 kmstest_pipe_name(pipe), plane->index, kmstest_plane_type_name(plane->type), output->name);
 
 		test_properties(display->drm_fd, DRM_MODE_OBJECT_PLANE, plane->drm_plane->plane_id, atomic);
 	}
-- 
2.11.0

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

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

* [PATCH i-g-t v1 23/32] tests/kms_psr_sink_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (21 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 22/32] tests/kms_properties: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 24/32] tests/kms_pwrite_crc: " Robert Foss
                   ` (8 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_psr_sink_crc.c | 52 +++++++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 29 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 926b8578..8f6bdc0d 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -34,12 +34,6 @@ bool running_with_psr_disabled;
 
 #define CRC_BLACK "000000000000"
 
-enum planes {
-	PRIMARY,
-	SPRITE,
-	CURSOR,
-};
-
 enum operations {
 	PAGE_FLIP,
 	MMAP_GTT,
@@ -69,7 +63,7 @@ static const char *op_str(enum operations op)
 
 typedef struct {
 	int drm_fd;
-	enum planes test_plane;
+	int test_plane;
 	enum operations op;
 	uint32_t devid;
 	uint32_t crtc_id;
@@ -313,9 +307,9 @@ static void run_test(data_t *data)
 
 	/* Setting a secondary fb/plane */
 	switch (data->test_plane) {
-	case PRIMARY: default: test_plane = data->primary; break;
-	case SPRITE: test_plane = data->sprite; break;
-	case CURSOR: test_plane = data->cursor; break;
+	case DRM_PLANE_TYPE_PRIMARY: default: test_plane = data->primary; break;
+	case DRM_PLANE_TYPE_OVERLAY: test_plane = data->sprite; break;
+	case DRM_PLANE_TYPE_CURSOR: test_plane = data->cursor; break;
 	}
 	igt_plane_set_fb(test_plane, &data->fb_white);
 	igt_display_commit(&data->display);
@@ -323,7 +317,7 @@ static void run_test(data_t *data)
 	/* Confirm it is not Green anymore */
 	igt_assert(wait_psr_entry(data));
 	get_sink_crc(data, ref_crc);
-	if (data->test_plane == PRIMARY)
+	if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
 		assert_or_manual(!is_green(ref_crc), "screen WHITE");
 	else
 		assert_or_manual(!is_green(ref_crc), "GREEN background with WHITE box");
@@ -355,7 +349,7 @@ static void run_test(data_t *data)
 		/* Printing white on white so the screen shouldn't change */
 		memset(ptr, 0xff, data->mod_size);
 		get_sink_crc(data, crc);
-		if (data->test_plane == PRIMARY)
+		if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
 			assert_or_manual(strcmp(ref_crc, crc) == 0, "screen WHITE");
 		else
 			assert_or_manual(strcmp(ref_crc, crc) == 0,
@@ -406,9 +400,9 @@ static void run_test(data_t *data)
 
 static void test_cleanup(data_t *data) {
 	igt_plane_set_fb(data->primary, NULL);
-	if (data->test_plane == SPRITE)
+	if (data->test_plane == DRM_PLANE_TYPE_OVERLAY)
 		igt_plane_set_fb(data->sprite, NULL);
-	if (data->test_plane == CURSOR)
+	if (data->test_plane == DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_fb(data->cursor, NULL);
 
 	igt_display_commit(&data->display);
@@ -428,7 +422,7 @@ static void setup_test_plane(data_t *data)
 			    0.0, 1.0, 0.0,
 			    &data->fb_green);
 
-	data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	data->primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(data->primary, NULL);
 
 	white_h = data->mode->hdisplay;
@@ -439,16 +433,16 @@ static void setup_test_plane(data_t *data)
 	data->mod_stride = white_h * 4;
 
 	switch (data->test_plane) {
-	case SPRITE:
-		data->sprite = igt_output_get_plane(data->output,
-						    IGT_PLANE_2);
+	case DRM_PLANE_TYPE_OVERLAY:
+		data->sprite = igt_output_get_plane_type(data->output,
+						    DRM_PLANE_TYPE_OVERLAY);
 		igt_plane_set_fb(data->sprite, NULL);
 		/* To make it different for human eyes let's make
 		 * sprite visible in only one quarter of the primary
 		 */
 		white_h = white_h/2;
 		white_v = white_v/2;
-	case PRIMARY:
+	case DRM_PLANE_TYPE_PRIMARY:
 		igt_create_color_fb(data->drm_fd,
 				    white_h, white_v,
 				    DRM_FORMAT_XRGB8888,
@@ -456,9 +450,9 @@ static void setup_test_plane(data_t *data)
 				    1.0, 1.0, 1.0,
 				    &data->fb_white);
 		break;
-	case CURSOR:
-		data->cursor = igt_output_get_plane(data->output,
-						    IGT_PLANE_CURSOR);
+	case DRM_PLANE_TYPE_CURSOR:
+		data->cursor = igt_output_get_plane_type(data->output,
+						    DRM_PLANE_TYPE_CURSOR);
 		igt_plane_set_fb(data->cursor, NULL);
 		create_cursor_fb(data);
 		igt_plane_set_position(data->cursor, 0, 0);
@@ -535,7 +529,7 @@ int main(int argc, char *argv[])
 
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
-			data.test_plane = PRIMARY;
+			data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 			data.op = op;
 			setup_test_plane(&data);
 			igt_assert(wait_psr_entry(&data));
@@ -546,7 +540,7 @@ int main(int argc, char *argv[])
 
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("sprite_%s", op_str(op)) {
-			data.test_plane = SPRITE;
+			data.test_plane = DRM_PLANE_TYPE_OVERLAY;
 			data.op = op;
 			setup_test_plane(&data);
 			igt_assert(wait_psr_entry(&data));
@@ -557,7 +551,7 @@ int main(int argc, char *argv[])
 
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("cursor_%s", op_str(op)) {
-			data.test_plane = CURSOR;
+			data.test_plane = DRM_PLANE_TYPE_CURSOR;
 			data.op = op;
 			setup_test_plane(&data);
 			igt_assert(wait_psr_entry(&data));
@@ -567,7 +561,7 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("dpms_off_psr_active") {
-		data.test_plane = PRIMARY;
+		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 		data.op = RENDER;
 		setup_test_plane(&data);
 		igt_assert(wait_psr_entry(&data));
@@ -579,7 +573,7 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("dpms_off_psr_exit") {
-		data.test_plane = SPRITE;
+		data.test_plane = DRM_PLANE_TYPE_OVERLAY;
 		data.op = PLANE_ONOFF;
 		setup_test_plane(&data);
 
@@ -591,7 +585,7 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("suspend_psr_active") {
-		data.test_plane = PRIMARY;
+		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 		data.op = PAGE_FLIP;
 		setup_test_plane(&data);
 		igt_assert(wait_psr_entry(&data));
@@ -604,7 +598,7 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest_f("suspend_psr_exit") {
-		data.test_plane = CURSOR;
+		data.test_plane = DRM_PLANE_TYPE_CURSOR;
 		data.op = PLANE_ONOFF;
 		setup_test_plane(&data);
 
-- 
2.11.0

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

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

* [PATCH i-g-t v1 24/32] tests/kms_pwrite_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (22 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 23/32] tests/kms_psr_sink_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 25/32] tests/kms_rmfb: " Robert Foss
                   ` (7 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_pwrite_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c
index b63afbc6..1e626375 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -116,7 +116,7 @@ static void prepare_crtc(data_t *data)
 			    DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
 			    1.0, 1.0, 1.0, &data->fb[0]);
 
-	data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	igt_plane_set_fb(data->primary, &data->fb[0]);
 	igt_display_commit(display);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 25/32] tests/kms_rmfb: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (23 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 24/32] tests/kms_pwrite_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 26/32] tests/kms_rotation_crc: " Robert Foss
                   ` (6 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_rmfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
index 17a3065a..5753d74c 100644
--- a/tests/kms_rmfb.c
+++ b/tests/kms_rmfb.c
@@ -83,7 +83,7 @@ test_rmfb(struct rmfb_data *data, igt_output_t *output, enum pipe pipe, bool reo
 	 * later on.
 	 */
 	for_each_plane_on_pipe(&data->display, pipe, plane) {
-		if (plane->is_cursor) {
+		if (plane->type == DRM_PLANE_TYPE_CURSOR) {
 			igt_plane_set_fb(plane, &argb_fb);
 			igt_fb_set_size(&argb_fb, plane, cursor_width, cursor_height);
 			igt_plane_set_size(plane, cursor_width, cursor_height);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 26/32] tests/kms_rotation_crc: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (24 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 25/32] tests/kms_rmfb: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 27/32] tests/kms_sink_crc_basic: " Robert Foss
                   ` (5 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_rotation_crc.c | 63 ++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cb0ac1eb..6769a89b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -97,17 +97,18 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 	 * we create an fb covering the crtc and call commit
 	 */
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, &data->fb_modeset);
 	primary->rotation_changed = false;
 	igt_display_commit(display);
 
 	igt_plane_set_fb(plane, &data->fb);
 
-	if (!plane->is_cursor)
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 
-	if (plane->is_primary || plane->is_cursor)
+	if (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+	    plane->type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
 
 	if (data->display.is_atomic)
@@ -154,7 +155,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 		tiling = data->override_tiling ?
 			 data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED;
 		w = h =  mode->vdisplay;
-	} else if (plane->is_cursor) {
+	} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
 		pixel_format = data->override_fmt ?
 			       data->override_fmt : DRM_FORMAT_ARGB8888;
 		w = h = 128;
@@ -206,10 +207,10 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 		igt_remove_fb(data->gfx_fd, &data->fb_flip);
 
 	/* XXX: see the note in prepare_crtc() */
-	if (!plane->is_primary) {
+	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
 
-		primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 		igt_plane_set_fb(primary, NULL);
 	}
 
@@ -236,7 +237,7 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
-static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation(data_t *data, int plane_type)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -247,10 +248,10 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 	unsigned int flip_count;
 	int ret;
 
-	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
 
-	if (plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
 
 	if (data->display.is_atomic)
@@ -261,7 +262,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 
 		igt_output_set_pipe(output, pipe);
 
-		plane = igt_output_get_plane(output, plane_type);
+		plane = igt_output_get_plane_type(output, plane_type);
 		igt_require(igt_plane_supports_rotation(plane));
 
 		prepare_crtc(data, output, pipe, plane);
@@ -321,7 +322,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 
 static void test_plane_rotation_ytiled_obj(data_t *data,
 					   igt_output_t *output,
-					   enum igt_plane plane_type)
+					   int plane_type)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -335,13 +336,13 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 	uint32_t gem_handle;
 	int ret;
 
-	plane = igt_output_get_plane(output, plane_type);
+	plane = igt_output_get_plane_type(output, plane_type);
 	igt_require(igt_plane_supports_rotation(plane));
 
-	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
 
-	if (plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
 
 	if (data->display.is_atomic)
@@ -388,7 +389,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 
 static void test_plane_rotation_exhaust_fences(data_t *data,
 					       igt_output_t *output,
-					       enum igt_plane plane_type)
+					       int plane_type)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -404,13 +405,13 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	uint64_t total_aperture_size, total_fbs_size;
 	int i, ret;
 
-	plane = igt_output_get_plane(output, plane_type);
+	plane = igt_output_get_plane_type(output, plane_type);
 	igt_require(igt_plane_supports_rotation(plane));
 
-	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
 
-	if (plane_type == IGT_PLANE_CURSOR)
+	if (plane_type == DRM_PLANE_TYPE_CURSOR)
 		igt_require(display->has_cursor_plane);
 
 	if (data->display.is_atomic)
@@ -519,41 +520,41 @@ igt_main
 	}
 	igt_subtest_f("primary-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("sprite-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
 	}
 
 	igt_subtest_f("cursor-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_CURSOR);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_CURSOR);
 	}
 
 	igt_subtest_f("primary-rotation-90") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-270") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_270;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("sprite-rotation-90") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
 	}
 
 	igt_subtest_f("sprite-rotation-270") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_270;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
 	}
 
 	igt_subtest_f("sprite-rotation-90-pos-100-0") {
@@ -561,7 +562,7 @@ igt_main
 		data.rotation = IGT_ROTATION_90;
 		data.pos_x = 100,
 		data.pos_y = 0;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_OVERLAY);
 	}
 
 	igt_subtest_f("bad-pixel-format") {
@@ -570,7 +571,7 @@ igt_main
 		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("bad-tiling") {
@@ -578,7 +579,7 @@ igt_main
 		data.override_fmt = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-90-flip-stress") {
@@ -586,7 +587,7 @@ igt_main
 		data.override_tiling = 0;
 		data.flip_stress = 60;
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
@@ -600,7 +601,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_output_set_pipe(output, pipe);
 
-			test_plane_rotation_ytiled_obj(&data, output, IGT_PLANE_PRIMARY);
+			test_plane_rotation_ytiled_obj(&data, output, DRM_PLANE_TYPE_PRIMARY);
 
 			valid_tests++;
 			break;
@@ -619,7 +620,7 @@ igt_main
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_output_set_pipe(output, pipe);
 
-			test_plane_rotation_exhaust_fences(&data, output, IGT_PLANE_PRIMARY);
+			test_plane_rotation_exhaust_fences(&data, output, DRM_PLANE_TYPE_PRIMARY);
 
 			valid_tests++;
 			break;
-- 
2.11.0

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

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

* [PATCH i-g-t v1 27/32] tests/kms_sink_crc_basic: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (25 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 26/32] tests/kms_rotation_crc: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 28/32] tests/kms_universal_plane: " Robert Foss
                   ` (4 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_sink_crc_basic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c
index c332eb1e..953ead10 100644
--- a/tests/kms_sink_crc_basic.c
+++ b/tests/kms_sink_crc_basic.c
@@ -138,7 +138,7 @@ static void run_test(data_t *data)
 				    1.0, 0.0, 0.0,
 				    &data->fb_red);
 
-		data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+		data->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 		basic_sink_crc_check(data);
 		return;
-- 
2.11.0

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

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

* [PATCH i-g-t v1 28/32] tests/kms_universal_plane: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (26 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 27/32] tests/kms_sink_crc_basic: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 29/32] tests/kms_vblank: " Robert Foss
                   ` (3 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_universal_plane.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 48560212..a2fe1cc1 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -148,16 +148,16 @@ functional_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 	 * boolean and show up in userspace as the wrong type.
 	 */
 	for (i = 0; i < display->pipes[pipe].n_planes; i++)
-		if (display->pipes[pipe].planes[i].is_primary)
+		if (display->pipes[pipe].planes[i].type == DRM_PLANE_TYPE_PRIMARY)
 			num_primary++;
-		else if (display->pipes[pipe].planes[i].is_cursor)
+		else if (display->pipes[pipe].planes[i].type == DRM_PLANE_TYPE_CURSOR)
 			num_cursor++;
 
 	igt_assert_eq(num_primary, 1);
 	igt_assert_lte(num_cursor, 1);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-	sprite = igt_output_get_plane(output, IGT_PLANE_2);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	sprite = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
 	if (!sprite) {
 		functional_test_fini(&test, output);
 		igt_skip("No sprite plane available\n");
@@ -369,7 +369,7 @@ sanity_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 
 	sanity_test_init(&test, output, pipe);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	/* Use legacy API to set a mode with a blue FB */
 	igt_plane_set_fb(primary, &test.blue_fb);
@@ -480,7 +480,7 @@ pageflip_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 
 	pageflip_test_init(&test, output, pipe);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	/* Use legacy API to set a mode with a blue FB */
 	igt_plane_set_fb(primary, &test.blue_fb);
@@ -602,8 +602,8 @@ cursor_leak_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 				    &cursor_fb[i]);
 	}
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-	cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
 	if (!primary || !cursor) {
 		cursor_leak_test_fini(data, output, &background_fb, cursor_fb);
 		igt_skip("Primary and/or cursor are unavailable\n");
@@ -706,7 +706,7 @@ gen9_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 
 	gen9_test_init(&test, output, pipe);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	/* Start with a full-screen primary plane */
 	igt_plane_set_fb(primary, &test.biggreen_fb);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 29/32] tests/kms_vblank: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (27 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 28/32] tests/kms_universal_plane: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 30/32] tests/prime_mmap_kms: " Robert Foss
                   ` (2 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_vblank.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 122fbc8f..0d250653 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -76,7 +76,7 @@ static void prepare_crtc(data_t *data, int fd, igt_output_t *output)
 			    0.0, 0.0, 0.0,
 			    &data->primary_fb);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, &data->primary_fb);
 
 	igt_display_commit(display);
@@ -91,7 +91,7 @@ static void cleanup_crtc(data_t *data, int fd, igt_output_t *output)
 
 	igt_remove_fb(fd, &data->primary_fb);
 
-	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
 
 	igt_output_set_pipe(output, PIPE_ANY);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 30/32] tests/prime_mmap_kms: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (28 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 29/32] tests/kms_vblank: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 31/32] tests/kms_ccs: " Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 32/32] tests/kms_plane_lowres: " Robert Foss
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/prime_mmap_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/prime_mmap_kms.c b/tests/prime_mmap_kms.c
index a2f85fa7..e7cca54c 100644
--- a/tests/prime_mmap_kms.c
+++ b/tests/prime_mmap_kms.c
@@ -168,7 +168,7 @@ static void prepare_crtc(gpu_process_t *gpu)
 			DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
 			1.0, 1.0, 1.0, &gpu->fb);
 
-	gpu->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+	gpu->primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
 	igt_plane_set_fb(gpu->primary, &gpu->fb);
 	igt_display_commit(display);
-- 
2.11.0

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

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

* [PATCH i-g-t v1 31/32] tests/kms_ccs: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (29 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 30/32] tests/prime_mmap_kms: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  2017-01-20 17:45 ` [PATCH i-g-t v1 32/32] tests/kms_plane_lowres: " Robert Foss
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_ccs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 047a3e87..11acda89 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -182,7 +182,7 @@ static void display_fb(data_t *data, int compressed)
 		render_ccs(data, f.handles[0], f.offsets[1], size[1],
 			   f.width/16, f.height/8, f.pitches[1]);
 
-	primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, fb);
 
 	if (data->flags & TEST_ROTATE_180)
@@ -231,7 +231,7 @@ static void test_output(data_t *data)
 		display_fb(data, TEST_COMPRESSED);
 	}
 
-	primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
 	igt_plane_set_rotation(primary, IGT_ROTATION_0);
 	if (!display->is_atomic)
-- 
2.11.0

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

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

* [PATCH i-g-t v1 32/32] tests/kms_plane_lowres: Add support for dynamic number of planes
  2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (30 preceding siblings ...)
  2017-01-20 17:45 ` [PATCH i-g-t v1 31/32] tests/kms_ccs: " Robert Foss
@ 2017-01-20 17:45 ` Robert Foss
  31 siblings, 0 replies; 39+ messages in thread
From: Robert Foss @ 2017-01-20 17:45 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone, Mika Kahola

Add changes reflecting the new support for dynamic number of planes per pipe.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_plane_lowres.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 424ecb97..689c248e 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -40,8 +40,8 @@ typedef struct {
 	int drm_fd;
 	igt_display_t display;
 	igt_pipe_crc_t *pipe_crc;
-	igt_plane_t *plane[IGT_MAX_PLANES];
-	struct igt_fb fb[IGT_MAX_PLANES];
+	igt_plane_t **plane;
+	struct igt_fb *fb;
 } data_t;
 
 static drmModeModeInfo
@@ -113,6 +113,12 @@ static void
 test_init(data_t *data, enum pipe pipe)
 {
 	data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+	data->plane = calloc(data->display.pipes[pipe].n_planes, sizeof(data->plane));\
+	igt_assert_f(data->plane, "Failed to allocate memory for %d planes\n",
+	             data->display.pipes[pipe].n_planes);
+	data->fb = calloc(data->display.pipes[pipe].n_planes, sizeof(struct igt_fb));
+	igt_assert_f(data->fb, "Failed to allocate memory for %d FBs\n",
+	             data->display.pipes[pipe].n_planes);
 }
 
 static void
@@ -128,6 +134,11 @@ test_fini(data_t *data, igt_output_t *output)
 	igt_output_set_pipe(output, PIPE_ANY);
 
 	igt_pipe_crc_free(data->pipe_crc);
+
+	free(data->plane);
+	data->plane = NULL;
+	free(data->fb);
+	data->fb = NULL;
 }
 
 static int
@@ -178,6 +189,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 	int size;
 	int i, x, y;
 
+	crtc.planes = calloc(sizeof(struct kmstest_plane), data->display.pipes[pipe].n_planes);
+	igt_assert_f(crtc.planes, "Failed to allocate memory for %d planes\n", data->display.pipes[pipe].n_planes);
 	igt_output_set_pipe(output, pipe);
 
 	kmstest_get_crtc(pipe, &crtc);
@@ -198,8 +211,10 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 	igt_plane_set_fb(data->plane[0], &data->fb[0]);
 
 	/* yellow sprite plane in lower left corner */
-	for (i = IGT_PLANE_2; i < crtc.n_planes; i++) {
-		if (data->plane[i]->is_cursor)
+	for (i = 0; i < crtc.n_planes; i++) {
+		if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY)
+			continue;
+		if (data->plane[i]->type == DRM_PLANE_TYPE_CURSOR)
 			size = 64;
 		else
 			size = SIZE;
@@ -209,8 +224,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 
 		igt_create_color_fb(data->drm_fd,
 				    size, size,
-				    data->plane[i]->is_cursor ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
-				    data->plane[i]->is_cursor ? LOCAL_DRM_FORMAT_MOD_NONE : modifier,
+				    data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888,
+				    data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? LOCAL_DRM_FORMAT_MOD_NONE : modifier,
 				    1.0, 1.0, 0.0,
 				    &data->fb[i]);
 
-- 
2.11.0

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

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

* Re: [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct
  2017-01-20 17:45 ` [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct Robert Foss
@ 2017-01-23 10:21   ` Mika Kahola
  0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2017-01-23 10:21 UTC (permalink / raw)
  To: Robert Foss, intel-gfx, Tomeu Vizoso, Maarten Lankhorst,
	Gustavo Padovan, Daniel Stone

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
> Add an index property which helps accessing the corresponding
> igt_plane_t structure through the igt_*_get_plane() functions.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_kms.c            | 12 ++++++------
>  lib/igt_kms.h            |  1 +
>  tests/kms_plane_lowres.c |  2 +-
>  3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index d104734a..e1abcf0d 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1244,21 +1244,21 @@ static int parse_planes(FILE *fid, struct
> kmstest_plane *plane)
>  {
>  	char tmp[256];
>  	int nplanes;
> -	int ovl;
>  
> -	ovl = 0;
>  	nplanes = 0;
>  	while (fgets(tmp, 256, fid) != NULL) {
>  		igt_assert_neq(nplanes, IGT_MAX_PLANES);
>  		if (strstr(tmp, "type=PRI") != NULL) {
> -			get_plane(tmp, IGT_PLANE_PRIMARY,
> &plane[nplanes]);
> +			get_plane(tmp, DRM_PLANE_TYPE_PRIMARY,
> &plane[nplanes]);
> +			plane[nplanes].index = nplanes;
>  			nplanes++;
>  		} else if (strstr(tmp, "type=OVL") != NULL) {
> -			get_plane(tmp, IGT_PLANE_2 + ovl,
> &plane[nplanes]);
> -			ovl++;
> +			get_plane(tmp, DRM_PLANE_TYPE_OVERLAY,
> &plane[nplanes]);
> +			plane[nplanes].index = nplanes;
>  			nplanes++;
>  		} else if (strstr(tmp, "type=CUR") != NULL) {
> -			get_plane(tmp, IGT_PLANE_CURSOR,
> &plane[nplanes]);
> +			get_plane(tmp, DRM_PLANE_TYPE_CURSOR,
> &plane[nplanes]);
> +			plane[nplanes].index = nplanes;
>  			nplanes++;
>  			break;
>  		}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 64414a24..d6cf8338 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -136,6 +136,7 @@ struct kmstest_connector_config {
>  struct kmstest_plane {
>  	int id;
>  	int plane;
> +	int index;
>  	int pos_x;
>  	int pos_y;
>  	int width;
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index 93aefdaa..858cc482 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -185,7 +185,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t
> modifier, int flags,
>  	igt_skip_on(crtc.nplanes == 0);
>  
>  	for (i = 0; i < crtc.nplanes; i++)
> -		data->plane[i] = igt_output_get_plane(output,
> crtc.plane[i].plane);
> +		data->plane[i] = igt_output_get_plane(output,
> crtc.plane[i].index);
>  
>  	mode = igt_output_get_mode(output);
>  
-- 
Mika Kahola - Intel OTC

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

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

* Re: [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count
  2017-01-20 17:45 ` [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count Robert Foss
@ 2017-01-23 10:31   ` Mika Kahola
  0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2017-01-23 10:31 UTC (permalink / raw)
  To: Robert Foss, intel-gfx, Tomeu Vizoso, Maarten Lankhorst,
	Gustavo Padovan, Daniel Stone

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
> Rework kmstest_crtc and kmstest_plane structs and their usage
> to not depend on a static plane count.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_kms.c | 47 ++++++++++++++++++++++++++++++-----------------
>  lib/igt_kms.h |  4 ++--
>  2 files changed, 32 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e1abcf0d..922bba63 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1227,7 +1227,7 @@ static void get_plane(char *str, int type,
> struct kmstest_plane *plane)
>  	int ret;
>  	char buf[256];
>  
> -	plane->plane = type;
> +	plane->type = type;
>  	ret = sscanf(str + 12, "%d%*c %*s %[^n]s",
>  		     &plane->id,
>  		     buf);
> @@ -1240,31 +1240,36 @@ static void get_plane(char *str, int type,
> struct kmstest_plane *plane)
>  	igt_assert_eq(ret, 2);
>  }
>  
> -static int parse_planes(FILE *fid, struct kmstest_plane *plane)
> +static int parse_planes(FILE *fid, struct kmstest_plane *planes)
>  {
>  	char tmp[256];
> -	int nplanes;
> +	int n_planes;
>  
> -	nplanes = 0;
> +	n_planes = 0;
>  	while (fgets(tmp, 256, fid) != NULL) {
> -		igt_assert_neq(nplanes, IGT_MAX_PLANES);
>  		if (strstr(tmp, "type=PRI") != NULL) {
> -			get_plane(tmp, DRM_PLANE_TYPE_PRIMARY,
> &plane[nplanes]);
> -			plane[nplanes].index = nplanes;
> -			nplanes++;
> +			if (planes) {
> +				get_plane(tmp,
> DRM_PLANE_TYPE_PRIMARY, &planes[n_planes]);
> +				planes[n_planes].index = n_planes;
> +			}
> +			n_planes++;
>  		} else if (strstr(tmp, "type=OVL") != NULL) {
> -			get_plane(tmp, DRM_PLANE_TYPE_OVERLAY,
> &plane[nplanes]);
> -			plane[nplanes].index = nplanes;
> -			nplanes++;
> +			if (planes) {
> +				get_plane(tmp,
> DRM_PLANE_TYPE_OVERLAY, &planes[n_planes]);
> +				planes[n_planes].index = n_planes;
> +			}
> +			n_planes++;
>  		} else if (strstr(tmp, "type=CUR") != NULL) {
> -			get_plane(tmp, DRM_PLANE_TYPE_CURSOR,
> &plane[nplanes]);
> -			plane[nplanes].index = nplanes;
> -			nplanes++;
> +			if (planes) {
> +				get_plane(tmp,
> DRM_PLANE_TYPE_CURSOR, &planes[n_planes]);
> +				planes[n_planes].index = n_planes;
> +			}
> +			n_planes++;
>  			break;
>  		}
>  	}
>  
> -	return nplanes;
> +	return n_planes;
>  }
>  
>  static void parse_crtc(char *info, struct kmstest_crtc *crtc)
> @@ -1304,7 +1309,12 @@ void kmstest_get_crtc(enum pipe pipe, struct
> kmstest_crtc *crtc)
>  			if (strstr(tmp, "active=yes") != NULL) {
>  				crtc->active = true;
>  				parse_crtc(tmp, crtc);
> -				crtc->nplanes = parse_planes(fid,
> crtc->plane);
> +
> +				crtc->nplanes = parse_planes(fid,
> NULL);
> +				crtc->plane = calloc(crtc->nplanes,
> sizeof(*crtc->plane));
> +				fseek(fid, 0, SEEK_END);
> +				fseek(fid, 0, SEEK_SET);
> +				parse_planes(fid, crtc->plane);
>  
>  				if (crtc->pipe != pipe)
>  					crtc = NULL;
> @@ -1330,7 +1340,10 @@ void igt_assert_plane_visible(enum pipe pipe,
> bool visibility)
>  	kmstest_get_crtc(pipe, &crtc);
>  
>  	visible = true;
> -	for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
> +	for (i = 0; i < crtc.nplanes; i++) {
> +		if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
> +			continue;
> +
>  		if (crtc.plane[i].pos_x > crtc.width) {
>  			visible = false;
>  			break;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index d6cf8338..44602fdd 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -135,8 +135,8 @@ struct kmstest_connector_config {
>  
>  struct kmstest_plane {
>  	int id;
> -	int plane;
>  	int index;
> +	int type;
>  	int pos_x;
>  	int pos_y;
>  	int width;
> @@ -150,7 +150,7 @@ struct kmstest_crtc {
>  	int width;
>  	int height;
>  	int nplanes;
> -	struct kmstest_plane plane[IGT_MAX_PLANES];
> +	struct kmstest_plane *plane;
>  };
>  
>  /**
-- 
Mika Kahola - Intel OTC

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

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

* Re: [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane
  2017-01-20 17:45 ` [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane Robert Foss
@ 2017-01-23 10:33   ` Mika Kahola
  0 siblings, 0 replies; 39+ messages in thread
From: Mika Kahola @ 2017-01-23 10:33 UTC (permalink / raw)
  To: Robert Foss, intel-gfx, Tomeu Vizoso, Maarten Lankhorst,
	Gustavo Padovan, Daniel Stone

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
> Rename these properties to have them use the same naming convention
> as the igt_*_t structs.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_kms.c            | 16 +++++++++-------
>  lib/igt_kms.h            |  4 ++--
>  tests/kms_plane_lowres.c | 10 +++++-----
>  3 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 922bba63..8fa40c28 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1310,11 +1310,13 @@ void kmstest_get_crtc(enum pipe pipe, struct
> kmstest_crtc *crtc)
>  				crtc->active = true;
>  				parse_crtc(tmp, crtc);
>  
> -				crtc->nplanes = parse_planes(fid,
> NULL);
> -				crtc->plane = calloc(crtc->nplanes,
> sizeof(*crtc->plane));
> +				crtc->n_planes = parse_planes(fid,
> NULL);
> +				crtc->planes = calloc(crtc-
> >n_planes, sizeof(*crtc->planes));
> +				igt_assert_f(crtc->planes, "Failed
> to allocate memory for %d planes\n", crtc->n_planes);
> +
>  				fseek(fid, 0, SEEK_END);
>  				fseek(fid, 0, SEEK_SET);
> -				parse_planes(fid, crtc->plane);
> +				parse_planes(fid, crtc->planes);
>  
>  				if (crtc->pipe != pipe)
>  					crtc = NULL;
> @@ -1340,14 +1342,14 @@ void igt_assert_plane_visible(enum pipe pipe,
> bool visibility)
>  	kmstest_get_crtc(pipe, &crtc);
>  
>  	visible = true;
> -	for (i = 0; i < crtc.nplanes; i++) {
> -		if (crtc.plane[i].type == DRM_PLANE_TYPE_PRIMARY)
> +	for (i = 0; i < crtc.n_planes; i++) {
> +		if (crtc.planes[i].type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
>  
> -		if (crtc.plane[i].pos_x > crtc.width) {
> +		if (crtc.planes[i].pos_x > crtc.width) {
>  			visible = false;
>  			break;
> -		} else if (crtc.plane[i].pos_y > crtc.height) {
> +		} else if (crtc.planes[i].pos_y > crtc.height) {
>  			visible = false;
>  			break;
>  		}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 44602fdd..859c79aa 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -149,8 +149,8 @@ struct kmstest_crtc {
>  	bool active;
>  	int width;
>  	int height;
> -	int nplanes;
> -	struct kmstest_plane *plane;
> +	int n_planes;
> +	struct kmstest_plane *planes;
>  };
>  
>  /**
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index 858cc482..424ecb97 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -181,11 +181,11 @@ test_setup(data_t *data, enum pipe pipe,
> uint64_t modifier, int flags,
>  	igt_output_set_pipe(output, pipe);
>  
>  	kmstest_get_crtc(pipe, &crtc);
> -	igt_skip_on(crtc.nplanes > data-
> >display.pipes[pipe].n_planes);
> -	igt_skip_on(crtc.nplanes == 0);
> +	igt_skip_on(crtc.n_planes > data-
> >display.pipes[pipe].n_planes);
> +	igt_skip_on(crtc.n_planes == 0);
>  
> -	for (i = 0; i < crtc.nplanes; i++)
> -		data->plane[i] = igt_output_get_plane(output,
> crtc.plane[i].index);
> +	for (i = 0; i < crtc.n_planes; i++)
> +		data->plane[i] = igt_output_get_plane(output,
> crtc.planes[i].index);
>  
>  	mode = igt_output_get_mode(output);
>  
> @@ -198,7 +198,7 @@ test_setup(data_t *data, enum pipe pipe, uint64_t
> modifier, int flags,
>  	igt_plane_set_fb(data->plane[0], &data->fb[0]);
>  
>  	/* yellow sprite plane in lower left corner */
> -	for (i = IGT_PLANE_2; i < crtc.nplanes; i++) {
> +	for (i = IGT_PLANE_2; i < crtc.n_planes; i++) {
>  		if (data->plane[i]->is_cursor)
>  			size = 64;
>  		else
-- 
Mika Kahola - Intel OTC

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

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

* Re: [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support
  2017-01-20 17:45 ` [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
@ 2017-01-23 11:00   ` Mika Kahola
  2017-01-23 15:47     ` Robert Foss
  0 siblings, 1 reply; 39+ messages in thread
From: Mika Kahola @ 2017-01-23 11:00 UTC (permalink / raw)
  To: Robert Foss, intel-gfx, Tomeu Vizoso, Maarten Lankhorst,
	Gustavo Padovan, Daniel Stone

With this patch applied, I received couple of issues during the
compilation

igt_kms.c:332:5: warning: no previous prototype for
‘kmstest_pipe_to_index’ [-Wmissing-prototypes]
 int kmstest_pipe_to_index(char pipe)
 
and

kms_fence_pin_leak.c:118:41: error: ‘IGT_PLANE_PRIMARY’ undeclared
(first use in this function)
  primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
 
This would require that we move all IGT_PLANE_PRIMARY references to
DRM_PLANE_TYPE_PRIMARY

On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
> In upcoming drm-misc-next changes, the number of planes per pipe has
> been increased as more than one primary plane can be associated with
> a pipe.
> 
> The simple fix for this would be to simply bump hardcoded value for
> number of frames per pipe.
> But a better solution would be to add support for dynamic number of
> planes per pipe to i-g-t.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_kms.c | 157 +++++++++++++++++++++++++++++++++++++++---------
> ----------
>  lib/igt_kms.h |  32 ++++--------
>  2 files changed, 114 insertions(+), 75 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 8fa40c28..58e62e2b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -347,24 +347,17 @@ int kmstest_pipe_to_index(char pipe)
>   *
>   * Returns: String represnting @pipe, e.g. "plane1".
>   */
> -const char *kmstest_plane_name(enum igt_plane plane)
> +const char *kmstest_plane_type_name(int plane_type)
>  {
>  	static const char *names[] = {
> -		[IGT_PLANE_1] = "plane1",
> -		[IGT_PLANE_2] = "plane2",
> -		[IGT_PLANE_3] = "plane3",
> -		[IGT_PLANE_4] = "plane4",
> -		[IGT_PLANE_5] = "plane5",
> -		[IGT_PLANE_6] = "plane6",
> -		[IGT_PLANE_7] = "plane7",
> -		[IGT_PLANE_8] = "plane8",
> -		[IGT_PLANE_9] = "plane9",
> -		[IGT_PLANE_CURSOR] = "cursor",
> +		[DRM_PLANE_TYPE_OVERLAY] = "overlay",
> +		[DRM_PLANE_TYPE_PRIMARY] = "primary",
> +		[DRM_PLANE_TYPE_CURSOR] = "cursor",
>  	};
>  
> -	igt_assert(plane < ARRAY_SIZE(names) && names[plane]);
> +	igt_assert(plane_type < ARRAY_SIZE(names) &&
> names[plane_type]);
>  
> -	return names[plane];
> +	return names[plane_type];
>  }
>  
>  static const char *mode_stereo_name(const drmModeModeInfo *mode)
> @@ -1532,14 +1525,17 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  	for (i = 0; i < display->n_pipes; i++) {
>  		igt_pipe_t *pipe = &display->pipes[i];
>  		igt_plane_t *plane;
> -		int p = IGT_PLANE_2;
> +		int p = 1;
>  		int j, type;
> -		uint8_t n_planes = 0;
> +		uint8_t last_plane = 0, n_planes = 0;
>  		uint64_t prop_value;
>  
>  		pipe->crtc_id = resources->crtcs[i];
>  		pipe->display = display;
>  		pipe->pipe = i;
> +		pipe->plane_cursor = -1;
> +		pipe->plane_primary = -1;
> +		pipe->planes = NULL;
>  
>  		get_crtc_property(display->drm_fd, pipe->crtc_id,
>  				    "background_color",
> @@ -1565,6 +1561,27 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  
>  		igt_atomic_fill_pipe_props(display, pipe,
> IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
>  
> +		/* count number of valid planes */
> +		for (j = 0; j < plane_resources->count_planes; j++)
> {
> +			drmModePlane *drm_plane;
> +
> +			drm_plane = drmModeGetPlane(display->drm_fd,
> +						    plane_resources-
> >planes[j]);
> +			igt_assert(drm_plane);
> +
> +			if (!(drm_plane->possible_crtcs & (1 << i)))
> {
> +				drmModeFreePlane(drm_plane);
> +				continue;
> +            }
> +
> +		    n_planes++;
> +		}
> +
> +		igt_assert_lte(0, n_planes);
> +		pipe->planes = calloc(sizeof(igt_plane_t),
> n_planes);
> +		igt_assert_f(pipe->planes, "Failed to allocate
> memory for %d planes\n", n_planes);
> +		last_plane = n_planes - 1;
> +
>  		/* add the planes that can be used with that pipe */
>  		for (j = 0; j < plane_resources->count_planes; j++)
> {
>  			drmModePlane *drm_plane;
> @@ -1582,21 +1599,24 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  						  plane_resources-
> >planes[j]);
>  			switch (type) {
>  			case DRM_PLANE_TYPE_PRIMARY:
> -				plane = &pipe-
> >planes[IGT_PLANE_PRIMARY];
> -				plane->is_primary = 1;
> -				plane->index = IGT_PLANE_PRIMARY;
> +				if (pipe->plane_primary == -1) {
> +					plane = &pipe->planes[0];
> +					plane->index = 0;
> +					pipe->plane_primary = 0;
> +				} else {
> +					plane = &pipe->planes[p];
> +					plane->index = p++;
> +				}
>  				break;
>  			case DRM_PLANE_TYPE_CURSOR:
> -				/*
> -				 * Cursor should be the highest
> index in our
> -				 * internal list, but we don't know
> what that
> -				 * is yet.  Just stick it in the
> last slot
> -				 * for now and we'll move it later,
> if
> -				 * necessary.
> -				 */
> -				plane = &pipe-
> >planes[IGT_PLANE_CURSOR];
> -				plane->is_cursor = 1;
> -				plane->index = IGT_PLANE_CURSOR;
> +				if (pipe->plane_cursor == -1) {
> +					plane = &pipe-
> >planes[last_plane];
> +					plane->index = last_plane;
> +					pipe->plane_cursor =
> last_plane;
> +				} else {
> +					plane = &pipe->planes[p];
> +					plane->index = p++;
> +				}
>  				display->has_cursor_plane = true;
>  				break;
>  			default:
> @@ -1605,7 +1625,7 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  				break;
>  			}
>  
> -			n_planes++;
> +			plane->type = type;
>  			plane->pipe = pipe;
>  			plane->drm_plane = drm_plane;
>  
> @@ -1626,7 +1646,7 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  		 * At the bare minimum, we should expect to have a
> primary
>  		 * plane
>  		 */
> -		igt_assert(pipe-
> >planes[IGT_PLANE_PRIMARY].drm_plane);
> +		igt_assert(pipe->planes[pipe-
> >plane_primary].drm_plane);
>  
>  		if (display->has_cursor_plane) {
>  			/*
> @@ -1634,11 +1654,11 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  			 * only 1 sprite, that's the wrong slot and
> we need to
>  			 * move it down.
>  			 */
> -			if (p != IGT_PLANE_CURSOR) {
> +			if (p != last_plane) {
>  				pipe->planes[p] =
> -					pipe-
> >planes[IGT_PLANE_CURSOR];
> +					pipe->planes[last_plane];
>  				pipe->planes[p].index = p;
> -				memset(&pipe-
> >planes[IGT_PLANE_CURSOR], 0,
> +				memset(&pipe->planes[last_plane], 0,
>  				       sizeof *plane);
>  			}
>  		} else {
> @@ -1646,7 +1666,7 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  			plane = &pipe->planes[p];
>  			plane->pipe = pipe;
>  			plane->index = p;
> -			plane->is_cursor = true;
> +			plane->type = DRM_PLANE_TYPE_CURSOR;
>  		}
>  
>  		pipe->n_planes = n_planes;
> @@ -1654,9 +1674,6 @@ void igt_display_init(igt_display_t *display,
> int drm_fd)
>  		for_each_plane_on_pipe(display, i, plane)
>  			plane->fb_changed = true;
>  
> -		/* make sure we don't overflow the plane array */
> -		igt_assert_lte(pipe->n_planes, IGT_MAX_PLANES);
> -
>  		pipe->mode_changed = true;
>  	}
>  
> @@ -1709,6 +1726,9 @@ static void igt_pipe_fini(igt_pipe_t *pipe)
>  			plane->drm_plane = NULL;
>  		}
>  	}
> +
> +	free(pipe->planes);
> +	pipe->planes = NULL;
>  }
>  
>  static void igt_output_fini(igt_output_t *output)
> @@ -1797,20 +1817,41 @@ static igt_pipe_t
> *igt_output_get_driving_pipe(igt_output_t *output)
>  	return &display->pipes[pipe];
>  }
>  
> -static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, enum
> igt_plane plane)
> +static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int
> plane_idx)
>  {
> -	int idx;
> +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
> +		"Valid pipe->planes plane_idx not found,
> plane_idx=%d n_planes=%d",
> +		plane_idx, pipe->n_planes);
>  
> -	/* Cursor plane is always the highest index */
> -	if (plane == IGT_PLANE_CURSOR)
> -		idx = pipe->n_planes - 1;
> -	else {
> -		igt_assert_f(plane >= 0 && plane < (pipe->n_planes),
> -			     "plane=%d\n", plane);
> -		idx = plane;
> +	return &pipe->planes[plane_idx];
> +}
> +
> +
> +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
> plane_type)
> +{
> +	int i, plane_idx = -1;
> +
> +	switch(plane_type) {
> +	case DRM_PLANE_TYPE_CURSOR:
> +		plane_idx = pipe->plane_cursor;
> +		break;
> +	case DRM_PLANE_TYPE_PRIMARY:
> +		plane_idx = pipe->plane_primary;
> +		break;
> +	case DRM_PLANE_TYPE_OVERLAY:
> +		for(i = 0; i < pipe->n_planes; i++)
> +			if (pipe->planes[i].type ==
> DRM_PLANE_TYPE_OVERLAY)
> +			    plane_idx = i;
> +		break;
> +	default:
> +		break;
>  	}
>  
> -	return &pipe->planes[idx];
> +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
> +		"Valid pipe->planes idx not found. plane_idx=%d
> plane_type=%d n_planes=%d\n",
> +		plane_idx, plane_type, pipe->n_planes);
> +
> +	return &pipe->planes[plane_idx];
>  }
>  
>  static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
> @@ -2155,9 +2196,9 @@ static int igt_plane_commit(igt_plane_t *plane,
>  			    enum igt_commit_style s,
>  			    bool fail_on_error)
>  {
> -	if (plane->is_cursor && s == COMMIT_LEGACY) {
> +	if (plane->type == DRM_PLANE_TYPE_CURSOR && s ==
> COMMIT_LEGACY) {
>  		return igt_cursor_commit_legacy(plane, pipe,
> fail_on_error);
> -	} else if (plane->is_primary && s == COMMIT_LEGACY) {
> +	} else if (plane->type == DRM_PLANE_TYPE_PRIMARY && s ==
> COMMIT_LEGACY) {
>  		return igt_primary_plane_commit_legacy(plane, pipe,
>  						       fail_on_error
> );
>  	} else {
> @@ -2374,7 +2415,9 @@ display_commit_changed(igt_display_t *display,
> enum igt_commit_style s)
>  			plane->position_changed = false;
>  			plane->size_changed = false;
>  
> -			if (s != COMMIT_LEGACY || !(plane-
> >is_primary || plane->is_cursor))
> +			if (s != COMMIT_LEGACY ||
> +			    !(plane->type == DRM_PLANE_TYPE_PRIMARY
> ||
> +			      plane->type == DRM_PLANE_TYPE_CURSOR))
>  				plane->rotation_changed = false;
>  		}
>  	}
> @@ -2654,14 +2697,24 @@ void igt_output_set_scaling_mode(igt_output_t
> *output, uint64_t scaling_mode)
>  	igt_require(output-
> >config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
>  }
>  
> -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
> igt_plane plane)
> +igt_plane_t *igt_output_get_plane(igt_output_t *output, int
> plane_idx)
> +{
> +	igt_pipe_t *pipe;
> +
> +	pipe = igt_output_get_driving_pipe(output);
> +	igt_assert(pipe);
> +
> +	return igt_pipe_get_plane(pipe, plane_idx);
> +}
> +
> +igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int
> plane_type)
>  {
>  	igt_pipe_t *pipe;
>  
>  	pipe = igt_output_get_driving_pipe(output);
>  	igt_assert(pipe);
>  
> -	return igt_pipe_get_plane(pipe, plane);
> +	return igt_pipe_get_plane_type(pipe, plane_type);
>  }
>  
>  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 859c79aa..dc172ec9 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -57,25 +57,7 @@ enum pipe {
>          I915_MAX_PIPES
>  };
>  const char *kmstest_pipe_name(enum pipe pipe);
> -int kmstest_pipe_to_index(char pipe);
> -
> -/* We namespace this enum to not conflict with the Android
> i915_drm.h */
> -enum igt_plane {
> -	IGT_PLANE_1 = 0,
> -	IGT_PLANE_PRIMARY = IGT_PLANE_1,
> -	IGT_PLANE_2,
> -	IGT_PLANE_3,
> -	IGT_PLANE_4,
> -	IGT_PLANE_5,
> -	IGT_PLANE_6,
> -	IGT_PLANE_7,
> -	IGT_PLANE_8,
> -	IGT_PLANE_9,
> -	IGT_PLANE_CURSOR, /* IGT_PLANE_CURSOR is always the last
> plane. */
> -	IGT_MAX_PLANES,
> -};
> -
> -const char *kmstest_plane_name(enum igt_plane plane);
> +const char *kmstest_plane_type_name(int plane_type);
>  
>  enum port {
>          PORT_A = 0,
> @@ -257,8 +239,7 @@ typedef struct {
>  	igt_pipe_t *pipe;
>  	int index;
>  	/* capabilities */
> -	unsigned int is_primary       : 1;
> -	unsigned int is_cursor        : 1;
> +	int type;
>  	/* state tracking */
>  	unsigned int fb_changed       : 1;
>  	unsigned int position_changed : 1;
> @@ -293,8 +274,11 @@ struct igt_pipe {
>  	igt_display_t *display;
>  	enum pipe pipe;
>  	bool enabled;
> +
>  	int n_planes;
> -	igt_plane_t planes[IGT_MAX_PLANES];
> +	int plane_cursor;
> +	int plane_primary;
> +	igt_plane_t *planes;
>  
>  	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
>  
> @@ -354,7 +338,9 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t
> *output);
>  void igt_output_override_mode(igt_output_t *output, drmModeModeInfo
> *mode);
>  void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
>  void igt_output_set_scaling_mode(igt_output_t *output, uint64_t
> scaling_mode);
> -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
> igt_plane plane);
> +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);
> +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
> plane_type);
>  bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
>  			   uint32_t *prop_id, uint64_t *value,
>  			   drmModePropertyPtr *prop);
-- 
Mika Kahola - Intel OTC

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

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

* Re: [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support
  2017-01-23 11:00   ` Mika Kahola
@ 2017-01-23 15:47     ` Robert Foss
  2017-01-24  9:03       ` Petri Latvala
  0 siblings, 1 reply; 39+ messages in thread
From: Robert Foss @ 2017-01-23 15:47 UTC (permalink / raw)
  To: mika.kahola, intel-gfx, Tomeu Vizoso, Maarten Lankhorst,
	Gustavo Padovan, Daniel Stone



On 2017-01-23 06:00 AM, Mika Kahola wrote:
> With this patch applied, I received couple of issues during the
> compilation
>
> igt_kms.c:332:5: warning: no previous prototype for
> ‘kmstest_pipe_to_index’ [-Wmissing-prototypes]
>  int kmstest_pipe_to_index(char pipe)
>
> and
>
> kms_fence_pin_leak.c:118:41: error: ‘IGT_PLANE_PRIMARY’ undeclared
> (first use in this function)
>   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
>
> This would require that we move all IGT_PLANE_PRIMARY references to
> DRM_PLANE_TYPE_PRIMARY

In the subsequent patches I clear up all of the IGT_PLANE_* being 
missing issues (which does mean that trunk does not build between the
enum being removed and that the individual test being fixed).

I could fix this by moving the removal of the enum until after all of 
the tests have had their dependency on the enum fixed.

Another solution is just to collapse all of the test fixes into this 
patch. Which does sound like the worse option to me.

Rob.
>
> On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
>> In upcoming drm-misc-next changes, the number of planes per pipe has
>> been increased as more than one primary plane can be associated with
>> a pipe.
>>
>> The simple fix for this would be to simply bump hardcoded value for
>> number of frames per pipe.
>> But a better solution would be to add support for dynamic number of
>> planes per pipe to i-g-t.
>>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>>  lib/igt_kms.c | 157 +++++++++++++++++++++++++++++++++++++++---------
>> ----------
>>  lib/igt_kms.h |  32 ++++--------
>>  2 files changed, 114 insertions(+), 75 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 8fa40c28..58e62e2b 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -347,24 +347,17 @@ int kmstest_pipe_to_index(char pipe)
>>   *
>>   * Returns: String represnting @pipe, e.g. "plane1".
>>   */
>> -const char *kmstest_plane_name(enum igt_plane plane)
>> +const char *kmstest_plane_type_name(int plane_type)
>>  {
>>  	static const char *names[] = {
>> -		[IGT_PLANE_1] = "plane1",
>> -		[IGT_PLANE_2] = "plane2",
>> -		[IGT_PLANE_3] = "plane3",
>> -		[IGT_PLANE_4] = "plane4",
>> -		[IGT_PLANE_5] = "plane5",
>> -		[IGT_PLANE_6] = "plane6",
>> -		[IGT_PLANE_7] = "plane7",
>> -		[IGT_PLANE_8] = "plane8",
>> -		[IGT_PLANE_9] = "plane9",
>> -		[IGT_PLANE_CURSOR] = "cursor",
>> +		[DRM_PLANE_TYPE_OVERLAY] = "overlay",
>> +		[DRM_PLANE_TYPE_PRIMARY] = "primary",
>> +		[DRM_PLANE_TYPE_CURSOR] = "cursor",
>>  	};
>>
>> -	igt_assert(plane < ARRAY_SIZE(names) && names[plane]);
>> +	igt_assert(plane_type < ARRAY_SIZE(names) &&
>> names[plane_type]);
>>
>> -	return names[plane];
>> +	return names[plane_type];
>>  }
>>
>>  static const char *mode_stereo_name(const drmModeModeInfo *mode)
>> @@ -1532,14 +1525,17 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  	for (i = 0; i < display->n_pipes; i++) {
>>  		igt_pipe_t *pipe = &display->pipes[i];
>>  		igt_plane_t *plane;
>> -		int p = IGT_PLANE_2;
>> +		int p = 1;
>>  		int j, type;
>> -		uint8_t n_planes = 0;
>> +		uint8_t last_plane = 0, n_planes = 0;
>>  		uint64_t prop_value;
>>
>>  		pipe->crtc_id = resources->crtcs[i];
>>  		pipe->display = display;
>>  		pipe->pipe = i;
>> +		pipe->plane_cursor = -1;
>> +		pipe->plane_primary = -1;
>> +		pipe->planes = NULL;
>>
>>  		get_crtc_property(display->drm_fd, pipe->crtc_id,
>>  				    "background_color",
>> @@ -1565,6 +1561,27 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>
>>  		igt_atomic_fill_pipe_props(display, pipe,
>> IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
>>
>> +		/* count number of valid planes */
>> +		for (j = 0; j < plane_resources->count_planes; j++)
>> {
>> +			drmModePlane *drm_plane;
>> +
>> +			drm_plane = drmModeGetPlane(display->drm_fd,
>> +						    plane_resources-
>>> planes[j]);
>> +			igt_assert(drm_plane);
>> +
>> +			if (!(drm_plane->possible_crtcs & (1 << i)))
>> {
>> +				drmModeFreePlane(drm_plane);
>> +				continue;
>> +            }
>> +
>> +		    n_planes++;
>> +		}
>> +
>> +		igt_assert_lte(0, n_planes);
>> +		pipe->planes = calloc(sizeof(igt_plane_t),
>> n_planes);
>> +		igt_assert_f(pipe->planes, "Failed to allocate
>> memory for %d planes\n", n_planes);
>> +		last_plane = n_planes - 1;
>> +
>>  		/* add the planes that can be used with that pipe */
>>  		for (j = 0; j < plane_resources->count_planes; j++)
>> {
>>  			drmModePlane *drm_plane;
>> @@ -1582,21 +1599,24 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  						  plane_resources-
>>> planes[j]);
>>  			switch (type) {
>>  			case DRM_PLANE_TYPE_PRIMARY:
>> -				plane = &pipe-
>>> planes[IGT_PLANE_PRIMARY];
>> -				plane->is_primary = 1;
>> -				plane->index = IGT_PLANE_PRIMARY;
>> +				if (pipe->plane_primary == -1) {
>> +					plane = &pipe->planes[0];
>> +					plane->index = 0;
>> +					pipe->plane_primary = 0;
>> +				} else {
>> +					plane = &pipe->planes[p];
>> +					plane->index = p++;
>> +				}
>>  				break;
>>  			case DRM_PLANE_TYPE_CURSOR:
>> -				/*
>> -				 * Cursor should be the highest
>> index in our
>> -				 * internal list, but we don't know
>> what that
>> -				 * is yet.  Just stick it in the
>> last slot
>> -				 * for now and we'll move it later,
>> if
>> -				 * necessary.
>> -				 */
>> -				plane = &pipe-
>>> planes[IGT_PLANE_CURSOR];
>> -				plane->is_cursor = 1;
>> -				plane->index = IGT_PLANE_CURSOR;
>> +				if (pipe->plane_cursor == -1) {
>> +					plane = &pipe-
>>> planes[last_plane];
>> +					plane->index = last_plane;
>> +					pipe->plane_cursor =
>> last_plane;
>> +				} else {
>> +					plane = &pipe->planes[p];
>> +					plane->index = p++;
>> +				}
>>  				display->has_cursor_plane = true;
>>  				break;
>>  			default:
>> @@ -1605,7 +1625,7 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  				break;
>>  			}
>>
>> -			n_planes++;
>> +			plane->type = type;
>>  			plane->pipe = pipe;
>>  			plane->drm_plane = drm_plane;
>>
>> @@ -1626,7 +1646,7 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  		 * At the bare minimum, we should expect to have a
>> primary
>>  		 * plane
>>  		 */
>> -		igt_assert(pipe-
>>> planes[IGT_PLANE_PRIMARY].drm_plane);
>> +		igt_assert(pipe->planes[pipe-
>>> plane_primary].drm_plane);
>>
>>  		if (display->has_cursor_plane) {
>>  			/*
>> @@ -1634,11 +1654,11 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  			 * only 1 sprite, that's the wrong slot and
>> we need to
>>  			 * move it down.
>>  			 */
>> -			if (p != IGT_PLANE_CURSOR) {
>> +			if (p != last_plane) {
>>  				pipe->planes[p] =
>> -					pipe-
>>> planes[IGT_PLANE_CURSOR];
>> +					pipe->planes[last_plane];
>>  				pipe->planes[p].index = p;
>> -				memset(&pipe-
>>> planes[IGT_PLANE_CURSOR], 0,
>> +				memset(&pipe->planes[last_plane], 0,
>>  				       sizeof *plane);
>>  			}
>>  		} else {
>> @@ -1646,7 +1666,7 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  			plane = &pipe->planes[p];
>>  			plane->pipe = pipe;
>>  			plane->index = p;
>> -			plane->is_cursor = true;
>> +			plane->type = DRM_PLANE_TYPE_CURSOR;
>>  		}
>>
>>  		pipe->n_planes = n_planes;
>> @@ -1654,9 +1674,6 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>  		for_each_plane_on_pipe(display, i, plane)
>>  			plane->fb_changed = true;
>>
>> -		/* make sure we don't overflow the plane array */
>> -		igt_assert_lte(pipe->n_planes, IGT_MAX_PLANES);
>> -
>>  		pipe->mode_changed = true;
>>  	}
>>
>> @@ -1709,6 +1726,9 @@ static void igt_pipe_fini(igt_pipe_t *pipe)
>>  			plane->drm_plane = NULL;
>>  		}
>>  	}
>> +
>> +	free(pipe->planes);
>> +	pipe->planes = NULL;
>>  }
>>
>>  static void igt_output_fini(igt_output_t *output)
>> @@ -1797,20 +1817,41 @@ static igt_pipe_t
>> *igt_output_get_driving_pipe(igt_output_t *output)
>>  	return &display->pipes[pipe];
>>  }
>>
>> -static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, enum
>> igt_plane plane)
>> +static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int
>> plane_idx)
>>  {
>> -	int idx;
>> +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
>> +		"Valid pipe->planes plane_idx not found,
>> plane_idx=%d n_planes=%d",
>> +		plane_idx, pipe->n_planes);
>>
>> -	/* Cursor plane is always the highest index */
>> -	if (plane == IGT_PLANE_CURSOR)
>> -		idx = pipe->n_planes - 1;
>> -	else {
>> -		igt_assert_f(plane >= 0 && plane < (pipe->n_planes),
>> -			     "plane=%d\n", plane);
>> -		idx = plane;
>> +	return &pipe->planes[plane_idx];
>> +}
>> +
>> +
>> +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
>> plane_type)
>> +{
>> +	int i, plane_idx = -1;
>> +
>> +	switch(plane_type) {
>> +	case DRM_PLANE_TYPE_CURSOR:
>> +		plane_idx = pipe->plane_cursor;
>> +		break;
>> +	case DRM_PLANE_TYPE_PRIMARY:
>> +		plane_idx = pipe->plane_primary;
>> +		break;
>> +	case DRM_PLANE_TYPE_OVERLAY:
>> +		for(i = 0; i < pipe->n_planes; i++)
>> +			if (pipe->planes[i].type ==
>> DRM_PLANE_TYPE_OVERLAY)
>> +			    plane_idx = i;
>> +		break;
>> +	default:
>> +		break;
>>  	}
>>
>> -	return &pipe->planes[idx];
>> +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
>> +		"Valid pipe->planes idx not found. plane_idx=%d
>> plane_type=%d n_planes=%d\n",
>> +		plane_idx, plane_type, pipe->n_planes);
>> +
>> +	return &pipe->planes[plane_idx];
>>  }
>>
>>  static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
>> @@ -2155,9 +2196,9 @@ static int igt_plane_commit(igt_plane_t *plane,
>>  			    enum igt_commit_style s,
>>  			    bool fail_on_error)
>>  {
>> -	if (plane->is_cursor && s == COMMIT_LEGACY) {
>> +	if (plane->type == DRM_PLANE_TYPE_CURSOR && s ==
>> COMMIT_LEGACY) {
>>  		return igt_cursor_commit_legacy(plane, pipe,
>> fail_on_error);
>> -	} else if (plane->is_primary && s == COMMIT_LEGACY) {
>> +	} else if (plane->type == DRM_PLANE_TYPE_PRIMARY && s ==
>> COMMIT_LEGACY) {
>>  		return igt_primary_plane_commit_legacy(plane, pipe,
>>  						       fail_on_error
>> );
>>  	} else {
>> @@ -2374,7 +2415,9 @@ display_commit_changed(igt_display_t *display,
>> enum igt_commit_style s)
>>  			plane->position_changed = false;
>>  			plane->size_changed = false;
>>
>> -			if (s != COMMIT_LEGACY || !(plane-
>>> is_primary || plane->is_cursor))
>> +			if (s != COMMIT_LEGACY ||
>> +			    !(plane->type == DRM_PLANE_TYPE_PRIMARY
>> ||
>> +			      plane->type == DRM_PLANE_TYPE_CURSOR))
>>  				plane->rotation_changed = false;
>>  		}
>>  	}
>> @@ -2654,14 +2697,24 @@ void igt_output_set_scaling_mode(igt_output_t
>> *output, uint64_t scaling_mode)
>>  	igt_require(output-
>>> config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
>>  }
>>
>> -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
>> igt_plane plane)
>> +igt_plane_t *igt_output_get_plane(igt_output_t *output, int
>> plane_idx)
>> +{
>> +	igt_pipe_t *pipe;
>> +
>> +	pipe = igt_output_get_driving_pipe(output);
>> +	igt_assert(pipe);
>> +
>> +	return igt_pipe_get_plane(pipe, plane_idx);
>> +}
>> +
>> +igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int
>> plane_type)
>>  {
>>  	igt_pipe_t *pipe;
>>
>>  	pipe = igt_output_get_driving_pipe(output);
>>  	igt_assert(pipe);
>>
>> -	return igt_pipe_get_plane(pipe, plane);
>> +	return igt_pipe_get_plane_type(pipe, plane_type);
>>  }
>>
>>  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index 859c79aa..dc172ec9 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -57,25 +57,7 @@ enum pipe {
>>          I915_MAX_PIPES
>>  };
>>  const char *kmstest_pipe_name(enum pipe pipe);
>> -int kmstest_pipe_to_index(char pipe);
>> -
>> -/* We namespace this enum to not conflict with the Android
>> i915_drm.h */
>> -enum igt_plane {
>> -	IGT_PLANE_1 = 0,
>> -	IGT_PLANE_PRIMARY = IGT_PLANE_1,
>> -	IGT_PLANE_2,
>> -	IGT_PLANE_3,
>> -	IGT_PLANE_4,
>> -	IGT_PLANE_5,
>> -	IGT_PLANE_6,
>> -	IGT_PLANE_7,
>> -	IGT_PLANE_8,
>> -	IGT_PLANE_9,
>> -	IGT_PLANE_CURSOR, /* IGT_PLANE_CURSOR is always the last
>> plane. */
>> -	IGT_MAX_PLANES,
>> -};
>> -
>> -const char *kmstest_plane_name(enum igt_plane plane);
>> +const char *kmstest_plane_type_name(int plane_type);
>>
>>  enum port {
>>          PORT_A = 0,
>> @@ -257,8 +239,7 @@ typedef struct {
>>  	igt_pipe_t *pipe;
>>  	int index;
>>  	/* capabilities */
>> -	unsigned int is_primary       : 1;
>> -	unsigned int is_cursor        : 1;
>> +	int type;
>>  	/* state tracking */
>>  	unsigned int fb_changed       : 1;
>>  	unsigned int position_changed : 1;
>> @@ -293,8 +274,11 @@ struct igt_pipe {
>>  	igt_display_t *display;
>>  	enum pipe pipe;
>>  	bool enabled;
>> +
>>  	int n_planes;
>> -	igt_plane_t planes[IGT_MAX_PLANES];
>> +	int plane_cursor;
>> +	int plane_primary;
>> +	igt_plane_t *planes;
>>
>>  	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
>>
>> @@ -354,7 +338,9 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t
>> *output);
>>  void igt_output_override_mode(igt_output_t *output, drmModeModeInfo
>> *mode);
>>  void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
>>  void igt_output_set_scaling_mode(igt_output_t *output, uint64_t
>> scaling_mode);
>> -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
>> igt_plane plane);
>> +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);
>> +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
>> plane_type);
>>  bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
>>  			   uint32_t *prop_id, uint64_t *value,
>>  			   drmModePropertyPtr *prop);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support
  2017-01-23 15:47     ` Robert Foss
@ 2017-01-24  9:03       ` Petri Latvala
  0 siblings, 0 replies; 39+ messages in thread
From: Petri Latvala @ 2017-01-24  9:03 UTC (permalink / raw)
  To: Robert Foss
  Cc: Daniel Stone, Tomeu Vizoso, intel-gfx, Gustavo Padovan,
	Maarten Lankhorst

On Mon, Jan 23, 2017 at 10:47:02AM -0500, Robert Foss wrote:
> In the subsequent patches I clear up all of the IGT_PLANE_* being missing
> issues (which does mean that trunk does not build between the
> enum being removed and that the individual test being fixed).
> 
> I could fix this by moving the removal of the enum until after all of the
> tests have had their dependency on the enum fixed.

This is how it's done. No deliberately broken commits please.


--
Petri Latvala



> 
> Another solution is just to collapse all of the test fixes into this patch.
> Which does sound like the worse option to me.
> 
> Rob.
> > 
> > On Fri, 2017-01-20 at 12:45 -0500, Robert Foss wrote:
> > > In upcoming drm-misc-next changes, the number of planes per pipe has
> > > been increased as more than one primary plane can be associated with
> > > a pipe.
> > > 
> > > The simple fix for this would be to simply bump hardcoded value for
> > > number of frames per pipe.
> > > But a better solution would be to add support for dynamic number of
> > > planes per pipe to i-g-t.
> > > 
> > > Signed-off-by: Robert Foss <robert.foss@collabora.com>
> > > ---
> > >  lib/igt_kms.c | 157 +++++++++++++++++++++++++++++++++++++++---------
> > > ----------
> > >  lib/igt_kms.h |  32 ++++--------
> > >  2 files changed, 114 insertions(+), 75 deletions(-)
> > > 
> > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > > index 8fa40c28..58e62e2b 100644
> > > --- a/lib/igt_kms.c
> > > +++ b/lib/igt_kms.c
> > > @@ -347,24 +347,17 @@ int kmstest_pipe_to_index(char pipe)
> > >   *
> > >   * Returns: String represnting @pipe, e.g. "plane1".
> > >   */
> > > -const char *kmstest_plane_name(enum igt_plane plane)
> > > +const char *kmstest_plane_type_name(int plane_type)
> > >  {
> > >  	static const char *names[] = {
> > > -		[IGT_PLANE_1] = "plane1",
> > > -		[IGT_PLANE_2] = "plane2",
> > > -		[IGT_PLANE_3] = "plane3",
> > > -		[IGT_PLANE_4] = "plane4",
> > > -		[IGT_PLANE_5] = "plane5",
> > > -		[IGT_PLANE_6] = "plane6",
> > > -		[IGT_PLANE_7] = "plane7",
> > > -		[IGT_PLANE_8] = "plane8",
> > > -		[IGT_PLANE_9] = "plane9",
> > > -		[IGT_PLANE_CURSOR] = "cursor",
> > > +		[DRM_PLANE_TYPE_OVERLAY] = "overlay",
> > > +		[DRM_PLANE_TYPE_PRIMARY] = "primary",
> > > +		[DRM_PLANE_TYPE_CURSOR] = "cursor",
> > >  	};
> > > 
> > > -	igt_assert(plane < ARRAY_SIZE(names) && names[plane]);
> > > +	igt_assert(plane_type < ARRAY_SIZE(names) &&
> > > names[plane_type]);
> > > 
> > > -	return names[plane];
> > > +	return names[plane_type];
> > >  }
> > > 
> > >  static const char *mode_stereo_name(const drmModeModeInfo *mode)
> > > @@ -1532,14 +1525,17 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  	for (i = 0; i < display->n_pipes; i++) {
> > >  		igt_pipe_t *pipe = &display->pipes[i];
> > >  		igt_plane_t *plane;
> > > -		int p = IGT_PLANE_2;
> > > +		int p = 1;
> > >  		int j, type;
> > > -		uint8_t n_planes = 0;
> > > +		uint8_t last_plane = 0, n_planes = 0;
> > >  		uint64_t prop_value;
> > > 
> > >  		pipe->crtc_id = resources->crtcs[i];
> > >  		pipe->display = display;
> > >  		pipe->pipe = i;
> > > +		pipe->plane_cursor = -1;
> > > +		pipe->plane_primary = -1;
> > > +		pipe->planes = NULL;
> > > 
> > >  		get_crtc_property(display->drm_fd, pipe->crtc_id,
> > >  				    "background_color",
> > > @@ -1565,6 +1561,27 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > > 
> > >  		igt_atomic_fill_pipe_props(display, pipe,
> > > IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
> > > 
> > > +		/* count number of valid planes */
> > > +		for (j = 0; j < plane_resources->count_planes; j++)
> > > {
> > > +			drmModePlane *drm_plane;
> > > +
> > > +			drm_plane = drmModeGetPlane(display->drm_fd,
> > > +						    plane_resources-
> > > > planes[j]);
> > > +			igt_assert(drm_plane);
> > > +
> > > +			if (!(drm_plane->possible_crtcs & (1 << i)))
> > > {
> > > +				drmModeFreePlane(drm_plane);
> > > +				continue;
> > > +            }
> > > +
> > > +		    n_planes++;
> > > +		}
> > > +
> > > +		igt_assert_lte(0, n_planes);
> > > +		pipe->planes = calloc(sizeof(igt_plane_t),
> > > n_planes);
> > > +		igt_assert_f(pipe->planes, "Failed to allocate
> > > memory for %d planes\n", n_planes);
> > > +		last_plane = n_planes - 1;
> > > +
> > >  		/* add the planes that can be used with that pipe */
> > >  		for (j = 0; j < plane_resources->count_planes; j++)
> > > {
> > >  			drmModePlane *drm_plane;
> > > @@ -1582,21 +1599,24 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  						  plane_resources-
> > > > planes[j]);
> > >  			switch (type) {
> > >  			case DRM_PLANE_TYPE_PRIMARY:
> > > -				plane = &pipe-
> > > > planes[IGT_PLANE_PRIMARY];
> > > -				plane->is_primary = 1;
> > > -				plane->index = IGT_PLANE_PRIMARY;
> > > +				if (pipe->plane_primary == -1) {
> > > +					plane = &pipe->planes[0];
> > > +					plane->index = 0;
> > > +					pipe->plane_primary = 0;
> > > +				} else {
> > > +					plane = &pipe->planes[p];
> > > +					plane->index = p++;
> > > +				}
> > >  				break;
> > >  			case DRM_PLANE_TYPE_CURSOR:
> > > -				/*
> > > -				 * Cursor should be the highest
> > > index in our
> > > -				 * internal list, but we don't know
> > > what that
> > > -				 * is yet.  Just stick it in the
> > > last slot
> > > -				 * for now and we'll move it later,
> > > if
> > > -				 * necessary.
> > > -				 */
> > > -				plane = &pipe-
> > > > planes[IGT_PLANE_CURSOR];
> > > -				plane->is_cursor = 1;
> > > -				plane->index = IGT_PLANE_CURSOR;
> > > +				if (pipe->plane_cursor == -1) {
> > > +					plane = &pipe-
> > > > planes[last_plane];
> > > +					plane->index = last_plane;
> > > +					pipe->plane_cursor =
> > > last_plane;
> > > +				} else {
> > > +					plane = &pipe->planes[p];
> > > +					plane->index = p++;
> > > +				}
> > >  				display->has_cursor_plane = true;
> > >  				break;
> > >  			default:
> > > @@ -1605,7 +1625,7 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  				break;
> > >  			}
> > > 
> > > -			n_planes++;
> > > +			plane->type = type;
> > >  			plane->pipe = pipe;
> > >  			plane->drm_plane = drm_plane;
> > > 
> > > @@ -1626,7 +1646,7 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  		 * At the bare minimum, we should expect to have a
> > > primary
> > >  		 * plane
> > >  		 */
> > > -		igt_assert(pipe-
> > > > planes[IGT_PLANE_PRIMARY].drm_plane);
> > > +		igt_assert(pipe->planes[pipe-
> > > > plane_primary].drm_plane);
> > > 
> > >  		if (display->has_cursor_plane) {
> > >  			/*
> > > @@ -1634,11 +1654,11 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  			 * only 1 sprite, that's the wrong slot and
> > > we need to
> > >  			 * move it down.
> > >  			 */
> > > -			if (p != IGT_PLANE_CURSOR) {
> > > +			if (p != last_plane) {
> > >  				pipe->planes[p] =
> > > -					pipe-
> > > > planes[IGT_PLANE_CURSOR];
> > > +					pipe->planes[last_plane];
> > >  				pipe->planes[p].index = p;
> > > -				memset(&pipe-
> > > > planes[IGT_PLANE_CURSOR], 0,
> > > +				memset(&pipe->planes[last_plane], 0,
> > >  				       sizeof *plane);
> > >  			}
> > >  		} else {
> > > @@ -1646,7 +1666,7 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  			plane = &pipe->planes[p];
> > >  			plane->pipe = pipe;
> > >  			plane->index = p;
> > > -			plane->is_cursor = true;
> > > +			plane->type = DRM_PLANE_TYPE_CURSOR;
> > >  		}
> > > 
> > >  		pipe->n_planes = n_planes;
> > > @@ -1654,9 +1674,6 @@ void igt_display_init(igt_display_t *display,
> > > int drm_fd)
> > >  		for_each_plane_on_pipe(display, i, plane)
> > >  			plane->fb_changed = true;
> > > 
> > > -		/* make sure we don't overflow the plane array */
> > > -		igt_assert_lte(pipe->n_planes, IGT_MAX_PLANES);
> > > -
> > >  		pipe->mode_changed = true;
> > >  	}
> > > 
> > > @@ -1709,6 +1726,9 @@ static void igt_pipe_fini(igt_pipe_t *pipe)
> > >  			plane->drm_plane = NULL;
> > >  		}
> > >  	}
> > > +
> > > +	free(pipe->planes);
> > > +	pipe->planes = NULL;
> > >  }
> > > 
> > >  static void igt_output_fini(igt_output_t *output)
> > > @@ -1797,20 +1817,41 @@ static igt_pipe_t
> > > *igt_output_get_driving_pipe(igt_output_t *output)
> > >  	return &display->pipes[pipe];
> > >  }
> > > 
> > > -static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, enum
> > > igt_plane plane)
> > > +static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, int
> > > plane_idx)
> > >  {
> > > -	int idx;
> > > +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
> > > +		"Valid pipe->planes plane_idx not found,
> > > plane_idx=%d n_planes=%d",
> > > +		plane_idx, pipe->n_planes);
> > > 
> > > -	/* Cursor plane is always the highest index */
> > > -	if (plane == IGT_PLANE_CURSOR)
> > > -		idx = pipe->n_planes - 1;
> > > -	else {
> > > -		igt_assert_f(plane >= 0 && plane < (pipe->n_planes),
> > > -			     "plane=%d\n", plane);
> > > -		idx = plane;
> > > +	return &pipe->planes[plane_idx];
> > > +}
> > > +
> > > +
> > > +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
> > > plane_type)
> > > +{
> > > +	int i, plane_idx = -1;
> > > +
> > > +	switch(plane_type) {
> > > +	case DRM_PLANE_TYPE_CURSOR:
> > > +		plane_idx = pipe->plane_cursor;
> > > +		break;
> > > +	case DRM_PLANE_TYPE_PRIMARY:
> > > +		plane_idx = pipe->plane_primary;
> > > +		break;
> > > +	case DRM_PLANE_TYPE_OVERLAY:
> > > +		for(i = 0; i < pipe->n_planes; i++)
> > > +			if (pipe->planes[i].type ==
> > > DRM_PLANE_TYPE_OVERLAY)
> > > +			    plane_idx = i;
> > > +		break;
> > > +	default:
> > > +		break;
> > >  	}
> > > 
> > > -	return &pipe->planes[idx];
> > > +	igt_assert_f(plane_idx >= 0 && plane_idx < pipe->n_planes,
> > > +		"Valid pipe->planes idx not found. plane_idx=%d
> > > plane_type=%d n_planes=%d\n",
> > > +		plane_idx, plane_type, pipe->n_planes);
> > > +
> > > +	return &pipe->planes[plane_idx];
> > >  }
> > > 
> > >  static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
> > > @@ -2155,9 +2196,9 @@ static int igt_plane_commit(igt_plane_t *plane,
> > >  			    enum igt_commit_style s,
> > >  			    bool fail_on_error)
> > >  {
> > > -	if (plane->is_cursor && s == COMMIT_LEGACY) {
> > > +	if (plane->type == DRM_PLANE_TYPE_CURSOR && s ==
> > > COMMIT_LEGACY) {
> > >  		return igt_cursor_commit_legacy(plane, pipe,
> > > fail_on_error);
> > > -	} else if (plane->is_primary && s == COMMIT_LEGACY) {
> > > +	} else if (plane->type == DRM_PLANE_TYPE_PRIMARY && s ==
> > > COMMIT_LEGACY) {
> > >  		return igt_primary_plane_commit_legacy(plane, pipe,
> > >  						       fail_on_error
> > > );
> > >  	} else {
> > > @@ -2374,7 +2415,9 @@ display_commit_changed(igt_display_t *display,
> > > enum igt_commit_style s)
> > >  			plane->position_changed = false;
> > >  			plane->size_changed = false;
> > > 
> > > -			if (s != COMMIT_LEGACY || !(plane-
> > > > is_primary || plane->is_cursor))
> > > +			if (s != COMMIT_LEGACY ||
> > > +			    !(plane->type == DRM_PLANE_TYPE_PRIMARY
> > > ||
> > > +			      plane->type == DRM_PLANE_TYPE_CURSOR))
> > >  				plane->rotation_changed = false;
> > >  		}
> > >  	}
> > > @@ -2654,14 +2697,24 @@ void igt_output_set_scaling_mode(igt_output_t
> > > *output, uint64_t scaling_mode)
> > >  	igt_require(output-
> > > > config.atomic_props_connector[IGT_CONNECTOR_SCALING_MODE]);
> > >  }
> > > 
> > > -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
> > > igt_plane plane)
> > > +igt_plane_t *igt_output_get_plane(igt_output_t *output, int
> > > plane_idx)
> > > +{
> > > +	igt_pipe_t *pipe;
> > > +
> > > +	pipe = igt_output_get_driving_pipe(output);
> > > +	igt_assert(pipe);
> > > +
> > > +	return igt_pipe_get_plane(pipe, plane_idx);
> > > +}
> > > +
> > > +igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int
> > > plane_type)
> > >  {
> > >  	igt_pipe_t *pipe;
> > > 
> > >  	pipe = igt_output_get_driving_pipe(output);
> > >  	igt_assert(pipe);
> > > 
> > > -	return igt_pipe_get_plane(pipe, plane);
> > > +	return igt_pipe_get_plane_type(pipe, plane_type);
> > >  }
> > > 
> > >  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
> > > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > > index 859c79aa..dc172ec9 100644
> > > --- a/lib/igt_kms.h
> > > +++ b/lib/igt_kms.h
> > > @@ -57,25 +57,7 @@ enum pipe {
> > >          I915_MAX_PIPES
> > >  };
> > >  const char *kmstest_pipe_name(enum pipe pipe);
> > > -int kmstest_pipe_to_index(char pipe);
> > > -
> > > -/* We namespace this enum to not conflict with the Android
> > > i915_drm.h */
> > > -enum igt_plane {
> > > -	IGT_PLANE_1 = 0,
> > > -	IGT_PLANE_PRIMARY = IGT_PLANE_1,
> > > -	IGT_PLANE_2,
> > > -	IGT_PLANE_3,
> > > -	IGT_PLANE_4,
> > > -	IGT_PLANE_5,
> > > -	IGT_PLANE_6,
> > > -	IGT_PLANE_7,
> > > -	IGT_PLANE_8,
> > > -	IGT_PLANE_9,
> > > -	IGT_PLANE_CURSOR, /* IGT_PLANE_CURSOR is always the last
> > > plane. */
> > > -	IGT_MAX_PLANES,
> > > -};
> > > -
> > > -const char *kmstest_plane_name(enum igt_plane plane);
> > > +const char *kmstest_plane_type_name(int plane_type);
> > > 
> > >  enum port {
> > >          PORT_A = 0,
> > > @@ -257,8 +239,7 @@ typedef struct {
> > >  	igt_pipe_t *pipe;
> > >  	int index;
> > >  	/* capabilities */
> > > -	unsigned int is_primary       : 1;
> > > -	unsigned int is_cursor        : 1;
> > > +	int type;
> > >  	/* state tracking */
> > >  	unsigned int fb_changed       : 1;
> > >  	unsigned int position_changed : 1;
> > > @@ -293,8 +274,11 @@ struct igt_pipe {
> > >  	igt_display_t *display;
> > >  	enum pipe pipe;
> > >  	bool enabled;
> > > +
> > >  	int n_planes;
> > > -	igt_plane_t planes[IGT_MAX_PLANES];
> > > +	int plane_cursor;
> > > +	int plane_primary;
> > > +	igt_plane_t *planes;
> > > 
> > >  	uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
> > > 
> > > @@ -354,7 +338,9 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t
> > > *output);
> > >  void igt_output_override_mode(igt_output_t *output, drmModeModeInfo
> > > *mode);
> > >  void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
> > >  void igt_output_set_scaling_mode(igt_output_t *output, uint64_t
> > > scaling_mode);
> > > -igt_plane_t *igt_output_get_plane(igt_output_t *output, enum
> > > igt_plane plane);
> > > +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);
> > > +igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
> > > plane_type);
> > >  bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
> > >  			   uint32_t *prop_id, uint64_t *value,
> > >  			   drmModePropertyPtr *prop);
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-01-24  9:03 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 17:45 [PATCH i-g-t v1 00/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 01/32] lib/igt_kms: Add index property to kmstest_plane struct Robert Foss
2017-01-23 10:21   ` Mika Kahola
2017-01-20 17:45 ` [PATCH i-g-t v1 02/32] lib/igt_kms: Avoid depencency on static plane count Robert Foss
2017-01-23 10:31   ` Mika Kahola
2017-01-20 17:45 ` [PATCH i-g-t v1 03/32] lib/igt_kms: Rename kmstest properties nplanes and plane Robert Foss
2017-01-23 10:33   ` Mika Kahola
2017-01-20 17:45 ` [PATCH i-g-t v1 04/32] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-23 11:00   ` Mika Kahola
2017-01-23 15:47     ` Robert Foss
2017-01-24  9:03       ` Petri Latvala
2017-01-20 17:45 ` [PATCH i-g-t v1 05/32] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 06/32] tests/kms_busy: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 07/32] tests/kms_chv_cursor_fail: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 08/32] tests/kms_crtc_background_color: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 09/32] tests/kms_cursor_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 10/32] tests/kms_cursor_legacy: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 11/32] tests/kms_fbc_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 12/32] tests/kms_fence_pin_leak: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 13/32] tests/kms_flip_event_leak: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 14/32] tests/kms_legacy_colorkey: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 15/32] tests/kms_mmap_write_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 16/32] tests/kms_mmio_vs_cs_flip: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 17/32] tests/kms_panel_fitting: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 18/32] tests/kms_pipe_color: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 19/32] tests/kms_plane: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 20/32] tests/kms_plane_multiple: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 21/32] tests/kms_plane_scaling: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 22/32] tests/kms_properties: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 23/32] tests/kms_psr_sink_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 24/32] tests/kms_pwrite_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 25/32] tests/kms_rmfb: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 26/32] tests/kms_rotation_crc: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 27/32] tests/kms_sink_crc_basic: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 28/32] tests/kms_universal_plane: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 29/32] tests/kms_vblank: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 30/32] tests/prime_mmap_kms: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 31/32] tests/kms_ccs: " Robert Foss
2017-01-20 17:45 ` [PATCH i-g-t v1 32/32] tests/kms_plane_lowres: " Robert Foss

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.