intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support
@ 2017-01-11 20:41 Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
                   ` (28 more replies)
  0 siblings, 29 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

Coverletter:
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 only been tested on vc4, but testing reveals no new failures.

This series can be found here:
https://git.collabora.com/cgit/user/robertfoss/intel-gpu-tools.git/


Robert Foss (29):
  lib/igt_debugfs: Prevent buffer overflow
  lib/igt_kms: Fixed typo
  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

 lib/igt_debugfs.c                 |   8 +-
 lib/igt_kms.c                     | 159 +++++++++++++++++++----------
 lib/igt_kms.h                     |  32 ++----
 tests/kms_atomic_transition.c     |  27 +++--
 tests/kms_busy.c                  |   2 +-
 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         |  30 +++---
 tests/kms_fbc_crc.c               |   4 +-
 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_multiple.c        | 203 +++++++++++++++++++++++---------------
 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 +-
 29 files changed, 440 insertions(+), 340 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] 33+ messages in thread

* [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-12  9:14   ` Lankhorst, Maarten
  2017-01-11 20:41 ` [PATCH i-g-t rfc 02/29] lib/igt_kms: Fixed typo Robert Foss
                   ` (27 subsequent siblings)
  28 siblings, 1 reply; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

buf array may overflow with when writing '\0' if
MAX_LINE_LEN bytes are read during read().

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

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index d828687a..8b8a627a 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -594,13 +594,15 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
 		read_len = MAX_LINE_LEN;
 
 	igt_set_timeout(5, "CRC reading");
-	bytes_read = read(pipe_crc->crc_fd, &buf, read_len);
+	bytes_read = read(pipe_crc->crc_fd, &buf, read_len - 1);
 	igt_reset_timeout();
 
-	if (bytes_read < 0 && errno == EAGAIN) {
+	if (bytes_read < 0 && errno == EAGAIN)
 		igt_assert(pipe_crc->flags & O_NONBLOCK);
+
+	if (bytes_read < 0)
 		bytes_read = 0;
-	}
+
 	buf[bytes_read] = '\0';
 
 	if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out, buf))
-- 
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] 33+ messages in thread

* [PATCH i-g-t rfc 02/29] lib/igt_kms: Fixed typo
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 03/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5312f8d8..0b8851f2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -308,7 +308,7 @@ const unsigned char* igt_kms_get_alt_edid(void)
  * kmstest_pipe_name:
  * @pipe: display pipe
  *
- * Returns: String represnting @pipe, e.g. "A".
+ * Returns: String reprsenting @pipe, e.g. "A".
  */
 const char *kmstest_pipe_name(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] 33+ messages in thread

* [PATCH i-g-t rfc 03/29] lib/igt_kms: Implement dynamic plane count support
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 02/29] lib/igt_kms: Fixed typo Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 04/29] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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, 115 insertions(+), 74 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0b8851f2..294a8113 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -329,24 +329,17 @@ const char *kmstest_pipe_name(enum pipe 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)
@@ -1355,14 +1348,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",
@@ -1388,6 +1384,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 != NULL, "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;
@@ -1405,21 +1422,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:
@@ -1428,7 +1448,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;
 
@@ -1449,7 +1469,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) {
 			/*
@@ -1457,11 +1477,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 {
@@ -1469,7 +1489,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;
@@ -1477,9 +1497,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;
 	}
 
@@ -1532,6 +1549,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)
@@ -1619,20 +1639,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)
@@ -1977,9 +2018,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 {
@@ -2196,7 +2237,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;
 		}
 	}
@@ -2476,14 +2519,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 5234f6c1..08812461 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -57,24 +57,7 @@ enum pipe {
         I915_MAX_PIPES
 };
 const char *kmstest_pipe_name(enum pipe 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,
@@ -232,8 +215,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;
@@ -268,8 +250,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];
 
@@ -329,7 +314,10 @@ 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);
+int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);
+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] 33+ messages in thread

* [PATCH i-g-t rfc 04/29] tests/kms_atomic_transition: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (2 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 03/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 05/29] tests/kms_busy: " Robert Foss
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 05/29] tests/kms_busy: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (3 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 04/29] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 06/29] tests/kms_chv_cursor_fail: " Robert Foss
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 06/29] tests/kms_chv_cursor_fail: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (4 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 05/29] tests/kms_busy: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 07/29] tests/kms_crtc_background_color: " Robert Foss
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 8f878cbf..a5c648af 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);
 }
 
@@ -249,7 +249,7 @@ static bool 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);
@@ -286,7 +286,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] 33+ messages in thread

* [PATCH i-g-t rfc 07/29] tests/kms_crtc_background_color: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (5 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 06/29] tests/kms_chv_cursor_fail: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 08/29] tests/kms_cursor_crc: " Robert Foss
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 08/29] tests/kms_cursor_crc: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (6 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 07/29] tests/kms_crtc_background_color: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 09/29] tests/kms_cursor_legacy: " Robert Foss
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 926579d6..a6ba6dc4 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);
 
@@ -308,7 +308,7 @@ static bool 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);
@@ -351,7 +351,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] 33+ messages in thread

* [PATCH i-g-t rfc 09/29] tests/kms_cursor_legacy: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (7 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 08/29] tests/kms_cursor_crc: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 10/29] tests/kms_fbc_crc: " Robert Foss
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 40220970..dcec9834 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);
@@ -345,7 +347,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);
@@ -794,7 +796,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;
@@ -1240,6 +1242,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)
@@ -1271,10 +1275,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. */
@@ -1300,7 +1304,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] 33+ messages in thread

* [PATCH i-g-t rfc 10/29] tests/kms_fbc_crc: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (8 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 09/29] tests/kms_cursor_legacy: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 11/29] tests/kms_fence_pin_leak: " Robert Foss
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 2a2c93f7..f2fd88a6 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -383,7 +383,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);
 
@@ -471,7 +471,7 @@ static void reset_display(data_t *data)
 
 	for_each_connected_output(display, data->output) {
 		if (data->output->valid > 0) {
-			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);
 		}
 		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] 33+ messages in thread

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

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 7d4ffbcd..98963bbb 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -122,7 +122,7 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
 	}
 
 	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] 33+ messages in thread

* [PATCH i-g-t rfc 12/29] tests/kms_flip_event_leak: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (10 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 11/29] tests/kms_fence_pin_leak: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 13/29] tests/kms_legacy_colorkey: " Robert Foss
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 a1389b4c..636a706e 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -57,7 +57,7 @@ static bool test(data_t *data, enum pipe pipe, igt_output_t *output)
 		return false;
 	}
 
-	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] 33+ messages in thread

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

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] 33+ messages in thread

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

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 fce0471d..fcfba154 100644
--- a/tests/kms_mmap_write_crc.c
+++ b/tests/kms_mmap_write_crc.c
@@ -184,7 +184,7 @@ static bool 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] 33+ messages in thread

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

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 25854020..e24299e5 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 bool
-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;
@@ -208,7 +208,7 @@ test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane pl
 		return false;
 	}
 
-	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);
@@ -473,7 +473,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] 33+ messages in thread

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

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] 33+ messages in thread

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

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 98dc4038..31755690 100644
--- a/tests/kms_pipe_color.c
+++ b/tests/kms_pipe_color.c
@@ -856,10 +856,10 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 			return;
 
 		pipe = &data->display.pipes[p];
-		if (pipe->n_planes < IGT_PLANE_PRIMARY)
+		if (pipe->n_planes < 0)
 			return;
 
