From 162914b9ed0af1436e260133a90b91f32e78b4fe Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Thu, 6 Feb 2014 16:05:19 +0000 Subject: lib/display: Check if we're trying to use the same pipe on 2 outputs Signed-off-by: Damien Lespiau --- lib/igt_kms.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/igt_kms.c') diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 9cc2cc8e..0354d3f4 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -978,10 +978,34 @@ void igt_display_fini(igt_display_t *display) static void igt_display_refresh(igt_display_t *display) { - int i; + int i, j; display->pipes_in_use = 0; + /* Check that two outputs aren't trying to use the same pipe */ + for (i = 0; i < display->n_outputs; i++) { + igt_output_t *a = &display->outputs[i]; + + if (a->pending_crtc_idx_mask == -1UL) + continue; + + for (j = 0; j < display->n_outputs; j++) { + igt_output_t *b = &display->outputs[j]; + + if (i == j) + continue; + + if (b->pending_crtc_idx_mask == -1UL) + continue; + + igt_assert_f(a->pending_crtc_idx_mask != + b->pending_crtc_idx_mask, + "%s and %s are both trying to use pipe %c\n", + igt_output_name(a), igt_output_name(b), + pipe_name(ffs(a->pending_crtc_idx_mask) - 1)); + } + } + /* * The pipe allocation has to be done in two phases: * - first, try to satisfy the outputs where a pipe has been specified -- cgit v1.2.3