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

Chris Wilson ickle at kemper.freedesktop.org
Mon Oct 21 05:38:11 PDT 2013


 src/sna/sna_display.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

New commits:
commit 11211cd7c06a80c2dbbe07360857486b5b0d3094
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 21 13:35:24 2013 +0100

    sna: Set the canonical name for the current mode if none match
    
    Always give the mode a name for pretty printing for the user.
    
    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 d7ef344..d630d76 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2089,6 +2089,29 @@ sna_output_panel_edid(xf86OutputPtr output, DisplayModePtr modes)
 	return xf86ModesAdd(modes, m);
 }
 
+static int _canonical_mode_name(DisplayModePtr mode, char *str)
+{
+	return sprintf(str, "%dx%d%s",
+		       mode->HDisplay, mode->VDisplay,
+		       mode->Flags & V_INTERLACE ? "i" : "");
+}
+
+static char *canonical_mode_name(DisplayModePtr mode)
+{
+	 char *str;
+	 int len;
+
+	 len = _canonical_mode_name(mode, NULL);
+	 if (len < 0)
+		 return NULL;
+
+	 str = malloc(len + 1);
+	 if (str != NULL)
+		 _canonical_mode_name(mode, str);
+
+	 return str;
+}
+
 static DisplayModePtr
 sna_output_get_modes(xf86OutputPtr output)
 {
@@ -2144,6 +2167,14 @@ sna_output_get_modes(xf86OutputPtr output)
 	}
 	free(Mode);
 
+	if (current && (current->name == NULL || *current->name == '\0')) {
+		char *str = canonical_mode_name(current);
+		if (str) {
+			free(current->name);
+			current->name = str;
+		}
+	}
+
 	/*
 	 * If the connector type is a panel, we will traverse the kernel mode to
 	 * get the panel limit. And then add all the standard modes to fake
commit 5d5dfb3e7a6056df7f6af1bcdc789a50ed00b068
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 21 13:25:01 2013 +0100

    sna: Copy the EDID mode name for the current CRTC mode
    
    As the kernel does not preserve the name and driver type when returning
    the current CRTC mode, we need to reconstruct those from the EDID mode
    when available.
    
    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 a7957eb..d7ef344 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -705,6 +705,12 @@ mode_from_kmode(ScrnInfoPtr scrn,
 		const struct drm_mode_modeinfo *kmode,
 		DisplayModePtr mode)
 {
+	DBG(("kmode: %s, clock=%d, %d %d %d %d %d, %d %d %d %d %d, flags=%x, type=%x\n",
+	     kmode->name, kmode->clock,
+	     kmode->hdisplay, kmode->hsync_start, kmode->hsync_end, kmode->htotal, kmode->hskew,
+	     kmode->vdisplay, kmode->vsync_start, kmode->vsync_end, kmode->vtotal, kmode->vscan,
+	     kmode->flags, kmode->type));
+
 	mode->status = MODE_OK;
 
 	mode->Clock = kmode->clock;
@@ -2116,6 +2122,8 @@ sna_output_get_modes(xf86OutputPtr output)
 		}
 	}
 
+	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)
@@ -2128,6 +2136,9 @@ sna_output_get_modes(xf86OutputPtr output)
 			if (!current || !xf86ModesEqual(Mode, current)) {
 				Modes = xf86ModesAdd(Modes, Mode);
 				Mode = NULL;
+			} else {
+				current->name = strdup(Mode->name);
+				current->type = Mode->type;
 			}
 		}
 	}


More information about the xorg-commit mailing list