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

Chris Wilson ickle at kemper.freedesktop.org
Tue Dec 4 01:21:19 PST 2012


 src/sna/sna_display.c |   57 ++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 29 deletions(-)

New commits:
commit 08c30c48bdd0db500498bd9617c15f37bacd8de9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Dec 3 13:23:33 2012 +0000

    sna: Tidy addition of fake GTF modes for panels
    
    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 8dc1058..c150078 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1698,41 +1698,40 @@ static DisplayModePtr
 sna_output_panel_edid(xf86OutputPtr output, DisplayModePtr modes)
 {
 	xf86MonPtr mon = output->MonInfo;
+	DisplayModePtr i, m, preferred = NULL;
+	int max_x = 0, max_y = 0;
+	float max_vrefresh = 0.0;
 
-	if (!mon || !GTF_SUPPORTED(mon->features.msc)) {
-		DisplayModePtr i, m, p = NULL;
-		int max_x = 0, max_y = 0;
-		float max_vrefresh = 0.0;
-
-		for (m = modes; m; m = m->next) {
-			if (m->type & M_T_PREFERRED)
-				p = m;
-			max_x = max(max_x, m->HDisplay);
-			max_y = max(max_y, m->VDisplay);
-			max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m));
-		}
-
-		max_vrefresh = max(max_vrefresh, 60.0);
-		max_vrefresh *= (1 + SYNC_TOLERANCE);
+	if (mon && GTF_SUPPORTED(mon->features.msc))
+		return modes;
 
-		m = xf86GetDefaultModes();
-		xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0);
+	for (m = modes; m; m = m->next) {
+		if (m->type & M_T_PREFERRED)
+			preferred = m;
+		max_x = max(max_x, m->HDisplay);
+		max_y = max(max_y, m->VDisplay);
+		max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m));
+	}
 
-		for (i = m; i; i = i->next) {
-			if (xf86ModeVRefresh(i) > max_vrefresh)
-				i->status = MODE_VSYNC;
-			if (p && i->HDisplay >= p->HDisplay &&
-			    i->VDisplay >= p->VDisplay &&
-			    xf86ModeVRefresh(i) >= xf86ModeVRefresh(p))
-				i->status = MODE_VSYNC;
-		}
+	max_vrefresh = max(max_vrefresh, 60.0);
+	max_vrefresh *= (1 + SYNC_TOLERANCE);
 
-		xf86PruneInvalidModes(output->scrn, &m, FALSE);
+	m = xf86GetDefaultModes();
+	xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0);
 
-		modes = xf86ModesAdd(modes, m);
+	for (i = m; i; i = i->next) {
+		if (xf86ModeVRefresh(i) > max_vrefresh)
+			i->status = MODE_VSYNC;
+		if (preferred &&
+		    i->HDisplay >= preferred->HDisplay &&
+		    i->VDisplay >= preferred->VDisplay &&
+		    xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred))
+			i->status = MODE_PANEL;
 	}
 
-	return modes;
+	xf86PruneInvalidModes(output->scrn, &m, FALSE);
+
+	return xf86ModesAdd(modes, m);
 }
 
 static DisplayModePtr
@@ -1766,6 +1765,7 @@ sna_output_get_modes(xf86OutputPtr output)
 	 */
 	sna_output->has_panel_limits = false;
 	if (is_panel(koutput->connector_type)) {
+		sna_output->panel_hdisplay = sna_output->panel_vdisplay = 0;
 		for (i = 0; i < koutput->count_modes; i++) {
 			drmModeModeInfo *mode_ptr;
 
@@ -1775,7 +1775,6 @@ sna_output_get_modes(xf86OutputPtr output)
 			if (mode_ptr->vdisplay > sna_output->panel_vdisplay)
 				sna_output->panel_vdisplay = mode_ptr->vdisplay;
 		}
-
 		sna_output->has_panel_limits =
 			sna_output->panel_hdisplay &&
 			sna_output->panel_vdisplay;


More information about the xorg-commit mailing list