summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-06-18 08:27:49 +0100
committerAdam Jackson <ajax@redhat.com>2015-07-01 11:13:07 -0400
commit3d03be780fca4949b11ead46c5ea5d3266c03c32 (patch)
treee966485bcc17a468da2ad4cd1d69d096e796471c
parent53ef3fc13b3e282902892e3140765460c6f93276 (diff)
Mark all CRTC as currently unused for second picking CRTC pass
We perform two passes over the CRTC in order to find the preferred CRTC for each enabled output. In the first pass, we try to preserve the existing output <-> CRTC relationships (to avoid unnecessary flicker). If that pass fails, we try again but with all outputs first disabled. However, the logic to preserve an active CRTC was not disabled along with the outputs - meaning that if one was active but its associated output was disabled by the user, then that CRTC would remain unavailable for other outputs. The result would be that we would try to assign more CRTC than available (i.e. if the user request 3 new HDMI outputs on a system with only 3 CRTC, and wished to switch off an active internal panel, we would report "cannot find CRTC" even though that configuration could be established.) Reported-and-tested-by: Nathan Schulte <nmschulte@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--xrandr.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xrandr.c b/xrandr.c
index c0feac3..181c76e 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2243,6 +2243,8 @@ static void
pick_crtcs (void)
{
output_t *output;
+ int saved_crtc_noutput[num_crtcs];
+ int n;
/*
* First try to match up newly enabled outputs with spare crtcs
@@ -2274,7 +2276,18 @@ pick_crtcs (void)
*/
for (output = all_outputs; output; output = output->next)
output->current_crtc_info = output->crtc_info;
+
+ /* Mark all CRTC as currently unused */
+ for (n = 0; n < num_crtcs; n++) {
+ saved_crtc_noutput[n] = crtcs[n].crtc_info->noutput;
+ crtcs[n].crtc_info->noutput = 0;
+ }
+
pick_crtcs_score (all_outputs);
+
+ for (n = 0; n < num_crtcs; n++)
+ crtcs[n].crtc_info->noutput = saved_crtc_noutput[n];
+
for (output = all_outputs; output; output = output->next)
{
if (output->mode_info && !output->crtc_info)