[PATCH] lib/igt_kms: Fix regression on kms_plane_lowres test

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

 



kms_plane_lowres subtest pipe-C-tiling-none crashes when reading out
number of crtc. This patch fixes the bug on crtc readout.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99653
Fixes: 9de635976c426b4c835083792c7d4d6e32aec615
       ("lib/igt_kms: Avoid depencency on static plane count")

Signed-off-by: Mika Kahola <mika.kahola@xxxxxxxxx>
---
 lib/igt_kms.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index dae8bf9..5388a83 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1331,6 +1331,7 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc)
 	const char *mode = "r";
 	int ncrtc;
 	int line;
+	long int n;
 
 	fid = igt_debugfs_fopen("i915_display_info", mode);
 
@@ -1344,18 +1342,20 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc)
 				crtc->active = true;
 				parse_crtc(tmp, crtc);
 
+				n = ftell(fid);
 				crtc->n_planes = parse_planes(fid, NULL);
 				crtc->planes = calloc(crtc->n_planes, sizeof(*crtc->planes));
 				igt_assert_f(crtc->planes, "Failed to allocate memory for %d planes\n", crtc->n_planes);
 
-				fseek(fid, 0, SEEK_END);
-				fseek(fid, 0, SEEK_SET);
+				fseek(fid, n, SEEK_SET);
 				parse_planes(fid, crtc->planes);
 
-				if (crtc->pipe != pipe)
-					crtc = NULL;
-				else
+				if (crtc->pipe != pipe) {
+					free(crtc->planes);
+				} else {
 					ncrtc++;
+					break;
+				}
 			}
 		}
 
-- 
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