diff options
author | Lyude <lyude@redhat.com> | 2016-12-12 13:25:39 -0500 |
---|---|---|
committer | Lyude <lyude@redhat.com> | 2016-12-13 10:13:48 -0500 |
commit | 3ccce99281eaef560334300bb025b770b49ed9b1 (patch) | |
tree | e969186d55575809e8c3725776b3c32b2dac8d50 /lib/igt_kms.c | |
parent | 6e716b7f5768bb0218d2b5934472ed462560f13b (diff) |
igt_kms: Dynamically allocate igt_display->pipes
Many GPUs have more then 3 pipes available, so hard limiting this to
I915_MAX_PIPES prevents us from using anything that relies on
igt_display_init() on non-intel systems (since we end up writing out of
bounds and seg faulting). Fix this by dynamically allocating
igt_display->pipes using the number of pipes we've detected on the GPU.
Signed-off-by: Lyude <lyude@redhat.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r-- | lib/igt_kms.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 0e7b8e88..5312f8d8 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1345,6 +1345,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) * hardware and cannot change of time (for now, at least). */ display->n_pipes = resources->count_crtcs; + display->pipes = calloc(sizeof(igt_pipe_t), display->n_pipes); drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); is_atomic = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1); @@ -1557,6 +1558,7 @@ void igt_display_fini(igt_display_t *display) for (i = 0; i < display->n_outputs; i++) igt_output_fini(&display->outputs[i]); free(display->outputs); + free(display->pipes); display->outputs = NULL; } |