diff mbox

[i-g-t,v2,1/5] lib/igt_kms: Fix drm_plane leak

Message ID 1487588568-5033-1-git-send-email-brian.starkey@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Starkey Feb. 20, 2017, 11:02 a.m. UTC
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>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Brian Starkey Feb. 21, 2017, 10:12 a.m. UTC | #1
Hi,

tsa@freenode was kind enough to run some piglit testing on this.

I gave the following test list:

igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
igt@kms_plane_multiple@legacy-pipe-A-tiling-none
igt@kms_plane_multiple@atomic-pipe-A-tiling-none
igt@kms_plane_multiple@legacy-pipe-A-tiling-x
igt@kms_plane_multiple@atomic-pipe-A-tiling-x
igt@kms_chv_cursor_fail@pipe-A-128x128-bottom-edge
igt@kms_chv_cursor_fail@pipe-A-128x128-left-edge
igt@kms_chv_cursor_fail@pipe-A-128x128-right-edge
igt@kms_chv_cursor_fail@pipe-A-128x128-top-edge
igt@kms_ccs@bad-rotation-90
igt@kms_busy@flip-blt-A
igt@kms_mmap_write_crc

There were no changes to any test on 11 hosts (ILK to KBL).
(3 fails on bad-rotation-90 stays just as they were)

Thanks,
Brian

On Mon, Feb 20, 2017 at 11:02:44AM +0000, Brian Starkey wrote:
>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>
>Reviewed-by: Robert Foss <robert.foss@collabora.com>
>---
> 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 d6b7d677ed8d..9e59e35f2e2f 100644
>--- a/lib/igt_kms.c
>+++ b/lib/igt_kms.c
>@@ -1613,12 +1613,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
>
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d6b7d677ed8d..9e59e35f2e2f 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1613,12 +1613,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);