[PATCH] xf86-video-geode: DCON: set the default (physical) screen size if we detect a DCON

Andres Salomon dilinger at queued.net
Tue Nov 25 22:39:28 PST 2008


We can be assured that a DCON device has an OLPC panel that's 152x114 mm.
This adds fields to GeodeRec to allow other panels to potentially
override physical width/height fields, and also allows xorg.conf to
override the values.

Signed-off-by: Andres Salomon <dilinger at debian.org>
---
 src/geode.h      |    2 ++
 src/geode_dcon.c |    6 ++++++
 src/lx_output.c  |   11 +++++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/geode.h b/src/geode.h
index e748ec6..37bee2e 100644
--- a/src/geode.h
+++ b/src/geode.h
@@ -196,6 +196,8 @@ typedef struct _geodeRec
     Bool tryCompression;
     Bool tryHWCursor;
 
+    int mm_width, mm_height;           /* physical display size */
+
     unsigned long CursorStartOffset;
 
     int Pitch;			       /* display FB pitch */
diff --git a/src/geode_dcon.c b/src/geode_dcon.c
index 0baa178..13e5fd2 100644
--- a/src/geode_dcon.c
+++ b/src/geode_dcon.c
@@ -92,6 +92,9 @@ dcon_init(ScrnInfoPtr pScrni)
 {
     GeodeRec *pGeode = GEODEPTR(pScrni);
 
+    pGeode->mm_width = 0;
+    pGeode->mm_height = 0;
+
     if (!dcon_present()) {
 	xf86DrvMsg(pScrni->scrnIndex, X_DEFAULT, "No DCON is present\n");
 	return FALSE;
@@ -115,6 +118,9 @@ dcon_init(ScrnInfoPtr pScrni)
     pGeode->panelMode->VTotal = 912;
     pGeode->panelMode->Flags = V_NHSYNC | V_NVSYNC;
 
+    pGeode->mm_width = 152;
+    pGeode->mm_height = 114;
+
     xf86SetModeDefaultName(pGeode->panelMode);
 
     /* TODO: Print board revision once sysfs exports it. */
diff --git a/src/lx_output.c b/src/lx_output.c
index 53a538a..5508477 100644
--- a/src/lx_output.c
+++ b/src/lx_output.c
@@ -249,6 +249,7 @@ LXSetupOutput(ScrnInfoPtr pScrni)
 {
     xf86OutputPtr output;
     LXOutputPrivatePtr lxpriv;
+    GeodePtr pGeode = GEODEPTR(pScrni);
 
     output = xf86OutputCreate(pScrni, &lx_output_funcs, "default");
 
@@ -267,6 +268,16 @@ LXSetupOutput(ScrnInfoPtr pScrni)
 
     GeodeI2CInit(pScrni, &lxpriv->pDDCBus, "CS5536 DDC");
 
+    if (pScrni->monitor->widthmm && pScrni->monitor->heightmm) {
+	/* prioritize the admin's screen size */
+	output->mm_width = pScrni->monitor->widthmm;
+	output->mm_height = pScrni->monitor->heightmm;
+    } else if (pGeode->mm_width && pGeode->mm_height) {
+	/* if we have a panel that we're certain of the size of, set it */
+	output->mm_width = pScrni->monitor->widthmm = pGeode->mm_width;
+	output->mm_height = pScrni->monitor->heightmm = pGeode->mm_height;
+    }
+
     /* We only have one CRTC, and this output is tied to it */
     output->possible_crtcs = 1;
 }
-- 
1.5.6.5




More information about the xorg mailing list