Skip to content

Instantly share code, notes, and snippets.

@ao-kenji
Created January 11, 2014 14:25
Show Gist options
  • Save ao-kenji/8371507 to your computer and use it in GitHub Desktop.
Save ao-kenji/8371507 to your computer and use it in GitHub Desktop.
[Merged into original tree] Add LUNA88K quirks in X.Org wscons driver to co-exist colored wscons with monochrome X server, with the help of WSDISPLAYIO_SETGFXMODE ioctl supported kernel.
Index: driver/xf86-video-wsfb//src/wsfb_driver.c
===================================================================
RCS file: /cvs/xenocara/driver/xf86-video-wsfb/src/wsfb_driver.c,v
retrieving revision 1.30
diff -u -r1.30 wsfb_driver.c
--- driver/xf86-video-wsfb//src/wsfb_driver.c 15 Jul 2013 13:23:17 -0000 1.30
+++ driver/xf86-video-wsfb//src/wsfb_driver.c 11 Jan 2014 14:17:54 -0000
@@ -531,6 +531,22 @@
strerror(errno));
return FALSE;
}
+
+ /* Quirk for LUNA: now X supports 1bpp only, so force to set 1bpp */
+ if (fPtr->wstype == WSDISPLAY_TYPE_LUNA) {
+ struct wsdisplay_gfx_mode gfxmode;
+ gfxmode.width = fPtr->info.width;
+ gfxmode.height = fPtr->info.height;
+ gfxmode.depth = fPtr->info.depth = 1;
+
+ if (ioctl(fPtr->fd, WSDISPLAYIO_SETGFXMODE, &gfxmode) == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl WSDISPLAY_SETGFXMODE: %s\n",
+ strerror(errno));
+ return FALSE;
+ }
+ }
+
/*
* Allocate room for saving the colormap.
*/
@@ -1334,6 +1350,21 @@
/* Clear the screen. */
memset(fPtr->fbmem, 0, fPtr->fbmem_len);
+
+ /* Quirk for LUNA: Restore default depth. */
+ if (fPtr->wstype == WSDISPLAY_TYPE_LUNA) {
+ struct wsdisplay_gfx_mode gfxmode;
+ gfxmode.width = fPtr->info.width;
+ gfxmode.height = fPtr->info.height;
+ gfxmode.depth = 0; /* set to default depth */
+
+ if (ioctl(fPtr->fd, WSDISPLAYIO_SETGFXMODE, &gfxmode) == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl WSDISPLAY_SETGFXMODE: %s\n",
+ strerror(errno));
+ return FALSE;
+ }
+ }
/* Restore the text mode. */
mode = WSDISPLAYIO_MODE_EMUL;
@ao-kenji
Copy link
Author

This diff has been commited to the original source tree:
http://marc.info/?l=openbsd-cvs&m=138978458217056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment