[PATCH i-g-t 1/3] igt_kms: Don't assume we have cursor planes if we have primary ones

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

 



On certain models of nvidia and AMD GPUs, we can have a primary plane
without any DRM plane for the cursor plane. Check for this so we don't
segfault on non-intel hardware.

Signed-off-by: Lyude <lyude@xxxxxxxxxx>
---
 lib/igt_kms.c | 27 +++++++++++++++------------
 lib/igt_kms.h |  1 +
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 433a721..13d323e 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1419,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 				plane = &pipe->planes[IGT_PLANE_CURSOR];
 				plane->is_cursor = 1;
 				plane->index = IGT_PLANE_CURSOR;
-				display->has_universal_planes = 1;
+				display->has_cursor_plane = 1;
 				break;
 			default:
 				plane = &pipe->planes[p];
@@ -1444,9 +1444,20 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			plane->rotation = (igt_rotation_t)prop_value;
 		}
 
-		if (display->has_universal_planes) {
+		if (!display->has_universal_planes) {
+			/*
+			 * No universal plane support.  Add drm_plane-less
+			 * primary and cursor planes.
+			 */
+			plane = &pipe->planes[IGT_PLANE_PRIMARY];
+			plane->pipe = pipe;
+			plane->index = IGT_PLANE_PRIMARY;
+			plane->is_primary = true;
+		}
+
+		if (display->has_cursor_plane) {
 			/*
-			 * If we have universal planes, we should have both
+			 * If we have a cursor plane, we should have both
 			 * primary and cursor planes setup now.
 			 */
 			igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane &&
@@ -1464,15 +1475,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 				       sizeof *plane);
 			}
 		} else {
-			/*
-			 * No universal plane support.  Add drm_plane-less
-			 * primary and cursor planes.
-			 */
-			plane = &pipe->planes[IGT_PLANE_PRIMARY];
-			plane->pipe = pipe;
-			plane->index = IGT_PLANE_PRIMARY;
-			plane->is_primary = true;
-
+			/* Add drm_plane-less cursor */
 			plane = &pipe->planes[p];
 			plane->pipe = pipe;
 			plane->index = p;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 95395cd..95d81c3 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -312,6 +312,7 @@ struct igt_display {
 	igt_output_t *outputs;
 	igt_pipe_t pipes[I915_MAX_PIPES];
 	bool has_universal_planes;
+	bool has_cursor_plane;
 	bool is_atomic;
 };
 
-- 
2.7.4

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux