From 4dcc8ae1a6903434def1a2706f7c68ff9e2a17c4 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Mon, 10 Mar 2008 21:37:09 -0700 Subject: [PATCH] Move outputs among crtcs as necessary. Fixes 14570 This patch makes new requests override existing crtc allocations. Outputs with restricted crtc usage can now force existing outputs to switch automatcially. --- xrandr.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xrandr/xrandr.c b/xrandr/xrandr.c index e2a657f..41e15dd 100644 --- a/xrandr/xrandr.c +++ b/xrandr/xrandr.c @@ -1241,7 +1241,7 @@ mark_changing_crtcs (void) * Test whether 'crtc' can be used for 'output' */ Bool -check_crtc_for_output (crtc_t *crtc, output_t *output) +check_crtc_for_output (crtc_t *crtc, output_t *output, Bool ignore_state) { int c; int l; @@ -1272,6 +1272,9 @@ check_crtc_for_output (crtc_t *crtc, output_t *output) return False; } + if (ignore_state) + return True; + if (crtc->noutput) { /* make sure the state matches */ @@ -1313,7 +1316,7 @@ find_crtc_for_output (output_t *output) crtc = find_crtc_by_xid (output->output_info->crtcs[c]); if (!crtc) fatal ("cannot find crtc 0x%x\n", output->output_info->crtcs[c]); - if (check_crtc_for_output (crtc, output)) + if (check_crtc_for_output (crtc, output, False)) return crtc; } return NULL; @@ -1518,7 +1521,7 @@ pick_crtcs_score (output_t *outputs) /* reset crtc allocation for following outputs */ disable_outputs (outputs); - if (!check_crtc_for_output (crtc, output)) + if (!check_crtc_for_output (crtc, output, True)) continue; my_score = 1000; -- 1.5.6.3