-		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] 33+ messages in thread

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

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 ce5e3101..4817ec4e 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] 33+ messages in thread

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

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 | 203 ++++++++++++++++++++++++++++-----------------
 1 file changed, 125 insertions(+), 78 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 5e12be45..dec5488d 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 {
@@ -92,20 +92,32 @@ static unsigned int get_vblank(int fd, int pipe, unsigned int flags)
 /*
  * 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);
+	free(data->fb);
 }
 
 static void
@@ -113,11 +125,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);
 
@@ -125,9 +139,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);
@@ -150,29 +164,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);
@@ -180,37 +200,49 @@ 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));
+	y = malloc(pipe->n_planes * sizeof(*y));
+	size = malloc(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]);
 
@@ -219,10 +251,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
@@ -254,7 +286,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);
@@ -318,7 +350,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);
@@ -387,54 +419,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;
@@ -481,15 +530,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] 33+ messages in thread

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

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] 33+ messages in thread

* [PATCH i-g-t rfc 21/29] tests/kms_properties: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (19 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 20/29] tests/kms_plane_scaling: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 22/29] tests/kms_psr_sink_crc: " Robert Foss
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 22/29] tests/kms_psr_sink_crc: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (20 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 21/29] tests/kms_properties: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 23/29] tests/kms_pwrite_crc: " Robert Foss
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 23/29] tests/kms_pwrite_crc: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (21 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 22/29] tests/kms_psr_sink_crc: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:41 ` [PATCH i-g-t rfc 24/29] tests/kms_rmfb: " Robert Foss
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 86292bda..587d0561 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -123,7 +123,7 @@ static bool 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] 33+ messages in thread

* [PATCH i-g-t rfc 24/29] tests/kms_rmfb: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (22 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 23/29] tests/kms_pwrite_crc: " Robert Foss
@ 2017-01-11 20:41 ` Robert Foss
  2017-01-11 20:42 ` [PATCH i-g-t rfc 25/29] tests/kms_rotation_crc: " Robert Foss
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:41 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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] 33+ messages in thread

* [PATCH i-g-t rfc 25/29] tests/kms_rotation_crc: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (23 preceding siblings ...)
  2017-01-11 20:41 ` [PATCH i-g-t rfc 24/29] tests/kms_rmfb: " Robert Foss
@ 2017-01-11 20:42 ` Robert Foss
  2017-01-11 20:42 ` [PATCH i-g-t rfc 26/29] tests/kms_sink_crc_basic: " Robert Foss
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:42 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 796b4486..5e87d4f4 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -97,16 +97,17 @@ 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);
 	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)
@@ -153,7 +154,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;
@@ -205,10 +206,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);
 	}
 
@@ -235,7 +236,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;
@@ -246,10 +247,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);
@@ -320,7 +321,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
-static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation_ytiled_obj(data_t *data, int plane_type)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -337,13 +338,13 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
 
 	igt_require(output != NULL && output->valid == true);
 
-	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)
@@ -386,7 +387,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
 	igt_assert(ret == 0);
 }
 
-static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation_exhaust_fences(data_t *data, int plane_type)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -405,13 +406,13 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
 
 	igt_require(output != NULL && output->valid == true);
 
-	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)
@@ -511,41 +512,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") {
@@ -553,7 +554,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") {
@@ -562,7 +563,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") {
@@ -570,7 +571,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") {
@@ -578,18 +579,18 @@ 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") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation_ytiled_obj(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_subtest_f("exhaust-fences") {
 		igt_require(gen >= 9);
-		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation_exhaust_fences(&data, DRM_PLANE_TYPE_PRIMARY);
 	}
 
 	igt_fixture {
-- 
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] 33+ messages in thread

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

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] 33+ messages in thread

* [PATCH i-g-t rfc 27/29] tests/kms_universal_plane: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (25 preceding siblings ...)
  2017-01-11 20:42 ` [PATCH i-g-t rfc 26/29] tests/kms_sink_crc_basic: " Robert Foss
@ 2017-01-11 20:42 ` Robert Foss
  2017-01-11 20:42 ` [PATCH i-g-t rfc 28/29] tests/kms_vblank: " Robert Foss
  2017-01-11 20:42 ` [PATCH i-g-t rfc 29/29] tests/prime_mmap_kms: " Robert Foss
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:42 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 b9e0651b..360211c1 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] 33+ messages in thread

* [PATCH i-g-t rfc 28/29] tests/kms_vblank: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (26 preceding siblings ...)
  2017-01-11 20:42 ` [PATCH i-g-t rfc 27/29] tests/kms_universal_plane: " Robert Foss
@ 2017-01-11 20:42 ` Robert Foss
  2017-01-11 20:42 ` [PATCH i-g-t rfc 29/29] tests/prime_mmap_kms: " Robert Foss
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:42 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 9bc49296..73b3b2ad 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -83,7 +83,7 @@ static bool 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);
@@ -100,7 +100,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] 33+ messages in thread

* [PATCH i-g-t rfc 29/29] tests/prime_mmap_kms: Add support for dynamic number of planes
  2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
                   ` (27 preceding siblings ...)
  2017-01-11 20:42 ` [PATCH i-g-t rfc 28/29] tests/kms_vblank: " Robert Foss
@ 2017-01-11 20:42 ` Robert Foss
  28 siblings, 0 replies; 33+ messages in thread
From: Robert Foss @ 2017-01-11 20:42 UTC (permalink / raw)
  To: intel-gfx, Tomeu Vizoso, Maarten Lankhorst, Gustavo Padovan,
	Daniel Stone

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 15e310fc..5ef882c3 100644
--- a/tests/prime_mmap_kms.c
+++ b/tests/prime_mmap_kms.c
@@ -175,7 +175,7 @@ static bool 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] 33+ messages in thread

* Re: [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow
  2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
@ 2017-01-12  9:14   ` Lankhorst, Maarten
  2017-01-12 16:30     ` Robert Foss
  0 siblings, 1 reply; 33+ messages in thread
From: Lankhorst, Maarten @ 2017-01-12  9:14 UTC (permalink / raw)
  To: intel-gfx@lists.freedesktop.org, tomeu.vizoso@collabora.com,
	gustavo.padovan@collabora.com, daniels@collabora.com,
	robert.foss@collabora.com

Robert Foss schreef op wo 11-01-2017 om 15:41 [-0500]:
> buf array may overflow with when writing '\0' if
> MAX_LINE_LEN bytes are read during read().
How?

char buf[MAX_LINE_LEN + 1];

> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_debugfs.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index d828687a..8b8a627a 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -594,13 +594,15 @@ static int read_crc(igt_pipe_crc_t *pipe_crc,
> igt_crc_t *out)
>  		read_len = MAX_LINE_LEN;
>  
>  	igt_set_timeout(5, "CRC reading");
> -	bytes_read = read(pipe_crc->crc_fd, &buf, read_len);
> +	bytes_read = read(pipe_crc->crc_fd, &buf, read_len - 1);
>  	igt_reset_timeout();
>  
> -	if (bytes_read < 0 && errno == EAGAIN) {
> +	if (bytes_read < 0 && errno == EAGAIN)
>  		igt_assert(pipe_crc->flags & O_NONBLOCK);
> +
> +	if (bytes_read < 0)
>  		bytes_read = 0;
> -	}
> +
>  	buf[bytes_read] = '\0';
>  
>  	if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out,
> buf))
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow
  2017-01-12  9:14   ` Lankhorst, Maarten
@ 2017-01-12 16:30     ` Robert Foss
  2017-01-12 18:28       ` Lankhorst, Maarten
  0 siblings, 1 reply; 33+ messages in thread
From: Robert Foss @ 2017-01-12 16:30 UTC (permalink / raw)
  To: Lankhorst, Maarten, intel-gfx@lists.freedesktop.org,
	tomeu.vizoso@collabora.com, gustavo.padovan@collabora.com,
	daniels@collabora.com



On 2017-01-12 04:14 AM, Lankhorst, Maarten wrote:
> Robert Foss schreef op wo 11-01-2017 om 15:41 [-0500]:
>> buf array may overflow with when writing '\0' if
>> MAX_LINE_LEN bytes are read during read().
> How?
>
> char buf[MAX_LINE_LEN + 1];

I actually missed the + 1, but parts of the commit are still relevant 
though, as the errno at least in theory could be != EAGAIN.

So I'd like to keep the below check, to prevent compiler warnings.
if (bytes_read < 0)

Sounds ok?


Rob.
>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>>  lib/igt_debugfs.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
>> index d828687a..8b8a627a 100644
>> --- a/lib/igt_debugfs.c
>> +++ b/lib/igt_debugfs.c
>> @@ -594,13 +594,15 @@ static int read_crc(igt_pipe_crc_t *pipe_crc,
>> igt_crc_t *out)
>>  		read_len = MAX_LINE_LEN;
>>
>>  	igt_set_timeout(5, "CRC reading");
>> -	bytes_read = read(pipe_crc->crc_fd, &buf, read_len);
>> +	bytes_read = read(pipe_crc->crc_fd, &buf, read_len - 1);
>>  	igt_reset_timeout();
>>
>> -	if (bytes_read < 0 && errno == EAGAIN) {
>> +	if (bytes_read < 0 && errno == EAGAIN)
>>  		igt_assert(pipe_crc->flags & O_NONBLOCK);
>> +
>> +	if (bytes_read < 0)
>>  		bytes_read = 0;
>> -	}
>> +
>>  	buf[bytes_read] = '\0';
>>
>>  	if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out,
>> buf))
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow
  2017-01-12 16:30     ` Robert Foss
@ 2017-01-12 18:28       ` Lankhorst, Maarten
  0 siblings, 0 replies; 33+ messages in thread
From: Lankhorst, Maarten @ 2017-01-12 18:28 UTC (permalink / raw)
  To: intel-gfx@lists.freedesktop.org, tomeu.vizoso@collabora.com,
	gustavo.padovan@collabora.com, daniels@collabora.com,
	robert.foss@collabora.com

Robert Foss schreef op do 12-01-2017 om 11:30 [-0500]:
> 
> On 2017-01-12 04:14 AM, Lankhorst, Maarten wrote:
> > 
> > Robert Foss schreef op wo 11-01-2017 om 15:41 [-0500]:
> > > 
> > > buf array may overflow with when writing '\0' if
> > > MAX_LINE_LEN bytes are read during read().
> > How?
> > 
> > char buf[MAX_LINE_LEN + 1];
> 
> I actually missed the + 1, but parts of the commit are still
> relevant 
> though, as the errno at least in theory could be != EAGAIN.
> 
> So I'd like to keep the below check, to prevent compiler warnings.
> if (bytes_read < 0)
> 
> Sounds ok?
Yes. :)
> 
> Rob.
> > 
> > 
> > > 
> > > Signed-off-by: Robert Foss <robert.foss@collabora.com>
> > > ---
> > >  lib/igt_debugfs.c | 8 +++++---
> > >  1 file changed, 5 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > > index d828687a..8b8a627a 100644
> > > --- a/lib/igt_debugfs.c
> > > +++ b/lib/igt_debugfs.c
> > > @@ -594,13 +594,15 @@ static int read_crc(igt_pipe_crc_t
> > > *pipe_crc,
> > > igt_crc_t *out)
> > >  		read_len = MAX_LINE_LEN;
> > > 
> > >  	igt_set_timeout(5, "CRC reading");
> > > -	bytes_read = read(pipe_crc->crc_fd, &buf, read_len);
> > > +	bytes_read = read(pipe_crc->crc_fd, &buf, read_len - 1);
> > >  	igt_reset_timeout();
> > > 
> > > -	if (bytes_read < 0 && errno == EAGAIN) {
> > > +	if (bytes_read < 0 && errno == EAGAIN)
> > >  		igt_assert(pipe_crc->flags & O_NONBLOCK);
> > > +
> > > +	if (bytes_read < 0)
> > >  		bytes_read = 0;
> > > -	}
> > > +
> > >  	buf[bytes_read] = '\0';
> > > 
> > >  	if (bytes_read && !pipe_crc_init_from_string(pipe_crc,
> > > out,
> > > buf))
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-01-12 18:28 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11 20:41 [PATCH i-g-t rfc 00/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 01/29] lib/igt_debugfs: Prevent buffer overflow Robert Foss
2017-01-12  9:14   ` Lankhorst, Maarten
2017-01-12 16:30     ` Robert Foss
2017-01-12 18:28       ` Lankhorst, Maarten
2017-01-11 20:41 ` [PATCH i-g-t rfc 02/29] lib/igt_kms: Fixed typo Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 03/29] lib/igt_kms: Implement dynamic plane count support Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 04/29] tests/kms_atomic_transition: Add support for dynamic number of planes Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 05/29] tests/kms_busy: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 06/29] tests/kms_chv_cursor_fail: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 07/29] tests/kms_crtc_background_color: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 08/29] tests/kms_cursor_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 09/29] tests/kms_cursor_legacy: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 10/29] tests/kms_fbc_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 11/29] tests/kms_fence_pin_leak: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 12/29] tests/kms_flip_event_leak: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 13/29] tests/kms_legacy_colorkey: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 14/29] tests/kms_mmap_write_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 15/29] tests/kms_mmio_vs_cs_flip: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 16/29] tests/kms_panel_fitting: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 17/29] tests/kms_pipe_color: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 18/29] tests/kms_plane: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 19/29] tests/kms_plane_multiple: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 20/29] tests/kms_plane_scaling: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 21/29] tests/kms_properties: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 22/29] tests/kms_psr_sink_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 23/29] tests/kms_pwrite_crc: " Robert Foss
2017-01-11 20:41 ` [PATCH i-g-t rfc 24/29] tests/kms_rmfb: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 25/29] tests/kms_rotation_crc: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 26/29] tests/kms_sink_crc_basic: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 27/29] tests/kms_universal_plane: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 28/29] tests/kms_vblank: " Robert Foss
2017-01-11 20:42 ` [PATCH i-g-t rfc 29/29] tests/prime_mmap_kms: " Robert Foss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).