diff options
Diffstat (limited to 'xorg-server/hw')
37 files changed, 1258 insertions, 1308 deletions
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c index 82f95c994..1a0c3fea8 100644 --- a/xorg-server/hw/dmx/dmx.c +++ b/xorg-server/hw/dmx/dmx.c @@ -57,6 +57,7 @@ #include "dmxextension.h" #include <X11/extensions/dmxproto.h> #include <X11/extensions/dmx.h> +#include "protocol-versions.h" #ifdef PANORAMIX #include "panoramiX.h" @@ -223,9 +224,9 @@ static int ProcDMXQueryVersion(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; - rep.majorVersion = DMX_EXTENSION_MAJOR; - rep.minorVersion = DMX_EXTENSION_MINOR; - rep.patchVersion = DMX_EXTENSION_PATCH; + rep.majorVersion = SERVER_DMX_MAJOR_VERSION; + rep.minorVersion = SERVER_DMX_MINOR_VERSION; + rep.patchVersion = SERVER_DMX_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); diff --git a/xorg-server/hw/dmx/dmxgcops.c b/xorg-server/hw/dmx/dmxgcops.c index eaabf16dd..267a306db 100644 --- a/xorg-server/hw/dmx/dmxgcops.c +++ b/xorg-server/hw/dmx/dmxgcops.c @@ -50,7 +50,9 @@ #include "pixmapstr.h" #include "dixfontstr.h" +#ifdef PANORAMIX #include "panoramiXsrv.h" +#endif #define DMX_GCOPS_SET_DRAWABLE(_pDraw, _draw) \ do { \ diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c index b9b18a85a..739c4ca7f 100644 --- a/xorg-server/hw/dmx/dmxinit.c +++ b/xorg-server/hw/dmx/dmxinit.c @@ -1,1040 +1,1042 @@ -/* - * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Kevin E. Martin <kem@redhat.com> - * David H. Dawes <dawes@xfree86.org> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide expected functions for initialization from the ddx layer and - * global variables for the DMX server. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxinit.h" -#include "dmxsync.h" -#include "dmxlog.h" -#include "dmxinput.h" -#include "dmxscrinit.h" -#include "dmxcursor.h" -#include "dmxfont.h" -#include "config/dmxconfig.h" -#include "dmxcb.h" -#include "dmxprop.h" -#include "dmxstat.h" -#ifdef RENDER -#include "dmxpict.h" -#endif - -#include <X11/Xos.h> /* For gettimeofday */ -#include "dixstruct.h" -#include "panoramiXsrv.h" - -#include <signal.h> /* For SIGQUIT */ - -#ifdef GLXEXT -#include <GL/glx.h> -#include <GL/glxint.h> -#include "dmx_glxvisuals.h" -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> - -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **configprivs -); -#endif /* GLXEXT */ - -/* Global variables available to all Xserver/hw/dmx routines. */ -int dmxNumScreens; -DMXScreenInfo *dmxScreens; - -int dmxNumInputs; -DMXInputInfo *dmxInputs; - -int dmxShadowFB = FALSE; - -XErrorEvent dmxLastErrorEvent; -Bool dmxErrorOccurred = FALSE; - -char *dmxFontPath = NULL; - -Bool dmxOffScreenOpt = TRUE; - -Bool dmxSubdividePrimitives = TRUE; - -Bool dmxLazyWindowCreation = TRUE; - -Bool dmxUseXKB = TRUE; - -int dmxDepth = 0; - -#ifndef GLXEXT -static Bool dmxGLXProxy = FALSE; -#else -Bool dmxGLXProxy = TRUE; - -Bool dmxGLXSwapGroupSupport = TRUE; - -Bool dmxGLXSyncSwap = FALSE; - -Bool dmxGLXFinishSwap = FALSE; -#endif - -Bool dmxIgnoreBadFontPaths = FALSE; - -Bool dmxAddRemoveScreens = FALSE; - -/* dmxErrorHandler catches errors that occur when calling one of the - * back-end servers. Some of this code is based on _XPrintDefaultError - * in xc/lib/X11/XlibInt.c */ -static int dmxErrorHandler(Display *dpy, XErrorEvent *ev) -{ -#define DMX_ERROR_BUF_SIZE 256 - /* RATS: these buffers are only used in - * length-limited calls. */ - char buf[DMX_ERROR_BUF_SIZE]; - char request[DMX_ERROR_BUF_SIZE]; - _XExtension *ext = NULL; - - dmxErrorOccurred = TRUE; - dmxLastErrorEvent = *ev; - - XGetErrorText(dpy, ev->error_code, buf, sizeof(buf)); - dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf); - - /* Find major opcode name */ - if (ev->request_code < 128) { - XmuSnprintf(request, sizeof(request), "%d", ev->request_code); - XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); - } else { - for (ext = dpy->ext_procs; - ext && ext->codes.major_opcode != ev->request_code; - ext = ext->next); - if (ext) strncpy(buf, ext->name, sizeof(buf)); - else buf[0] = '\0'; - } - dmxLog(dmxWarning, " Major opcode: %d (%s)\n", - ev->request_code, buf); - - /* Find minor opcode name */ - if (ev->request_code >= 128 && ext) { - XmuSnprintf(request, sizeof(request), "%d", ev->request_code); - XmuSnprintf(request, sizeof(request), "%s.%d", - ext->name, ev->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); - dmxLog(dmxWarning, " Minor opcode: %d (%s)\n", - ev->minor_code, buf); - } - - /* Provide value information */ - switch (ev->error_code) { - case BadValue: - dmxLog(dmxWarning, " Value: 0x%x\n", - ev->resourceid); - break; - case BadAtom: - dmxLog(dmxWarning, " AtomID: 0x%x\n", - ev->resourceid); - break; - default: - dmxLog(dmxWarning, " ResourceID: 0x%x\n", - ev->resourceid); - break; - } - - /* Provide serial number information */ - dmxLog(dmxWarning, " Failed serial number: %d\n", - ev->serial); - dmxLog(dmxWarning, " Current serial number: %d\n", - dpy->request); - return 0; -} - -#ifdef GLXEXT -static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev) -{ - return 0; -} -#endif - -Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen) -{ - if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name))) - return FALSE; - - dmxPropertyDisplay(dmxScreen); - return TRUE; -} - -void dmxSetErrorHandler(DMXScreenInfo *dmxScreen) -{ - XSetErrorHandler(dmxErrorHandler); -} - -static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen) -{ - XWindowAttributes attribs; - int ndepths = 0, *depths = NULL; - int i; - Display *dpy = dmxScreen->beDisplay; - Screen *s = DefaultScreenOfDisplay(dpy); - int scr = DefaultScreen(dpy); - - 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", - ProtocolVersion(dpy), ProtocolRevision(dpy)); - dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy)); - if (!strstr(ServerVendor(dpy), "XFree86")) { - dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy)); - } else { - /* This code based on xdpyinfo.c */ - int v = VendorRelease(dpy); - int major = -1, minor = -1, patch = -1, subpatch = -1; - - if (v < 336) - major = v / 100, minor = (v / 10) % 10, patch = v % 10; - else if (v < 3900) { - major = v / 1000; - minor = (v / 100) % 10; - if (((v / 10) % 10) || (v % 10)) { - patch = (v / 10) % 10; - if (v % 10) subpatch = v % 10; - } - } else if (v < 40000000) { - major = v / 1000; - minor = (v / 10) % 10; - if (v % 10) patch = v % 10; - } else { - major = v / 10000000; - minor = (v / 100000) % 100; - patch = (v / 1000) % 100; - if (v % 1000) subpatch = v % 1000; - } - dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d", - v, major, minor); - if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch); - if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch); - dmxLogOutputCont(dmxScreen, ")\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++) - dmxLogOutputCont(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]); - dmxLogOutputCont(dmxScreen, "\n"); - dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n", - attribs.depth, attribs.depth == 1 ? "" : "s", - 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", - (DoesBackingStore (s) == NotUseful) ? "no" : - ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"), - DoesSaveUnders (s) ? "yes" : "no"); - dmxLogOutput(dmxScreen, "Window Manager running: %s\n", - (dmxScreen->WMRunningOnBE) ? "yes" : "no"); - - if (dmxScreen->WMRunningOnBE) { - dmxLogOutputWarning(dmxScreen, - "Window manager running " - "-- colormaps not supported\n"); - } - XFree(depths); -} - -void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) -{ - XWindowAttributes attribs; - Display *dpy = dmxScreen->beDisplay; -#ifdef GLXEXT - int dummy; -#endif - - XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); - - dmxScreen->beWidth = attribs.width; - dmxScreen->beHeight = attribs.height; - - /* Fill in missing geometry information */ - if (dmxScreen->scrnXSign < 0) { - if (dmxScreen->scrnWidth) { - dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth - - dmxScreen->scrnX); - } else { - dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; - dmxScreen->scrnX = 0; - } - } - if (dmxScreen->scrnYSign < 0) { - if (dmxScreen->scrnHeight) { - dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight - - dmxScreen->scrnY); - } else { - dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; - dmxScreen->scrnY = 0; - } - } - if (!dmxScreen->scrnWidth) - dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; - if (!dmxScreen->scrnHeight) - dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; - - if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth; - if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight; - if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth) - dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX; - if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight) - dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY; - - /* FIXME: Get these from the back-end server */ - dmxScreen->beXDPI = 75; - dmxScreen->beYDPI = 75; - - dmxScreen->beDepth = 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. */ - - if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8; - else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16; - else dmxScreen->beBPP = 32; - -#ifdef GLXEXT - /* get the majorOpcode for the back-end GLX extension */ - XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode, - &dummy, &dmxScreen->glxErrorBase); -#endif - - dmxPrintScreenInfo(dmxScreen); - dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n", - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY, - dmxScreen->beWidth, dmxScreen->beHeight, - dmxScreen->beDepth, dmxScreen->beBPP); - if (dmxScreen->beDepth == 8) - dmxLogOutputWarning(dmxScreen, - "Support for depth == 8 is not complete\n"); -} - -Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen) -{ - int i; - XVisualInfo visinfo; - - visinfo.screen = DefaultScreen(dmxScreen->beDisplay); - dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay, - VisualScreenMask, - &visinfo, - &dmxScreen->beNumVisuals); - - dmxScreen->beDefVisualIndex = -1; - - if (defaultColorVisualClass >= 0 || dmxDepth > 0) { - for (i = 0; i < dmxScreen->beNumVisuals; i++) - if (defaultColorVisualClass >= 0) { - if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) { - if (dmxDepth > 0) { - if (dmxScreen->beVisuals[i].depth == dmxDepth) { - dmxScreen->beDefVisualIndex = i; - break; - } - } else { - dmxScreen->beDefVisualIndex = i; - break; - } - } - } else if (dmxScreen->beVisuals[i].depth == dmxDepth) { - dmxScreen->beDefVisualIndex = i; - break; - } - } else { - visinfo.visualid = - XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay, - visinfo.screen)); - - for (i = 0; i < dmxScreen->beNumVisuals; i++) - if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) { - dmxScreen->beDefVisualIndex = i; - break; - } - } - - for (i = 0; i < dmxScreen->beNumVisuals; i++) - dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i], - (i == dmxScreen->beDefVisualIndex)); - - return (dmxScreen->beDefVisualIndex >= 0); -} - -void dmxGetColormaps(DMXScreenInfo *dmxScreen) -{ - int i; - - dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals; - dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps * - sizeof(*dmxScreen->beDefColormaps)); - - for (i = 0; i < dmxScreen->beNumDefColormaps; i++) - dmxScreen->beDefColormaps[i] = - XCreateColormap(dmxScreen->beDisplay, - DefaultRootWindow(dmxScreen->beDisplay), - dmxScreen->beVisuals[i].visual, - AllocNone); - - dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); - dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); -} - -void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen) -{ - dmxScreen->beDepths = - XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay), - &dmxScreen->beNumDepths); - - dmxScreen->bePixmapFormats = - XListPixmapFormats(dmxScreen->beDisplay, - &dmxScreen->beNumPixmapFormats); -} - -static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo, - DMXScreenInfo *dmxScreen) -{ - XPixmapFormatValues *bePixmapFormat; - PixmapFormatRec *format; - int i, j; - - pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay); - pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay); - pScreenInfo->bitmapScanlinePad = BitmapPad(dmxScreen->beDisplay); - pScreenInfo->bitmapBitOrder = BitmapBitOrder(dmxScreen->beDisplay); - - pScreenInfo->numPixmapFormats = 0; - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - bePixmapFormat = &dmxScreen->bePixmapFormats[i]; - for (j = 0; j < dmxScreen->beNumDepths; j++) - if ((bePixmapFormat->depth == 1) || - (bePixmapFormat->depth == dmxScreen->beDepths[j])) { - format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats]; - - format->depth = bePixmapFormat->depth; - format->bitsPerPixel = bePixmapFormat->bits_per_pixel; - format->scanlinePad = bePixmapFormat->scanline_pad; - - pScreenInfo->numPixmapFormats++; - break; - } - } - - return TRUE; -} - -void dmxCheckForWM(DMXScreenInfo *dmxScreen) -{ - Status status; - XWindowAttributes xwa; - - status = XGetWindowAttributes(dmxScreen->beDisplay, - DefaultRootWindow(dmxScreen->beDisplay), - &xwa); - dmxScreen->WMRunningOnBE = - (status && - ((xwa.all_event_masks & SubstructureRedirectMask) || - (xwa.all_event_masks & SubstructureNotifyMask))); -} - -/** Initialize the display and collect relevant information about the - * display properties */ -static void dmxDisplayInit(DMXScreenInfo *dmxScreen) -{ - if (!dmxOpenDisplay(dmxScreen)) - dmxLog(dmxFatal, - "dmxOpenDisplay: Unable to open display %s\n", - dmxScreen->name); - - dmxSetErrorHandler(dmxScreen); - dmxCheckForWM(dmxScreen); - dmxGetScreenAttribs(dmxScreen); - - if (!dmxGetVisualInfo(dmxScreen)) - dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n"); - - dmxGetColormaps(dmxScreen); - dmxGetPixmapFormats(dmxScreen); -} - -/* If this doesn't compile, just add || defined(yoursystem) to the line - * below. This information is to help with bug reports and is not - * critical. */ -#if !defined(_POSIX_SOURCE) -static const char *dmxExecOS(void) { return ""; } -#else -#include <sys/utsname.h> -static const char *dmxExecOS(void) -{ - static char buffer[128]; - static int initialized = 0; - struct utsname u; - - if (!initialized++) { - memset(buffer, 0, sizeof(buffer)); - uname(&u); - XmuSnprintf(buffer, sizeof(buffer)-1, "%s %s %s", - u.sysname, u.release, u.version); - } - return buffer; -} -#endif - -static const char *dmxBuildCompiler(void) -{ - static char buffer[128]; - static int initialized = 0; - - if (!initialized++) { - memset(buffer, 0, sizeof(buffer)); -#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__) - XmuSnprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d", - __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); -#endif - } - return buffer; -} - -static const char *dmxExecHost(void) -{ - static char buffer[128]; - static int initialized = 0; - - if (!initialized++) { - memset(buffer, 0, sizeof(buffer)); - XmuGetHostname(buffer, sizeof(buffer) - 1); - } - return buffer; -} - -/** This routine is called in Xserver/dix/main.c from \a main(). */ -void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) -{ - int i; - static unsigned long dmxGeneration = 0; -#ifdef GLXEXT - Bool glxSupported = TRUE; -#endif - - if (dmxGeneration != serverGeneration) { - int vendrel = VENDOR_RELEASE; - int major, minor, year, month, day; - - dmxGeneration = serverGeneration; - - major = vendrel / 100000000; - vendrel -= major * 100000000; - minor = vendrel / 1000000; - vendrel -= minor * 1000000; - year = vendrel / 10000; - vendrel -= year * 10000; - month = vendrel / 100; - vendrel -= month * 100; - day = vendrel; - - /* Add other epoch tests here */ - if (major > 0 && minor > 0) year += 2000; - - dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration); - dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n", - major, minor, year, month, day, VENDOR_STRING); - - SetVendorRelease(VENDOR_RELEASE); - SetVendorString(VENDOR_STRING); - - if (dmxGeneration == 1) { - dmxLog(dmxInfo, "DMX Build OS: %s (%s)\n", OSNAME, OSVENDOR); - dmxLog(dmxInfo, "DMX Build Compiler: %s\n", dmxBuildCompiler()); - dmxLog(dmxInfo, "DMX Execution OS: %s\n", dmxExecOS()); - dmxLog(dmxInfo, "DMX Execution Host: %s\n", dmxExecHost()); - } - dmxLog(dmxInfo, "MAXSCREENS: %d\n", MAXSCREENS); - - for (i = 0; i < dmxNumScreens; i++) { - if (dmxScreens[i].beDisplay) - dmxLog(dmxWarning, "Display \"%s\" still open\n", - dmxScreens[i].name); - dmxStatFree(dmxScreens[i].stat); - dmxScreens[i].stat = NULL; - } - for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]); - if (dmxScreens) free(dmxScreens); - if (dmxInputs) free(dmxInputs); - dmxScreens = NULL; - dmxInputs = NULL; - dmxNumScreens = 0; - dmxNumInputs = 0; - } - - /* Make sure that the command-line arguments are sane. */ - if (dmxAddRemoveScreens && dmxGLXProxy) { - /* Currently it is not possible to support GLX and Render - * extensions with dynamic screen addition/removal due to the - * state that each extension keeps, which cannot be restored. */ - dmxLog(dmxWarning, - "GLX Proxy and Render extensions do not yet support dynamic\n"); - dmxLog(dmxWarning, - "screen addition and removal. Please specify -noglxproxy\n"); - dmxLog(dmxWarning, - "and -norender on the command line or in the configuration\n"); - dmxLog(dmxWarning, - "file to disable these two extensions if you wish to use\n"); - dmxLog(dmxWarning, - "the dynamic addition and removal of screens support.\n"); - dmxLog(dmxFatal, - "Dynamic screen addition/removal error (see above).\n"); - } - - /* ddxProcessArgument has been called at this point, but any data - * from the configuration file has not been applied. Do so, and be - * sure we have at least one back-end display. */ - dmxConfigConfigure(); - if (!dmxNumScreens) - dmxLog(dmxFatal, "InitOutput: no back-end displays found\n"); - if (!dmxNumInputs) - dmxLog(dmxInfo, "InitOutput: no inputs found\n"); - - /* Disable lazy window creation optimization if offscreen - * optimization is disabled */ - if (!dmxOffScreenOpt && dmxLazyWindowCreation) { - dmxLog(dmxInfo, - "InitOutput: Disabling lazy window creation optimization\n"); - dmxLog(dmxInfo, - " since it requires the offscreen optimization\n"); - dmxLog(dmxInfo, - " to function properly.\n"); - dmxLazyWindowCreation = FALSE; - } - - /* Open each display and gather information about it. */ - for (i = 0; i < dmxNumScreens; i++) - dmxDisplayInit(&dmxScreens[i]); - -#if PANORAMIX - /* Register a Xinerama callback which will run from within - * PanoramiXCreateConnectionBlock. We can use the callback to - * determine if Xinerama is loaded and to check the visuals - * determined by PanoramiXConsolidate. */ - XineramaRegisterConnectionBlockCallback(dmxConnectionBlockCallback); -#endif - - /* Since we only have a single screen thus far, we only need to set - the pixmap formats to match that screen. FIXME: this isn't true.*/ - if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return; - - /* Might want to install a signal handler to allow cleaning up after - * unexpected signals. The DIX/OS layer already handles SIGINT and - * SIGTERM, so everything is OK for expected signals. --DD - * - * SIGHUP, SIGINT, and SIGTERM are trapped in os/connection.c - * SIGQUIT is another common signal that is sent from the keyboard. - * Trap it here, to ensure that the keyboard modifier map and other - * state for the input devices are restored. (This makes the - * behavior of SIGQUIT somewhat unexpected, since it will be the - * same as the behavior of SIGINT. However, leaving the modifier - * map of the input devices empty is even more unexpected.) --RF - */ - OsSignal(SIGQUIT, GiveUp); - -#ifdef GLXEXT - /* Check if GLX extension exists on all back-end servers */ - for (i = 0; i < dmxNumScreens; i++) - glxSupported &= (dmxScreens[i].glxMajorOpcode > 0); -#endif - - /* Tell dix layer about the backend displays */ - for (i = 0; i < dmxNumScreens; i++) { - -#ifdef GLXEXT - if (glxSupported) { - /* - * Builds GLX configurations from the list of visuals - * supported by the back-end server, and give that - * configuration list to the glx layer - so that he will - * build the visuals accordingly. - */ - - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - __GLXvisualConfig *configs = NULL; - dmxGlxVisualPrivate **configprivs = NULL; - int nconfigs = 0; - int (*oldErrorHandler)(Display *, XErrorEvent *); - int i; - - /* Catch errors if when using an older GLX w/o FBconfigs */ - oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler); - - /* Get FBConfigs of the back-end server */ - dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay, - dmxScreen->glxMajorOpcode, - &dmxScreen->numFBConfigs); - - XSetErrorHandler(oldErrorHandler); - - dmxScreen->glxVisuals = - GetGLXVisualConfigs(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay), - &dmxScreen->numGlxVisuals); - - if (dmxScreen->fbconfigs) { - configs = - GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs, - dmxScreen->numFBConfigs, - dmxScreen->beVisuals, - dmxScreen->beNumVisuals, - dmxScreen->glxVisuals, - dmxScreen->numGlxVisuals, - &nconfigs); - } else { - configs = dmxScreen->glxVisuals; - nconfigs = dmxScreen->numGlxVisuals; - } - - configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*)); - - if (configs != NULL && configprivs != NULL) { - - /* Initialize our private info for each visual - * (currently only x_visual_depth and x_visual_class) - */ - for (i = 0; i < nconfigs; i++) { - - configprivs[i] = (dmxGlxVisualPrivate *) - xalloc(sizeof(dmxGlxVisualPrivate)); - configprivs[i]->x_visual_depth = 0; - configprivs[i]->x_visual_class = 0; - - /* Find the visual depth */ - if (configs[i].vid > 0) { - int j; - for (j = 0; j < dmxScreen->beNumVisuals; j++) { - if (dmxScreen->beVisuals[j].visualid == - configs[i].vid) { - configprivs[i]->x_visual_depth = - dmxScreen->beVisuals[j].depth; - configprivs[i]->x_visual_class = - dmxScreen->beVisuals[j].class; - break; - } - } - } - } - - /* Hand out the glx configs to glx extension */ - GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs); - - XFlush(dmxScreen->beDisplay); - } - } -#endif /* GLXEXT */ - - AddScreen(dmxScreenInit, argc, argv); - } - - /* Compute origin information. */ - dmxInitOrigins(); - - /* Compute overlap information. */ - dmxInitOverlap(); - - /* Make sure there is a global width/height available */ - dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); - - /* FIXME: The following is temporarily placed here. When the DMX - * extension is available, it will be move there. - */ - dmxInitFonts(); - -#ifdef RENDER - /* Initialize the render extension */ - if (!noRenderExtension) - dmxInitRender(); -#endif - - /* Initialized things that need timer hooks */ - dmxStatInit(); - dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */ - - dmxLog(dmxInfo, "Shadow framebuffer support %s\n", - dmxShadowFB ? "enabled" : "disabled"); -} - -/* RATS: Assuming the fp string (which comes from the command-line argv - vector) is NULL-terminated, the buffer is large enough for the - strcpy. */ -static void dmxSetDefaultFontPath(char *fp) -{ - int fplen = strlen(fp) + 1; - - if (dmxFontPath) { - int len; - - len = strlen(dmxFontPath); - dmxFontPath = xrealloc(dmxFontPath, len+fplen+1); - dmxFontPath[len] = ','; - strncpy(&dmxFontPath[len+1], fp, fplen); - } else { - dmxFontPath = xalloc(fplen); - strncpy(dmxFontPath, fp, fplen); - } - - defaultFontPath = dmxFontPath; -} - -/** This function is called in Xserver/os/utils.c from \a AbortServer(). - * We must ensure that backend and console state is restored in the - * event the server shutdown wasn't clean. */ -void AbortDDX(void) -{ - int i; - - for (i=0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay); - dmxScreen->beDisplay = NULL; - } -} - -#ifdef DDXBEFORERESET -/* This function is called in Xserver/dix/dispatch.c */ -void ddxBeforeReset(void) -{ -} -#endif - -/** This function is called in Xserver/dix/main.c from \a main() when - * dispatchException & DE_TERMINATE (which is the only way to exit the - * main loop without an interruption. */ -void ddxGiveUp(void) -{ - AbortDDX(); -} - -/** This function is called in Xserver/os/osinit.c from \a OsInit(). */ -void OsVendorInit(void) -{ -} - -/** This function is called in Xserver/os/utils.c from \a FatalError() - * and \a VFatalError(). (Note that setting the function pointer \a - * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the - * two routines mentioned here, as well as by others) to use the - * referenced routine instead of \a vfprintf().) */ -void OsVendorFatalError(void) -{ -} - -/** Process our command line arguments. */ -int ddxProcessArgument(int argc, char *argv[], int i) -{ - int retval = 0; - - if (!strcmp(argv[i], "-display")) { - if (++i < argc) dmxConfigStoreDisplay(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) { - if (++i < argc) dmxConfigStoreInput(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) { - if (++i < argc) dmxConfigStoreXInput(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-noshadowfb")) { - dmxLog(dmxWarning, - "-noshadowfb has been deprecated " - "since it is now the default\n"); - dmxShadowFB = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-nomulticursor")) { - dmxCursorNoMulti(); - retval = 1; - } else if (!strcmp(argv[i], "-shadowfb")) { - dmxShadowFB = TRUE; - retval = 1; - } else if (!strcmp(argv[i], "-configfile")) { - if (++i < argc) dmxConfigStoreFile(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-config")) { - if (++i < argc) dmxConfigStoreConfig(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-fontpath")) { - if (++i < argc) dmxSetDefaultFontPath(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-stat")) { - if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]); - retval = 3; - } else if (!strcmp(argv[i], "-syncbatch")) { - if (++i < argc) dmxSyncActivate(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-nooffscreenopt")) { - dmxOffScreenOpt = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-nosubdivprims")) { - dmxSubdividePrimitives = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-nowindowopt")) { - dmxLazyWindowCreation = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-noxkb")) { - dmxUseXKB = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-depth")) { - if (++i < argc) dmxDepth = atoi(argv[i]); - retval = 2; - } else if (!strcmp(argv[i], "-norender")) { - noRenderExtension = TRUE; - retval = 1; -#ifdef GLXEXT - } else if (!strcmp(argv[i], "-noglxproxy")) { - dmxGLXProxy = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-noglxswapgroup")) { - dmxGLXSwapGroupSupport = FALSE; - retval = 1; - } else if (!strcmp(argv[i], "-glxsyncswap")) { - dmxGLXSyncSwap = TRUE; - retval = 1; - } else if (!strcmp(argv[i], "-glxfinishswap")) { - dmxGLXFinishSwap = TRUE; - retval = 1; -#endif - } else if (!strcmp(argv[i], "-ignorebadfontpaths")) { - dmxIgnoreBadFontPaths = TRUE; - retval = 1; - } else if (!strcmp(argv[i], "-addremovescreens")) { - dmxAddRemoveScreens = TRUE; - retval = 1; - } else if (!strcmp(argv[i], "-param")) { - if ((i += 2) < argc) { - if (!strcasecmp(argv[i-1], "xkbrules")) - dmxConfigSetXkbRules(argv[i]); - else if (!strcasecmp(argv[i-1], "xkbmodel")) - dmxConfigSetXkbModel(argv[i]); - else if (!strcasecmp(argv[i-1], "xkblayout")) - dmxConfigSetXkbLayout(argv[i]); - else if (!strcasecmp(argv[i-1], "xkbvariant")) - dmxConfigSetXkbVariant(argv[i]); - else if (!strcasecmp(argv[i-1], "xkboptions")) - dmxConfigSetXkbOptions(argv[i]); - else - dmxLog(dmxWarning, - "-param requires: XkbRules, XkbModel, XkbLayout," - " XkbVariant, or XkbOptions\n"); - } - retval = 3; - } - if (!serverGeneration) dmxConfigSetMaxScreens(); - return retval; -} - -/** Provide succinct usage information for the DMX server. */ -void ddxUseMsg(void) -{ - ErrorF("\n\nDevice Dependent Usage:\n"); - ErrorF("-display string Specify the back-end display(s)\n"); - ErrorF("-input string Specify input source for core device\n"); - ErrorF("-xinput string Specify input source for XInput device\n"); - ErrorF("-shadowfb Enable shadow frame buffer\n"); - ErrorF("-configfile file Read from a configuration file\n"); - ErrorF("-config config Select a specific configuration\n"); - ErrorF("-nomulticursor Turn of multiple cursor support\n"); - ErrorF("-fontpath Sets the default font path\n"); - ErrorF("-stat inter scrns Print out performance statistics\n"); - ErrorF("-syncbatch inter Set interval for XSync batching\n"); - ErrorF("-nooffscreenopt Disable offscreen optimization\n"); - ErrorF("-nosubdivprims Disable primitive subdivision\n"); - ErrorF(" optimization\n"); - ErrorF("-nowindowopt Disable lazy window creation optimization\n"); - ErrorF("-noxkb Disable use of the XKB extension with\n"); - ErrorF(" backend displays (cf. -kb).\n"); - ErrorF("-depth Specify the default root window depth\n"); - ErrorF("-norender Disable RENDER extension support\n"); -#ifdef GLXEXT - ErrorF("-noglxproxy Disable GLX Proxy\n"); - ErrorF("-noglxswapgroup Disable swap group and swap barrier\n"); - ErrorF(" extensions in GLX proxy\n"); - ErrorF("-glxsyncswap Force XSync after swap buffers\n"); - ErrorF("-glxfinishswap Force glFinish after swap buffers\n"); -#endif - ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n"); - ErrorF("-addremovescreens Enable dynamic screen addition/removal\n"); - ErrorF("-param ... Specify configuration parameters (e.g.,\n"); - ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n"); - ErrorF("\n"); - ErrorF(" If the -input string matches a -display string, then input\n" - " is taken from that backend display. (XInput cannot be taken\n" - " from a backend display.) Placing \",console\" after the\n" - " display name will force a console window to be opened on\n" - " that display in addition to the backend input. This is\n" - " useful if the backend window does not cover the whole\n" - " physical display.\n\n"); - - ErrorF(" Otherwise, if the -input or -xinput string specifies another\n" - " X display, then a console window will be created on that\n" - " display. Placing \",windows\" or \",nowindows\" after the\n" - " display name will control the display of window outlines in\n" - " the console.\n\n"); - - ErrorF(" -input or -xinput dummy specifies no input.\n"); - ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n" - " mouse, or other (extension) device:\n" - " -input local,kbd,ps2 will use a ps2 mouse\n" - " -input local,kbd,ms will use a serial mouse\n" - " -input local,usb-kbd,usb-mou will use USB devices \n" - " -xinput local,usb-oth will use a non-mouse and\n" - " non-keyboard USB device with XInput\n\n"); - - ErrorF(" Special Keys:\n"); - ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n"); - ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n"); - ErrorF(" Ctrl-Alt-q Quit (core devices only)\n"); - ErrorF(" Ctrl-Alt-F* Switch to VC (local only)\n"); -} +/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide expected functions for initialization from the ddx layer and
+ * global variables for the DMX server. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxinit.h"
+#include "dmxsync.h"
+#include "dmxlog.h"
+#include "dmxinput.h"
+#include "dmxscrinit.h"
+#include "dmxcursor.h"
+#include "dmxfont.h"
+#include "config/dmxconfig.h"
+#include "dmxcb.h"
+#include "dmxprop.h"
+#include "dmxstat.h"
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
+
+#include <X11/Xos.h> /* For gettimeofday */
+#include "dixstruct.h"
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+#include <signal.h> /* For SIGQUIT */
+
+#ifdef GLXEXT
+#include <GL/glx.h>
+#include <GL/glxint.h>
+#include "dmx_glxvisuals.h"
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+extern void GlxSetVisualConfigs(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **configprivs
+);
+#endif /* GLXEXT */
+
+/* Global variables available to all Xserver/hw/dmx routines. */
+int dmxNumScreens;
+DMXScreenInfo *dmxScreens;
+
+int dmxNumInputs;
+DMXInputInfo *dmxInputs;
+
+int dmxShadowFB = FALSE;
+
+XErrorEvent dmxLastErrorEvent;
+Bool dmxErrorOccurred = FALSE;
+
+char *dmxFontPath = NULL;
+
+Bool dmxOffScreenOpt = TRUE;
+
+Bool dmxSubdividePrimitives = TRUE;
+
+Bool dmxLazyWindowCreation = TRUE;
+
+Bool dmxUseXKB = TRUE;
+
+int dmxDepth = 0;
+
+#ifndef GLXEXT
+static Bool dmxGLXProxy = FALSE;
+#else
+Bool dmxGLXProxy = TRUE;
+
+Bool dmxGLXSwapGroupSupport = TRUE;
+
+Bool dmxGLXSyncSwap = FALSE;
+
+Bool dmxGLXFinishSwap = FALSE;
+#endif
+
+Bool dmxIgnoreBadFontPaths = FALSE;
+
+Bool dmxAddRemoveScreens = FALSE;
+
+/* dmxErrorHandler catches errors that occur when calling one of the
+ * back-end servers. Some of this code is based on _XPrintDefaultError
+ * in xc/lib/X11/XlibInt.c */
+static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+#define DMX_ERROR_BUF_SIZE 256
+ /* RATS: these buffers are only used in
+ * length-limited calls. */
+ char buf[DMX_ERROR_BUF_SIZE];
+ char request[DMX_ERROR_BUF_SIZE];
+ _XExtension *ext = NULL;
+
+ dmxErrorOccurred = TRUE;
+ dmxLastErrorEvent = *ev;
+
+ XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
+ dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
+
+ /* Find major opcode name */
+ if (ev->request_code < 128) {
+ XmuSnprintf(request, sizeof(request), "%d", ev->request_code);
+ XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
+ } else {
+ for (ext = dpy->ext_procs;
+ ext && ext->codes.major_opcode != ev->request_code;
+ ext = ext->next);
+ if (ext) strncpy(buf, ext->name, sizeof(buf));
+ else buf[0] = '\0';
+ }
+ dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
+ ev->request_code, buf);
+
+ /* Find minor opcode name */
+ if (ev->request_code >= 128 && ext) {
+ XmuSnprintf(request, sizeof(request), "%d", ev->request_code);
+ XmuSnprintf(request, sizeof(request), "%s.%d",
+ ext->name, ev->minor_code);
+ XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
+ dmxLog(dmxWarning, " Minor opcode: %d (%s)\n",
+ ev->minor_code, buf);
+ }
+
+ /* Provide value information */
+ switch (ev->error_code) {
+ case BadValue:
+ dmxLog(dmxWarning, " Value: 0x%x\n",
+ ev->resourceid);
+ break;
+ case BadAtom:
+ dmxLog(dmxWarning, " AtomID: 0x%x\n",
+ ev->resourceid);
+ break;
+ default:
+ dmxLog(dmxWarning, " ResourceID: 0x%x\n",
+ ev->resourceid);
+ break;
+ }
+
+ /* Provide serial number information */
+ dmxLog(dmxWarning, " Failed serial number: %d\n",
+ ev->serial);
+ dmxLog(dmxWarning, " Current serial number: %d\n",
+ dpy->request);
+ return 0;
+}
+
+#ifdef GLXEXT
+static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+ return 0;
+}
+#endif
+
+Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen)
+{
+ if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
+ return FALSE;
+
+ dmxPropertyDisplay(dmxScreen);
+ return TRUE;
+}
+
+void dmxSetErrorHandler(DMXScreenInfo *dmxScreen)
+{
+ XSetErrorHandler(dmxErrorHandler);
+}
+
+static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
+{
+ XWindowAttributes attribs;
+ int ndepths = 0, *depths = NULL;
+ int i;
+ Display *dpy = dmxScreen->beDisplay;
+ Screen *s = DefaultScreenOfDisplay(dpy);
+ int scr = DefaultScreen(dpy);
+
+ 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",
+ ProtocolVersion(dpy), ProtocolRevision(dpy));
+ dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy));
+ if (!strstr(ServerVendor(dpy), "XFree86")) {
+ dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
+ } else {
+ /* This code based on xdpyinfo.c */
+ int v = VendorRelease(dpy);
+ int major = -1, minor = -1, patch = -1, subpatch = -1;
+
+ if (v < 336)
+ major = v / 100, minor = (v / 10) % 10, patch = v % 10;
+ else if (v < 3900) {
+ major = v / 1000;
+ minor = (v / 100) % 10;
+ if (((v / 10) % 10) || (v % 10)) {
+ patch = (v / 10) % 10;
+ if (v % 10) subpatch = v % 10;
+ }
+ } else if (v < 40000000) {
+ major = v / 1000;
+ minor = (v / 10) % 10;
+ if (v % 10) patch = v % 10;
+ } else {
+ major = v / 10000000;
+ minor = (v / 100000) % 100;
+ patch = (v / 1000) % 100;
+ if (v % 1000) subpatch = v % 1000;
+ }
+ dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
+ v, major, minor);
+ if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch);
+ if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch);
+ dmxLogOutputCont(dmxScreen, ")\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++)
+ dmxLogOutputCont(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]);
+ dmxLogOutputCont(dmxScreen, "\n");
+ dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n",
+ attribs.depth, attribs.depth == 1 ? "" : "s",
+ 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",
+ (DoesBackingStore (s) == NotUseful) ? "no" :
+ ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
+ DoesSaveUnders (s) ? "yes" : "no");
+ dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
+ (dmxScreen->WMRunningOnBE) ? "yes" : "no");
+
+ if (dmxScreen->WMRunningOnBE) {
+ dmxLogOutputWarning(dmxScreen,
+ "Window manager running "
+ "-- colormaps not supported\n");
+ }
+ XFree(depths);
+}
+
+void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
+{
+ XWindowAttributes attribs;
+ Display *dpy = dmxScreen->beDisplay;
+#ifdef GLXEXT
+ int dummy;
+#endif
+
+ XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
+
+ dmxScreen->beWidth = attribs.width;
+ dmxScreen->beHeight = attribs.height;
+
+ /* Fill in missing geometry information */
+ if (dmxScreen->scrnXSign < 0) {
+ if (dmxScreen->scrnWidth) {
+ dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
+ - dmxScreen->scrnX);
+ } else {
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnX = 0;
+ }
+ }
+ if (dmxScreen->scrnYSign < 0) {
+ if (dmxScreen->scrnHeight) {
+ dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
+ - dmxScreen->scrnY);
+ } else {
+ dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
+ dmxScreen->scrnY = 0;
+ }
+ }
+ if (!dmxScreen->scrnWidth)
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ if (!dmxScreen->scrnHeight)
+ dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
+
+ if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth;
+ if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight;
+ if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
+ dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
+ if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
+ dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY;
+
+ /* FIXME: Get these from the back-end server */
+ dmxScreen->beXDPI = 75;
+ dmxScreen->beYDPI = 75;
+
+ dmxScreen->beDepth = 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. */
+
+ if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8;
+ else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16;
+ else dmxScreen->beBPP = 32;
+
+#ifdef GLXEXT
+ /* get the majorOpcode for the back-end GLX extension */
+ XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
+ &dummy, &dmxScreen->glxErrorBase);
+#endif
+
+ dmxPrintScreenInfo(dmxScreen);
+ dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ if (dmxScreen->beDepth == 8)
+ dmxLogOutputWarning(dmxScreen,
+ "Support for depth == 8 is not complete\n");
+}
+
+Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
+{
+ int i;
+ XVisualInfo visinfo;
+
+ visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
+ dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
+ VisualScreenMask,
+ &visinfo,
+ &dmxScreen->beNumVisuals);
+
+ dmxScreen->beDefVisualIndex = -1;
+
+ if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (defaultColorVisualClass >= 0) {
+ if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
+ if (dmxDepth > 0) {
+ if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ } else {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ } else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ } else {
+ visinfo.visualid =
+ XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
+ visinfo.screen));
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i],
+ (i == dmxScreen->beDefVisualIndex));
+
+ return (dmxScreen->beDefVisualIndex >= 0);
+}
+
+void dmxGetColormaps(DMXScreenInfo *dmxScreen)
+{
+ int i;
+
+ dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
+ dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps *
+ sizeof(*dmxScreen->beDefColormaps));
+
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ dmxScreen->beDefColormaps[i] =
+ XCreateColormap(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->beVisuals[i].visual,
+ AllocNone);
+
+ dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+ dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+}
+
+void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen)
+{
+ dmxScreen->beDepths =
+ XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->beNumDepths);
+
+ dmxScreen->bePixmapFormats =
+ XListPixmapFormats(dmxScreen->beDisplay,
+ &dmxScreen->beNumPixmapFormats);
+}
+
+static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
+ DMXScreenInfo *dmxScreen)
+{
+ XPixmapFormatValues *bePixmapFormat;
+ PixmapFormatRec *format;
+ int i, j;
+
+ pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
+ pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
+ pScreenInfo->bitmapScanlinePad = BitmapPad(dmxScreen->beDisplay);
+ pScreenInfo->bitmapBitOrder = BitmapBitOrder(dmxScreen->beDisplay);
+
+ pScreenInfo->numPixmapFormats = 0;
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ bePixmapFormat = &dmxScreen->bePixmapFormats[i];
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((bePixmapFormat->depth == 1) ||
+ (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
+
+ format->depth = bePixmapFormat->depth;
+ format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
+ format->scanlinePad = bePixmapFormat->scanline_pad;
+
+ pScreenInfo->numPixmapFormats++;
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+void dmxCheckForWM(DMXScreenInfo *dmxScreen)
+{
+ Status status;
+ XWindowAttributes xwa;
+
+ status = XGetWindowAttributes(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ &xwa);
+ dmxScreen->WMRunningOnBE =
+ (status &&
+ ((xwa.all_event_masks & SubstructureRedirectMask) ||
+ (xwa.all_event_masks & SubstructureNotifyMask)));
+}
+
+/** Initialize the display and collect relevant information about the
+ * display properties */
+static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
+{
+ if (!dmxOpenDisplay(dmxScreen))
+ dmxLog(dmxFatal,
+ "dmxOpenDisplay: Unable to open display %s\n",
+ dmxScreen->name);
+
+ dmxSetErrorHandler(dmxScreen);
+ dmxCheckForWM(dmxScreen);
+ dmxGetScreenAttribs(dmxScreen);
+
+ if (!dmxGetVisualInfo(dmxScreen))
+ dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
+
+ dmxGetColormaps(dmxScreen);
+ dmxGetPixmapFormats(dmxScreen);
+}
+
+/* If this doesn't compile, just add || defined(yoursystem) to the line
+ * below. This information is to help with bug reports and is not
+ * critical. */
+#if !defined(_POSIX_SOURCE)
+static const char *dmxExecOS(void) { return ""; }
+#else
+#include <sys/utsname.h>
+static const char *dmxExecOS(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+ struct utsname u;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+ uname(&u);
+ XmuSnprintf(buffer, sizeof(buffer)-1, "%s %s %s",
+ u.sysname, u.release, u.version);
+ }
+ return buffer;
+}
+#endif
+
+static const char *dmxBuildCompiler(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
+ XmuSnprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+#endif
+ }
+ return buffer;
+}
+
+static const char *dmxExecHost(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+ XmuGetHostname(buffer, sizeof(buffer) - 1);
+ }
+ return buffer;
+}
+
+/** This routine is called in Xserver/dix/main.c from \a main(). */
+void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
+{
+ int i;
+ static unsigned long dmxGeneration = 0;
+#ifdef GLXEXT
+ Bool glxSupported = TRUE;
+#endif
+
+ if (dmxGeneration != serverGeneration) {
+ int vendrel = VENDOR_RELEASE;
+ int major, minor, year, month, day;
+
+ dmxGeneration = serverGeneration;
+
+ major = vendrel / 100000000;
+ vendrel -= major * 100000000;
+ minor = vendrel / 1000000;
+ vendrel -= minor * 1000000;
+ year = vendrel / 10000;
+ vendrel -= year * 10000;
+ month = vendrel / 100;
+ vendrel -= month * 100;
+ day = vendrel;
+
+ /* Add other epoch tests here */
+ if (major > 0 && minor > 0) year += 2000;
+
+ dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
+ dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n",
+ major, minor, year, month, day, VENDOR_STRING);
+
+ SetVendorRelease(VENDOR_RELEASE);
+ SetVendorString(VENDOR_STRING);
+
+ if (dmxGeneration == 1) {
+ dmxLog(dmxInfo, "DMX Build OS: %s (%s)\n", OSNAME, OSVENDOR);
+ dmxLog(dmxInfo, "DMX Build Compiler: %s\n", dmxBuildCompiler());
+ dmxLog(dmxInfo, "DMX Execution OS: %s\n", dmxExecOS());
+ dmxLog(dmxInfo, "DMX Execution Host: %s\n", dmxExecHost());
+ }
+ dmxLog(dmxInfo, "MAXSCREENS: %d\n", MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (dmxScreens[i].beDisplay)
+ dmxLog(dmxWarning, "Display \"%s\" still open\n",
+ dmxScreens[i].name);
+ dmxStatFree(dmxScreens[i].stat);
+ dmxScreens[i].stat = NULL;
+ }
+ for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
+ if (dmxScreens) free(dmxScreens);
+ if (dmxInputs) free(dmxInputs);
+ dmxScreens = NULL;
+ dmxInputs = NULL;
+ dmxNumScreens = 0;
+ dmxNumInputs = 0;
+ }
+
+ /* Make sure that the command-line arguments are sane. */
+ if (dmxAddRemoveScreens && dmxGLXProxy) {
+ /* Currently it is not possible to support GLX and Render
+ * extensions with dynamic screen addition/removal due to the
+ * state that each extension keeps, which cannot be restored. */
+ dmxLog(dmxWarning,
+ "GLX Proxy and Render extensions do not yet support dynamic\n");
+ dmxLog(dmxWarning,
+ "screen addition and removal. Please specify -noglxproxy\n");
+ dmxLog(dmxWarning,
+ "and -norender on the command line or in the configuration\n");
+ dmxLog(dmxWarning,
+ "file to disable these two extensions if you wish to use\n");
+ dmxLog(dmxWarning,
+ "the dynamic addition and removal of screens support.\n");
+ dmxLog(dmxFatal,
+ "Dynamic screen addition/removal error (see above).\n");
+ }
+
+ /* ddxProcessArgument has been called at this point, but any data
+ * from the configuration file has not been applied. Do so, and be
+ * sure we have at least one back-end display. */
+ dmxConfigConfigure();
+ if (!dmxNumScreens)
+ dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
+ if (!dmxNumInputs)
+ dmxLog(dmxInfo, "InitOutput: no inputs found\n");
+
+ /* Disable lazy window creation optimization if offscreen
+ * optimization is disabled */
+ if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
+ dmxLog(dmxInfo,
+ "InitOutput: Disabling lazy window creation optimization\n");
+ dmxLog(dmxInfo,
+ " since it requires the offscreen optimization\n");
+ dmxLog(dmxInfo,
+ " to function properly.\n");
+ dmxLazyWindowCreation = FALSE;
+ }
+
+ /* Open each display and gather information about it. */
+ for (i = 0; i < dmxNumScreens; i++)
+ dmxDisplayInit(&dmxScreens[i]);
+
+#if PANORAMIX
+ /* Register a Xinerama callback which will run from within
+ * PanoramiXCreateConnectionBlock. We can use the callback to
+ * determine if Xinerama is loaded and to check the visuals
+ * determined by PanoramiXConsolidate. */
+ XineramaRegisterConnectionBlockCallback(dmxConnectionBlockCallback);
+#endif
+
+ /* Since we only have a single screen thus far, we only need to set
+ the pixmap formats to match that screen. FIXME: this isn't true.*/
+ if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return;
+
+ /* Might want to install a signal handler to allow cleaning up after
+ * unexpected signals. The DIX/OS layer already handles SIGINT and
+ * SIGTERM, so everything is OK for expected signals. --DD
+ *
+ * SIGHUP, SIGINT, and SIGTERM are trapped in os/connection.c
+ * SIGQUIT is another common signal that is sent from the keyboard.
+ * Trap it here, to ensure that the keyboard modifier map and other
+ * state for the input devices are restored. (This makes the
+ * behavior of SIGQUIT somewhat unexpected, since it will be the
+ * same as the behavior of SIGINT. However, leaving the modifier
+ * map of the input devices empty is even more unexpected.) --RF
+ */
+ OsSignal(SIGQUIT, GiveUp);
+
+#ifdef GLXEXT
+ /* Check if GLX extension exists on all back-end servers */
+ for (i = 0; i < dmxNumScreens; i++)
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+#endif
+
+ /* Tell dix layer about the backend displays */
+ for (i = 0; i < dmxNumScreens; i++) {
+
+#ifdef GLXEXT
+ if (glxSupported) {
+ /*
+ * Builds GLX configurations from the list of visuals
+ * supported by the back-end server, and give that
+ * configuration list to the glx layer - so that he will
+ * build the visuals accordingly.
+ */
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ __GLXvisualConfig *configs = NULL;
+ dmxGlxVisualPrivate **configprivs = NULL;
+ int nconfigs = 0;
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+ int i;
+
+ /* Catch errors if when using an older GLX w/o FBconfigs */
+ oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
+
+ /* Get FBConfigs of the back-end server */
+ dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
+ dmxScreen->glxMajorOpcode,
+ &dmxScreen->numFBConfigs);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ dmxScreen->glxVisuals =
+ GetGLXVisualConfigs(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->numGlxVisuals);
+
+ if (dmxScreen->fbconfigs) {
+ configs =
+ GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs,
+ dmxScreen->beVisuals,
+ dmxScreen->beNumVisuals,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals,
+ &nconfigs);
+ } else {
+ configs = dmxScreen->glxVisuals;
+ nconfigs = dmxScreen->numGlxVisuals;
+ }
+
+ configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
+
+ if (configs != NULL && configprivs != NULL) {
+
+ /* Initialize our private info for each visual
+ * (currently only x_visual_depth and x_visual_class)
+ */
+ for (i = 0; i < nconfigs; i++) {
+
+ configprivs[i] = (dmxGlxVisualPrivate *)
+ xalloc(sizeof(dmxGlxVisualPrivate));
+ configprivs[i]->x_visual_depth = 0;
+ configprivs[i]->x_visual_class = 0;
+
+ /* Find the visual depth */
+ if (configs[i].vid > 0) {
+ int j;
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ if (dmxScreen->beVisuals[j].visualid ==
+ configs[i].vid) {
+ configprivs[i]->x_visual_depth =
+ dmxScreen->beVisuals[j].depth;
+ configprivs[i]->x_visual_class =
+ dmxScreen->beVisuals[j].class;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Hand out the glx configs to glx extension */
+ GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs);
+
+ XFlush(dmxScreen->beDisplay);
+ }
+ }
+#endif /* GLXEXT */
+
+ AddScreen(dmxScreenInit, argc, argv);
+ }
+
+ /* Compute origin information. */
+ dmxInitOrigins();
+
+ /* Compute overlap information. */
+ dmxInitOverlap();
+
+ /* Make sure there is a global width/height available */
+ dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
+
+ /* FIXME: The following is temporarily placed here. When the DMX
+ * extension is available, it will be move there.
+ */
+ dmxInitFonts();
+
+#ifdef RENDER
+ /* Initialize the render extension */
+ if (!noRenderExtension)
+ dmxInitRender();
+#endif
+
+ /* Initialized things that need timer hooks */
+ dmxStatInit();
+ dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
+
+ dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
+ dmxShadowFB ? "enabled" : "disabled");
+}
+
+/* RATS: Assuming the fp string (which comes from the command-line argv
+ vector) is NULL-terminated, the buffer is large enough for the
+ strcpy. */
+static void dmxSetDefaultFontPath(char *fp)
+{
+ int fplen = strlen(fp) + 1;
+
+ if (dmxFontPath) {
+ int len;
+
+ len = strlen(dmxFontPath);
+ dmxFontPath = xrealloc(dmxFontPath, len+fplen+1);
+ dmxFontPath[len] = ',';
+ strncpy(&dmxFontPath[len+1], fp, fplen);
+ } else {
+ dmxFontPath = xalloc(fplen);
+ strncpy(dmxFontPath, fp, fplen);
+ }
+
+ defaultFontPath = dmxFontPath;
+}
+
+/** This function is called in Xserver/os/utils.c from \a AbortServer().
+ * We must ensure that backend and console state is restored in the
+ * event the server shutdown wasn't clean. */
+void AbortDDX(void)
+{
+ int i;
+
+ for (i=0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay);
+ dmxScreen->beDisplay = NULL;
+ }
+}
+
+#ifdef DDXBEFORERESET
+/* This function is called in Xserver/dix/dispatch.c */
+void ddxBeforeReset(void)
+{
+}
+#endif
+
+/** This function is called in Xserver/dix/main.c from \a main() when
+ * dispatchException & DE_TERMINATE (which is the only way to exit the
+ * main loop without an interruption. */
+void ddxGiveUp(void)
+{
+ AbortDDX();
+}
+
+/** This function is called in Xserver/os/osinit.c from \a OsInit(). */
+void OsVendorInit(void)
+{
+}
+
+/** This function is called in Xserver/os/utils.c from \a FatalError()
+ * and \a VFatalError(). (Note that setting the function pointer \a
+ * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
+ * two routines mentioned here, as well as by others) to use the
+ * referenced routine instead of \a vfprintf().) */
+void OsVendorFatalError(void)
+{
+}
+
+/** Process our command line arguments. */
+int ddxProcessArgument(int argc, char *argv[], int i)
+{
+ int retval = 0;
+
+ if (!strcmp(argv[i], "-display")) {
+ if (++i < argc) dmxConfigStoreDisplay(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
+ if (++i < argc) dmxConfigStoreInput(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) {
+ if (++i < argc) dmxConfigStoreXInput(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-noshadowfb")) {
+ dmxLog(dmxWarning,
+ "-noshadowfb has been deprecated "
+ "since it is now the default\n");
+ dmxShadowFB = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nomulticursor")) {
+ dmxCursorNoMulti();
+ retval = 1;
+ } else if (!strcmp(argv[i], "-shadowfb")) {
+ dmxShadowFB = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-configfile")) {
+ if (++i < argc) dmxConfigStoreFile(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-config")) {
+ if (++i < argc) dmxConfigStoreConfig(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-fontpath")) {
+ if (++i < argc) dmxSetDefaultFontPath(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-stat")) {
+ if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]);
+ retval = 3;
+ } else if (!strcmp(argv[i], "-syncbatch")) {
+ if (++i < argc) dmxSyncActivate(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-nooffscreenopt")) {
+ dmxOffScreenOpt = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nosubdivprims")) {
+ dmxSubdividePrimitives = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nowindowopt")) {
+ dmxLazyWindowCreation = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-noxkb")) {
+ dmxUseXKB = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc) dmxDepth = atoi(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-norender")) {
+ noRenderExtension = TRUE;
+ retval = 1;
+#ifdef GLXEXT
+ } else if (!strcmp(argv[i], "-noglxproxy")) {
+ dmxGLXProxy = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-noglxswapgroup")) {
+ dmxGLXSwapGroupSupport = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-glxsyncswap")) {
+ dmxGLXSyncSwap = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-glxfinishswap")) {
+ dmxGLXFinishSwap = TRUE;
+ retval = 1;
+#endif
+ } else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
+ dmxIgnoreBadFontPaths = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-addremovescreens")) {
+ dmxAddRemoveScreens = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-param")) {
+ if ((i += 2) < argc) {
+ if (!strcasecmp(argv[i-1], "xkbrules"))
+ dmxConfigSetXkbRules(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkbmodel"))
+ dmxConfigSetXkbModel(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkblayout"))
+ dmxConfigSetXkbLayout(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkbvariant"))
+ dmxConfigSetXkbVariant(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkboptions"))
+ dmxConfigSetXkbOptions(argv[i]);
+ else
+ dmxLog(dmxWarning,
+ "-param requires: XkbRules, XkbModel, XkbLayout,"
+ " XkbVariant, or XkbOptions\n");
+ }
+ retval = 3;
+ }
+ if (!serverGeneration) dmxConfigSetMaxScreens();
+ return retval;
+}
+
+/** Provide succinct usage information for the DMX server. */
+void ddxUseMsg(void)
+{
+ ErrorF("\n\nDevice Dependent Usage:\n");
+ ErrorF("-display string Specify the back-end display(s)\n");
+ ErrorF("-input string Specify input source for core device\n");
+ ErrorF("-xinput string Specify input source for XInput device\n");
+ ErrorF("-shadowfb Enable shadow frame buffer\n");
+ ErrorF("-configfile file Read from a configuration file\n");
+ ErrorF("-config config Select a specific configuration\n");
+ ErrorF("-nomulticursor Turn of multiple cursor support\n");
+ ErrorF("-fontpath Sets the default font path\n");
+ ErrorF("-stat inter scrns Print out performance statistics\n");
+ ErrorF("-syncbatch inter Set interval for XSync batching\n");
+ ErrorF("-nooffscreenopt Disable offscreen optimization\n");
+ ErrorF("-nosubdivprims Disable primitive subdivision\n");
+ ErrorF(" optimization\n");
+ ErrorF("-nowindowopt Disable lazy window creation optimization\n");
+ ErrorF("-noxkb Disable use of the XKB extension with\n");
+ ErrorF(" backend displays (cf. -kb).\n");
+ ErrorF("-depth Specify the default root window depth\n");
+ ErrorF("-norender Disable RENDER extension support\n");
+#ifdef GLXEXT
+ ErrorF("-noglxproxy Disable GLX Proxy\n");
+ ErrorF("-noglxswapgroup Disable swap group and swap barrier\n");
+ ErrorF(" extensions in GLX proxy\n");
+ ErrorF("-glxsyncswap Force XSync after swap buffers\n");
+ ErrorF("-glxfinishswap Force glFinish after swap buffers\n");
+#endif
+ ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n");
+ ErrorF("-addremovescreens Enable dynamic screen addition/removal\n");
+ ErrorF("-param ... Specify configuration parameters (e.g.,\n");
+ ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n");
+ ErrorF("\n");
+ ErrorF(" If the -input string matches a -display string, then input\n"
+ " is taken from that backend display. (XInput cannot be taken\n"
+ " from a backend display.) Placing \",console\" after the\n"
+ " display name will force a console window to be opened on\n"
+ " that display in addition to the backend input. This is\n"
+ " useful if the backend window does not cover the whole\n"
+ " physical display.\n\n");
+
+ ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
+ " X display, then a console window will be created on that\n"
+ " display. Placing \",windows\" or \",nowindows\" after the\n"
+ " display name will control the display of window outlines in\n"
+ " the console.\n\n");
+
+ ErrorF(" -input or -xinput dummy specifies no input.\n");
+ ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
+ " mouse, or other (extension) device:\n"
+ " -input local,kbd,ps2 will use a ps2 mouse\n"
+ " -input local,kbd,ms will use a serial mouse\n"
+ " -input local,usb-kbd,usb-mou will use USB devices \n"
+ " -xinput local,usb-oth will use a non-mouse and\n"
+ " non-keyboard USB device with XInput\n\n");
+
+ ErrorF(" Special Keys:\n");
+ ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
+ ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
+ ErrorF(" Ctrl-Alt-q Quit (core devices only)\n");
+ ErrorF(" Ctrl-Alt-F* Switch to VC (local only)\n");
+}
diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c index 37dfa10ac..072e3a61a 100644 --- a/xorg-server/hw/dmx/dmxpict.c +++ b/xorg-server/hw/dmx/dmxpict.c @@ -51,6 +51,7 @@ #include <X11/extensions/render.h> #include <X11/extensions/renderproto.h> +#include <X11/extensions/Xfixes.h> #include "picture.h" #include "picturestr.h" #include "mipict.h" diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c index b5afb5839..09734f56d 100644 --- a/xorg-server/hw/dmx/dmxscrinit.c +++ b/xorg-server/hw/dmx/dmxscrinit.c @@ -282,6 +282,10 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]) (void)dmxPictureInit(pScreen, 0, 0); #endif + /* Not yet... */ + pScreen->GetWindowPixmap = NULL; + pScreen->SetWindowPixmap = NULL; + if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL)) return FALSE; @@ -384,8 +388,11 @@ void dmxBECloseScreen(ScreenPtr pScreen) } else { /* Free the default drawables */ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - XFreePixmap(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i]); - dmxScreen->scrnDefDrawables[i] = (Drawable)0; + if (dmxScreen->scrnDefDrawables[i]) { + XFreePixmap(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i]); + dmxScreen->scrnDefDrawables[i] = (Drawable)0; + } } } diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c index e94a7f0f0..08123d35c 100644 --- a/xorg-server/hw/kdrive/ephyr/XF86dri.c +++ b/xorg-server/hw/kdrive/ephyr/XF86dri.c @@ -63,7 +63,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/extensions/extutil.h> #include <GL/glx.h> #include "xf86dri.h" -#include <X11/dri/xf86dristr.h> +#include <X11/dri/xf86driproto.h> static XExtensionInfo _xf86dri_info_data; static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; diff --git a/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre b/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre index f5e8b984d..008256914 100644 --- a/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre +++ b/xorg-server/hw/kdrive/ephyr/Xephyr.man.pre @@ -23,7 +23,7 @@ Xephyr - X server outputting to a window on a pre-existing X display .IR ... ] .SH DESCRIPTION .B Xephyr -is a a kdrive server that outputs to a window on a pre-existing "host" +is a kdrive server that outputs to a window on a pre-existing "host" X display. Think .I Xnest diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c index 84885d8f0..231b0985c 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c @@ -38,7 +38,7 @@ #include <X11/Xproto.h> #define _XF86DRI_SERVER_ #include <X11/dri/xf86dri.h> -#include <X11/dri/xf86dristr.h> +#include <X11/dri/xf86driproto.h> #include "misc.h" #include "privates.h" #include "dixstruct.h" @@ -54,7 +54,7 @@ #include "hostx.h" #define _HAVE_XALLOC_DECLS #include "ephyrlog.h" - +#include "protocol-versions.h" typedef struct { int foo; @@ -622,9 +622,9 @@ ProcXF86DRIQueryVersion (register ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = XF86DRI_MAJOR_VERSION; - rep.minorVersion = XF86DRI_MINOR_VERSION; - rep.patchVersion = XF86DRI_PATCH_VERSION; + rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION; + rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION; + rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c index 5667e1a87..a6199b0e8 100644 --- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c +++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c @@ -159,13 +159,13 @@ videoPtrToDriverList(struct pci_device *dev, /* older Geode products acquired by AMD still carry an NSC vendor_id */ case 0x100b: if (dev->device_id == 0x0030) { - /* NSC Geode GX2 specifically ... */ + /* NSC Geode GX2 specifically */ driverList[0] = "geode"; /* GX2 support started its life in the NSC tree and was later forked by AMD for GEODE so we keep it as a backup */ driverList[1] = "nsc"; } else - /* ... any other NSC Geode SC variant e.g. 0x0504 for SCx200 */ + /* other NSC variant e.g. 0x0104 (SC1400), 0x0504 (SCx200) */ driverList[0] = "nsc"; break; /* Cyrix Geode GX1 */ diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c index f0a0723f9..9d243c172 100644 --- a/xorg-server/hw/xfree86/common/xf86Bus.c +++ b/xorg-server/hw/xfree86/common/xf86Bus.c @@ -521,30 +521,15 @@ xf86PostProbe(void) void xf86PostScreenInit(void) { -#ifdef HAVE_PCI_DEVICE_VGAARB_INIT - int vga_count; -#endif if (doFramebufferMode) { SetSIGIOForState(OPERATING); return; } - /* - * we need to wrap the arbiter if we have more than - * one VGA card - hotplug cries. - */ -#ifdef HAVE_PCI_DEVICE_VGAARB_INIT - pci_device_vgaarb_get_info(NULL, &vga_count, NULL); - if (vga_count > 1 && xf86Screens) { - int i; - xf86Msg(X_INFO,"Number of VGA devices: %d: arbiter wrapping enabled\n", vga_count); - for (i = 0; i < xf86NumScreens; i++) - xf86VGAarbiterWrapFunctions(xf86Screens[i]->pScreen); - } -#endif + xf86VGAarbiterWrapFunctions(); + DebugF("PostScreenInit generation: %i\n",serverGeneration); xf86EnterServerState(OPERATING); - } /* diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index e81eb0f63..40f65bdbf 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -614,22 +614,6 @@ configFiles(XF86ConfFilesPtr fileconf) pathFrom = X_DEFAULT; temp_path = defaultFontPath ? defaultFontPath : ""; - /* ensure defaultFontPath contains "built-ins" */ - start = strstr(temp_path, "built-ins"); - end = start + strlen("built-ins"); - if (start == NULL || - !((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) { - defaultFontPath = Xprintf("%s%sbuilt-ins", - temp_path, *temp_path ? "," : ""); - if (must_copy == TRUE) { - if (defaultFontPath != NULL) { - must_copy = FALSE; - } - } else { - /* already made a copy of the font path */ - xfree(temp_path); - } - } /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath; defaultFontPath = xf86ValidateFontPath(temp_path); @@ -724,8 +708,13 @@ typedef enum { FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, FLAG_DRI2, + FLAG_USE_SIGIO } FlagValues; - + +/** + * NOTE: the last value for each entry is NOT the default. It is set to TRUE + * if the parser found the option in the config file. + */ static OptionInfoRec FlagOptions[] = { { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN, {0}, FALSE }, @@ -774,13 +763,15 @@ static OptionInfoRec FlagOptions[] = { { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, - {0}, TRUE }, + {0}, FALSE }, { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, - {0}, TRUE }, + {0}, FALSE }, { FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING, {0}, FALSE }, { FLAG_DRI2, "DRI2", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -848,6 +839,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); } + if (xf86SIGIOSupported()) { + xf86Info.useSIGIO = xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO, USE_SIGIO_BY_DEFAULT); + if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) { + from = X_CONFIG; + } else { + from = X_DEFAULT; + } + if (!xf86Info.useSIGIO) { + xf86Msg(from, "Disabling SIGIO handlers for input devices\n"); + } else if (from == X_CONFIG) { + xf86Msg(from, "Enabling SIGIO handlers for input devices\n"); + } + } else { + xf86Info.useSIGIO = FALSE; + } + if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, &xf86Info.autoAddDevices); diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c index 8328f5875..42b7c5805 100644 --- a/xorg-server/hw/xfree86/common/xf86DGA.c +++ b/xorg-server/hw/xfree86/common/xf86DGA.c @@ -1193,7 +1193,7 @@ DGAGetOldDGAMode(int index) static void DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) { - DGAEvent *event= (DGAEvent*)ev; + DGAEvent *event= &ev->dga_event; ScreenPtr pScreen = screenInfo.screens[screen_num]; DGAScreenPtr pScreenPriv; diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c index 9a2468dd3..56ab266ae 100644 --- a/xorg-server/hw/xfree86/common/xf86Helper.c +++ b/xorg-server/hw/xfree86/common/xf86Helper.c @@ -2312,7 +2312,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen) * yet. Should handle this differently so that alternate async methods * work correctly with this too. */ - pScrn->silkenMouse = useSM && xf86SIGIOSupported(); + pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported(); if (serverGeneration == 1) xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n", pScrn->silkenMouse ? "enabled" : "disabled"); diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 8f2cdf6aa..c9baff3ef 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -439,7 +439,7 @@ probe_devices_from_device_sections(DriverPtr drvp) } } } - + xfree(devList); return foundScreen; } @@ -1112,6 +1112,8 @@ InitInput(int argc, char **argv) mieqInit(); + GetEventList(&xf86Events); + /* Call the PreInit function for each input device instance. */ for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) { /* Replace obsolete keyboard driver with kbd */ diff --git a/xorg-server/hw/xfree86/common/xf86Privstr.h b/xorg-server/hw/xfree86/common/xf86Privstr.h index 26f822dc4..998260142 100644 --- a/xorg-server/hw/xfree86/common/xf86Privstr.h +++ b/xorg-server/hw/xfree86/common/xf86Privstr.h @@ -87,6 +87,8 @@ typedef struct { Bool miscModInDevEnabled; /* Allow input devices to be * changed */ Bool miscModInDevAllowNonLocal; + Bool useSIGIO; /* Use SIGIO for handling + input device events */ Pix24Flags pixmap24; MessageType pix24From; #ifdef __i386__ diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c index c38973933..b24099811 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c @@ -35,6 +35,7 @@ #ifdef HAVE_PCI_DEVICE_VGAARB_INIT #include "xf86VGAarbiterPriv.h" #include "xf86Bus.h" +#include "xf86Priv.h" #include "pciaccess.h" #ifdef DEBUG @@ -153,59 +154,79 @@ xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) } Bool -xf86VGAarbiterWrapFunctions(ScreenPtr pScreen) +xf86VGAarbiterWrapFunctions(void) { ScrnInfoPtr pScrn; VGAarbiterScreenPtr pScreenPriv; miPointerScreenPtr PointPriv; #ifdef RENDER - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); + PictureScreenPtr ps; #endif + ScreenPtr pScreen; + int vga_count, i; if (vga_no_arb) - return FALSE; - - pScrn = xf86Screens[pScreen->myNum]; - PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); - - DPRINT_S("VGAarbiterWrapFunctions",pScreen->myNum); - - if (!dixRequestPrivate(VGAarbiterGCKey, sizeof(VGAarbiterGCRec))) - return FALSE; - - if (!(pScreenPriv = xalloc(sizeof(VGAarbiterScreenRec)))) - return FALSE; - - dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv); - - WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen); - WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen); - WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler); - WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler); - WRAP_SCREEN(CreateGC, VGAarbiterCreateGC); - WRAP_SCREEN(GetImage, VGAarbiterGetImage); - WRAP_SCREEN(GetSpans, VGAarbiterGetSpans); - WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate); - WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow); - WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground); - WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap); - WRAP_SCREEN(StoreColors, VGAarbiterStoreColors); - WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor); - WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor); - WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor); - WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor); - WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition); + return FALSE; + + /* + * we need to wrap the arbiter if we have more than + * one VGA card - hotplug cries. + */ + pci_device_vgaarb_get_info(NULL, &vga_count, NULL); + if (vga_count < 2 || !xf86Screens) + return FALSE; + + xf86Msg(X_INFO,"Found %d VGA devices: arbiter wrapping enabled\n", + vga_count); + + for (i = 0; i < xf86NumScreens; i++) { + pScreen = xf86Screens[i]->pScreen; +#ifdef RENDER + ps = GetPictureScreenIfSet(pScreen); +#endif + pScrn = xf86Screens[pScreen->myNum]; + PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); + + DPRINT_S("VGAarbiterWrapFunctions",pScreen->myNum); + + if (!dixRequestPrivate(VGAarbiterGCKey, sizeof(VGAarbiterGCRec))) + return FALSE; + + if (!(pScreenPriv = xalloc(sizeof(VGAarbiterScreenRec)))) + return FALSE; + + dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv); + + WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen); + WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen); + WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler); + WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler); + WRAP_SCREEN(CreateGC, VGAarbiterCreateGC); + WRAP_SCREEN(GetImage, VGAarbiterGetImage); + WRAP_SCREEN(GetSpans, VGAarbiterGetSpans); + WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate); + WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow); + WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground); + WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap); + WRAP_SCREEN(StoreColors, VGAarbiterStoreColors); + WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor); + WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor); + WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor); + WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor); + WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition); #ifdef RENDER - WRAP_PICT(Composite,VGAarbiterComposite); - WRAP_PICT(Glyphs,VGAarbiterGlyphs); - WRAP_PICT(CompositeRects,VGAarbiterCompositeRects); + WRAP_PICT(Composite,VGAarbiterComposite); + WRAP_PICT(Glyphs,VGAarbiterGlyphs); + WRAP_PICT(CompositeRects,VGAarbiterCompositeRects); #endif - WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame); - WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode); - WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT); - WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT); - WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen); - WRAP_SPRITE; + WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame); + WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode); + WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT); + WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT); + WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen); + WRAP_SPRITE; + } + return TRUE; } @@ -1152,6 +1173,6 @@ void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {} Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; } void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {} void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {} -Bool xf86VGAarbiterWrapFunctions(ScreenPtr pScreen) { return FALSE; } +Bool xf86VGAarbiterWrapFunctions(void) { return FALSE; } #endif diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.h b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h index 145d31c78..904b6b079 100644 --- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.h +++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h @@ -34,7 +34,7 @@ extern void xf86VGAarbiterInit(void); extern void xf86VGAarbiterFini(void); void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn); -extern Bool xf86VGAarbiterWrapFunctions(ScreenPtr pScreen); +extern Bool xf86VGAarbiterWrapFunctions(void); extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn); extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn); diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index 3543811db..b36953700 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -283,11 +283,6 @@ xf86ProcessCommonOptions(LocalDevicePtr local, /* Backwards compatibility. */ local->history_size = GetMotionHistorySize(); - /* Preallocate xEvent store */ - if (!xf86Events) - GetEventList(&xf86Events); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); } /*********************************************************************** @@ -769,7 +764,6 @@ xf86PostMotionEventP(DeviceIntPtr device, } #endif - GetEventList(&xf86Events); nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, first_valuator, num_valuators, valuators); @@ -819,7 +813,6 @@ xf86PostProximityEventP(DeviceIntPtr device, XI_VERIFY_VALUATORS(num_valuators); - GetEventList(&xf86Events); nevents = GetProximityEvents(xf86Events, device, is_in ? ProximityIn : ProximityOut, first_valuator, num_valuators, valuators); @@ -881,7 +874,6 @@ xf86PostButtonEventP(DeviceIntPtr device, } #endif - GetEventList(&xf86Events); nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, flags, first_valuator, num_valuators, valuators); @@ -940,7 +932,6 @@ xf86PostKeyEventP(DeviceIntPtr device, XI_VERIFY_VALUATORS(num_valuators); if (is_absolute) { - GetEventList(&xf86Events); nevents = GetKeyboardValuatorEvents(xf86Events, device, is_down ? KeyPress : KeyRelease, key_code, first_valuator, @@ -1074,22 +1065,12 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) void xf86DisableDevice(DeviceIntPtr dev, Bool panic) { - devicePresenceNotify ev; - DeviceIntRec dummyDev; - if(!panic) { DisableDevice(dev, TRUE); } else { - ev.type = DevicePresenceNotify; - ev.time = currentTime.milliseconds; - ev.devchange = DeviceUnrecoverable; - ev.deviceid = dev->id; - dummyDev.id = 0; - SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, - (xEvent *) &ev, 1); - + SendDevicePresenceEvent(dev->id, DeviceUnrecoverable); DeleteInputDeviceRequest(dev); } } diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c index df62e0766..ac018e739 100644 --- a/xorg-server/hw/xfree86/common/xf86pciBus.c +++ b/xorg-server/hw/xfree86/common/xf86pciBus.c @@ -124,7 +124,7 @@ xf86PciProbe(void) info->user_data = 0; } } - + free(iter); /* If we haven't found a primary device try a different heuristic */ if (primaryBus.type == BUS_NONE && num) { @@ -212,6 +212,7 @@ xf86PciProbe(void) xf86ErrorF("\n"); } + xfree(xf86PciVideoInfo); } /* diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c index 7579f7d51..5367bcc42 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -26,6 +26,7 @@ #include "swaprep.h" #include "dgaproc.h" #include "xf86dgaext.h" +#include "protocol-versions.h" #include <string.h> @@ -122,8 +123,8 @@ ProcXDGAQueryVersion(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = XDGA_MAJOR_VERSION; - rep.minorVersion = XDGA_MINOR_VERSION; + rep.majorVersion = SERVER_XDGA_MAJOR_VERSION; + rep.minorVersion = SERVER_XDGA_MINOR_VERSION; WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep); return (client->noClientException); diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c index 4a288d79f..49201155e 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -46,6 +46,7 @@ from Kaleb S. KEITHLEY #include "xf86.h" #include "vidmodeproc.h" #include "globals.h" +#include "protocol-versions.h" #define DEFAULT_XF86VIDMODE_VERBOSITY 3 @@ -384,8 +385,8 @@ ProcXF86VidModeQueryVersion(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = XF86VIDMODE_MAJOR_VERSION; - rep.minorVersion = XF86VIDMODE_MINOR_VERSION; + rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION; + rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); @@ -1540,7 +1541,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client) { CARD16 *ramp = NULL; int n, length; - size_t ramplen; + size_t ramplen = 0; xXF86VidModeGetGammaRampReply rep; REQUEST(xXF86VidModeGetGammaRampReq); diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre index d714b2a8e..e3cbcf586 100644 --- a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre @@ -450,6 +450,15 @@ core file. In general you never want to use this option unless you are debugging an __xservername__ server problem and know how to deal with the consequences. .TP 7 +.BI "Option \*qUseSIGIO\*q \*q" boolean \*q +This controls whether the __xservername__ server requests that events from +input devices be reported via a SIGIO signal handler (also known as SIGPOLL +on some platforms), or only reported via the standard select(3) loop. +The default behaviour is platform specific. In general you do not want to +use this option unless you are debugging the __xservername__ server, or +working around a specific bug until it is fixed, and understand the +consequences. +.TP 7 .BI "Option \*qDontVTSwitch\*q \*q" boolean \*q This disallows the use of the .BI Ctrl+Alt+F n @@ -714,12 +723,12 @@ multimedia subdirectories of each of those directories. In addition to this, operating system specific subdirectories of all the above are searched first if they exist. .PP -To see what extension modules are available, check the contents -of the following directory: +To see what extension modules are available, check the extensions +subdirectory under: .PP .RS 4 .nf -__projectroot__/lib/modules/extensions +__modulepath__ .fi .RE .PP diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c index d32b284ed..faddfe6ec 100644 --- a/xorg-server/hw/xfree86/dri/dri.c +++ b/xorg-server/hw/xfree86/dri/dri.c @@ -57,7 +57,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "windowstr.h" #include "servermd.h" #define _XF86DRI_SERVER_ -#include "xf86dristr.h" +#include <X11/dri/xf86driproto.h> #include "swaprep.h" #include "xf86str.h" #include "dri.h" @@ -73,10 +73,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) -#if !defined(PANORAMIX) -extern Bool noPanoramiXExtension; -#endif - static int DRIEntPrivIndex = -1; static int DRIScreenPrivKeyIndex; static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKeyIndex; @@ -321,7 +317,6 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) drm_context_t * reserved; int reserved_count; int i; - Bool xineramaInCore = FALSE; DRIEntPrivPtr pDRIEntPriv; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; DRIContextFlags flags = 0; @@ -339,21 +334,18 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) "Direct rendering is not supported when VGA arb is necessary for the device\n"); return FALSE; } - + +#ifdef PANORAMIX /* * If Xinerama is on, don't allow DRI to initialise. It won't be usable * anyway. */ - if (xf86LoaderCheckSymbol("noPanoramiXExtension")) - xineramaInCore = TRUE; - - if (xineramaInCore) { if (!noPanoramiXExtension) { DRIDrvMsg(pScreen->myNum, X_WARNING, "Direct rendering is not supported when Xinerama is enabled\n"); return FALSE; } - } +#endif if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize, pDRIInfo->busIdString, diff --git a/xorg-server/hw/xfree86/dri/drimodule.c b/xorg-server/hw/xfree86/dri/drimodule.c index 3aa9245b9..28f6ad8c0 100644 --- a/xorg-server/hw/xfree86/dri/drimodule.c +++ b/xorg-server/hw/xfree86/dri/drimodule.c @@ -60,7 +60,7 @@ static XF86ModuleVersionInfo VersRec = extern void XFree86DRIExtensionInit(INITARGS); #define _XF86DRI_SERVER_ -#include "xf86dristr.h" +#include <X11/dri/xf86driproto.h> static ExtensionModule XF86DRIExt = { diff --git a/xorg-server/hw/xfree86/dri/xf86dri.c b/xorg-server/hw/xfree86/dri/xf86dri.c index d3e5e688a..035057b77 100644 --- a/xorg-server/hw/xfree86/dri/xf86dri.c +++ b/xorg-server/hw/xfree86/dri/xf86dri.c @@ -52,7 +52,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "scrnintstr.h" #include "servermd.h" #define _XF86DRI_SERVER_ -#include "xf86dristr.h" +#include <X11/dri/xf86driproto.h> #include "swaprep.h" #include "xf86str.h" #include "dri.h" @@ -60,6 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dristruct.h" #include "xf86.h" #include "xf86drm.h" +#include "protocol-versions.h" static int DRIErrorBase; @@ -134,9 +135,9 @@ ProcXF86DRIQueryVersion( rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = XF86DRI_MAJOR_VERSION; - rep.minorVersion = XF86DRI_MINOR_VERSION; - rep.patchVersion = XF86DRI_PATCH_VERSION; + rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION; + rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION; + rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c index 72f9a448b..6c14578d7 100644 --- a/xorg-server/hw/xfree86/dri2/dri2ext.c +++ b/xorg-server/hw/xfree86/dri2/dri2ext.c @@ -45,6 +45,7 @@ #include "xf86drm.h" #include "xfixes.h" #include "dri2.h" +#include "protocol-versions.h" /* The only xf86 include */ #include "xf86Module.h" @@ -79,8 +80,8 @@ ProcDRI2QueryVersion(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = 1; - rep.minorVersion = 1; + rep.majorVersion = SERVER_DRI2_MAJOR_VERSION; + rep.minorVersion = SERVER_DRI2_MAJOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); diff --git a/xorg-server/hw/xfree86/loader/loadext.c b/xorg-server/hw/xfree86/loader/loadext.c index a61b28cc2..29cdaf1ac 100644 --- a/xorg-server/hw/xfree86/loader/loadext.c +++ b/xorg-server/hw/xfree86/loader/loadext.c @@ -430,6 +430,8 @@ LoaderSortExtensions(void) } if (sorted) free_nodes(sorted); + if (graph) + free_nodes(graph); newList[i].name = NULL; xfree(ExtensionModuleList); ExtensionModuleList = newList; diff --git a/xorg-server/hw/xfree86/loader/sdksyms.c b/xorg-server/hw/xfree86/loader/sdksyms.c index f7307750b..df06ef561 100644 --- a/xorg-server/hw/xfree86/loader/sdksyms.c +++ b/xorg-server/hw/xfree86/loader/sdksyms.c @@ -594,7 +594,6 @@ _X_HIDDEN void *xorg_symbols[] = { (void *) &GetMaximumEventsNum, (void *) &GetEventList, (void *) &InitEventList, - (void *) &SetMinimumEventSize, (void *) &FreeEventList, (void *) &CreateClassesChangedEvent, (void *) &GetPointerEvents, @@ -615,6 +614,7 @@ _X_HIDDEN void *xorg_symbols[] = { (void *) &AllocXTestDevice, (void *) &IsXTestDevice, (void *) &GetXTestDevice, + (void *) &SendDevicePresenceEvent, (void *) &GetEventFilter, (void *) &GetWindowXI2Mask, (void *) &NewInputDeviceRequest, @@ -1824,7 +1824,7 @@ _X_HIDDEN void *xorg_symbols[] = { (void *) &miRecolorCursor, (void *) &miStepDash, (void *) &mieqInit, - (void *) &mieqResizeEvents, + (void *) &mieqFini, (void *) &mieqEnqueue, (void *) &mieqSwitchScreen, (void *) &mieqProcessDeviceEvent, diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index 8d636af48..c1e31e003 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -384,7 +384,9 @@ done: crtc->transformPresent = saved_transform_present; } - free(adjusted_mode); + if (adjusted_mode->name) + xfree(adjusted_mode->name); + xfree(adjusted_mode); if (didLock) crtc->funcs->unlock (crtc); @@ -803,6 +805,9 @@ xf86CrtcScreenInit (ScreenPtr screen) config->CloseScreen = screen->CloseScreen; screen->CloseScreen = xf86CrtcCloseScreen; +#ifdef XFreeXDGA + xf86DiDGAInit(screen, 0); +#endif #ifdef RANDR_13_INTERFACE return RANDR_INTERFACE_VERSION; #else @@ -1921,6 +1926,10 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) } } scrn->currentMode = scrn->modes; +#ifdef XFreeXDGA + if (scrn->pScreen) + xf86DiDGAReInit(scrn->pScreen); +#endif } static void diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c index fc4df8477..385848b7a 100644 --- a/xorg-server/hw/xfree86/modes/xf86Cursors.c +++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c @@ -480,10 +480,10 @@ xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; + ++cursor->refcnt; if (xf86_config->cursor) FreeCursor (xf86_config->cursor, None); xf86_config->cursor = cursor; - ++cursor->refcnt; /* Make sure ARGB support is available */ if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0) diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c index 0964cefa7..0f7b8342c 100644 --- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c +++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c @@ -72,8 +72,7 @@ xf86_dga_get_modes (ScreenPtr pScreen) mode = modes + num++; mode->mode = display_mode; - mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + mode->flags = DGA_CONCURRENT_ACCESS; if (display_mode->Flags & V_DBLSCAN) mode->flags |= DGA_DOUBLESCAN; if (display_mode->Flags & V_INTERLACE) @@ -91,14 +90,14 @@ xf86_dga_get_modes (ScreenPtr pScreen) mode->yViewportStep = 1; mode->viewportFlags = DGA_FLIP_RETRACE; mode->offset = 0; - mode->address = (unsigned char *) xf86_config->dga_address; - mode->bytesPerScanline = xf86_config->dga_stride; - mode->imageWidth = xf86_config->dga_width; - mode->imageHeight = xf86_config->dga_height; + mode->address = 0; + mode->imageWidth = mode->viewportWidth; + mode->imageHeight = mode->viewportHeight; + mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3; mode->pixmapWidth = mode->imageWidth; mode->pixmapHeight = mode->imageHeight; - mode->maxViewportX = mode->imageWidth - mode->viewportWidth; - mode->maxViewportY = mode->imageHeight - mode->viewportHeight; + mode->maxViewportX = 0; + mode->maxViewportY = 0; display_mode = display_mode->next; if (display_mode == scrn->modes) @@ -149,93 +148,11 @@ xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags) } static Bool -xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC) -{ - ScreenPtr pScreen = scrn->pScreen; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - PixmapPtr pPixmap; - GCPtr pGC; - - pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height, - scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride, - (char *) scrn->memPhysBase + scrn->fbOffset); - if (!pPixmap) - return FALSE; - pGC = GetScratchGC (scrn->depth, pScreen); - if (!pGC) - { - FreeScratchPixmapHeader (pPixmap); - return FALSE; - } - *ppDrawable = &pPixmap->drawable; - *ppGC = pGC; - return TRUE; -} - -static void -xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC) -{ - FreeScratchGC (pGC); - FreeScratchPixmapHeader ((PixmapPtr) pDrawable); -} - -static void -xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color) -{ - GCPtr pGC; - DrawablePtr pDrawable; - XID vals[1]; - xRectangle r; - - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC)) - return; - vals[0] = color; - ChangeGC (pGC, GCForeground, vals); - ValidateGC (pDrawable, pGC); - r.x = x; - r.y = y; - r.width = w; - r.height = h; - pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r); - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC); -} - -static void -xf86_dga_sync(ScrnInfoPtr scrn) -{ - ScreenPtr pScreen = scrn->pScreen; - WindowPtr pRoot = WindowTable [pScreen->myNum]; - char buffer[4]; - - pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer); -} - -static void -xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - DrawablePtr pDrawable; - GCPtr pGC; - - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC)) - return; - ValidateGC (pDrawable, pGC); - pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty); - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC); -} - -static Bool xf86_dga_open_framebuffer(ScrnInfoPtr scrn, char **name, unsigned char **mem, int *size, int *offset, int *flags) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - - *size = xf86_config->dga_stride * xf86_config->dga_height; - *mem = (unsigned char *) (xf86_config->dga_address); - *offset = 0; - *flags = DGA_NEED_ROOT; - - return TRUE; + return FALSE; } static void @@ -249,9 +166,9 @@ static DGAFunctionRec xf86_dga_funcs = { xf86_dga_set_mode, xf86_dga_set_viewport, xf86_dga_get_viewport, - xf86_dga_sync, - xf86_dga_fill_rect, - xf86_dga_blit_rect, + NULL, + NULL, + NULL, NULL }; @@ -261,6 +178,9 @@ xf86DiDGAReInit (ScreenPtr pScreen) ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + if (!DGAAvailable(pScreen->myNum)) + return TRUE; + if (!xf86_dga_get_modes (pScreen)) return FALSE; @@ -273,11 +193,14 @@ xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + if (DGAAvailable(pScreen->myNum)) + return TRUE; + xf86_config->dga_flags = 0; - xf86_config->dga_address = dga_address; - xf86_config->dga_width = scrn->virtualX; - xf86_config->dga_height = scrn->virtualY; - xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3; + xf86_config->dga_address = 0; + xf86_config->dga_width = 0; + xf86_config->dga_height = 0; + xf86_config->dga_stride = 0; if (!xf86_dga_get_modes (pScreen)) return FALSE; diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index c2465bce3..6ea9d26b6 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -1,5 +1,5 @@ /* - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -467,9 +467,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations) { xf86ProbeOutputModes (scrp, 0, 0); xf86SetScrnInfoModes (scrp); -#ifdef XFreeXDGA - xf86DiDGAReInit (pScreen); -#endif } for (mode = scrp->modes; ; mode = mode->next) @@ -1528,9 +1525,6 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations) return TRUE; xf86ProbeOutputModes (pScrn, 0, 0); xf86SetScrnInfoModes (pScrn); -#ifdef XFreeXDGA - xf86DiDGAReInit (pScreen); -#endif return xf86RandR12SetInfo12 (pScreen); } diff --git a/xorg-server/hw/xfree86/os-support/shared/sigio.c b/xorg-server/hw/xfree86/os-support/shared/sigio.c index 44136ccfb..aed5654e8 100644 --- a/xorg-server/hw/xfree86/os-support/shared/sigio.c +++ b/xorg-server/hw/xfree86/os-support/shared/sigio.c @@ -145,6 +145,9 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure) int blocked; int installed = FALSE; + if (!xf86Info.useSIGIO) + return 0; + for (i = 0; i < MAX_FUNCS; i++) { if (!xf86SigIOFuncs[i].f) @@ -216,6 +219,9 @@ xf86RemoveSIGIOHandler(int fd) int maxfd; int ret; + if (!xf86Info.useSIGIO) + return 0; + max = 0; maxfd = -1; ret = 0; diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c index 330bac4a4..14be180a1 100644 --- a/xorg-server/hw/xquartz/applewm.c +++ b/xorg-server/hw/xquartz/applewm.c @@ -50,6 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/extensions/applewmproto.h> #include "applewmExt.h" #include "X11Application.h" +#include "protocol-versions.h" #define DEFINE_ATOM_HELPER(func,atom_name) \ static Atom func (void) { \ @@ -183,9 +184,9 @@ ProcAppleWMQueryVersion( rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = APPLE_WM_MAJOR_VERSION; - rep.minorVersion = APPLE_WM_MINOR_VERSION; - rep.patchVersion = APPLE_WM_PATCH_VERSION; + rep.majorVersion = SERVER_APPLEWM_MAJOR_VERSION; + rep.minorVersion = SERVER_APPLEWM_MINOR_VERSION; + rep.patchVersion = SERVER_APPLEWM_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.m b/xorg-server/hw/xquartz/pbproxy/x-selection.m index 4f2d848fb..ef84f8bfb 100644 --- a/xorg-server/hw/xquartz/pbproxy/x-selection.m +++ b/xorg-server/hw/xquartz/pbproxy/x-selection.m @@ -440,10 +440,6 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato [self x_copy_request_targets]; } } - else - { - XBell (xpbproxy_dpy, 0); - } } /* Set pbproxy as owner of the SELECTION_MANAGER selection. diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c index 4d1a82fcc..835ccabaf 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.c +++ b/xorg-server/hw/xquartz/xpr/appledri.c @@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dristruct.h" #include "xpr.h" #include "x-hash.h" +#include "protocol-versions.h" static int DRIErrorBase = 0; @@ -119,9 +120,9 @@ ProcAppleDRIQueryVersion( rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = APPLE_DRI_MAJOR_VERSION; - rep.minorVersion = APPLE_DRI_MINOR_VERSION; - rep.patchVersion = APPLE_DRI_PATCH_VERSION; + rep.majorVersion = SERVER_APPLEDRI_MAJOR_VERSION; + rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION; + rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index 61972c932..5b164ea96 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -41,6 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swaprep.h" #define _WINDOWSWM_SERVER_ #include <X11/extensions/windowswmstr.h> +#include "protocol-versions.h" static int WMErrorBase; @@ -114,9 +115,9 @@ ProcWindowsWMQueryVersion(register ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = WINDOWS_WM_MAJOR_VERSION; - rep.minorVersion = WINDOWS_WM_MINOR_VERSION; - rep.patchVersion = WINDOWS_WM_PATCH_VERSION; + rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION; + rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION; + rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); |