256ColorMode

256 color mode

The X server can't switch from 24bpp* mode to 8bpp** mode. Nevertheless, Wine (in general) can run software that uses 8bpp graphics by internally converting bitmaps to formats compatible with the current X server mode (e.g. 24bpp). This is also true for 8bpp DirectDraw games such as Starcraft, C&C Red Alert and Total Annihilation. Such games will output a fixme message

fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 8

but for practical purposes it can be ignored. Although the general support for such conversion is there, there may be bugs affecting specific software, and performance is often not on par with native Windows installations. Search Bugzilla and the AppDB for known issues with individual applications.

* "24bpp" = 24-bit color = 16 million colors = Truecolor

** "8bpp" = 8-bit color = 256 colors = color index mode

Workarounds

If your application says that it needs 8bpp or 256 colors even though you have millions of colors available, you may be able to get it working with one of the workarounds below. Any of four major methods are suggested to provide 8bpp to applications. These include:

  • Xephyr (preferred)
  • Xnest
  • VNC
  • Xinit

Stage 1: Creating a new X11 display

The instructions below allow you to create a new X11 display, with 256 colors, and with an xterm running within it. But:

  • Wherever :1 is written you may use :n instead, where n is an unused display number.

  • If your shell doesn't accept the "DISPLAY=:1 xterm" syntax, you may need to use something like "env DISPLAY=:1 xterm" instead.

  • See also bug 7334.

Xephyr

Once you have installed Xephyr (Ubuntu: package xserver-xephyr, in universe), you should be able to run something like the following:

Xephyr :1 -ac -screen 800x600x8 &
DISPLAY=:1 xterm

This will create a 800x600 display, in a window, with 8-bit color, and display an xterm in it.

Xnest

Once you have installed Xnest (Ubuntu: package xnest, in main), you should be able to run the following:

Xnest :1 -depth 8 &
DISPLAY=:1 xterm

This will create a display in a window, with 8-bit color, and display an xterm in it. Xnest depends on the parent X11 for various things; in some cases Xnest won't work (-depth 8 fails on many systems).

VNC

Once you have installed VNC (Ubuntu: packages vnc4server and xvnc4viewer, in universe), you should be able to run the following:

vnc4server :1 -cc 3 -depth 8 -geometry 640x480 -localhost

Then issue the command:

xvnc4viewer :1

This will create a virtual 8bpp display (in this example, a 640x480 window containing the virtual screen). This is known as PseudoColor mode in the VNC documentation.

Xinit

Of course you can use just plain ol' X.

cd "~/.wine/drive_c/Program Files/My game/"
xinit /usr/bin/wine "my game.exe" -- :1 -ac -depth 8

Stage 2: Using the new display

Move the cursor over the xterm in the new display (without a window manager, X11 uses focus-follows-mouse), and run:

metacity &
xsetroot -solid gray50
cd "$HOME/.wine/drive_c/Program Files/<etc>"
wine <program> <args>

(Running these commands from the xterm in the new display makes sure that $DISPLAY is set correctly. You can of course run these commands from a terminal in another display, but be sure to prepend "DISPLAY=:1" to them.)

Instead of metacity, you may use another window manager; note that compositing WMs like compiz may not work.

When you're finished, you can close the new display. This will kill all programs that were running in it. If you used Xinit, type exit in the xterm that appeared initially.

256ColorMode (last edited 2009-10-20 20:56:30 by AlexanderScottJohns)