Module Name:    xsrc
Committed By:   macallan
Date:           Thu Feb 14 16:13:38 UTC 2013

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

Log Message:
call ioctl(WSDISPLAYIO_SMODE, ...) in EnterTV/LeaveVT so kernel graphics
drivers get notified when we switch in and out of X


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
    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.15 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.16
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.15	Thu Jan 31 11:18:01 2013
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Thu Feb 14 16:13:38 2013
@@ -1147,9 +1147,19 @@ static Bool
 WsfbEnterVT(int scrnIndex, int flags)
 {
 	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+	WsfbPtr fPtr = WSFBPTR(pScrn);
+	int mode;
 
 	TRACE_ENTER("EnterVT");
 	pScrn->vtSema = TRUE;
+
+	/* Restore the graphics mode. */
+	mode = WSDISPLAYIO_MODE_DUMBFB;
+	if (ioctl(fPtr->fd, WSDISPLAYIO_SMODE, &mode) == -1) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "error setting graphics mode %s\n", strerror(errno));
+	}
+
 	TRACE_EXIT("EnterVT");
 	return TRUE;
 }
@@ -1157,11 +1167,39 @@ WsfbEnterVT(int scrnIndex, int flags)
 static void
 WsfbLeaveVT(int scrnIndex, int flags)
 {
-#if DEBUG
 	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-#endif
+	WsfbPtr fPtr = WSFBPTR(pScrn);
+	int mode;
 
 	TRACE_ENTER("LeaveVT");
+
+	/*
+	 * stuff to do:
+	 * - turn off hw cursor
+	 * - restore colour map if WSFB_CI
+	 * - ioctl(WSDISPLAYIO_MODE_EMUL) to notify the kernel driver that
+	 *   we're backing off
+	 */
+
+	if (fPtr->fbi.fbi_pixeltype == WSFB_CI) {
+		/* reset colormap for text mode */
+		if (ioctl(fPtr->fd, WSDISPLAYIO_PUTCMAP,
+			  &(fPtr->saved_cmap)) == -1) {
+			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				   "error restoring colormap %s\n",
+				   strerror(errno));
+		}
+	}
+
+	/* Restore the text mode. */
+	mode = WSDISPLAYIO_MODE_EMUL;
+	if (ioctl(fPtr->fd, WSDISPLAYIO_SMODE, &mode) == -1) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "error setting text mode %s\n", strerror(errno));
+	}
+
+	pScrn->vtSema = FALSE;
+	TRACE_EXIT("LeaveVT");
 }
 
 static Bool

Reply via email to