Module Name:    xsrc
Committed By:   tsutsui
Date:           Fri Jul 22 15:12:01 UTC 2011

Modified Files:
        xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
Make wsfb driver work with 1bpp wscons framebuffer on luna68k:
 - Pass proper args (a number of line dots, not byte of screen width)
   to fbScreenInit() in 1bpp case, as X11R6 Xhpc server did
 - handle luna68k quirk (fbstart has 8 byte offset) by WSDISPLAYIO_GTYPE
   (XXX wstype should be stored in pScrn?)
 - set rgbBits properly in 1bpp and 4bpp cases
   (XXX not sure if really necessary)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
    xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.12 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.13
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.12	Thu Jul 21 11:08:58 2011
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Fri Jul 22 15:12:01 2011
@@ -546,7 +546,7 @@
 	xf86SetGamma(pScrn,zeros);
 
 	pScrn->progClock = TRUE;
-	pScrn->rgbBits   = 8;
+	pScrn->rgbBits   = (pScrn->depth >= 8) ? 8 : pScrn->depth;
 	pScrn->chipset   = "wsfb";
 	pScrn->videoRam  = fPtr->linebytes * fPtr->info.height;
 
@@ -736,6 +736,7 @@
 	VisualPtr visual;
 	int ret, flags, ncolors;
 	int wsmode = WSDISPLAYIO_MODE_DUMBFB;
+	int wstype;
 	size_t len;
 
 	TRACE_ENTER("WsfbScreenInit");
@@ -787,6 +788,13 @@
 			   strerror(errno));
 		return FALSE;
 	}
+	/* Get wsdisplay type to handle quirks */
+	if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "ioctl WSDISPLAY_GTYPE: %s\n",
+			   strerror(errno));
+		return FALSE;
+	}
 	fPtr->fbmem = wsfb_mmap(len, 0, fPtr->fd);
 
 	if (fPtr->fbmem == NULL) {
@@ -826,6 +834,17 @@
 	}
 
 	fPtr->fbstart = fPtr->fbmem;
+#ifdef	WSDISPLAY_TYPE_LUNA
+	if (wstype == WSDISPLAY_TYPE_LUNA) {
+		/*
+		 * XXX
+		 * LUNA's FB seems to have 64 dot (8 byte) offset.
+		 * This might be able to be changed in kernel lunafb driver,
+		 * but current setting was pulled from 4.4BSD-Lite2/luna68k.
+		 */
+		fPtr->fbstart += 8;
+	}
+#endif
 
 	if (fPtr->shadowFB) {
 		fPtr->shadow = xcalloc(1, pScrn->virtualX * pScrn->virtualY *
@@ -840,6 +859,12 @@
 
 	switch (pScrn->bitsPerPixel) {
 	case 1:
+		ret = fbScreenInit(pScreen,
+		    fPtr->fbstart,
+		    pScrn->virtualX, pScrn->virtualY,
+		    pScrn->xDpi, pScrn->yDpi,
+		    fPtr->linebytes * 8, pScrn->bitsPerPixel);
+		break;
 	case 4:
 	case 8:
 	case 16:

Reply via email to