xf86-video-intel: 2 commits - src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Aug 4 22:31:03 PDT 2014


 src/sna/sna_display.c |   40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 5926da0ab3339bbfd55a27ac84a8306b8d931181
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 4 16:25:36 2014 +0100

    sna: Mark the current mode as preferred if no other mode is
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 80a5bb1..e0a1610 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2801,8 +2801,10 @@ sna_output_get_modes(xf86OutputPtr output)
 
 			if (mode.mode_valid && mode.mode.clock) {
 				current = calloc(1, sizeof(DisplayModeRec));
-				if (current)
+				if (current) {
 					mode_from_kmode(output->scrn, &mode.mode, current);
+					current->type |= M_T_DRIVER | M_T_PREFERRED;
+				}
 			}
 		}
 	}
@@ -2825,6 +2827,8 @@ sna_output_get_modes(xf86OutputPtr output)
 			free(current);
 			current = NULL;
 		}
+		if (current && mode->type & M_T_PREFERRED)
+			current->type &= ~M_T_PREFERRED;
 	}
 
 	if (current)
commit ab3f1526f19ec405dca8ab3094a626096dc30358
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 4 16:23:00 2014 +0100

    sna: Add the current CRTC mode last
    
    We only want to add the current mode to the modelist if it is not
    already present in the EDID. At the moment, we always add the current
    mode first which causes the list to be reordered. If we add it after
    checking the EDID, then we will not perturb the list.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82068

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 9906dfb..80a5bb1 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2778,7 +2778,7 @@ static DisplayModePtr
 sna_output_get_modes(xf86OutputPtr output)
 {
 	struct sna_output *sna_output = output->driver_private;
-	DisplayModePtr Modes = NULL, Mode, current = NULL;
+	DisplayModePtr Modes = NULL, current = NULL;
 	int i;
 
 	DBG(("%s(%s:%d)\n", __FUNCTION__, output->name, sna_output->id));
@@ -2801,36 +2801,34 @@ sna_output_get_modes(xf86OutputPtr output)
 
 			if (mode.mode_valid && mode.mode.clock) {
 				current = calloc(1, sizeof(DisplayModeRec));
-				if (current) {
+				if (current)
 					mode_from_kmode(output->scrn, &mode.mode, current);
-					Modes = xf86ModesAdd(Modes, current);
-				}
 			}
 		}
 	}
 
 	DBG(("%s: adding %d probed modes\n", __FUNCTION__, sna_output->num_modes));
 
-	Mode = NULL;
 	for (i = 0; i < sna_output->num_modes; i++) {
-		if (Mode == NULL)
-			Mode = calloc(1, sizeof(DisplayModeRec));
-		if (Mode) {
-			Mode = mode_from_kmode(output->scrn,
-					       &sna_output->modes[i],
-					       Mode);
-
-			if (!current || !xf86ModesEqual(Mode, current)) {
-				Modes = xf86ModesAdd(Modes, Mode);
-				Mode = NULL;
-			} else {
-				free((void *)current->name);
-				current->name = strdup(Mode->name);
-				current->type = Mode->type;
-			}
+		DisplayModePtr mode;
+
+		mode = calloc(1, sizeof(DisplayModeRec));
+		if (mode == NULL)
+			continue;
+
+		mode = mode_from_kmode(output->scrn,
+				       &sna_output->modes[i],
+				       mode);
+		Modes = xf86ModesAdd(Modes, mode);
+		if (current && xf86ModesEqual(mode, current)) {
+			free(current->name);
+			free(current);
+			current = NULL;
 		}
 	}
-	free(Mode);
+
+	if (current)
+		Modes = xf86ModesAdd(current, Modes);
 
 	/*
 	 * If the connector type is a panel, we will traverse the kernel mode to


More information about the xorg-commit mailing list