All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/5] lib/igt_kms: Fix drm_plane leak
@ 2017-02-17 17:54 Brian Starkey
  2017-02-17 17:54 ` [PATCH i-g-t 2/5] lib/igt_kms: Neaten up pipe->planes[] assignment Brian Starkey
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Brian Starkey @ 2017-02-17 17:54 UTC (permalink / raw)
  To: intel-gfx

In the loop looking for planes on a pipe, we always want to free up
the drm_plane afterwards.

Fixes: 36656239ef96 lib/igt_kms: Implement dynamic plane count support
Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---

Hi,

This series cleans up igt_display_init a bit.

 - Fixes a memory leak.
 - Fixes out-of-bounds array access on cards with no primary plane.
 - Fixes memory corruption/crashes on cards with no cursor plane.
 - Cleans up some left-over stuff which wasn't really relevant after
   the dynamic planes change.

There's one detail (patch 4) I'm not really sure about - the dynamic
planes stuff means that the "drm_plane-less" cursor plane doesn't
work/make sense anymore, as it will never be found by
igt_pipe_get_plane_type(). I couldn't find any tests which seemed to
rely on having that cursor plane present, but I don't have any
hardware with a cursor to test on.

igt_display_init() could be simplified a bit further by not putting
the primary/cursor planes at the start/end respectively, but at least
kms_cursor_legacy appears to rely on a non-cursor plane being index 0,
so I've left it as-is for now.

I've given this a cursory test on Mali-DP, but if anyone is able to
test it more thoroughly on Intel HW that might be a good idea.

-Brian

 lib/igt_kms.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f59af6e75348..4ca9145726e2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1759,12 +1759,10 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 						    plane_resources->planes[j]);
 			igt_assert(drm_plane);
 
-			if (!(drm_plane->possible_crtcs & (1 << i))) {
-				drmModeFreePlane(drm_plane);
-				continue;
-			}
+			if (drm_plane->possible_crtcs & (1 << i))
+				n_planes++;
 
-			n_planes++;
+			drmModeFreePlane(drm_plane);
 		}
 
 		igt_assert_lte(0, n_planes);
-- 
1.7.9.5

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

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

end of thread, other threads:[~2017-02-20 10:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 17:54 [PATCH i-g-t 1/5] lib/igt_kms: Fix drm_plane leak Brian Starkey
2017-02-17 17:54 ` [PATCH i-g-t 2/5] lib/igt_kms: Neaten up pipe->planes[] assignment Brian Starkey
2017-02-19 20:41   ` Robert Foss
2017-02-20 10:17     ` Brian Starkey
2017-02-17 17:54 ` [PATCH i-g-t 3/5] lib/igt_kms: Fix possible out-of-bounds access Brian Starkey
2017-02-19 20:42   ` Robert Foss
2017-02-17 17:54 ` [PATCH i-g-t 4/5] lib/igt_kms: Fix memory corruption when there's no cursor plane Brian Starkey
2017-02-19 20:43   ` Robert Foss
2017-02-17 17:54 ` [PATCH i-g-t 5/5] lib/igt_kms: Remove redundant cursor code Brian Starkey
2017-02-19 20:45   ` Robert Foss
2017-02-19 20:39 ` [PATCH i-g-t 1/5] lib/igt_kms: Fix drm_plane leak Robert Foss
2017-02-20 10:16   ` Brian Starkey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.