Add support to Xephyr for simulating 8bit grayscale.

This commit is contained in:
Matthew Allum 2006-07-08 21:10:58 +01:00
parent 5416f90e9c
commit e805621894
2 changed files with 22 additions and 7 deletions

View File

@ -40,6 +40,8 @@ extern DeviceIntPtr pKdKeyboard;
static int mouseState = 0;
Bool EphyrWantGrayScale = 0;
Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
{
@ -80,7 +82,10 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
screen->width = width;
screen->height = height;
}
if (EphyrWantGrayScale)
screen->fb[0].depth = 8;
if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
{
if (screen->fb[0].depth < hostx_get_depth()
@ -98,12 +103,15 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
if (screen->fb[0].depth <= 8)
{
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
if (EphyrWantGrayScale)
screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale));
else
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
screen->fb[0].redMask = 0x00;
screen->fb[0].greenMask = 0x00;

View File

@ -29,6 +29,7 @@
#include "ephyr.h"
extern Window EphyrPreExistingHostWin;
extern Bool EphyrWantGrayScale;
void
InitCard (char *name)
@ -62,6 +63,7 @@ ddxUseMsg (void)
ErrorF("-parent XID Use existing window as Xephyr root win\n");
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
ErrorF("-grayscale Simulate 8bit grayscale\n");
ErrorF("-fakexa Simulate acceleration using software rendering\n");
ErrorF("\n");
@ -94,6 +96,11 @@ ddxProcessArgument (int argc, char **argv, int i)
hostx_use_fullscreen();
return 1;
}
else if (!strcmp (argv[i], "-grayscale"))
{
EphyrWantGrayScale = 1;
return 1;
}
else if (!strcmp (argv[i], "-fakexa"))
{
ephyrFuncs.initAccel = ephyrDrawInit;