summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorMika Kahola <mika.kahola@intel.com>2017-02-16 11:20:45 +0200
committerMika Kahola <mika.kahola@intel.com>2017-02-17 09:14:43 +0200
commit11e31f9e5abfda8a0a51561ed01ad48c2692e320 (patch)
tree5080c9f8d7ce45995565151ed9617df2a4513602 /lib/igt_kms.c
parentca2ba471d630aef4315bca98df6b345bed872536 (diff)
lib/igt_kms: Fix regression on kms_plane_lowres test
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") Reviewed-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index dae8bf9d..d6b7d677 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 +1345,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;
+ }
}
}