diff options
author | faith <faith> | 2001-12-12 19:59:57 +0000 |
---|---|---|
committer | faith <faith> | 2001-12-12 19:59:57 +0000 |
commit | e6ede3f595916a6dea71bb90ab24a0e61c66ed53 (patch) | |
tree | feb177799c08a53b267e15894b81129d88f49280 | |
parent | f99c666b683364a651b1b4e995ea967f9593eeef (diff) |
Move screen information logging into a separate function
Add a heuristically computed depth value to the dmxScreen structure
(to allow 24-bit back-end servers).
-rw-r--r-- | xc/programs/Xserver/hw/dmx/dmx.h | 1 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/dmx/dmxinit.c | 64 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/dmx/dmxscrinit.c | 2 |
3 files changed, 42 insertions, 25 deletions
diff --git a/xc/programs/Xserver/hw/dmx/dmx.h b/xc/programs/Xserver/hw/dmx/dmx.h index 675760848..68939e732 100644 --- a/xc/programs/Xserver/hw/dmx/dmx.h +++ b/xc/programs/Xserver/hw/dmx/dmx.h @@ -59,6 +59,7 @@ typedef struct _DMXScreenInfo { Window window; int width; int height; + int depth; int bpp; void *shadow; diff --git a/xc/programs/Xserver/hw/dmx/dmxinit.c b/xc/programs/Xserver/hw/dmx/dmxinit.c index f13ad7bac..6855c8cd3 100644 --- a/xc/programs/Xserver/hw/dmx/dmxinit.c +++ b/xc/programs/Xserver/hw/dmx/dmxinit.c @@ -64,7 +64,7 @@ static char *inputName = NULL; extern char *ConnectionInfo; extern int connBlockScreenStart; -static void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) +static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen) { XWindowAttributes attribs; int ndepths = 0, *depths = NULL; @@ -76,12 +76,12 @@ static void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); if (!(depths = XListDepths(dpy, scr, &ndepths))) ndepths = 0; - dmxLogOutput(dmxScreen, "name of display: %s\n", DisplayString(dpy)); - dmxLogOutput(dmxScreen, "version number: %d.%d\n", + dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy)); + dmxLogOutput(dmxScreen, "Version number: %d.%d\n", ProtocolVersion(dpy), ProtocolRevision(dpy)); - dmxLogOutput(dmxScreen, "vendor string: %s\n", ServerVendor(dpy)); + dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy)); if (!strstr(ServerVendor(dpy), "XFree86")) { - dmxLogOutput(dmxScreen, "vendor release: %d\n", VendorRelease(dpy)); + dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy)); } else { /* This code based on xdpyinfo.c */ int v = VendorRelease(dpy); @@ -106,7 +106,7 @@ static void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) patch = (v / 1000) % 100; if (v % 1000) subpatch = v % 1000; } - dmxLogOutput(dmxScreen, "vendor release: %d (XFree86 version: %d.%d", + dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d", v, major, minor); if (patch > 0) dmxLogAdditional(dmxScreen, ".%d", patch); if (subpatch > 0) dmxLogAdditional(dmxScreen, ".%d", subpatch); @@ -114,35 +114,51 @@ static void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) } - dmxLogOutput(dmxScreen, "dimensions: %dx%d pixels\n", + dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n", attribs.width, attribs.height); dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr); for (i = 0; i < ndepths; i++) dmxLogAdditional(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]); dmxLogAdditional(dmxScreen, "\n"); - dmxLogOutput(dmxScreen, "depth of root window: %d plane%s (%d)\n", + dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n", attribs.depth, attribs.depth == 1 ? "" : "s", - DisplayPlanes(dmxScreen->display, scr)); - dmxLogOutput(dmxScreen, "number of colormaps: %d min, %d max\n", + DisplayPlanes(dpy, scr)); + dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n", MinCmapsOfScreen(s), MaxCmapsOfScreen(s)); - dmxLogOutput(dmxScreen, "options: backing-store %s, save-unders %s\n", + dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n", (DoesBackingStore (s) == NotUseful) ? "no" : ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"), DoesSaveUnders (s) ? "yes" : "no"); - - dmxScreen->width = attribs.width; +} + +static void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) +{ + XWindowAttributes attribs; + Display *dpy = dmxScreen->display; + + XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); + + dmxScreen->width = attribs.width; dmxScreen->height = attribs.height; - - dmxScreen->bpp = attribs.depth; /* FIXME: verify that this works - * always. In particular, this will - * work well for depth=16, will fail - * because of colormap issues at - * depth 8, and will dump core at - * depth=24 because of XCreateImage. - * More work needs to be done - * here. */ - - if (dmxScreen->bpp != 16) + dmxScreen->depth = attribs.depth; /* FIXME: verify that this works + * always. In particular, this will + * work well for depth=16, will fail + * because of colormap issues at + * depth 8. + * More work needs to be done + * here. */ + switch (dmxScreen->depth) { + case 4: dmxScreen->bpp = 8; break; /* FIXME? */ + case 15: dmxScreen->bpp = 16; break; + case 24: dmxScreen->bpp = 32; break; + default: dmxScreen->bpp = dmxScreen->depth; break; + } + + dmxPrintScreenInfo(dmxScreen); + dmxLogOutput(dmxScreen, "Using %dx%d at depth=%d, bpp=%d\n", + dmxScreen->width, dmxScreen->height, + dmxScreen->depth, dmxScreen->bpp); + if (dmxScreen->depth != 16) dmxLog(dmxWarning, "Support for depth != 16 is not complete\n"); } diff --git a/xc/programs/Xserver/hw/dmx/dmxscrinit.c b/xc/programs/Xserver/hw/dmx/dmxscrinit.c index 6ca858ab6..f342c99b3 100644 --- a/xc/programs/Xserver/hw/dmx/dmxscrinit.c +++ b/xc/programs/Xserver/hw/dmx/dmxscrinit.c @@ -195,7 +195,7 @@ Bool dmxScreenInit(int index, ScreenPtr pScreen, int argc, char *argv[]) dmxScreen->image = XCreateImage(dmxScreen->display, dmxScreen->visuals[dmxScreen->defVisualIndex].visual, - dmxScreen->bpp, /* FIXME: this should be depth */ + dmxScreen->depth, ZPixmap, 0, (char *)dmxScreen->shadow, |