Module Name:    xsrc
Committed By:   macallan
Date:           Thu Jan  6 00:40:50 UTC 2011

Modified Files:
        xsrc/external/mit/xf86-video-r128/dist/src: r128_driver.c

Log Message:
if we can't read panel resolution from BIOS - for example if there is none -
get the display resolution from wsdisplay instead
With this we no longer need to specify PanelWidth and PanelHeight in xorg.conf


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
    xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c
diff -u xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.3 xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.4
--- xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c:1.3	Thu Dec 23 04:32:50 2010
+++ xsrc/external/mit/xf86-video-r128/dist/src/r128_driver.c	Thu Jan  6 00:40:50 2011
@@ -94,6 +94,7 @@
 #include "xf86cmap.h"
 #include "xf86xv.h"
 #include "vbe.h"
+#include "xf86Priv.h"
 
 				/* fbdevhw & vgahw */
 #ifdef WITH_VGAHW
@@ -114,6 +115,10 @@
 #include <X11/extensions/dpms.h>
 #endif
 
+#ifdef __NetBSD__
+#include <sys/time.h>
+#include <dev/wscons/wsconsio.h>
+#endif
 
 #ifndef MAX
 #define MAX(a,b) ((a)>(b)?(a):(b))
@@ -667,8 +672,6 @@
 	    info->PanelXRes = R128_BIOS16(info->FPBIOSstart+25);
 	if (!info->PanelYRes)
 	    info->PanelYRes = R128_BIOS16(info->FPBIOSstart+27);
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n",
-		   info->PanelXRes, info->PanelYRes);
 
 	info->PanelPwrDly = R128_BIOS8(info->FPBIOSstart+56);
 
@@ -702,11 +705,33 @@
 	}
     }
 
+#ifdef __NetBSD__
+    if (!info->PanelXRes || !info->PanelYRes) {
+	/*
+	 * we may not be on x86 so check wsdisplay for panel dimensions
+	 * XXX this assumes that the r128 is the console, although that should
+	 * be the case in the vast majority of cases where an LCD is hooked up
+	 * directly
+	 * We should probably just check the relevant registers but I'm not
+	 * sure they're available at this point.
+	 */
+	struct wsdisplay_fbinfo fbinfo;
+	
+	if (ioctl(xf86Info.screenFd, WSDISPLAYIO_GINFO, &fbinfo) == 0) {
+	    info->PanelXRes = fbinfo.width;
+	    info->PanelYRes = fbinfo.height;
+	}
+    }
+#endif
+
     if (!info->PanelXRes || !info->PanelYRes) {
         info->HasPanelRegs = FALSE;
         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		   "Can't determine panel dimensions, and none specified.\n"
 		   "\tDisabling programming of FP registers.\n");
+    } else {
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n",
+		   info->PanelXRes, info->PanelYRes);
     }
 
     return TRUE;

Reply via email to