aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xext/Makefile.am9
-rw-r--r--xorg-server/Xext/mbuf.c2014
-rw-r--r--xorg-server/Xext/mbufbf.c1007
-rw-r--r--xorg-server/Xext/mbufpx.c648
-rw-r--r--xorg-server/Xext/panoramiX.c6
-rw-r--r--xorg-server/Xext/panoramiX.h2
-rw-r--r--xorg-server/Xext/sync.c2
-rw-r--r--xorg-server/Xext/xtest.c3
-rw-r--r--xorg-server/Xi/sendexev.c3
-rw-r--r--xorg-server/Xi/xiquerydevice.c5
-rw-r--r--xorg-server/configure.ac7
-rw-r--r--xorg-server/exa/exa.c24
-rw-r--r--xorg-server/exa/exa_classic.c3
-rw-r--r--xorg-server/exa/exa_driver.c3
-rw-r--r--xorg-server/exa/exa_mixed.c3
-rw-r--r--xorg-server/exa/exa_priv.h6
-rw-r--r--xorg-server/exa/exa_render.c2
-rw-r--r--xorg-server/exa/exa_unaccel.c10
-rw-r--r--xorg-server/fb/fb.h4
-rw-r--r--xorg-server/fb/fbpict.c977
-rw-r--r--xorg-server/fb/fbtrap.c3
-rw-r--r--xorg-server/hw/dmx/dmx.h4
-rw-r--r--xorg-server/hw/dmx/dmxclient.h2
-rw-r--r--xorg-server/hw/dmx/dmxextension.c10
-rw-r--r--xorg-server/hw/dmx/dmxinit.c4
-rw-r--r--xorg-server/hw/dmx/dmxscrinit.c8
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c8
-rw-r--r--xorg-server/hw/dmx/dmxwindow.h2
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c4
-rw-r--r--xorg-server/hw/vfb/InitOutput.c6
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c2214
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h6
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c9
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.h5
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/posix_tty.c5
-rw-r--r--xorg-server/hw/xfree86/parser/read.c4
-rw-r--r--xorg-server/hw/xfree86/parser/scan.c7
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadow.c16
-rw-r--r--xorg-server/hw/xfree86/xaa/xaa.h7
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInitAccel.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStateChange.c6
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWrapper.c12
-rw-r--r--xorg-server/hw/xfree86/xaa/xaalocal.h7
-rw-r--r--xorg-server/hw/xfree86/xaa/xaawrap.h2
-rw-r--r--xorg-server/hw/xquartz/darwin.c2
-rw-r--r--xorg-server/hw/xquartz/mach-startup/launchd_fd.h2
-rw-r--r--xorg-server/hw/xwin/InitOutput.c3
-rw-r--r--xorg-server/hw/xwin/win.h2874
-rw-r--r--xorg-server/hw/xwin/winscrinit.c1552
-rw-r--r--xorg-server/include/cursor.h2
-rw-r--r--xorg-server/include/dix-config.h.in6
-rw-r--r--xorg-server/include/globals.h6
-rw-r--r--xorg-server/mi/midispcur.c270
-rw-r--r--xorg-server/mi/miinitext.c23
-rw-r--r--xorg-server/mi/mipointer.c6
-rw-r--r--xorg-server/miext/cw/cw.c10
-rw-r--r--xorg-server/miext/cw/cw.h2
-rw-r--r--xorg-server/miext/cw/cw_render.c3
-rw-r--r--xorg-server/miext/damage/damage.c7
-rw-r--r--xorg-server/miext/damage/damagestr.h4
-rw-r--r--xorg-server/miext/rootless/rootlessCommon.h4
-rw-r--r--xorg-server/miext/rootless/rootlessScreen.c6
-rw-r--r--xorg-server/miext/shadow/shadow.h2
-rw-r--r--xorg-server/os/utils.c11
-rw-r--r--xorg-server/randr/randrstr.h2
-rw-r--r--xorg-server/randr/rrinfo.c2
-rw-r--r--xorg-server/randr/rrscreen.c4
-rw-r--r--xorg-server/xfixes/region.c10
-rw-r--r--xorg-server/xkb/xkbEvents.c3
-rw-r--r--xorg-server/xkb/xkbout.c9
76 files changed, 3995 insertions, 7949 deletions
diff --git a/xorg-server/Xext/Makefile.am b/xorg-server/Xext/Makefile.am
index 53cbc1fbd..fa007aa91 100644
--- a/xorg-server/Xext/Makefile.am
+++ b/xorg-server/Xext/Makefile.am
@@ -99,13 +99,6 @@ BUILTIN_SRCS += $(XCALIBRATE_SRCS)
# XCalibrate needs tslib
endif
-# Multi-buffering extension
-MULTIBUFFER_SRCS = mbuf.c
-EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c
-if MULTIBUFFER
-MODULE_SRCS += $(MULTIBUFFER_SRCS)
-endif
-
# XF86 Big Font extension
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
if XF86BIGFONT
@@ -140,8 +133,6 @@ EXTRA_DIST = \
$(XSELINUX_SRCS) \
$(XCALIBRATE_SRCS) \
$(XINERAMA_SRCS) \
- $(MULTIBUFFER_SRCS) \
- $(EXTRA_MULTIBUFFER_SRCS) \
$(FONTCACHE_SRCS) \
$(BIGFONT_SRCS) \
$(DPMS_SRCS) \
diff --git a/xorg-server/Xext/mbuf.c b/xorg-server/Xext/mbuf.c
deleted file mode 100644
index b4c635799..000000000
--- a/xorg-server/Xext/mbuf.c
+++ /dev/null
@@ -1,2014 +0,0 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "window.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "sleepuntil.h"
-#include "inputstr.h"
-#include <X11/extensions/multibufconst.h>
-#include <X11/extensions/multibufproto.h>
-
-#include <stdio.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#endif
-
-/* given an OtherClientPtr obj, get the ClientPtr */
-#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-
-/* given a MultibufferPtr b, get the ClientPtr */
-#define bClient(b) (clients[CLIENT_ID(b->pPixmap->drawable.id)])
-
-#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
-
-/* The _Multibuffer and _Multibuffers structures below refer to each other,
- * so we need this forward declaration
- */
-typedef struct _Multibuffers *MultibuffersPtr;
-
-/*
- * per-Multibuffer data
- */
-typedef struct _Multibuffer {
- MultibuffersPtr pMultibuffers; /* associated window data */
- Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */
- Mask otherEventMask; /* mask of all other clients event masks */
- OtherClients *otherClients; /* other clients that want events */
- int number; /* index of this buffer into array */
- int side; /* always Mono */
- int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */
- PixmapPtr pPixmap; /* associated pixmap */
-} MultibufferRec, *MultibufferPtr;
-
-/*
- * per-window data
- */
-
-typedef struct _Multibuffers {
- WindowPtr pWindow; /* associated window */
- int numMultibuffer; /* count of buffers */
- int refcnt; /* ref count for delete */
- int displayedMultibuffer; /* currently active buffer */
- int updateAction; /* Undefined, Background, Untouched, Copied */
- int updateHint; /* Frequent, Intermittent, Static */
- int windowMode; /* always Mono */
-
- TimeStamp lastUpdate; /* time of last update */
-
- unsigned short width, height; /* last known window size */
- short x, y; /* for static gravity */
-
- MultibufferPtr buffers; /* array of numMultibuffer buffers */
-} MultibuffersRec;
-
-/*
- * per-screen data
- */
-typedef struct _MultibufferScreen {
- PositionWindowProcPtr PositionWindow; /* pWin, x,y */
-} MultibufferScreenRec, *MultibufferScreenPtr;
-
-/*
- * per display-image-buffers request data.
- */
-
-typedef struct _DisplayRequest {
- struct _DisplayRequest *next;
- TimeStamp activateTime;
- ClientPtr pClient;
- XID id;
-} DisplayRequestRec, *DisplayRequestPtr;
-
-#define DestroyWindowMask (1L<<0)
-#define PositionWindowMask (1L<<1)
-#define PostValidateTreeMask (1L<<2)
-#define ClipNotifyMask (1L<<3)
-#define WindowExposuresMask (1L<<4)
-#define CopyWindowMask (1L<<5)
-#define ClearToBackgroundMask (1L<<6)
-#define ChangeWindowAttributesMask (1L<<7)
-
-extern int MultibufferScreenIndex;
-extern int MultibufferWindowIndex;
-
-extern RESTYPE MultibufferDrawableResType;
-
-extern void MultibufferUpdate( /* pMbuffer, time */
- MultibufferPtr /* pMultibuffer */,
- CARD32 /* time */
- );
-extern void MultibufferExpose( /* pMbuffer, pRegion */
- MultibufferPtr /* pMultibuffer */,
- RegionPtr /* pRegion */
- );
-extern void MultibufferClobber( /* pMbuffer */
- MultibufferPtr /* pMultibuffer */
- );
-
-typedef struct _mbufWindow *mbufWindowPtr;
-
-void DestroyImageBuffers (WindowPtr pWin);
-
-/*
- * per-buffer data
- */
-
-#define MB_DISPLAYED_BUFFER(pMBWindow) \
- ((pMBWindow)->buffers + (pMBWindow)->displayedMultibuffer)
-
-typedef struct _mbufBuffer {
- mbufWindowPtr pMBWindow; /* associated window data */
- Mask eventMask; /* client event mask */
- Mask otherEventMask; /* union of other clients' event masks */
- OtherClientsPtr otherClients; /* other clients that want events */
- int number; /* index of this buffer into array */
- int side; /* stero side: always Mono */
- int clobber; /* clober state */
- DrawablePtr pDrawable; /* associated drawable */
-} mbufBufferRec, *mbufBufferPtr;
-
-
-/*
- * per-window data
- */
-
-#define MB_WINDOW_PRIV(pWin) \
- ((mbufWindowPtr)((pWin)->devPrivates[MultibufferWindowIndex].ptr))
-
-typedef struct _mbufWindow {
- WindowPtr pWindow; /* associated window */
- int numMultibuffer; /* count of buffers */
- mbufBufferPtr buffers; /* array of (numMultibuffer) buffers */
- int displayedMultibuffer; /* currently active buffer */
- int updateAction; /* Undefined, Background,
- Untouched, Copied */
- int updateHint; /* Frequent, Intermittent, Static */
- int windowMode; /* always Mono */
- TimeStamp lastUpdate; /* time of last update */
- short x, y; /* for static gravity */
- unsigned short width, height; /* last known window size */
- DevUnion devPrivate;
-} mbufWindowRec;
-
-
-/*
- * per-screen data
- */
-
-#define MB_SCREEN_PRIV(pScreen) \
- ((mbufScreenPtr)((pScreen)->devPrivates[MultibufferScreenIndex].ptr))
-
-typedef struct _mbufScreen {
- long mbufWindowCount; /* count of multibuffered windows */
-
- /* Wrap pScreen->DestroyWindow */
- DestroyWindowProcPtr DestroyWindow;
- long funcsWrapped; /* flags which functions are wrapped */
-
- /* Initialized by device-dependent section */
- int nInfo; /* number of buffer info rec's */
- xMbufBufferInfo *pInfo; /* buffer info (for Normal buffers) */
-
- int (* CreateImageBuffers)(
- WindowPtr /* pWin */,
- int /* nbuf */,
- XID * /* ids */,
- int /* action */,
- int /* hint */
- );
- void (* DestroyImageBuffers)(
- WindowPtr /* pWin */
- );
- void (* DisplayImageBuffers)(
- ScreenPtr /* pScreen */,
- mbufBufferPtr * /* ppMBBuffer */,
- mbufWindowPtr * /* ppMBWindow */,
- int /* nbuf */
- );
- void (* ClearImageBufferArea)(
- mbufBufferPtr /* pMBBuffer */,
- short /* x */,
- short /* y */,
- unsigned short /* width */,
- unsigned short /* height */,
- Bool /* exposures */
- );
- Bool (* ChangeMBufferAttributes)( /* pMBWindow, vmask */
- /* FIXME */
- );
- Bool (* ChangeBufferAttributes)( /* pMBBuffer, vmask */
- /* FIXME */
- );
- void (* DeleteBufferDrawable)(
- DrawablePtr /* pDrawable */
- );
- void (* WrapScreenFuncs)(
- ScreenPtr /* pScreen */
- );
- void (* ResetProc)(
- ScreenPtr /* pScreen */
- );
- DevUnion devPrivate;
-} mbufScreenRec, *mbufScreenPtr;
-
-
-/* Privates to mbufScreenRec */
-
-#ifdef _MULTIBUF_PIXMAP_
-#define MB_SCREEN_PRIV_PIXMAP(pScreen) \
- ((mbufPixmapPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr)
-
-typedef struct _mbufPixmapPriv
-{
- /* Pointers to wrapped functions */
- PositionWindowProcPtr PositionWindow; /* pWin, x,y */
- long funcsWrapped; /* flags which functions are wrapped */
-} mbufPixmapPrivRec, *mbufPixmapPrivPtr;
-#endif /* _MULTIBUF_PIXMAP_ */
-
-
-#ifdef _MULTIBUF_BUFFER_
-
-extern int frameWindowPrivateIndex;
-
-#define MB_SCREEN_PRIV_BUFFER(pScreen) \
- ((mbufBufferPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr)
-
-typedef struct _mbufBufferPriv
-{
- DevUnion *frameBuffer; /* Array of screen framebuffers */
- DevUnion selectPlane; /* Plane(s) that select displayed buffer */
-
- /*
- * Note: subtractRgn and unionRgn may overlap. subtractRgn is a union
- * of all the old clipLists of the windows that are displaying
- * the backbuffer. unionRgn is the union of all the new clipLists
- * of the same windows.
- */
-
- RegionRec backBuffer; /* Area of screen displaying back buffer */
- RegionRec subtractRgn; /* Regions lost to backBuffer */
- RegionRec unionRgn; /* Regions gained by backBuffer */
- Bool rgnChanged; /* TRUE if "backBuffer" needs to be updated */
-
- void (* CopyBufferBits)(); /* pMBWindow, srcBufferNum, dstBufferNum */
- void (* DrawSelectPlane)(); /* pScreen, selectPlane, pRegion, bufferNum */
-
- /* Pointers to wrapped functions */
- PostValidateTreeProcPtr PostValidateTree; /* pParent, pChild, kind */
- ClipNotifyProcPtr ClipNotify; /* pWin, dx, dy */
- WindowExposuresProcPtr WindowExposures; /* pWin, pRegion */
- CopyWindowProcPtr CopyWindow; /* pWin, oldPt, pOldRegion */
- ClearToBackgroundProcPtr ClearToBackground; /* pWin, x,y,w,h, sendExpose */
- ChangeWindowAttributesProcPtr ChangeWindowAttributes; /* pWin, vmask */
- long funcsWrapped; /* flags which functions are wrapped */
- unsigned inClearToBackground:1; /* used by WindowExposure */
-} mbufBufferPrivRec, *mbufBufferPrivPtr;
-#endif /* _MULTIBUF_BUFFER_ */
-
-static int MultibufferEventBase;
-static int MultibufferErrorBase;
-static int MultibufferScreenPrivKeyIndex;
-static DevPrivateKey MultibufferScreenPrivKey = &MultibufferScreenPrivKeyIndex;
-static int MultibufferWindowPrivKeyIndex;
-static DevPrivateKey MultibufferWindowPrivKey = &MultibufferWindowPrivKeyIndex;
-
-static void PerformDisplayRequest (
- MultibuffersPtr * /* ppMultibuffers */,
- MultibufferPtr * /* pMultibuffer */,
- int /* nbuf */
- );
-static Bool QueueDisplayRequest (
- ClientPtr /* client */,
- TimeStamp /* activateTime */
- );
-
-static void BumpTimeStamp (
- TimeStamp * /* ts */,
- CARD32 /* inc */
- );
-
-static void AliasMultibuffer (
- MultibuffersPtr /* pMultibuffers */,
- int /* i */
- );
-static void RecalculateMultibufferOtherEvents (
- MultibufferPtr /* pMultibuffer */
- );
-static int EventSelectForMultibuffer(
- MultibufferPtr /* pMultibuffer */,
- ClientPtr /* client */,
- Mask /* mask */
- );
-
-/*
- * The Pixmap associated with a buffer can be found as a resource
- * with this type
- */
-RESTYPE MultibufferDrawableResType;
-static int MultibufferDrawableDelete (
- pointer /* value */,
- XID /* id */
- );
-/*
- * The per-buffer data can be found as a resource with this type.
- * the resource id of the per-buffer data is the same as the resource
- * id of the pixmap
- */
-static RESTYPE MultibufferResType;
-static int MultibufferDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/*
- * The per-window data can be found as a resource with this type,
- * using the window resource id
- */
-static RESTYPE MultibuffersResType;
-static int MultibuffersDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/*
- * Clients other than the buffer creator attach event masks in
- * OtherClient structures; each has a resource of this type.
- */
-static RESTYPE OtherClientResType;
-static int OtherClientDelete (
- pointer /* value */,
- XID /* id */
- );
-
-/****************
- * MultibufferExtensionInit
- *
- * Called from InitExtensions in main()
- *
- ****************/
-
-extern DISPATCH_PROC(ProcGetBufferAttributes);
-
-static DISPATCH_PROC(ProcClearImageBufferArea);
-static DISPATCH_PROC(ProcCreateImageBuffers);
-static DISPATCH_PROC(ProcDestroyImageBuffers);
-static DISPATCH_PROC(ProcDisplayImageBuffers);
-static DISPATCH_PROC(ProcGetBufferInfo);
-static DISPATCH_PROC(ProcGetBufferVersion);
-static DISPATCH_PROC(ProcGetMBufferAttributes);
-static DISPATCH_PROC(ProcMultibufferDispatch);
-static DISPATCH_PROC(ProcSetBufferAttributes);
-static DISPATCH_PROC(ProcSetMBufferAttributes);
-static DISPATCH_PROC(SProcClearImageBufferArea);
-static DISPATCH_PROC(SProcCreateImageBuffers);
-static DISPATCH_PROC(SProcDestroyImageBuffers);
-static DISPATCH_PROC(SProcDisplayImageBuffers);
-static DISPATCH_PROC(SProcGetBufferAttributes);
-static DISPATCH_PROC(SProcGetBufferInfo);
-static DISPATCH_PROC(SProcGetBufferVersion);
-static DISPATCH_PROC(SProcGetMBufferAttributes);
-static DISPATCH_PROC(SProcMultibufferDispatch);
-static DISPATCH_PROC(SProcSetBufferAttributes);
-static DISPATCH_PROC(SProcSetMBufferAttributes);
-
-static void MultibufferResetProc(
- ExtensionEntry * /* extEntry */
- );
-static void SClobberNotifyEvent(
- xMbufClobberNotifyEvent * /* from */,
- xMbufClobberNotifyEvent * /* to */
- );
-static void SUpdateNotifyEvent(
- xMbufUpdateNotifyEvent * /* from */,
- xMbufUpdateNotifyEvent * /* to */
- );
-static Bool MultibufferPositionWindow(
- WindowPtr /* pWin */,
- int /* x */,
- int /* y */
- );
-
-static void SetupBackgroundPainter (
- WindowPtr /* pWin */,
- GCPtr /* pGC */
- );
-
-static int DeliverEventsToMultibuffer (
- MultibufferPtr /* pMultibuffer */,
- xEvent * /* pEvents */,
- int /* count */,
- Mask /* filter */
- );
-
-void
-MultibufferExtensionInit()
-{
- ExtensionEntry *extEntry;
- int i, j;
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (!(pMultibufferScreen = xalloc (sizeof (MultibufferScreenRec))))
- {
- for (j = 0; j < i; j++)
- xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey));
- return;
- }
- dixSetPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey, pMultibufferScreen);
- /*
- * wrap PositionWindow to resize the pixmap when the window
- * changes size
- */
- pMultibufferScreen->PositionWindow = pScreen->PositionWindow;
- pScreen->PositionWindow = MultibufferPositionWindow;
- }
- /*
- * create the resource types
- */
- MultibufferDrawableResType =
- CreateNewResourceType(MultibufferDrawableDelete, "MultibufferDrawable");
- if (MultibufferDrawableResType)
- MultibufferDrawableResType |= RC_DRAWABLE;
- MultibufferResType = CreateNewResourceType(MultibufferDelete,
- "MultibufferBuffer");
- MultibuffersResType = CreateNewResourceType(MultibuffersDelete,
- "MultibufferWindow");
- OtherClientResType = CreateNewResourceType(OtherClientDelete,
- "MultibufferOtherClient");
- if (MultibufferDrawableResType && MultibufferResType &&
- MultibuffersResType && OtherClientResType &&
- (extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
- MultibufferNumberEvents,
- MultibufferNumberErrors,
- ProcMultibufferDispatch, SProcMultibufferDispatch,
- MultibufferResetProc, StandardMinorOpcode)))
- {
- MultibufferEventBase = extEntry->eventBase;
- MultibufferErrorBase = extEntry->errorBase;
- EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
- EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
- }
-}
-
-/*ARGSUSED*/
-static void
-MultibufferResetProc (extEntry)
-ExtensionEntry *extEntry;
-{
- int i;
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if ((pMultibufferScreen = (MultibufferScreenPtr)dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey)))
- {
- pScreen->PositionWindow = pMultibufferScreen->PositionWindow;
- xfree (pMultibufferScreen);
- }
- }
-}
-
-static int
-ProcGetBufferVersion (client)
- ClientPtr client;
-{
- xMbufGetBufferVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = MULTIBUFFER_MAJOR_VERSION;
- rep.minorVersion = MULTIBUFFER_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof (xMbufGetBufferVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static void
-SetupBackgroundPainter (pWin, pGC)
- WindowPtr pWin;
- GCPtr pGC;
-{
- pointer gcvalues[4];
- int ts_x_origin, ts_y_origin;
- PixUnion background;
- int backgroundState;
- Mask gcmask;
-
- /*
- * First take care of any ParentRelative stuff by altering the
- * tile/stipple origin to match the coordinates of the upper-left
- * corner of the first ancestor without a ParentRelative background.
- * This coordinate is, of course, negative.
- */
-
- ts_x_origin = ts_y_origin = 0;
- while (pWin->backgroundState == ParentRelative) {
- ts_x_origin -= pWin->origin.x;
- ts_y_origin -= pWin->origin.y;
- pWin = pWin->parent;
- }
- backgroundState = pWin->backgroundState;
- background = pWin->background;
-
- switch (backgroundState)
- {
- case BackgroundPixel:
- gcvalues[0] = (pointer) background.pixel;
- gcvalues[1] = (pointer) FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0] = (pointer) FillTiled;
- gcvalues[1] = (pointer) background.pixmap;
- gcvalues[2] = (pointer)(long) ts_x_origin;
- gcvalues[3] = (pointer)(long) ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- gcvalues[0] = (pointer) GXnoop;
- gcmask = GCFunction;
- }
- DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
-}
-
-int
-CreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- MultibuffersPtr pMultibuffers;
- MultibufferPtr pMultibuffer;
- ScreenPtr pScreen;
- int width, height, depth;
- int i;
- GCPtr pClearGC = NULL;
- xRectangle clearRect;
-
- DestroyImageBuffers(pWin);
- pMultibuffers = xalloc (sizeof (MultibuffersRec) + nbuf * sizeof (MultibufferRec));
- if (!pMultibuffers)
- return BadAlloc;
- pMultibuffers->pWindow = pWin;
- pMultibuffers->buffers = (MultibufferPtr) (pMultibuffers + 1);
- pMultibuffers->refcnt = pMultibuffers->numMultibuffer = 0;
- if (!AddResource (pWin->drawable.id, MultibuffersResType, (pointer) pMultibuffers))
- return BadAlloc;
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- depth = pWin->drawable.depth;
- pScreen = pWin->drawable.pScreen;
-
- if (pWin->backgroundState != None)
- {
- pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
- SetupBackgroundPainter (pWin, pClearGC);
- clearRect.x = clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
-
- for (i = 0; i < nbuf; i++)
- {
- pMultibuffer = &pMultibuffers->buffers[i];
- pMultibuffer->eventMask = 0L;
- pMultibuffer->otherEventMask = 0L;
- pMultibuffer->otherClients = (OtherClientsPtr) NULL;
- pMultibuffer->number = i;
- pMultibuffer->side = MultibufferSideMono;
- pMultibuffer->clobber = MultibufferUnclobbered;
- pMultibuffer->pMultibuffers = pMultibuffers;
- if (!AddResource (ids[i], MultibufferResType, (pointer) pMultibuffer))
- break;
- pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth, 0);
- if (!pMultibuffer->pPixmap)
- break;
- if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap))
- {
- FreeResource (ids[i], MultibufferResType);
- (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
- break;
- }
- pMultibuffer->pPixmap->drawable.id = ids[i];
-
- if (i > 0 && pClearGC)
- {
- ValidateGC((DrawablePtr)pMultibuffer->pPixmap, pClearGC);
- (*pClearGC->ops->PolyFillRect)((DrawablePtr)pMultibuffer->pPixmap,
- pClearGC, 1, &clearRect);
- }
- }
- pMultibuffers->numMultibuffer = i;
- pMultibuffers->refcnt = i;
- pMultibuffers->displayedMultibuffer = -1;
- if (i > 0)
- AliasMultibuffer (pMultibuffers, 0);
- pMultibuffers->updateAction = action;
- pMultibuffers->updateHint = hint;
- pMultibuffers->windowMode = MultibufferModeMono;
- pMultibuffers->lastUpdate.months = 0;
- pMultibuffers->lastUpdate.milliseconds = 0;
- pMultibuffers->width = width;
- pMultibuffers->height = height;
- dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, pMultibuffers);
- if (pClearGC) FreeScratchGC(pClearGC);
- return Success;
-}
-
-
-static int
-ProcCreateImageBuffers (client)
- ClientPtr client;
-{
- REQUEST(xMbufCreateImageBuffersReq);
- xMbufCreateImageBuffersReply rep;
- int n;
- WindowPtr pWin;
- XID *ids;
- int len, nbuf, i, err, rc;
-
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- len = stuff->length - bytes_to_int32(sizeof(xMbufCreateImageBuffersReq));
- if (len == 0)
- return BadLength;
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success)
- return rc;
- if (pWin->drawable.class == InputOnly)
- return BadMatch;
- switch (stuff->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- case MultibufferUpdateActionBackground:
- case MultibufferUpdateActionUntouched:
- case MultibufferUpdateActionCopied:
- break;
- default:
- client->errorValue = stuff->updateAction;
- return BadValue;
- }
- switch (stuff->updateHint)
- {
- case MultibufferUpdateHintFrequent:
- case MultibufferUpdateHintIntermittent:
- case MultibufferUpdateHintStatic:
- break;
- default:
- client->errorValue = stuff->updateHint;
- return BadValue;
- }
- nbuf = len;
- ids = (XID *) &stuff[1];
- for (i = 0; i < nbuf; i++)
- {
- LEGAL_NEW_RESOURCE(ids[i], client);
- }
- err = CreateImageBuffers (pWin, nbuf, ids,
- stuff->updateAction, stuff->updateHint);
- if (err != Success)
- return err;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.numberBuffer = ((MultibuffersPtr) (dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))->numMultibuffer;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.numberBuffer, n);
- }
- WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcDisplayImageBuffers (client)
- ClientPtr client;
-{
- REQUEST(xMbufDisplayImageBuffersReq);
- MultibufferPtr *pMultibuffer;
- MultibuffersPtr *ppMultibuffers;
- int nbuf;
- XID *ids;
- int i, j;
- CARD32 minDelay;
- TimeStamp activateTime, bufferTime;
- int rc;
-
-
- REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
- nbuf = stuff->length - bytes_to_int32(sizeof (xMbufDisplayImageBuffersReq));
- if (!nbuf)
- return Success;
- minDelay = stuff->minDelay;
- ids = (XID *) &stuff[1];
- ppMultibuffers = xalloc(nbuf * sizeof (MultibuffersPtr));
- pMultibuffer = xalloc(nbuf * sizeof (MultibufferPtr));
- if (!ppMultibuffers || !pMultibuffer)
- {
- if (ppMultibuffers) xfree(ppMultibuffers);
- if (pMultibuffer) xfree(pMultibuffer);
- client->errorValue = 0;
- return BadAlloc;
- }
- activateTime.months = 0;
- activateTime.milliseconds = 0;
- for (i = 0; i < nbuf; i++)
- {
- rc = dixLookupResourceByType(&pMultibuffer[i], ids[i],
- MultibufferResType, client, DixUseAccess);
- if (rc != Success)
- {
- xfree(ppMultibuffers);
- xfree(pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- ppMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
- for (j = 0; j < i; j++)
- {
- if (ppMultibuffers[i] == ppMultibuffers[j])
- {
- xfree(ppMultibuffers);
- xfree(pMultibuffer);
- client->errorValue = ids[i];
- return BadMatch;
- }
- }
- bufferTime = ppMultibuffers[i]->lastUpdate;
- BumpTimeStamp (&bufferTime, minDelay);
- if (CompareTimeStamps (bufferTime, activateTime) == LATER)
- activateTime = bufferTime;
- }
- UpdateCurrentTime ();
- if (CompareTimeStamps (activateTime, currentTime) == LATER &&
- QueueDisplayRequest (client, activateTime))
- {
- ;
- }
- else
- PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
-
- xfree(ppMultibuffers);
- xfree(pMultibuffer);
- return Success;
-}
-
-
-static int
-ProcDestroyImageBuffers (client)
- ClientPtr client;
-{
- REQUEST (xMbufDestroyImageBuffersReq);
- WindowPtr pWin;
- int rc;
-
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success)
- return rc;
- DestroyImageBuffers (pWin);
- return Success;
-}
-
-static int
-ProcSetMBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST (xMbufSetMBufferAttributesReq);
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- int len, rc;
- Mask vmask;
- Mask index2;
- CARD32 updateHint;
- XID *vlist;
-
- REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success)
- return rc;
- rc = dixLookupResourceByType(&pMultibuffers, pWin->drawable.id,
- MultibufferResType, client, DixSetAttrAccess);
- if (rc != Success)
- return BadMatch;
- len = stuff->length - bytes_to_int32(sizeof (xMbufSetMBufferAttributesReq));
- vmask = stuff->valueMask;
- if (len != Ones (vmask))
- return BadLength;
- vlist = (XID *) &stuff[1];
- while (vmask)
- {
- index2 = (Mask) lowbit (vmask);
- vmask &= ~index2;
- switch (index2)
- {
- case MultibufferWindowUpdateHint:
- updateHint = (CARD32) *vlist;
- switch (updateHint)
- {
- case MultibufferUpdateHintFrequent:
- case MultibufferUpdateHintIntermittent:
- case MultibufferUpdateHintStatic:
- pMultibuffers->updateHint = updateHint;
- break;
- default:
- client->errorValue = updateHint;
- return BadValue;
- }
- vlist++;
- break;
- default:
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
- }
- return Success;
-}
-
-static int
-ProcGetMBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST (xMbufGetMBufferAttributesReq);
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- XID *ids;
- xMbufGetMBufferAttributesReply rep;
- int i, n, rc;
-
- REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success)
- return rc;
- rc = dixLookupResourceByType(&pMultibuffers, pWin->drawable.id,
- MultibufferResType, client, DixGetAttrAccess);
- if (rc != Success)
- return BadAccess;
- ids = xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
- if (!ids)
- return BadAlloc;
- for (i = 0; i < pMultibuffers->numMultibuffer; i++)
- ids[i] = pMultibuffers->buffers[i].pPixmap->drawable.id;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = pMultibuffers->numMultibuffer;
- rep.displayedBuffer = pMultibuffers->displayedMultibuffer;
- rep.updateAction = pMultibuffers->updateAction;
- rep.updateHint = pMultibuffers->updateHint;
- rep.windowMode = pMultibuffers->windowMode;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.displayedBuffer, n);
- SwapLongs (ids, pMultibuffers->numMultibuffer);
- }
- WriteToClient (client, sizeof(xMbufGetMBufferAttributesReply),
- (char *)&rep);
- WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
- (char *)ids);
- xfree((pointer) ids);
- return client->noClientException;
-}
-
-static int
-ProcSetBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST(xMbufSetBufferAttributesReq);
- MultibufferPtr pMultibuffer;
- int len;
- Mask vmask, index2;
- XID *vlist;
- Mask eventMask;
- int result;
- int rc;
-
- REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq);
-
- rc = dixLookupResourceByType(&pMultibuffer, stuff->buffer,
- MultibufferResType, client, DixSetAttrAccess);
- if (rc != Success)
- return MultibufferErrorBase + MultibufferBadBuffer;
- len = stuff->length - bytes_to_int32(sizeof (xMbufSetBufferAttributesReq));
- vmask = stuff->valueMask;
- if (len != Ones (vmask))
- return BadLength;
- vlist = (XID *) &stuff[1];
- while (vmask)
- {
- index2 = (Mask) lowbit (vmask);
- vmask &= ~index2;
- switch (index2)
- {
- case MultibufferBufferEventMask:
- eventMask = (Mask) *vlist;
- vlist++;
- result = EventSelectForMultibuffer (pMultibuffer, client, eventMask);
- if (result != Success)
- return result;
- break;
- default:
- client->errorValue = stuff->valueMask;
- return BadValue;
- }
- }
- return Success;
-}
-
-int
-ProcGetBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST(xMbufGetBufferAttributesReq);
- MultibufferPtr pMultibuffer;
- xMbufGetBufferAttributesReply rep;
- OtherClientsPtr other;
- int n;
- int rc;
-
- REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq);
- rc = dixLookupResourceByType(&pMultibuffer, stuff->buffer,
- MultibufferResType, client, DixGetAttrAccess);
- if (rc != Success)
- return MultibufferErrorBase + MultibufferBadBuffer;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.window = pMultibuffer->pMultibuffers->pWindow->drawable.id;
- if (bClient (pMultibuffer) == client)
- rep.eventMask = pMultibuffer->eventMask;
- else
- {
- rep.eventMask = (Mask) 0L;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- if (SameClient (other, client))
- {
- rep.eventMask = other->mask;
- break;
- }
- }
- rep.bufferIndex = pMultibuffer->number;
- rep.side = pMultibuffer->side;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.window, n);
- swapl(&rep.eventMask, n);
- swaps(&rep.bufferIndex, n);
- }
- WriteToClient(client, sizeof (xMbufGetBufferAttributesReply), (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcGetBufferInfo (client)
- ClientPtr client;
-{
- REQUEST (xMbufGetBufferInfoReq);
- DrawablePtr pDrawable;
- xMbufGetBufferInfoReply rep;
- ScreenPtr pScreen;
- int i, j, k, n, rc;
- xMbufBufferInfo *pInfo;
- int nInfo;
- DepthPtr pDepth;
-
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixUnknownAccess);
- if (rc != Success)
- return rc;
- pScreen = pDrawable->pScreen;
- nInfo = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- nInfo += pDepth->numVids;
- }
- pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
- if (!pInfo)
- return BadAlloc;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = nInfo * bytes_to_int32(sizeof (xMbufBufferInfo));
- rep.normalInfo = nInfo;
- rep.stereoInfo = 0;
- if (client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.normalInfo, n);
- swaps(&rep.stereoInfo, n);
- }
-
- k = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- for (j = 0; j < pDepth->numVids; j++)
- {
- pInfo[k].visualID = pDepth->vids[j];
- pInfo[k].maxBuffers = 0;
- pInfo[k].depth = pDepth->depth;
- if (client->swapped)
- {
- swapl (&pInfo[k].visualID, n);
- swaps (&pInfo[k].maxBuffers, n);
- }
- k++;
- }
- }
- WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep);
- WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo);
- xfree ((pointer) pInfo);
- return client->noClientException;
-}
-
-static int
-ProcClearImageBufferArea (client)
- ClientPtr client;
-{
- REQUEST (xMbufClearImageBufferAreaReq);
- MultibufferPtr pMultibuffer;
- WindowPtr pWin;
- xRectangle clearRect;
- int width, height;
- DrawablePtr pDrawable;
- ScreenPtr pScreen;
- int rc;
-
- REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
- rc = dixLookupResourceByType(&pMultibuffer, stuff->buffer,
- MultibufferResType, client, DixWriteAccess);
- if (rc != Success)
- return MultibufferErrorBase + MultibufferBadBuffer;
- if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
- {
- client->errorValue = stuff->exposures;
- return(BadValue);
- }
- pWin = pMultibuffer->pMultibuffers->pWindow;
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- pScreen = pWin->drawable.pScreen;
-
- clearRect.x = stuff->x;
- clearRect.y = stuff->y;
- clearRect.width = stuff->width ? stuff->width : width;
- clearRect.height = stuff->height ? stuff->height : height;
-
- if (pWin->backgroundState != None)
- {
- GCPtr pClearGC;
- pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
- SetupBackgroundPainter (pWin, pClearGC);
-
- if (pMultibuffer->number == pMultibuffer->pMultibuffers->displayedMultibuffer)
- pDrawable = (DrawablePtr)pWin;
- else
- pDrawable = (DrawablePtr)pMultibuffer->pPixmap;
-
- ValidateGC(pDrawable, pClearGC);
- (*pClearGC->ops->PolyFillRect) (pDrawable, pClearGC, 1, &clearRect);
- FreeScratchGC(pClearGC);
- }
-
- if (stuff->exposures)
- {
- RegionRec region;
- BoxRec box;
- box.x1 = clearRect.x;
- box.y1 = clearRect.y;
- box.x2 = clearRect.x + clearRect.width;
- box.y2 = clearRect.y + clearRect.height;
- REGION_INIT(pScreen, &region, &box, 1);
- MultibufferExpose(pMultibuffer, &region);
- REGION_UNINIT(pScreen, &region);
- }
- return Success;
-}
-
-static int
-ProcMultibufferDispatch (client)
- ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_MbufGetBufferVersion:
- return ProcGetBufferVersion (client);
- case X_MbufCreateImageBuffers:
- return ProcCreateImageBuffers (client);
- case X_MbufDisplayImageBuffers:
- return ProcDisplayImageBuffers (client);
- case X_MbufDestroyImageBuffers:
- return ProcDestroyImageBuffers (client);
- case X_MbufSetMBufferAttributes:
- return ProcSetMBufferAttributes (client);
- case X_MbufGetMBufferAttributes:
- return ProcGetMBufferAttributes (client);
- case X_MbufSetBufferAttributes:
- return ProcSetBufferAttributes (client);
- case X_MbufGetBufferAttributes:
- return ProcGetBufferAttributes (client);
- case X_MbufGetBufferInfo:
- return ProcGetBufferInfo (client);
- case X_MbufClearImageBufferArea:
- return ProcClearImageBufferArea (client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcGetBufferVersion (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufGetBufferVersionReq);
-
- swaps (&stuff->length, n);
- return ProcGetBufferVersion (client);
-}
-
-static int
-SProcCreateImageBuffers (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufCreateImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- swapl (&stuff->window, n);
- SwapRestL(stuff);
- return ProcCreateImageBuffers (client);
-}
-
-static int
-SProcDisplayImageBuffers (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufDisplayImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
- swaps (&stuff->minDelay, n);
- swaps (&stuff->maxDelay, n);
- SwapRestL(stuff);
- return ProcDisplayImageBuffers (client);
-}
-
-static int
-SProcDestroyImageBuffers (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufDestroyImageBuffersReq);
-
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- swapl (&stuff->window, n);
- return ProcDestroyImageBuffers (client);
-}
-
-static int
-SProcSetMBufferAttributes (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufSetMBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufSetMBufferAttributesReq);
- swapl (&stuff->window, n);
- swapl (&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcSetMBufferAttributes (client);
-}
-
-static int
-SProcGetMBufferAttributes (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufGetMBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufGetMBufferAttributesReq);
- swapl (&stuff->window, n);
- return ProcGetMBufferAttributes (client);
-}
-
-static int
-SProcSetBufferAttributes (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufSetBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufSetBufferAttributesReq);
- swapl (&stuff->buffer, n);
- swapl (&stuff->valueMask, n);
- SwapRestL(stuff);
- return ProcSetBufferAttributes (client);
-}
-
-static int
-SProcGetBufferAttributes (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufGetBufferAttributesReq);
-
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xMbufGetBufferAttributesReq);
- swapl (&stuff->buffer, n);
- return ProcGetBufferAttributes (client);
-}
-
-static int
-SProcGetBufferInfo (client)
- ClientPtr client;
-{
- int n;
- REQUEST (xMbufGetBufferInfoReq);
-
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufGetBufferInfoReq);
- swapl (&stuff->drawable, n);
- return ProcGetBufferInfo (client);
-}
-
-static int
-SProcClearImageBufferArea(client)
- ClientPtr client;
-{
- char n;
- REQUEST(xMbufClearImageBufferAreaReq);
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
- swapl(&stuff->buffer, n);
- swaps(&stuff->x, n);
- swaps(&stuff->y, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- return ProcClearImageBufferArea(client);
-}
-
-static int
-SProcMultibufferDispatch (client)
- ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_MbufGetBufferVersion:
- return SProcGetBufferVersion (client);
- case X_MbufCreateImageBuffers:
- return SProcCreateImageBuffers (client);
- case X_MbufDisplayImageBuffers:
- return SProcDisplayImageBuffers (client);
- case X_MbufDestroyImageBuffers:
- return SProcDestroyImageBuffers (client);
- case X_MbufSetMBufferAttributes:
- return SProcSetMBufferAttributes (client);
- case X_MbufGetMBufferAttributes:
- return SProcGetMBufferAttributes (client);
- case X_MbufSetBufferAttributes:
- return SProcSetBufferAttributes (client);
- case X_MbufGetBufferAttributes:
- return SProcGetBufferAttributes (client);
- case X_MbufGetBufferInfo:
- return SProcGetBufferInfo (client);
- case X_MbufClearImageBufferArea:
- return SProcClearImageBufferArea (client);
- default:
- return BadRequest;
- }
-}
-
-static void
-SUpdateNotifyEvent (from, to)
- xMbufUpdateNotifyEvent *from, *to;
-{
- to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->buffer, to->buffer);
- cpswapl (from->timeStamp, to->timeStamp);
-}
-
-static void
-SClobberNotifyEvent (from, to)
- xMbufClobberNotifyEvent *from, *to;
-{
- to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->buffer, to->buffer);
- to->state = from->state;
-}
-
-RegionPtr CreateUnclippedWinSize(WindowPtr pWin);
-
-RegionPtr
-CreateUnclippedWinSize (WindowPtr pWin)
-{
- RegionPtr pRgn;
- BoxRec box;
-
- box.x1 = pWin->drawable.x;
- box.y1 = pWin->drawable.y;
- box.x2 = pWin->drawable.x + (int) pWin->drawable.width;
- box.y2 = pWin->drawable.y + (int) pWin->drawable.height;
- pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
- if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen;
- pScreen = pWin->drawable.pScreen;
-
- REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
- - pWin->drawable.y);
- if (wBoundingShape (pWin))
- REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin));
- if (wClipShape (pWin))
- REGION_INTERSECT(pScreen, pRgn, pRgn, wClipShape (pWin));
- REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y);
- }
- return pRgn;
-}
-
-static void
-PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
- MultibufferPtr *pMultibuffer;
- MultibuffersPtr *ppMultibuffers;
- int nbuf;
-{
- GCPtr pGC;
- PixmapPtr pPrevPixmap, pNewPixmap;
- xRectangle clearRect;
- WindowPtr pWin;
- RegionPtr pExposed;
- int i;
- MultibufferPtr pPrevMultibuffer;
- XID graphicsExpose;
-
- UpdateCurrentTime ();
- for (i = 0; i < nbuf; i++)
- {
- pWin = ppMultibuffers[i]->pWindow;
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- pPrevMultibuffer =
- &ppMultibuffers[i]->buffers[ppMultibuffers[i]->displayedMultibuffer];
- pPrevPixmap = pPrevMultibuffer->pPixmap;
- pNewPixmap = pMultibuffer[i]->pPixmap;
- switch (ppMultibuffers[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
- case MultibufferUpdateActionBackground:
- SetupBackgroundPainter (pWin, pGC);
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = pPrevPixmap->drawable.width;
- clearRect.height = pPrevPixmap->drawable.height;
- (*pGC->ops->PolyFillRect) ((DrawablePtr)pPrevPixmap, pGC,
- 1, &clearRect);
- break;
- case MultibufferUpdateActionUntouched:
- /* copy the window to the pixmap that represents the
- * currently displayed buffer
- */
- if (pPrevMultibuffer->eventMask & ExposureMask)
- {
- graphicsExpose = TRUE;
- DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
- }
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- pExposed = (*pGC->ops->CopyArea)
- ((DrawablePtr) pWin,
- (DrawablePtr) pPrevPixmap,
- pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
-
- /* if we couldn't copy the whole window to the buffer,
- * send expose events (if any client wants them)
- */
- if (pPrevMultibuffer->eventMask & ExposureMask)
- { /* some client wants expose events */
- if (pExposed)
- {
- RegionPtr pWinSize;
-
- pWinSize = CreateUnclippedWinSize (pWin);
- /* pExposed is window-relative, but at this point
- * pWinSize is screen-relative. Make pWinSize be
- * window-relative so that region ops involving
- * pExposed and pWinSize behave sensibly.
- */
- REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
- -pWin->drawable.x, -pWin->drawable.y);
- REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
- pExposed, pWinSize);
- REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
- MultibufferExpose (pPrevMultibuffer, pExposed);
- REGION_DESTROY(pWin->drawable.pScreen, pExposed);
- }
- graphicsExpose = FALSE;
- DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
- }
- break; /* end case MultibufferUpdateActionUntouched */
-
- case MultibufferUpdateActionCopied:
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
- (DrawablePtr)pPrevPixmap, pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- break;
- } /* end switch on update action */
-
- /* display the new buffer */
- ValidateGC ((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC,
- 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- ppMultibuffers[i]->lastUpdate = currentTime;
- MultibufferUpdate (pMultibuffer[i],
- ppMultibuffers[i]->lastUpdate.milliseconds);
- AliasMultibuffer (ppMultibuffers[i],
- pMultibuffer[i] - ppMultibuffers[i]->buffers);
- FreeScratchGC (pGC);
- }
-}
-
-DrawablePtr
-GetBufferPointer (pWin, i)
- WindowPtr pWin;
- int i;
-{
- MultibuffersPtr pMultibuffers;
-
- if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))
- return NULL;
- return (DrawablePtr) pMultibuffers->buffers[i].pPixmap;
-}
-
-static Bool
-QueueDisplayRequest (client, activateTime)
- ClientPtr client;
- TimeStamp activateTime;
-{
- /* see xtest.c:ProcXTestFakeInput for code similar to this */
-
- if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
- {
- return FALSE;
- }
- /* swap the request back so we can simply re-execute it */
- if (client->swapped)
- {
- int n;
- REQUEST (xMbufDisplayImageBuffersReq);
-
- SwapRestL(stuff);
- swaps (&stuff->length, n);
- swaps (&stuff->minDelay, n);
- swaps (&stuff->maxDelay, n);
- }
- ResetCurrentRequest (client);
- client->sequence--;
- return TRUE;
-}
-
-
-/*
- * Deliver events to a buffer
- */
-
-static int
-DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
- MultibufferPtr pMultibuffer;
- xEvent *pEvents;
- int count;
- Mask filter;
-{
- int deliveries = 0, nondeliveries = 0;
- int attempt;
- OtherClients *other;
-
- /* if nobody wants the event, we're done */
- if (!((pMultibuffer->otherEventMask|pMultibuffer->eventMask) & filter))
- return 0;
-
- /* maybe send event to owner */
- if ((attempt = TryClientEvents(
- bClient(pMultibuffer), NULL, pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
- {
- if (attempt > 0)
- deliveries++;
- else
- nondeliveries--;
- }
-
- /* maybe send event to other clients */
- for (other = pMultibuffer->otherClients; other; other=other->next)
- {
- if ((attempt = TryClientEvents(
- rClient(other), NULL, pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
- {
- if (attempt > 0)
- deliveries++;
- else
- nondeliveries--;
- }
- }
- if (deliveries)
- return deliveries;
- return nondeliveries;
-}
-
-/*
- * Send Expose events to interested clients
- */
-
-void
-MultibufferExpose (pMultibuffer, pRegion)
- MultibufferPtr pMultibuffer;
- RegionPtr pRegion;
-{
- if (pRegion && !REGION_NIL(pRegion))
- {
- xEvent *pEvent;
- PixmapPtr pPixmap;
- xEvent *pe;
- BoxPtr pBox;
- int i;
- int numRects;
-
- pPixmap = pMultibuffer->pPixmap;
- REGION_TRANSLATE(pPixmap->drawable.pScreen, pRegion,
- -pPixmap->drawable.x, -pPixmap->drawable.y);
- /* XXX MultibufferExpose "knows" the region representation */
- numRects = REGION_NUM_RECTS(pRegion);
- pBox = REGION_RECTS(pRegion);
-
- pEvent = xalloc(numRects * sizeof(xEvent));
- if (pEvent) {
- pe = pEvent;
-
- for (i=1; i<=numRects; i++, pe++, pBox++)
- {
- pe->u.u.type = Expose;
- pe->u.expose.window = pPixmap->drawable.id;
- pe->u.expose.x = pBox->x1;
- pe->u.expose.y = pBox->y1;
- pe->u.expose.width = pBox->x2 - pBox->x1;
- pe->u.expose.height = pBox->y2 - pBox->y1;
- pe->u.expose.count = (numRects - i);
- }
- (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
- ExposureMask);
- xfree(pEvent);
- }
- }
-}
-
-/* send UpdateNotify event */
-void
-MultibufferUpdate (pMultibuffer, time2)
- MultibufferPtr pMultibuffer;
- CARD32 time2;
-{
- xMbufUpdateNotifyEvent event;
-
- event.type = MultibufferEventBase + MultibufferUpdateNotify;
- event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.timeStamp = time2;
- (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
- 1, (Mask)MultibufferUpdateNotifyMask);
-}
-
-/*
- * The sample implementation will never generate MultibufferClobberNotify
- * events
- */
-
-void
-MultibufferClobber (pMultibuffer)
- MultibufferPtr pMultibuffer;
-{
- xMbufClobberNotifyEvent event;
-
- event.type = MultibufferEventBase + MultibufferClobberNotify;
- event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.state = pMultibuffer->clobber;
- (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
- 1, (Mask)MultibufferClobberNotifyMask);
-}
-
-/*
- * make the resource id for buffer i refer to the window
- * drawable instead of the pixmap;
- */
-
-static void
-AliasMultibuffer (pMultibuffers, i)
- MultibuffersPtr pMultibuffers;
- int i;
-{
- MultibufferPtr pMultibuffer;
-
- if (i == pMultibuffers->displayedMultibuffer)
- return;
- /*
- * remove the old association
- */
- if (pMultibuffers->displayedMultibuffer >= 0)
- {
- pMultibuffer = &pMultibuffers->buffers[pMultibuffers->displayedMultibuffer];
- ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pMultibuffer->pPixmap);
- }
- /*
- * make the new association
- */
- pMultibuffer = &pMultibuffers->buffers[i];
- ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pMultibuffers->pWindow);
- pMultibuffers->displayedMultibuffer = i;
-}
-
-/*
- * free everything associated with multibuffering for this
- * window
- */
-
-void
-DestroyImageBuffers (pWin)
- WindowPtr pWin;
-{
- FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE);
- /* Zero out the window's pointer to the buffers so they won't be reused */
- dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, NULL);
-}
-
-/*
- * resize the buffers when the window is resized
- */
-
-static Bool
-MultibufferPositionWindow (pWin, x, y)
- WindowPtr pWin;
- int x, y;
-{
- ScreenPtr pScreen;
- MultibufferScreenPtr pMultibufferScreen;
- MultibuffersPtr pMultibuffers;
- MultibufferPtr pMultibuffer;
- int width, height;
- int i;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- PixmapPtr pPixmap;
- GCPtr pGC;
- int savewidth, saveheight;
- xRectangle clearRect;
- Bool clear;
-
- pScreen = pWin->drawable.pScreen;
- pMultibufferScreen = (MultibufferScreenPtr) dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey);
- (*pMultibufferScreen->PositionWindow) (pWin, x, y);
-
- /* if this window is not multibuffered, we're done */
- if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))
- return TRUE;
-
- /* if new size is same as old, we're done */
- if (pMultibuffers->width == pWin->drawable.width &&
- pMultibuffers->height == pWin->drawable.height)
- return TRUE;
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- dx = pWin->drawable.x - pMultibuffers->x;
- dy = pWin->drawable.x - pMultibuffers->y;
- dw = width - pMultibuffers->width;
- dh = height - pMultibuffers->height;
- GravityTranslate (0, 0, -dx, -dy, dw, dh,
- pWin->bitGravity, &destx, &desty);
-
- /* if the window grew, remember to paint the window background,
- * and maybe send expose events, for the new areas of the buffers
- */
- clear = pMultibuffers->width < width || pMultibuffers->height < height ||
- pWin->bitGravity == ForgetGravity;
-
- sourcex = 0;
- sourcey = 0;
- savewidth = pMultibuffers->width;
- saveheight = pMultibuffers->height;
- /* clip rectangle to source and destination */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
- }
- if (destx + savewidth > width)
- savewidth = width - destx;
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
- }
- if (desty + saveheight > height)
- saveheight = height - desty;
-
- pMultibuffers->width = width;
- pMultibuffers->height = height;
- pMultibuffers->x = pWin->drawable.x;
- pMultibuffers->y = pWin->drawable.y;
-
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
- if (clear)
- {
- SetupBackgroundPainter (pWin, pGC);
- clearRect.x = 0;
- clearRect.y = 0;
- clearRect.width = width;
- clearRect.height = height;
- }
- for (i = 0; i < pMultibuffers->numMultibuffer; i++)
- {
- pMultibuffer = &pMultibuffers->buffers[i];
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pWin->drawable.depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- DestroyImageBuffers (pWin);
- break;
- }
- ValidateGC ((DrawablePtr)pPixmap, pGC);
- /*
- * I suppose this could avoid quite a bit of work if
- * it computed the minimal area required.
- */
- if (clear)
- (*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC, 1, &clearRect);
- if (pWin->bitGravity != ForgetGravity)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr)pMultibuffer->pPixmap,
- (DrawablePtr)pPixmap, pGC,
- sourcex, sourcey, savewidth, saveheight,
- destx, desty);
- }
- pPixmap->drawable.id = pMultibuffer->pPixmap->drawable.id;
- (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
- pMultibuffer->pPixmap = pPixmap;
- if (i != pMultibuffers->displayedMultibuffer)
- {
- ChangeResourceValue (pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- return TRUE;
-}
-
-/* Resource delete func for MultibufferDrawableResType */
-/*ARGSUSED*/
-static int
-MultibufferDrawableDelete (value, id)
- pointer value;
- XID id;
-{
- DrawablePtr pDrawable = (DrawablePtr)value;
- WindowPtr pWin;
- MultibuffersPtr pMultibuffers;
- PixmapPtr pPixmap;
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDrawable;
- pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey);
- pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap;
- }
- else
- {
- pPixmap = (PixmapPtr) pDrawable;
- }
- (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
- return Success;
-}
-
-/* Resource delete func for MultibufferResType */
-/*ARGSUSED*/
-static int
-MultibufferDelete (value, id)
- pointer value;
- XID id;
-{
- MultibufferPtr pMultibuffer = (MultibufferPtr)value;
- MultibuffersPtr pMultibuffers;
-
- pMultibuffers = pMultibuffer->pMultibuffers;
- if (--pMultibuffers->refcnt == 0)
- {
- FreeResourceByType (pMultibuffers->pWindow->drawable.id,
- MultibuffersResType, TRUE);
- xfree (pMultibuffers);
- }
- return Success;
-}
-
-/* Resource delete func for MultibuffersResType */
-/*ARGSUSED*/
-static int
-MultibuffersDelete (value, id)
- pointer value;
- XID id;
-{
- MultibuffersPtr pMultibuffers = (MultibuffersPtr)value;
- int i;
-
- if (pMultibuffers->refcnt == pMultibuffers->numMultibuffer)
- {
- for (i = pMultibuffers->numMultibuffer; --i >= 0; )
- FreeResource (pMultibuffers->buffers[i].pPixmap->drawable.id, 0);
- }
- return Success;
-}
-
-/* Resource delete func for OtherClientResType */
-static int
-OtherClientDelete (value, id)
- pointer value;
- XID id;
-{
- MultibufferPtr pMultibuffer = (MultibufferPtr)value;
- OtherClientsPtr other, prev;
-
- prev = 0;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- {
- if (other->resource == id)
- {
- if (prev)
- prev->next = other->next;
- else
- pMultibuffer->otherClients = other->next;
- xfree (other);
- RecalculateMultibufferOtherEvents (pMultibuffer);
- break;
- }
- prev = other;
- }
- return Success;
-}
-
-static int
-EventSelectForMultibuffer (pMultibuffer, client, mask)
- MultibufferPtr pMultibuffer;
- ClientPtr client;
- Mask mask;
-{
- OtherClientsPtr other;
-
- if (mask & ~ValidEventMasks)
- {
- client->errorValue = mask;
- return BadValue;
- }
- if (bClient (pMultibuffer) == client)
- {
- pMultibuffer->eventMask = mask;
- }
- else /* some other client besides the creator wants events */
- {
- for (other = pMultibuffer->otherClients; other; other = other->next)
- {
- if (SameClient (other, client))
- {
- if (mask == 0)
- {
- FreeResource (other->resource, RT_NONE);
- break;
- }
- other->mask = mask;
- break;
- }
- }
- if (!other)
- { /* new client that never selected events on this buffer before */
- other = xalloc (sizeof (OtherClients));
- if (!other)
- return BadAlloc;
- other->mask = mask;
- other->resource = FakeClientID (client->index);
- if (!AddResource (other->resource, OtherClientResType, (pointer) pMultibuffer))
- {
- xfree (other);
- return BadAlloc;
- }
- other->next = pMultibuffer->otherClients;
- pMultibuffer->otherClients = other;
- }
- RecalculateMultibufferOtherEvents (pMultibuffer);
- }
- return (client->noClientException);
-}
-
-/* or together all the otherClients event masks */
-static void
-RecalculateMultibufferOtherEvents (pMultibuffer)
- MultibufferPtr pMultibuffer;
-{
- Mask otherEventMask;
- OtherClients *other;
-
- otherEventMask = 0L;
- for (other = pMultibuffer->otherClients; other; other = other->next)
- otherEventMask |= other->mask;
- pMultibuffer->otherEventMask = otherEventMask;
-}
-
-/* add milliseconds to a timestamp, handling overflow */
-static void
-BumpTimeStamp (ts, inc)
-TimeStamp *ts;
-CARD32 inc;
-{
- CARD32 newms;
-
- newms = ts->milliseconds + inc;
- if (newms < ts->milliseconds)
- ts->months++;
- ts->milliseconds = newms;
-}
diff --git a/xorg-server/Xext/mbufbf.c b/xorg-server/Xext/mbufbf.c
deleted file mode 100644
index 7d9d60a4f..000000000
--- a/xorg-server/Xext/mbufbf.c
+++ /dev/null
@@ -1,1007 +0,0 @@
-/*
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#include "validate.h"
-#include "globals.h"
-#include <sys/time.h>
-
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#define _MULTIBUF_BUFFER_
-#include <X11/extensions/multibufst.h>
-
-/*
-Support for doublebuffer hardare
-
-This code is designed to support doublebuffer hardware where the
-displayed buffer is selected on a per-pixel basis by an additional bit
-plane, called the select plane. It could probably be easily modified
-to work with systems that use window-id planes.
-
-This is done by creating a new drawable type, DRAWABLE_BUFFER. The
-type has the same exact layout as a window drawable. Your code should
-treat a DRAWABLE_BUFFER the same as it would tread a DRAWABLE_WINDOW
-when handling the gc drawing functions. In addition, PaintWindowBackground,
-CopyWindow, and all of the gc drawing functions to be able to draw into both
-framebuffers. Which framebuffer to draw into is selected by the contents of
- pWin->devPrivates[frameWindowPrivateIndex].
-The content of the devPrivate is either from frameBuffer[0] or
-frameBuffer[1], depending on which buffer is being drawn into. When
- pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[0],
-the functions should draw into the front framebuffer. When
- pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[1],
-the functions should draw into the back framebuffer.
-
-In addition, you need to provide a function that allows you to copy
-bits between the buffers (optional since CopyArea can be used) and a
-function that draws into the select plane. Then, you need to register
-your functions and other information, by calling:
-
-void
-RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
- CopyBufferBitsFunc, DrawSelectPlaneFunc)
- int nInfo;
- xMbufBufferInfo *pInfo;
- DevUnion *frameBuffer;
- DevUnion selectPlane;
-
-"pInfo" is an array indicating which visuals and depths that double
-buffering is supported on. "nInfo" is the length of the array.
-
-"frameBuffer" is array of length 2. The contents of the array element
-is ddx-specific. The content of frameBuffer[0] should, when placed in
-the window private, indicate that framebuffer 0 should be drawn into.
-The contents of frameBuffer[1], when placed into the window private,
-should indicate that framebuffer 1 should be drawn into.
-
-"selectPlane" is ddx-specific. It should contain information
-neccessary for your displayProc to access the select plane.
-It is passed to DrawSelectPlaneFunc.
-
-"CopyBufferBitsFunc" is a ddx-specific function that copies from one
-buffer of a multibuffered window to another buffer. If the CopyBufferBitsFunc
-is NULL, a default function will be used that calls pScreen->CopyArea.
-
- void CopyBufferBitsFunc(pMBWindow, srcBufferNum, dstBufferNum)
- mbufWindowPtr pMBWindow;
- int srcBufferNum, dstBufferNum;
-
-"DrawSelectPlaneFunc" is a ddx-specific function that fills the
-regions "prgn" of select plane with the value "bufferNum". If
-selectPlane is a DrawablePtr (such as a PixmapPtr), you can pass
-NULL for DrawSelectPlaneFunc, a default function will be used that
-calls FillRectangle on the selectPlane.
-
- void DrawSelectPlaneFunc(pScreen, selectPlane, prgn, bufferNum)
- ScreenPtr pScreen;
- DevUnion selectPlane;
- RegionPtr prgn;
- long bufferNum;
-
-...
-...
-...
-
-*/
-
-#define MAX_BUFFERS 2 /* Only supports 2 buffers */
-#define FRONT_BUFFER 0
-#define BACK_BUFFER 1
-
-
-/* Buffer drawables have the same structure as window drawables */
-typedef WindowRec BufferRec;
-typedef WindowPtr BufferPtr;
-
-
-/*
- * Call RegisterHdwrBuffer for every screen that has doublebuffer hardware.
- */
-
-static int bufNumInfo[MAXSCREENS];
-static xMbufBufferInfo *bufInfo[MAXSCREENS];
-static DevUnion *bufFrameBuffer[MAXSCREENS];
-static DevUnion bufselectPlane[MAXSCREENS];
-static void (* bufCopyBufferBitsFunc[MAXSCREENS])();
-static void (* bufDrawSelectPlaneFunc[MAXSCREENS])();
-
-static Bool bufMultibufferInit();
-
-
-void
-RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
- CopyBufferBitsFunc, DrawSelectPlaneFunc)
- ScreenPtr pScreen;
- int nInfo;
- xMbufBufferInfo *pInfo;
- DevUnion *frameBuffer;
- DevUnion selectPlane;
- void (* CopyBufferBitsFunc)();
- void (* DrawSelectPlaneFunc)();
-{
- bufNumInfo[pScreen->myNum] = nInfo;
- bufInfo[pScreen->myNum] = pInfo;
- bufFrameBuffer[pScreen->myNum] = frameBuffer;
- bufselectPlane[pScreen->myNum] = selectPlane;
-
- bufCopyBufferBitsFunc[pScreen->myNum] = CopyBufferBitsFunc;
- bufDrawSelectPlaneFunc[pScreen->myNum] = DrawSelectPlaneFunc;
-
- /* Register ourselves with device-independent multibuffers code */
- RegisterMultibufferInit(pScreen, bufMultibufferInit);
-}
-
-
-/*
- * Called by Multibuffer extension initialization.
- * Initializes mbufScreenRec and its devPrivate.
- */
-
-static Bool NoopDDA_True() { return TRUE; }
-static Bool bufPositionWindow();
-static int bufCreateImageBuffers();
-static void bufDestroyImageBuffers();
-static void bufDisplayImageBuffers();
-static void bufClearImageBufferArea();
-static void bufDestroyBuffer();
-static void bufCopyBufferBits();
-static void bufDrawSelectPlane();
-static void bufWrapScreenFuncs();
-static void bufResetProc();
-
-static void bufPostValidateTree();
-static void bufClipNotify();
-static void bufWindowExposures();
-static Bool bufChangeWindowAttributes();
-static void bufClearToBackground();
-static void bufCopyWindow();
-
-static Bool
-bufMultibufferInit(pScreen, pMBScreen)
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
-{
- mbufBufferPrivPtr pMBPriv;
- BoxRec box;
-
- /* Multibuffer info */
- pMBScreen->nInfo = bufNumInfo[pScreen->myNum];
- pMBScreen->pInfo = bufInfo[pScreen->myNum];
-
- /* Hooks */
- pMBScreen->CreateImageBuffers = bufCreateImageBuffers;
- pMBScreen->DestroyImageBuffers = bufDestroyImageBuffers;
- pMBScreen->DisplayImageBuffers = bufDisplayImageBuffers;
- pMBScreen->ClearImageBufferArea = bufClearImageBufferArea;
- pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
- pMBScreen->ChangeBufferAttributes = NoopDDA_True;
- pMBScreen->DeleteBufferDrawable = bufDestroyBuffer;
- pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
- pMBScreen->ResetProc = bufResetProc;
- /* Create devPrivate part */
- pMBPriv = xalloc(sizeof *pMBPriv);
- if (!pMBPriv)
- return (FALSE);
-
- pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
- pMBPriv->frameBuffer = bufFrameBuffer[pScreen->myNum];
- pMBPriv->selectPlane = bufselectPlane[pScreen->myNum];
-
- /*
- * Initializing the subtractRgn to the screen area will ensure that
- * the selectPlane will get cleared on the first PostValidateTree.
- */
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
-
- pMBPriv->rgnChanged = TRUE;
- REGION_INIT(pScreen, &pMBPriv->backBuffer, &box, 1);
- REGION_INIT(pScreen, &pMBPriv->subtractRgn, &box, 1);
- REGION_NULL(pScreen, &pMBPriv->unionRgn);
-
- /* Misc functions */
- pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum];
- pMBPriv->DrawSelectPlane = bufDrawSelectPlaneFunc[pScreen->myNum];
-
- if (!pMBPriv->CopyBufferBits)
- pMBPriv->CopyBufferBits = bufCopyBufferBits;
-
- if (!pMBPriv->DrawSelectPlane)
- pMBPriv->DrawSelectPlane = bufDrawSelectPlane;
-
- /* screen functions */
- pMBPriv->funcsWrapped = 0;
- pMBPriv->inClearToBackground = FALSE;
- pMBPriv->WindowExposures = NULL;
- pMBPriv->CopyWindow = NULL;
- pMBPriv->ClearToBackground = NULL;
- pMBPriv->ClipNotify = NULL;
- pMBPriv->ChangeWindowAttributes = NULL;
-
- /* Start out wrapped to clear select plane */
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
- return TRUE;
-}
-
-static void
-UpdateBufferFromWindow(pBuffer, pWin)
- BufferPtr pBuffer;
- WindowPtr pWin;
-{
- pBuffer->drawable.x = pWin->drawable.x;
- pBuffer->drawable.y = pWin->drawable.y;
- pBuffer->drawable.width = pWin->drawable.width;
- pBuffer->drawable.height = pWin->drawable.height;
-
- pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- /* Update for PaintWindowBackground */
- pBuffer->parent = pWin->parent;
-
- /*
- * Make the borderClip the same as the clipList so
- * NotClippedByChildren comes out with just clipList.
- */
-
- pBuffer->clipList = pWin->clipList;
- pBuffer->borderClip = pWin->clipList;
- pBuffer->winSize = pWin->winSize;
- pBuffer->borderSize = pWin->borderSize;
-
- pBuffer->origin = pWin->origin;
-}
-
-static BufferPtr
-bufCreateBuffer(pScreen, pWin, bufferNum)
- ScreenPtr pScreen;
- WindowPtr pWin;
- int bufferNum;
-{
- mbufBufferPrivPtr pMBPriv;
- DevUnion *devPrivates;
- BufferPtr pBuffer;
- int i;
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- pBuffer = AllocateWindow(pWin->drawable.pScreen);
- if (!pBuffer)
- return (NULL);
-
- /* XXX- Until we know what is needed, copy everything. */
- devPrivates = pBuffer->devPrivates;
- *pBuffer = *pWin;
- pBuffer->devPrivates = devPrivates;
-
- pBuffer->drawable.type = DRAWABLE_BUFFER;
- pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pBuffer->nextSib = NULL;
- pBuffer->prevSib = NULL;
- pBuffer->firstChild = NULL;
- pBuffer->lastChild = NULL;
-
- /* XXX - Need to call pScreen->CreateWindow for tile/stipples
- * or should I just copy the devPrivates?
- */
-
- for (i=0; i < pScreen->WindowPrivateLen; i++)
- pBuffer->devPrivates[i] = pWin->devPrivates[i];
-
- pBuffer->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[bufferNum];
-
- return pBuffer;
-}
-
-static void
-bufDestroyBuffer(pDrawable)
- DrawablePtr pDrawable;
-{
- xfree(pDrawable);
-}
-
-/*ARGSUSED*/
-static int
-bufCreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- int i;
-
- pScreen = pWin->drawable.pScreen;
- pMBScreen = MB_SCREEN_PRIV(pScreen);
- pMBWindow = MB_WINDOW_PRIV(pWin);
-
- pMBWindow->devPrivate.ptr = (pointer) REGION_CREATE(pScreen, 0,0);
- if (!pMBWindow->devPrivate.ptr)
- return(0);
- REGION_COPY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr,
- &pWin->clipList);
-
- for (i = 0; i < nbuf; i++)
- {
- pMBBuffer = pMBWindow->buffers + i;
- pMBBuffer->pDrawable = (DrawablePtr) bufCreateBuffer(pScreen,pWin,i);
-
- if (!pMBBuffer->pDrawable)
- break;
-
- if (!AddResource (ids[i], MultibufferDrawableResType,
- (pointer) pMBBuffer->pDrawable))
- {
- bufDestroyBuffer((BufferPtr) pMBBuffer->pDrawable);
- break;
- }
- pMBBuffer->pDrawable->id = ids[i];
-
- /*
- * If window is already mapped, generate exposures and
- * clear the area of the newly buffers.
- */
-
- if ((pWin->realized) && (i != pMBWindow->displayedMultibuffer))
- (* pMBScreen->ClearImageBufferArea)(pMBBuffer, 0,0, 0,0, TRUE);
- }
-
- return i;
-}
-
-static void
-bufDestroyImageBuffers(pWin)
- WindowPtr pWin;
-{
- ScreenPtr pScreen;
- mbufWindowPtr pMBWindow;
-
- pScreen = pWin->drawable.pScreen;
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- /*
- * if the backbuffer is currently being displayed, move the bits
- * to the frontbuffer and display it instead.
- */
-
- if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER))
- {
- (* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER);
- REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer,
- &pMBPriv->backBuffer, &pWin->clipList);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &pWin->clipList, FRONT_BUFFER);
- }
-
- /* Switch window rendering to front buffer */
- pWin->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[FRONT_BUFFER];
-
- REGION_DESTROY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr);
- pMBWindow->devPrivate.ptr = NULL;
- }
-}
-
-/*
- * Can be replaced by pScreen->ClearToBackground if pBuffer->eventMask
- * and wOtherEventsMasks(pBuffer) were setup.
- */
-
-static void
-bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures)
- mbufBufferPtr pMBBuffer;
- short x,y;
- unsigned short w,h;
- Bool generateExposures;
-{
- BoxRec box;
- RegionRec reg;
- RegionPtr pBSReg = NullRegion;
- ScreenPtr pScreen;
- BoxPtr extents;
- int x1, y1, x2, y2;
- BufferPtr pBuffer;
-
- pBuffer = (BufferPtr) pMBBuffer->pDrawable;
- /* compute everything using ints to avoid overflow */
-
- x1 = pBuffer->drawable.x + x;
- y1 = pBuffer->drawable.y + y;
- if (w)
- x2 = x1 + (int) w;
- else
- x2 = x1 + (int) pBuffer->drawable.width - (int) x;
- if (h)
- y2 = y1 + h;
- else
- y2 = y1 + (int) pBuffer->drawable.height - (int) y;
-
- extents = &pBuffer->clipList.extents;
-
- /* clip the resulting rectangle to the window clipList extents. This
- * makes sure that the result will fit in a box, given that the
- * screen is < 32768 on a side.
- */
-
- if (x1 < extents->x1)
- x1 = extents->x1;
- if (x2 > extents->x2)
- x2 = extents->x2;
- if (y1 < extents->y1)
- y1 = extents->y1;
- if (y2 > extents->y2)
- y2 = extents->y2;
-
- if (x2 <= x1 || y2 <= y1)
- {
- x2 = x1 = 0;
- y2 = y1 = 0;
- }
-
- box.x1 = x1;
- box.x2 = x2;
- box.y1 = y1;
- box.y2 = y2;
-
- pScreen = pBuffer->drawable.pScreen;
- REGION_INIT(pScreen, &reg, &box, 1);
-
- REGION_INTERSECT(pScreen, &reg, &reg, &pBuffer->clipList);
- if (pBuffer->backgroundState != None)
- miPaintWindow(pBuffer, &reg, PW_BACKGROUND);
- if (generateExposures)
- MultibufferExpose(pMBBuffer, &reg);
-#ifdef _notdef
- /* XXBS - This is the original miClearToBackground code.
- * WindowExposures needs to be called (or the functionality emulated)
- * in order for backingStore to work, but first, pBuffer->eventMask
- * and wOtherEventsMasks(pBuffer) need to be setup correctly.
- */
-
- if (generateExposures)
- (*pScreen->WindowExposures)(pBuffer, &reg, pBSReg);
- else if (pBuffer->backgroundState != None)
- miPaintWindow(pBuffer, &reg, PW_BACKGROUND);
-#endif
- REGION_UNINIT(pScreen, &reg);
- if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
-}
-
-static void
-bufWrapScreenFuncs(pScreen)
- ScreenPtr pScreen;
-{
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClipNotify, bufClipNotify);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,WindowExposures,bufWindowExposures);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ChangeWindowAttributes, bufChangeWindowAttributes);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClearToBackground,bufClearToBackground);
- WRAP_SCREEN_FUNC(pScreen,pMBPriv,CopyWindow,bufCopyWindow);
-}
-
-static void
-bufResetProc(pScreen)
- ScreenPtr pScreen;
-{
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- /*
- * frameBuffer, selectPlane, and pInfo should be freed by
- * whoever called RegisterDoubleBufferHardware
- */
-
- REGION_UNINIT(pScreen, &pMBPriv->backBuffer);
- REGION_UNINIT(pScreen, &pMBPriv->subtractRgn);
- REGION_UNINIT(pScreen, &pMBPriv->unionRgn);
- xfree(pMBPriv);
-}
-
-/*---------------------------------------------------------------------------*/
-
-/*
- * Used if CopyBufferBitsFunc is not provided when registering.
- * This should work for everybody since CopyArea needs to support
- * copying between buffers anyway.
- */
-
-static void
-bufCopyBufferBits(pMBWindow, srcBufferNum, dstBufferNum)
- mbufWindowPtr pMBWindow;
- int srcBufferNum, dstBufferNum;
-{
- DrawablePtr pSrcBuffer, pDstBuffer;
- GCPtr pGC;
-
- pSrcBuffer = pMBWindow->buffers[srcBufferNum].pDrawable;
- pDstBuffer = pMBWindow->buffers[dstBufferNum].pDrawable;
-
- pGC = GetScratchGC (pDstBuffer->depth, pDstBuffer->pScreen);
- if (!pGC)
- return;
-
- ValidateGC (pDstBuffer, pGC);
- (* pGC->ops->CopyArea) (pSrcBuffer, pDstBuffer, pGC,
- 0,0, pDstBuffer->width, pDstBuffer->height, 0,0);
- FreeScratchGC (pGC);
-}
-
-/*
- * Used if DrawSelectPlanFunc is not provided for when registering.
- * However, it only works if selectPlane.ptr is a drawable. Also
- * assumes that painting with color 0 selects the front buffer,
- * while color 1 selects the back buffer.
- */
-
-static void
-bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
- ScreenPtr pScreen;
- DevUnion selectPlane;
- RegionPtr prgn;
- long bufferNum;
-{
- DrawablePtr pDrawable;
- GCPtr pGC;
- int i;
- BoxPtr pbox;
- xRectangle *prect;
- int numRects;
- XID value;
-
- if (REGION_NUM_RECTS(prgn) == 0)
- return;
-
- pDrawable = (DrawablePtr) selectPlane.ptr;
- pGC = GetScratchGC (pDrawable->depth, pScreen);
- if (!pGC)
- return;
-
- prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
- if (!prect)
- {
- FreeScratchGC(pGC);
- return;
- }
-
- value = (XID) bufferNum;
- DoChangeGC(pGC, GCForeground, &value, 0);
- ValidateGC(pDrawable, pGC);
-
- numRects = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
- for (i= numRects; --i >= 0; pbox++, prect++)
- {
- prect->x = pbox->x1;
- prect->y = pbox->y1;
- prect->width = pbox->x2 - pbox->x1;
- prect->height = pbox->y2 - pbox->y1;
- }
- prect -= numRects;
- (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
-
- xfree(prect);
- FreeScratchGC (pGC);
-}
-
-
-static void
-bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
- ScreenPtr pScreen;
- mbufBufferPtr *ppMBBuffer;
- mbufWindowPtr *ppMBWindow;
- int nbuf;
-{
- WindowPtr pWin;
- BufferPtr pPrevBuffer, pNewBuffer;
- int i, number;
- mbufBufferPrivPtr pMBPriv;
- mbufBufferPtr pPrevMBBuffer;
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- for (i = 0; i < nbuf; i++)
- {
- number = ppMBBuffer[i]->number; /* 0=frontbuffer, 1=backbuffer */
- pWin = ppMBWindow[i]->pWindow;
- pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
-
- pPrevBuffer = (BufferPtr) pPrevMBBuffer->pDrawable;
- pNewBuffer = (BufferPtr) ppMBBuffer[i]->pDrawable;
-
- if (pPrevBuffer != pNewBuffer)
- {
- RegionPtr backBuffer = &pMBPriv->backBuffer;
-
- /*
- * Update the select plane and the backBuffer region.
- */
-
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &pWin->clipList, number);
-
- if (number == BACK_BUFFER)
- REGION_UNION(pScreen, backBuffer, backBuffer,
- &pWin->clipList);
- else
- REGION_SUBTRACT(pScreen, backBuffer, backBuffer,
- &pWin->clipList);
-
- /* Switch which framebuffer the window draws into */
- pWin->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[number];
- }
-
- switch (ppMBWindow[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
- case MultibufferUpdateActionBackground:
- (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
- (pPrevMBBuffer, 0,0, 0,0, FALSE);
- break;
- case MultibufferUpdateActionUntouched:
- break;
- case MultibufferUpdateActionCopied:
- if (pPrevBuffer != pNewBuffer)
- {
- (* pMBPriv->CopyBufferBits) (ppMBWindow[i],
- ppMBBuffer[i]->number, pPrevMBBuffer->number);
- }
- break;
- }
- }
-}
-
-/* Updates the backBuffer region and paints the selectPlane. */
-
-static void
-bufPostValidateTree(pParent, pChild, kind)
- WindowPtr pParent, pChild;
- VTKind kind;
-{
- ScreenPtr pScreen;
- mbufBufferPrivPtr pMBPriv;
-
- if (pParent)
- pScreen = pParent->drawable.pScreen;
- else if (pChild)
- pScreen = pChild->drawable.pScreen;
- else
- return; /* Hopeless */
-
- pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
- if (pScreen->PostValidateTree)
- (* pScreen->PostValidateTree)(pParent, pChild, kind);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
-
- /* Does backBuffer need to change? */
- if (pMBPriv->rgnChanged)
- {
- RegionRec exposed;
- RegionPtr pSubtractRgn, pUnionRgn;
- Bool overlap;
-
- pMBPriv->rgnChanged = FALSE;
-
- pSubtractRgn = &pMBPriv->subtractRgn;
- pUnionRgn = &pMBPriv->unionRgn;
- REGION_VALIDATE(pScreen, pSubtractRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: subtractRgn overlaps");
-#endif
- REGION_VALIDATE(pScreen, pUnionRgn, &overlap);
-#ifdef DEBUG
- if (overlap)
- FatalError("bufPostValidateTree: unionRgn overlaps");
-#endif
-
- /* Update backBuffer: subtract must come before union */
- REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pSubtractRgn);
- REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
- pUnionRgn);
-
- /* Paint gained and lost backbuffer areas in select plane */
- REGION_NULL(pScreen, &exposed);
- REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, FRONT_BUFFER);
-
- REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn);
- (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
- &exposed, BACK_BUFFER);
-
- REGION_UNINIT(pScreen, &exposed);
- REGION_EMPTY(pScreen, pSubtractRgn);
- REGION_EMPTY(pScreen, pUnionRgn);
- }
-}
-
-/*
- * If the window is multibuffered and displaying the backbuffer,
- * add the old clipList to the subtractRgn and add the new clipList
- * to the unionRgn. PostValidateTree will use subtractRgn and unionRgn
- * to update the backBuffer region and the selectPlane.
- *
- * Copy changes to the window structure into the buffers.
- * Send ClobberNotify events.
- */
-
-static void
-bufClipNotify(pWin, dx,dy)
- WindowPtr pWin;
- int dx,dy;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- mbufWindowPtr pMBWindow;
- int i;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify)(pWin, dx,dy);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr;
-
- if (! REGION_EQUAL(pScreen, pOldClipList, &pWin->clipList))
- {
- if (pMBWindow->displayedMultibuffer == BACK_BUFFER)
- {
- pMBPriv->rgnChanged = TRUE;
- REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList);
- REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList);
- }
-
- REGION_COPY(pScreen, pOldClipList,&pWin->clipList);
- }
-
- /* Update buffer x,y,w,h, and clipList */
- for (i=0; i<pMBWindow->numMultibuffer; i++)
- {
- mbufBufferPtr pMBBuffer = pMBWindow->buffers + i;
- if (pMBBuffer->clobber != pWin->visibility)
- {
- pMBBuffer->clobber = pWin->visibility;
- MultibufferClobber(pMBBuffer);
- }
- UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin);
- }
- }
-}
-
-/*
- * Updates buffer's background fields when the window's changes.
- * This is necessary because miPaintWindow is used to paint the buffer.
- *
- * XXBS - Backingstore state will have be tracked too if it is supported.
- */
-
-static Bool
-bufChangeWindowAttributes(pWin, mask)
- WindowPtr pWin;
- unsigned long mask;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- mbufWindowPtr pMBWindow;
- Bool ret;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
- ret = (* pScreen->ChangeWindowAttributes)(pWin, mask);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
-
- if (pMBWindow = MB_WINDOW_PRIV(pWin))
- {
- if (mask & (CWBackPixmap | CWBackPixel))
- {
- BufferPtr pBuffer;
- int i;
-
- for (i=0; i<pMBWindow->displayedMultibuffer; i++)
- {
- pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable;
- pBuffer->backgroundState = pWin->backgroundState;
- pBuffer->background = pWin->background;
- }
- }
- }
- return ret;
-}
-
-/*
- * Send exposures and clear the background for a buffer whenever
- * its corresponding window is exposed, except when called by
- * ClearToBackground.
- */
-
-static void
-bufWindowExposures(pWin, prgn, other_exposed)
- WindowPtr pWin;
- RegionPtr prgn, other_exposed;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- RegionRec tmp_rgn;
- int i;
- Bool handleBuffers;
-
- handleBuffers = (!pMBPriv->inClearToBackground) &&
- (pWin->drawable.type == DRAWABLE_WINDOW) &&
- pMBWindow && (prgn && !REGION_NIL(prgn));
-
- /* miWindowExposures munges prgn and other_exposed. */
- if (handleBuffers)
- {
- REGION_NULL(pScreen, &tmp_rgn);
- REGION_COPY(pScreen, &tmp_rgn, prgn);
- }
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
- (* pScreen->WindowExposures) (pWin, prgn, other_exposed);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
-
- if (!handleBuffers)
- return;
-
- /*
- * Send expose events to all clients. Paint the exposed region for all
- * buffers except the displayed buffer since it is handled when the
- * window is painted.
- *
- * XXBS - Will have to be re-written to handle BackingStore on buffers.
- */
-
- for (i=0; i<pMBWindow->numMultibuffer; i++)
- {
- mbufBufferPtr pMBBuffer;
- BufferPtr pBuffer;
-
- pMBBuffer = pMBWindow->buffers + i;
- pBuffer = (BufferPtr) pMBBuffer->pDrawable;
-
- if (i != pMBWindow->displayedMultibuffer)
- miPaintWindow(pBuffer, &tmp_rgn, PW_BACKGROUND);
- if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask)
- MultibufferExpose(pMBBuffer, &tmp_rgn);
- }
-
- REGION_UNINIT(pScreen, &tmp_rgn);
-}
-
-/*
- * Set ``inClearToBackground'' so that WindowExposures does not attempt
- * to send expose events or clear the background on the buffers.
- */
-
-static void
-bufClearToBackground(pWin, x,y,w,h, sendExpose)
- WindowPtr pWin;
- int x,y, w,h;
- Bool sendExpose;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
-
- pMBPriv->inClearToBackground = TRUE;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
- (* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
-
- pMBPriv->inClearToBackground = FALSE;
-}
-
-/*
- * Move bits in both buffers. It does this by calling pScreen->CopyWindow
- * twice, once with the root window's devPrivate[frameWindowPrivateIndex]
- * pointing to the frontbuffer pixmap and once with it pointed to the
- * backbuffer pixmap. It does this if there are *any* existing multibuffered
- * window... a possible optimization is to copy the backbuffer only if this
- * window or its inferiors are multibuffered. May be faster, maybe not.
- *
- * XXX - Only works if your CopyWindow checks the root window's devPrivate
- * to see which buffer to draw into. Works for cfbPaintWindow.
- */
-
-/*ARGSUSED*/
-static void
-bufCopyWindow(pWin, ptOldOrg, prgnSrc)
- WindowPtr pWin;
- DDXPointRec ptOldOrg;
- RegionPtr prgnSrc;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
- WindowPtr pwinroot;
- DevUnion save;
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
-
- pwinroot = WindowTable[pScreen->myNum];
- save = pwinroot->devPrivates[frameWindowPrivateIndex];
-
- /*
- * Copy front buffer
- */
-
- pwinroot->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[FRONT_BUFFER];
- (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
-
- /*
- * Copy back buffer
- */
-
- /* CopyWindow translates prgnSrc... translate it back for 2nd call. */
- REGION_TRANSLATE(pScreen, prgnSrc,
- ptOldOrg.x - pWin->drawable.x,
- ptOldOrg.y - pWin->drawable.y);
- pwinroot->devPrivates[frameWindowPrivateIndex] =
- pMBPriv->frameBuffer[BACK_BUFFER];
- (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
-
- pwinroot->devPrivates[frameWindowPrivateIndex] = save;
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
-}
diff --git a/xorg-server/Xext/mbufpx.c b/xorg-server/Xext/mbufpx.c
deleted file mode 100644
index 8421ba9eb..000000000
--- a/xorg-server/Xext/mbufpx.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/************************************************************
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "opaque.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#include <sys/time.h>
-
-#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
-#define _MULTIBUF_PIXMAP_
-#include <X11/extensions/multibufst.h>
-
-
-static Bool NoopDDA_True() { return TRUE; }
-
-static Bool pixPositionWindow();
-static int pixCreateImageBuffers();
-static void pixDisplayImageBuffers();
-static void pixClearImageBufferArea();
-static void pixDeleteBufferDrawable();
-static void pixWrapScreenFuncs();
-static void pixResetProc();
-
-Bool
-pixMultibufferInit(pScreen, pMBScreen)
- ScreenPtr pScreen;
- mbufScreenPtr pMBScreen;
-{
- int i, j, k;
- xMbufBufferInfo *pInfo;
- int nInfo;
- DepthPtr pDepth;
- mbufPixmapPrivPtr pMBPriv;
-
- pMBScreen->CreateImageBuffers = pixCreateImageBuffers;
- pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA;
- pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers;
- pMBScreen->ClearImageBufferArea = pixClearImageBufferArea;
- pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
- pMBScreen->ChangeBufferAttributes = NoopDDA_True;
- pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable;
- pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs;
- pMBScreen->ResetProc = pixResetProc;
-
- /* Support every depth and visual combination that the screen does */
-
- nInfo = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- nInfo += pDepth->numVids;
- }
-
- pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo));
- if (!pInfo)
- return FALSE;
-
- k = 0;
- for (i = 0; i < pScreen->numDepths; i++)
- {
- pDepth = &pScreen->allowedDepths[i];
- for (j = 0; j < pDepth->numVids; j++)
- {
- pInfo[k].visualID = pDepth->vids[j];
- pInfo[k].maxBuffers = 0;
- pInfo[k].depth = pDepth->depth;
- k++;
- }
- }
-
- pMBScreen->nInfo = nInfo;
- pMBScreen->pInfo = pInfo;
-
- /*
- * Setup the devPrivate to mbufScreenRec
- */
-
- pMBPriv = xalloc(sizeof(* pMBPriv));
- if (!pMBPriv)
- {
- xfree(pInfo);
- return (FALSE);
- }
- pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
- pMBPriv->PositionWindow = NULL;
- pMBPriv->funcsWrapped = 0;
-
- return TRUE;
-}
-
-/*ARGSUSED*/
-static int
-pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
- WindowPtr pWin;
- int nbuf;
- XID *ids;
- int action;
- int hint;
-{
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- ScreenPtr pScreen;
- int width, height, depth;
- int i;
-
- pMBWindow = MB_WINDOW_PRIV(pWin);
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- depth = pWin->drawable.depth;
- pScreen = pWin->drawable.pScreen;
-
- for (i = 0; i < nbuf; i++)
- {
- pMBBuffer = &pMBWindow->buffers[i];
- pMBBuffer->pDrawable = (DrawablePtr)
- (*pScreen->CreatePixmap) (pScreen, width, height, depth, 0);
- if (!pMBBuffer->pDrawable)
- break;
-
- if (!AddResource (ids[i], MultibufferDrawableResType,
- (pointer) pMBBuffer->pDrawable))
- {
- (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
- break;
- }
- pMBBuffer->pDrawable->id = ids[i];
-
- /*
- * In the description of the CreateImageBuffers request:
- * "If the window is mapped, or if these image buffers have
- * backing store, their contents will be tiled with the window
- * background, and zero or more expose events will be generated
- * for each of these buffers."
- */
-
- (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
- (pMBBuffer, 0,0, 0,0, TRUE);
- }
-
- return i;
-}
-
-/*
- * set up the gc to clear the pixmaps;
- */
-static Bool
-SetupBackgroundPainter (pWin, pGC)
- WindowPtr pWin;
- GCPtr pGC;
-{
- XID gcvalues[4];
- int ts_x_origin, ts_y_origin;
- PixUnion background;
- int backgroundState;
- Mask gcmask;
-
- /*
- * First take care of any ParentRelative stuff by altering the
- * tile/stipple origin to match the coordinates of the upper-left
- * corner of the first ancestor without a ParentRelative background.
- * This coordinate is, of course, negative.
- */
-
- ts_x_origin = ts_y_origin = 0;
- while (pWin->backgroundState == ParentRelative) {
- ts_x_origin -= pWin->origin.x;
- ts_y_origin -= pWin->origin.y;
- pWin = pWin->parent;
- }
- backgroundState = pWin->backgroundState;
- background = pWin->background;
-
- switch (backgroundState)
- {
- case BackgroundPixel:
- gcvalues[0] = (XID) background.pixel;
- gcvalues[1] = FillSolid;
- gcmask = GCForeground|GCFillStyle;
- break;
-
- case BackgroundPixmap:
- gcvalues[0] = FillTiled;
- gcvalues[1] = (XID) background.pixmap;
- gcvalues[2] = ts_x_origin;
- gcvalues[3] = ts_y_origin;
- gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
- break;
-
- default:
- return FALSE;
- }
- DoChangeGC(pGC, gcmask, gcvalues, TRUE);
- return TRUE;
-}
-
-static void
-MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects)
- WindowPtr pWin;
- DrawablePtr pDrawable;
- int nrects;
- xRectangle *pRects;
-{
- GCPtr pGC;
-
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- if (SetupBackgroundPainter(pWin, pGC))
- {
- ValidateGC(pDrawable, pGC);
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects);
- }
- FreeScratchGC(pGC);
-}
-
-static void
-MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
- WindowPtr pWin;
- DrawablePtr pDrawable;
- RegionPtr pRegion;
-{
- xRectangle *pRects;
- int nrects = REGION_NUM_RECTS(pRegion);
- BoxPtr pbox = REGION_RECTS(pRegion);
-
- pRects = xalloc(nrects * sizeof(xRectangle));
- if (pRects)
- {
- int i;
- for (i = 0; i < nrects; i++)
- {
- pRects[i].x = pbox->x1;
- pRects[i].y = pbox->y1;
- pRects[i].width = pbox->x2 - pbox->x1;
- pRects[i].height = pbox->y2 - pbox->y1;
- }
- MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
- xfree(pRects);
- }
-}
-
-static void
-pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
- mbufBufferPtr *ppMBBuffer;
- mbufWindowPtr *ppMBWindow;
- int nbuf;
-{
- GCPtr pGC = NULL;
- PixmapPtr pPrevPixmap, pNewPixmap;
- WindowPtr pWin;
- RegionPtr pExposed;
- int i;
- mbufBufferPtr pPrevMBBuffer;
- XID bool;
- xRectangle r;
-
- UpdateCurrentTime ();
- for (i = 0; i < nbuf; i++)
- {
- pWin = ppMBWindow[i]->pWindow;
-
- /* Time to get a different scratch GC? */
-
- if (!pGC
- || pGC->depth != pWin->drawable.depth
- || pGC->pScreen != pWin->drawable.pScreen)
- {
- if (pGC) FreeScratchGC(pGC);
- pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
- }
- pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
- pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable;
- pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable;
-
- if (pPrevPixmap == pNewPixmap)
- {
- /* "If a specified buffer is already displayed, any delays and
- * update action will still be performed for that buffer."
- *
- * We special-case this because applications do occasionally
- * request a redundant DisplayImageBuffers, and we can save
- * strokes by recognizing that the only update action that will
- * change the buffer contents in this case is Background.
- */
- if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground)
- {
- r.x = r.y = 0;
- r.width = pWin->drawable.width;
- r.height = pWin->drawable.height;
- MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin,
- 1, &r);
- }
- }
- else /* different buffer is being displayed */
- {
- /* perform update action */
-
- switch (ppMBWindow[i]->updateAction)
- {
- case MultibufferUpdateActionUndefined:
- break;
-
- case MultibufferUpdateActionBackground:
-
- r.x = r.y = 0;
- r.width = pPrevPixmap->drawable.width;
- r.height = pPrevPixmap->drawable.height;
- MultibufferPaintBackgroundRectangles(pWin,
- (DrawablePtr)pPrevPixmap,
- 1, &r);
- break;
-
- case MultibufferUpdateActionUntouched:
-
- /* copy the window to the pixmap that represents the
- * currently displayed buffer
- */
-
- if (pPrevMBBuffer->eventMask & ExposureMask)
- {
- bool = TRUE;
- DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
- }
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin,
- (DrawablePtr) pPrevPixmap,
- pGC,
- 0, 0,
- pWin->drawable.width,
- pWin->drawable.height,
- 0, 0);
-
- /* if we couldn't copy the whole window to the buffer,
- * send expose events (if any client wants them)
- */
-
- if (pPrevMBBuffer->eventMask & ExposureMask)
- { /* some client wants expose events */
- if (pExposed)
- {
- RegionPtr pWinSize;
- extern RegionPtr CreateUnclippedWinSize();
- ScreenPtr pScreen = pWin->drawable.pScreen;
- pWinSize = CreateUnclippedWinSize (pWin);
- /*
- * pExposed is window-relative, but at this point
- * pWinSize is screen-relative. Make pWinSize be
- * window-relative so that region ops involving
- * pExposed and pWinSize behave sensibly.
- */
- REGION_TRANSLATE(pScreen, pWinSize,
- -pWin->drawable.x,
- -pWin->drawable.y);
- REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
- REGION_DESTROY(pScreen, pWinSize);
- MultibufferExpose (pPrevMBBuffer, pExposed);
- REGION_DESTROY(pScreen, pExposed);
- }
- bool = FALSE;
- DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
- } /* end some client wants expose events */
-
- break; /* end case MultibufferUpdateActionUntouched */
-
- case MultibufferUpdateActionCopied:
-
- ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
- (DrawablePtr)pPrevPixmap, pGC,
- 0, 0, pWin->drawable.width,
- pWin->drawable.height, 0, 0);
- break;
-
- } /* end switch on update action */
-
- /* display the new buffer */
-
- ValidateGC ((DrawablePtr)pWin, pGC);
- (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin,
- pGC, 0, 0,
- pWin->drawable.width, pWin->drawable.height,
- 0, 0);
- }
-
- ppMBWindow[i]->lastUpdate = currentTime;
- }
-
- if (pGC) FreeScratchGC (pGC);
- return;
-}
-
-/*
- * resize the buffers when the window is resized
- */
-
-static Bool
-pixPositionWindow (pWin, x, y)
- WindowPtr pWin;
- int x, y;
-{
- ScreenPtr pScreen;
- mbufPixmapPrivPtr pMBPriv;
- mbufWindowPtr pMBWindow;
- mbufBufferPtr pMBBuffer;
- int width, height;
- int i;
- int dx, dy, dw, dh;
- int sourcex, sourcey;
- int destx, desty;
- PixmapPtr pPixmap;
- GCPtr pGC;
- int savewidth, saveheight;
- Bool clear;
- RegionRec exposedRegion;
- Bool ret;
-
- pScreen = pWin->drawable.pScreen;
- pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
-
- UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
- ret = (* pScreen->PositionWindow) (pWin, x, y);
- REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
-
- if (!(pMBWindow = MB_WINDOW_PRIV(pWin)))
- return ret;
-
- /* if new size is same as old, we're done */
-
- if (pMBWindow->width == pWin->drawable.width &&
- pMBWindow->height == pWin->drawable.height)
- return ret;
-
- width = pWin->drawable.width;
- height = pWin->drawable.height;
- dx = pWin->drawable.x - pMBWindow->x;
- dy = pWin->drawable.x - pMBWindow->y;
- dw = width - pMBWindow->width;
- dh = height - pMBWindow->height;
- GravityTranslate (0, 0, -dx, -dy, dw, dh,
- pWin->bitGravity, &destx, &desty);
-
- /* if the window grew, remember to paint the window background,
- * and maybe send expose events, for the new areas of the buffers
- */
-
- clear = pMBWindow->width < width || pMBWindow->height < height ||
- pWin->bitGravity == ForgetGravity;
-
- sourcex = 0;
- sourcey = 0;
- savewidth = pMBWindow->width;
- saveheight = pMBWindow->height;
- /* clip rectangle to source and destination */
- if (destx < 0)
- {
- savewidth += destx;
- sourcex -= destx;
- destx = 0;
- }
- if (destx + savewidth > width)
- savewidth = width - destx;
- if (desty < 0)
- {
- saveheight += desty;
- sourcey -= desty;
- desty = 0;
- }
- if (desty + saveheight > height)
- saveheight = height - desty;
-
- pMBWindow->width = width;
- pMBWindow->height = height;
- pMBWindow->x = pWin->drawable.x;
- pMBWindow->y = pWin->drawable.y;
-
- if (clear)
- {
- BoxRec box;
-
- box.x1 = box.y1 = 0;
- box.x2 = width;
- box.y2 = height;
- REGION_INIT(pScreen, &exposedRegion, &box, 1);
- if (pWin->bitGravity != ForgetGravity)
- {
- RegionRec preservedRegion;
- box.x1 = destx;
- box.y1 = desty;
- box.x2 = destx + savewidth;
- box.y2 = desty + saveheight;
- REGION_INIT(pScreen, &preservedRegion, &box, 1);
- REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion);
- REGION_UNINIT(pScreen, &preservedRegion);
- }
-
- } /* end if (clear) */
-
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- /* create buffers with new window size */
-
- for (i = 0; i < pMBWindow->numMultibuffer; i++)
- {
- pMBBuffer = &pMBWindow->buffers[i];
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- (* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
- break;
- }
- if (clear)
- {
- MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion);
- MultibufferExpose(pMBBuffer, &exposedRegion);
- }
- if (pWin->bitGravity != ForgetGravity)
- {
- ValidateGC ((DrawablePtr)pPixmap, pGC);
- (*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap,
- pGC,
- sourcex, sourcey, savewidth, saveheight,
- destx, desty);
- }
- pPixmap->drawable.id = pMBBuffer->pDrawable->id;
- (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
- pMBBuffer->pDrawable = (DrawablePtr) pPixmap;
- if (i != pMBWindow->displayedMultibuffer)
- {
- ChangeResourceValue (pPixmap->drawable.id,
- MultibufferDrawableResType,
- (pointer) pPixmap);
- }
- }
- FreeScratchGC (pGC);
- if (clear)
- REGION_UNINIT(pScreen, &exposedRegion);
- return TRUE;
-}
-
-static void
-pixWrapScreenFuncs(pScreen)
- ScreenPtr pScreen;
-{
- mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
- WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow);
-}
-
-static void
-pixResetProc(pScreen)
- ScreenPtr pScreen;
-{
- mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen);
- mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
-
- xfree(pMBScreen->pInfo);
- xfree(pMBPriv);
-}
-
-static void
-pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures)
- mbufBufferPtr pMBBuffer;
- short x, y;
- unsigned short width, height;
- Bool exposures;
-{
- WindowPtr pWin;
- ScreenPtr pScreen;
- BoxRec box;
- RegionRec region;
- int w_width, w_height;
- DrawablePtr pDrawable;
-
- pWin = pMBBuffer->pMBWindow->pWindow;
- pScreen = pWin->drawable.pScreen;
-
- w_width = pWin->drawable.width;
- w_height = pWin->drawable.height;
-
- box.x1 = x;
- box.y1 = y;
- box.x2 = width ? (box.x1 + width) : w_width;
- box.y2 = height ? (box.y1 + height) : w_height;
-
- if (box.x1 < 0) box.x1 = 0;
- if (box.y1 < 0) box.y1 = 0;
- if (box.x2 > w_width) box.x2 = w_width;
- if (box.y2 > w_height) box.y2 = w_height;
-
- REGION_INIT(pScreen, &region, &box, 1);
-
- if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer)
- pDrawable = (DrawablePtr) pWin;
- else
- pDrawable = pMBBuffer->pDrawable;
-
- MultibufferPaintBackgroundRegion(pWin, pDrawable, &region);
-
- if (exposures)
- MultibufferExpose(pMBBuffer, &region);
-
- REGION_UNINIT(pScreen, &region);
-}
-
-static void
-pixDeleteBufferDrawable(pDrawable)
- DrawablePtr pDrawable;
-{
- (* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable);
-}
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index cfeba017f..96eb8f9e1 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -52,9 +52,7 @@ Equipment Corporation.
#include "globals.h"
#include "servermd.h"
#include "resource.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#include "modinit.h"
#include "protocol-versions.h"
@@ -589,9 +587,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_StoreColors] = PanoramiXStoreColors;
ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
-#ifdef RENDER
PanoramiXRenderInit ();
-#endif
}
extern Bool CreateConnectionBlock(void);
@@ -891,9 +887,7 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
{
int i;
-#ifdef RENDER
PanoramiXRenderReset ();
-#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
diff --git a/xorg-server/Xext/panoramiX.h b/xorg-server/Xext/panoramiX.h
index cca4c5249..463a99441 100644
--- a/xorg-server/Xext/panoramiX.h
+++ b/xorg-server/Xext/panoramiX.h
@@ -69,11 +69,9 @@ typedef struct {
struct {
Bool shared;
} pix;
-#ifdef RENDER
struct {
Bool root;
} pict;
-#endif
char raw_data[4];
} u;
} PanoramiXRes;
diff --git a/xorg-server/Xext/sync.c b/xorg-server/Xext/sync.c
index d8374fe96..2b02dbbfb 100644
--- a/xorg-server/Xext/sync.c
+++ b/xorg-server/Xext/sync.c
@@ -2178,7 +2178,7 @@ static XSyncValue *pnext_time;
/*
*** Server Block Handler
-*** code inspired by multibuffer extension
+*** code inspired by multibuffer extension (now deprecated)
*/
/*ARGSUSED*/
static void
diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c
index 5af2b5c83..a1aacc4cd 100644
--- a/xorg-server/Xext/xtest.c
+++ b/xorg-server/Xext/xtest.c
@@ -357,7 +357,8 @@ ProcXTestFakeInput(ClientPtr client)
activateTime.milliseconds = ms;
ev->u.keyButtonPointer.time = 0;
- /* see mbuf.c:QueueDisplayRequest for code similar to this */
+ /* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
+ * extension) for code similar to this */
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
{
diff --git a/xorg-server/Xi/sendexev.c b/xorg-server/Xi/sendexev.c
index 04ac9deab..bd96d74c7 100644
--- a/xorg-server/Xi/sendexev.c
+++ b/xorg-server/Xi/sendexev.c
@@ -138,8 +138,7 @@ ProcXSendExtensionEvent(ClientPtr client)
first = ((xEvent *) & stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
- (first->u.u.type < lastEvent)))
- {
+ (first->u.u.type < lastEvent))) {
client->errorValue = first->u.u.type;
return BadValue;
}
diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c
index 435868de2..47ab688fd 100644
--- a/xorg-server/Xi/xiquerydevice.c
+++ b/xorg-server/Xi/xiquerydevice.c
@@ -247,6 +247,9 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState)
int mask_len;
int i;
+ if (!dev || !dev->button)
+ return 0;
+
mask_len = bytes_to_int32(bits_to_bytes(dev->button->numButtons));
info->type = ButtonClass;
@@ -259,7 +262,7 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState)
memset(bits, 0, mask_len * 4);
if (reportState)
- for (i = 0; dev && dev->button && i < dev->button->numButtons; i++)
+ for (i = 0; i < dev->button->numButtons; i++)
if (BitIsOn(dev->button->down, i))
SetBit(bits, i);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index b1d511980..b48d3a9c5 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -632,7 +632,6 @@ AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinu
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
-AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
@@ -1095,12 +1094,6 @@ if test "x$XCSECURITY" = xyes; then
AC_DEFINE(XCSECURITY, 1, [Build Security extension])
fi
-AM_CONDITIONAL(MULTIBUFFER, [test "x$MULTIBUFFER" = xyes])
-if test "x$MULTIBUFFER" = xyes; then
- AC_DEFINE(MULTIBUFFER, 1, [Build Multibuffer extension])
- # Requires xextproto which is always required
-fi
-
AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
if test "x$DBE" = xyes; then
AC_DEFINE(DBE, 1, [Support DBE extension])
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index 590d9a500..da3797237 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -753,9 +753,7 @@ static Bool
exaCloseScreen(int i, ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
if (ps->Glyphs == exaGlyphs)
exaGlyphsFini(pScreen);
@@ -778,16 +776,12 @@ exaCloseScreen(int i, ScreenPtr pScreen)
unwrap(pExaScr, pScreen, ChangeWindowAttributes);
unwrap(pExaScr, pScreen, BitmapToRegion);
unwrap(pExaScr, pScreen, CreateScreenResources);
-#ifdef RENDER
- if (ps) {
- unwrap(pExaScr, ps, Composite);
- if (pExaScr->SavedGlyphs)
- unwrap(pExaScr, ps, Glyphs);
- unwrap(pExaScr, ps, Trapezoids);
- unwrap(pExaScr, ps, Triangles);
- unwrap(pExaScr, ps, AddTraps);
- }
-#endif
+ unwrap(pExaScr, ps, Composite);
+ if (pExaScr->SavedGlyphs)
+ unwrap(pExaScr, ps, Glyphs);
+ unwrap(pExaScr, ps, Trapezoids);
+ unwrap(pExaScr, ps, Triangles);
+ unwrap(pExaScr, ps, AddTraps);
xfree (pExaScr);
@@ -825,9 +819,7 @@ exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo)
{
ExaScreenPrivPtr pExaScr;
-#ifdef RENDER
PictureScreenPtr ps;
-#endif
if (!pScreenInfo)
return FALSE;
@@ -895,9 +887,7 @@ exaDriverInit (ScreenPtr pScreen,
pScreenInfo->maxPitchPixels = pScreenInfo->maxX;
}
-#ifdef RENDER
ps = GetPictureScreenIfSet(pScreen);
-#endif
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
if (!pExaScr) {
@@ -940,7 +930,6 @@ exaDriverInit (ScreenPtr pScreen,
wrap(pExaScr, pScreen, BitmapToRegion, exaBitmapToRegion);
wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources);
-#ifdef RENDER
if (ps) {
wrap(pExaScr, ps, Composite, exaComposite);
if (pScreenInfo->PrepareComposite)
@@ -949,7 +938,6 @@ exaDriverInit (ScreenPtr pScreen,
wrap(pExaScr, ps, Triangles, exaTriangles);
wrap(pExaScr, ps, AddTraps, ExaCheckAddTraps);
}
-#endif
#ifdef MITSHM
/*
diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c
index c31e2d4b3..e1ead6c0d 100644
--- a/xorg-server/exa/exa_classic.c
+++ b/xorg-server/exa/exa_classic.c
@@ -148,7 +148,7 @@ Bool
exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap;
Bool ret;
@@ -156,6 +156,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept
if (!pPixmap)
return FALSE;
+ pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap);
diff --git a/xorg-server/exa/exa_driver.c b/xorg-server/exa/exa_driver.c
index dcf1a9860..abe79baad 100644
--- a/xorg-server/exa/exa_driver.c
+++ b/xorg-server/exa/exa_driver.c
@@ -126,7 +126,7 @@ Bool
exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap;
Bool ret;
@@ -134,6 +134,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth
if (!pPixmap)
return FALSE;
+ pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap);
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 21cc3bd13..49e04f22a 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -124,7 +124,7 @@ Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData)
{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ScreenPtr pScreen;
ExaScreenPrivPtr pExaScr;
ExaPixmapPrivPtr pExaPixmap;
Bool ret, has_gpu_copy;
@@ -132,6 +132,7 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
if (!pPixmap)
return FALSE;
+ pScreen = pPixmap->drawable.pScreen;
pExaScr = ExaGetScreenPriv(pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap);
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h
index 21d964683..ed8be31f6 100644
--- a/xorg-server/exa/exa_priv.h
+++ b/xorg-server/exa/exa_priv.h
@@ -50,10 +50,8 @@
#include "dix.h"
#include "fb.h"
#include "fboverlay.h"
-#ifdef RENDER
#include "fbpict.h"
#include "glyphstr.h"
-#endif
#include "damage.h"
#define DEBUG_TRACE_FALL 0
@@ -166,13 +164,11 @@ typedef struct {
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
SourceValidateProcPtr SavedSourceValidate;
-#ifdef RENDER
CompositeProcPtr SavedComposite;
TrianglesProcPtr SavedTriangles;
GlyphsProcPtr SavedGlyphs;
TrapezoidsProcPtr SavedTrapezoids;
AddTrapsProcPtr SavedAddTraps;
-#endif
void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
Bool (*pixmap_has_gpu_copy) (PixmapPtr pPixmap);
void (*do_move_in_pixmap) (PixmapPtr pPixmap);
@@ -499,7 +495,6 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
extern const GCOps exaOps;
-#ifdef RENDER
void
ExaCheckComposite (CARD8 op,
PicturePtr pSrc,
@@ -513,7 +508,6 @@ ExaCheckComposite (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
-#endif
/* exa_offscreen.c */
void
diff --git a/xorg-server/exa/exa_render.c b/xorg-server/exa/exa_render.c
index 1b68e1cdc..b7f383f38 100644
--- a/xorg-server/exa/exa_render.c
+++ b/xorg-server/exa/exa_render.c
@@ -30,7 +30,6 @@
#include "exa_priv.h"
-#ifdef RENDER
#include "mipict.h"
#if DEBUG_TRACE_FALL
@@ -1072,7 +1071,6 @@ done:
if (pMask)
pMask->repeat = saveMaskRepeat;
}
-#endif
/**
* Same as miCreateAlphaPicture, except it uses ExaCheckPolyFillRect instead
diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c
index adbee8413..6345f6b59 100644
--- a/xorg-server/exa/exa_unaccel.c
+++ b/xorg-server/exa/exa_unaccel.c
@@ -23,9 +23,7 @@
#include "exa_priv.h"
-#ifdef RENDER
#include "mipict.h"
-#endif
/*
* These functions wrap the low-level fb rendering functions and
@@ -617,9 +615,7 @@ ExaCheckComposite (CARD8 op,
CARD16 height)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreen(pScreen);
-#endif /* RENDER */
EXA_PRE_FALLBACK(pScreen);
if (pExaScr->prepare_access_reg) {
@@ -652,7 +648,6 @@ ExaCheckComposite (CARD8 op,
exaPrepareAccess (pMask->pDrawable, EXA_PREPARE_MASK);
}
-#ifdef RENDER
swap(pExaScr, ps, Composite);
ps->Composite (op,
pSrc,
@@ -667,7 +662,6 @@ ExaCheckComposite (CARD8 op,
width,
height);
swap(pExaScr, ps, Composite);
-#endif /* RENDER */
if (pMask && pMask->pDrawable != NULL)
exaFinishAccess (pMask->pDrawable, EXA_PREPARE_MASK);
if (pSrc->pDrawable != NULL)
@@ -692,19 +686,15 @@ ExaCheckAddTraps (PicturePtr pPicture,
xTrap *traps)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreen(pScreen);
-#endif /* RENDER */
EXA_PRE_FALLBACK(pScreen);
EXA_FALLBACK(("to pict %p (%c)\n",
exaDrawableLocation(pPicture->pDrawable)));
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
-#ifdef RENDER
swap(pExaScr, ps, AddTraps);
ps->AddTraps (pPicture, x_off, y_off, ntrap, traps);
swap(pExaScr, ps, AddTraps);
-#endif /* RENDER */
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
EXA_POST_FALLBACK(pScreen);
}
diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h
index 02d6c0372..91c91eeb2 100644
--- a/xorg-server/fb/fb.h
+++ b/xorg-server/fb/fb.h
@@ -41,11 +41,7 @@
#include "mi.h"
#include "migc.h"
#include "mibstore.h"
-#ifdef RENDER
#include "picturestr.h"
-#else
-#include "picture.h"
-#endif
#ifdef FB_ACCESS_WRAPPER
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c
index cc7ce738d..896d33ebb 100644
--- a/xorg-server/fb/fbpict.c
+++ b/xorg-server/fb/fbpict.c
@@ -1,493 +1,484 @@
-/*
- *
- * Copyright © 2000 SuSE, Inc.
- * Copyright © 2007 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "fb.h"
-
-#include "picturestr.h"
-
-#ifdef RENDER
-
-#include "mipict.h"
-#include "fbpict.h"
-
-#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
-void
-fbWalkCompositeRegion (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height,
- Bool srcRepeat,
- Bool maskRepeat,
- CompositeFunc compositeRect)
-{
- RegionRec region;
- int n;
- BoxPtr pbox;
- int w, h, w_this, h_this;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- if (pSrc->pDrawable)
- {
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
- }
- if (pMask && pMask->pDrawable)
- {
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height))
- return;
-
- n = REGION_NUM_RECTS (&region);
- pbox = REGION_RECTS (&region);
- while (n--)
- {
- h = pbox->y2 - pbox->y1;
- y_src = pbox->y1 - yDst + ySrc;
- y_msk = pbox->y1 - yDst + yMask;
- y_dst = pbox->y1;
- while (h)
- {
- h_this = h;
- w = pbox->x2 - pbox->x1;
- x_src = pbox->x1 - xDst + xSrc;
- x_msk = pbox->x1 - xDst + xMask;
- x_dst = pbox->x1;
- if (maskRepeat)
- {
- y_msk = mod (y_msk - pMask->pDrawable->y, pMask->pDrawable->height);
- if (h_this > pMask->pDrawable->height - y_msk)
- h_this = pMask->pDrawable->height - y_msk;
- y_msk += pMask->pDrawable->y;
- }
- if (srcRepeat)
- {
- y_src = mod (y_src - pSrc->pDrawable->y, pSrc->pDrawable->height);
- if (h_this > pSrc->pDrawable->height - y_src)
- h_this = pSrc->pDrawable->height - y_src;
- y_src += pSrc->pDrawable->y;
- }
- while (w)
- {
- w_this = w;
- if (maskRepeat)
- {
- x_msk = mod (x_msk - pMask->pDrawable->x, pMask->pDrawable->width);
- if (w_this > pMask->pDrawable->width - x_msk)
- w_this = pMask->pDrawable->width - x_msk;
- x_msk += pMask->pDrawable->x;
- }
- if (srcRepeat)
- {
- x_src = mod (x_src - pSrc->pDrawable->x, pSrc->pDrawable->width);
- if (w_this > pSrc->pDrawable->width - x_src)
- w_this = pSrc->pDrawable->width - x_src;
- x_src += pSrc->pDrawable->x;
- }
- (*compositeRect) (op, pSrc, pMask, pDst,
- x_src, y_src, x_msk, y_msk, x_dst, y_dst,
- w_this, h_this);
- w -= w_this;
- x_src += w_this;
- x_msk += w_this;
- x_dst += w_this;
- }
- h -= h_this;
- y_src += h_this;
- y_msk += h_this;
- y_dst += h_this;
- }
- pbox++;
- }
- REGION_UNINIT (pDst->pDrawable->pScreen, &region);
-}
-
-void
-fbComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- pixman_image_t *src, *mask, *dest;
- int src_xoff, src_yoff;
- int msk_xoff, msk_yoff;
- int dst_xoff, dst_yoff;
-
- miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
- if (pMask)
- miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
-
- src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
- mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
- dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
-
- if (src && dest && !(pMask && !mask))
- {
- pixman_image_composite (op, src, mask, dest,
- xSrc + src_xoff, ySrc + src_yoff,
- xMask + msk_xoff, yMask + msk_yoff,
- xDst + dst_xoff, yDst + dst_yoff,
- width, height);
- }
-
- free_pixman_pict (pSrc, src);
- free_pixman_pict (pMask, mask);
- free_pixman_pict (pDst, dest);
-}
-
-void
-fbCompositeGeneral (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- fbComposite (op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
-}
-
-#endif /* RENDER */
-
-static pixman_image_t *
-create_solid_fill_image (PicturePtr pict)
-{
- PictSolidFill *solid = &pict->pSourcePict->solidFill;
- pixman_color_t color;
- CARD32 a, r, g, b;
-
- a = (solid->color & 0xff000000) >> 24;
- r = (solid->color & 0x00ff0000) >> 16;
- g = (solid->color & 0x0000ff00) >> 8;
- b = (solid->color & 0x000000ff) >> 0;
-
- color.alpha = (a << 8) | a;
- color.red = (r << 8) | r;
- color.green = (g << 8) | g;
- color.blue = (b << 8) | b;
-
- return pixman_image_create_solid_fill (&color);
-}
-
-static pixman_image_t *
-create_linear_gradient_image (PictGradient *gradient)
-{
- PictLinearGradient *linear = (PictLinearGradient *)gradient;
- pixman_point_fixed_t p1;
- pixman_point_fixed_t p2;
-
- p1.x = linear->p1.x;
- p1.y = linear->p1.y;
- p2.x = linear->p2.x;
- p2.y = linear->p2.y;
-
- return pixman_image_create_linear_gradient (
- &p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
-}
-
-static pixman_image_t *
-create_radial_gradient_image (PictGradient *gradient)
-{
- PictRadialGradient *radial = (PictRadialGradient *)gradient;
- pixman_point_fixed_t c1;
- pixman_point_fixed_t c2;
-
- c1.x = radial->c1.x;
- c1.y = radial->c1.y;
- c2.x = radial->c2.x;
- c2.y = radial->c2.y;
-
- return pixman_image_create_radial_gradient (
- &c1, &c2, radial->c1.radius,
- radial->c2.radius,
- (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
-}
-
-static pixman_image_t *
-create_conical_gradient_image (PictGradient *gradient)
-{
- PictConicalGradient *conical = (PictConicalGradient *)gradient;
- pixman_point_fixed_t center;
-
- center.x = conical->center.x;
- center.y = conical->center.y;
-
- return pixman_image_create_conical_gradient (
- &center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
- gradient->nstops);
-}
-
-static pixman_image_t *
-create_bits_picture (PicturePtr pict,
- Bool has_clip,
- int *xoff,
- int *yoff)
-{
- PixmapPtr pixmap;
- FbBits *bits;
- FbStride stride;
- int bpp;
- pixman_image_t *image;
-
- fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
- fbGetPixmapBitsData(pixmap, bits, stride, bpp);
-
- image = pixman_image_create_bits (
- pict->format,
- pixmap->drawable.width, pixmap->drawable.height,
- (uint32_t *)bits, stride * sizeof (FbStride));
-
-
-#ifdef FB_ACCESS_WRAPPER
-#if FB_SHIFT==5
-
- pixman_image_set_accessors (image,
- (pixman_read_memory_func_t)wfbReadMemory,
- (pixman_write_memory_func_t)wfbWriteMemory);
-
-#else
-
-#error The pixman library only works when FbBits is 32 bits wide
-
-#endif
-#endif
-
- /* pCompositeClip is undefined for source pictures, so
- * only set the clip region for pictures with drawables
- */
- if (has_clip)
- {
- if (pict->clientClipType != CT_NONE)
- pixman_image_set_has_client_clip (image, TRUE);
-
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
-
- pixman_image_set_clip_region (image, pict->pCompositeClip);
-
- if (*xoff || *yoff)
- pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
- }
-
- /* Indexed table */
- if (pict->pFormat->index.devPrivate)
- pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
-
- /* Add in drawable origin to position within the image */
- *xoff += pict->pDrawable->x;
- *yoff += pict->pDrawable->y;
-
- return image;
-}
-
-static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
-{
- pixman_repeat_t repeat;
- pixman_filter_t filter;
-
- if (pict->transform)
- {
- /* For source images, adjust the transform to account
- * for the drawable offset within the pixman image,
- * then set the offset to 0 as it will be used
- * to compute positions within the transformed image.
- */
- if (!has_clip) {
- struct pixman_transform adjusted;
-
- adjusted = *pict->transform;
- pixman_transform_translate(&adjusted,
- NULL,
- pixman_int_to_fixed(*xoff),
- pixman_int_to_fixed(*yoff));
- pixman_image_set_transform (image, &adjusted);
- *xoff = 0;
- *yoff = 0;
- } else
- pixman_image_set_transform (image, pict->transform);
- }
-
- switch (pict->repeatType)
- {
- default:
- case RepeatNone:
- repeat = PIXMAN_REPEAT_NONE;
- break;
-
- case RepeatPad:
- repeat = PIXMAN_REPEAT_PAD;
- break;
-
- case RepeatNormal:
- repeat = PIXMAN_REPEAT_NORMAL;
- break;
-
- case RepeatReflect:
- repeat = PIXMAN_REPEAT_REFLECT;
- break;
- }
-
- pixman_image_set_repeat (image, repeat);
-
- if (pict->alphaMap)
- {
- int alpha_xoff, alpha_yoff;
- pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
-
- pixman_image_set_alpha_map (
- image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
-
- free_pixman_pict (pict->alphaMap, alpha_map);
- }
-
- pixman_image_set_component_alpha (image, pict->componentAlpha);
-
- switch (pict->filter)
- {
- default:
- case PictFilterNearest:
- case PictFilterFast:
- filter = PIXMAN_FILTER_NEAREST;
- break;
-
- case PictFilterBilinear:
- case PictFilterGood:
- filter = PIXMAN_FILTER_BILINEAR;
- break;
-
- case PictFilterConvolution:
- filter = PIXMAN_FILTER_CONVOLUTION;
- break;
- }
-
- pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
- pixman_image_set_source_clipping (image, TRUE);
-}
-
-pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
-{
- pixman_image_t *image = NULL;
-
- if (!pict)
- return NULL;
-
- if (pict->pDrawable)
- {
- image = create_bits_picture (pict, has_clip, xoff, yoff);
- }
- else if (pict->pSourcePict)
- {
- SourcePict *sp = pict->pSourcePict;
-
- if (sp->type == SourcePictTypeSolidFill)
- {
- image = create_solid_fill_image (pict);
- }
- else
- {
- PictGradient *gradient = &pict->pSourcePict->gradient;
-
- if (sp->type == SourcePictTypeLinear)
- image = create_linear_gradient_image (gradient);
- else if (sp->type == SourcePictTypeRadial)
- image = create_radial_gradient_image (gradient);
- else if (sp->type == SourcePictTypeConical)
- image = create_conical_gradient_image (gradient);
- }
- *xoff = *yoff = 0;
- }
-
- if (image)
- set_image_properties (image, pict, has_clip, xoff, yoff);
-
- return image;
-}
-
-void
-free_pixman_pict (PicturePtr pict, pixman_image_t *image)
-{
- if (image && pixman_image_unref (image) && pict->pDrawable)
- fbFinishAccess (pict->pDrawable);
-}
-
-Bool
-fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
-
-#ifdef RENDER
-
- PictureScreenPtr ps;
-
- if (!miPictureInit (pScreen, formats, nformats))
- return FALSE;
- ps = GetPictureScreen(pScreen);
- ps->Composite = fbComposite;
- ps->Glyphs = miGlyphs;
- ps->CompositeRects = miCompositeRects;
- ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
- ps->AddTraps = fbAddTraps;
- ps->AddTriangles = fbAddTriangles;
-
-#endif /* RENDER */
-
- return TRUE;
-}
+/*
+ *
+ * Copyright © 2000 SuSE, Inc.
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "fb.h"
+
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+
+void
+fbWalkCompositeRegion (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height,
+ Bool srcRepeat,
+ Bool maskRepeat,
+ CompositeFunc compositeRect)
+{
+ RegionRec region;
+ int n;
+ BoxPtr pbox;
+ int w, h, w_this, h_this;
+ int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ if (pSrc->pDrawable)
+ {
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+ }
+ if (pMask && pMask->pDrawable)
+ {
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height))
+ return;
+
+ n = REGION_NUM_RECTS (&region);
+ pbox = REGION_RECTS (&region);
+ while (n--)
+ {
+ h = pbox->y2 - pbox->y1;
+ y_src = pbox->y1 - yDst + ySrc;
+ y_msk = pbox->y1 - yDst + yMask;
+ y_dst = pbox->y1;
+ while (h)
+ {
+ h_this = h;
+ w = pbox->x2 - pbox->x1;
+ x_src = pbox->x1 - xDst + xSrc;
+ x_msk = pbox->x1 - xDst + xMask;
+ x_dst = pbox->x1;
+ if (maskRepeat)
+ {
+ y_msk = mod (y_msk - pMask->pDrawable->y, pMask->pDrawable->height);
+ if (h_this > pMask->pDrawable->height - y_msk)
+ h_this = pMask->pDrawable->height - y_msk;
+ y_msk += pMask->pDrawable->y;
+ }
+ if (srcRepeat)
+ {
+ y_src = mod (y_src - pSrc->pDrawable->y, pSrc->pDrawable->height);
+ if (h_this > pSrc->pDrawable->height - y_src)
+ h_this = pSrc->pDrawable->height - y_src;
+ y_src += pSrc->pDrawable->y;
+ }
+ while (w)
+ {
+ w_this = w;
+ if (maskRepeat)
+ {
+ x_msk = mod (x_msk - pMask->pDrawable->x, pMask->pDrawable->width);
+ if (w_this > pMask->pDrawable->width - x_msk)
+ w_this = pMask->pDrawable->width - x_msk;
+ x_msk += pMask->pDrawable->x;
+ }
+ if (srcRepeat)
+ {
+ x_src = mod (x_src - pSrc->pDrawable->x, pSrc->pDrawable->width);
+ if (w_this > pSrc->pDrawable->width - x_src)
+ w_this = pSrc->pDrawable->width - x_src;
+ x_src += pSrc->pDrawable->x;
+ }
+ (*compositeRect) (op, pSrc, pMask, pDst,
+ x_src, y_src, x_msk, y_msk, x_dst, y_dst,
+ w_this, h_this);
+ w -= w_this;
+ x_src += w_this;
+ x_msk += w_this;
+ x_dst += w_this;
+ }
+ h -= h_this;
+ y_src += h_this;
+ y_msk += h_this;
+ y_dst += h_this;
+ }
+ pbox++;
+ }
+ REGION_UNINIT (pDst->pDrawable->pScreen, &region);
+}
+
+void
+fbComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ pixman_image_t *src, *mask, *dest;
+ int src_xoff, src_yoff;
+ int msk_xoff, msk_yoff;
+ int dst_xoff, dst_yoff;
+
+ miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
+ if (pMask)
+ miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
+
+ src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
+ mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
+ dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+
+ if (src && dest && !(pMask && !mask))
+ {
+ pixman_image_composite (op, src, mask, dest,
+ xSrc + src_xoff, ySrc + src_yoff,
+ xMask + msk_xoff, yMask + msk_yoff,
+ xDst + dst_xoff, yDst + dst_yoff,
+ width, height);
+ }
+
+ free_pixman_pict (pSrc, src);
+ free_pixman_pict (pMask, mask);
+ free_pixman_pict (pDst, dest);
+}
+
+void
+fbCompositeGeneral (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ fbComposite (op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+}
+
+static pixman_image_t *
+create_solid_fill_image (PicturePtr pict)
+{
+ PictSolidFill *solid = &pict->pSourcePict->solidFill;
+ pixman_color_t color;
+ CARD32 a, r, g, b;
+
+ a = (solid->color & 0xff000000) >> 24;
+ r = (solid->color & 0x00ff0000) >> 16;
+ g = (solid->color & 0x0000ff00) >> 8;
+ b = (solid->color & 0x000000ff) >> 0;
+
+ color.alpha = (a << 8) | a;
+ color.red = (r << 8) | r;
+ color.green = (g << 8) | g;
+ color.blue = (b << 8) | b;
+
+ return pixman_image_create_solid_fill (&color);
+}
+
+static pixman_image_t *
+create_linear_gradient_image (PictGradient *gradient)
+{
+ PictLinearGradient *linear = (PictLinearGradient *)gradient;
+ pixman_point_fixed_t p1;
+ pixman_point_fixed_t p2;
+
+ p1.x = linear->p1.x;
+ p1.y = linear->p1.y;
+ p2.x = linear->p2.x;
+ p2.y = linear->p2.y;
+
+ return pixman_image_create_linear_gradient (
+ &p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+}
+
+static pixman_image_t *
+create_radial_gradient_image (PictGradient *gradient)
+{
+ PictRadialGradient *radial = (PictRadialGradient *)gradient;
+ pixman_point_fixed_t c1;
+ pixman_point_fixed_t c2;
+
+ c1.x = radial->c1.x;
+ c1.y = radial->c1.y;
+ c2.x = radial->c2.x;
+ c2.y = radial->c2.y;
+
+ return pixman_image_create_radial_gradient (
+ &c1, &c2, radial->c1.radius,
+ radial->c2.radius,
+ (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
+}
+
+static pixman_image_t *
+create_conical_gradient_image (PictGradient *gradient)
+{
+ PictConicalGradient *conical = (PictConicalGradient *)gradient;
+ pixman_point_fixed_t center;
+
+ center.x = conical->center.x;
+ center.y = conical->center.y;
+
+ return pixman_image_create_conical_gradient (
+ &center, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
+ gradient->nstops);
+}
+
+static pixman_image_t *
+create_bits_picture (PicturePtr pict,
+ Bool has_clip,
+ int *xoff,
+ int *yoff)
+{
+ PixmapPtr pixmap;
+ FbBits *bits;
+ FbStride stride;
+ int bpp;
+ pixman_image_t *image;
+
+ fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
+ fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+
+ image = pixman_image_create_bits (
+ pict->format,
+ pixmap->drawable.width, pixmap->drawable.height,
+ (uint32_t *)bits, stride * sizeof (FbStride));
+
+
+#ifdef FB_ACCESS_WRAPPER
+#if FB_SHIFT==5
+
+ pixman_image_set_accessors (image,
+ (pixman_read_memory_func_t)wfbReadMemory,
+ (pixman_write_memory_func_t)wfbWriteMemory);
+
+#else
+
+#error The pixman library only works when FbBits is 32 bits wide
+
+#endif
+#endif
+
+ /* pCompositeClip is undefined for source pictures, so
+ * only set the clip region for pictures with drawables
+ */
+ if (has_clip)
+ {
+ if (pict->clientClipType != CT_NONE)
+ pixman_image_set_has_client_clip (image, TRUE);
+
+ if (*xoff || *yoff)
+ pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+
+ pixman_image_set_clip_region (image, pict->pCompositeClip);
+
+ if (*xoff || *yoff)
+ pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+ }
+
+ /* Indexed table */
+ if (pict->pFormat->index.devPrivate)
+ pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
+
+ /* Add in drawable origin to position within the image */
+ *xoff += pict->pDrawable->x;
+ *yoff += pict->pDrawable->y;
+
+ return image;
+}
+
+static void
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+{
+ pixman_repeat_t repeat;
+ pixman_filter_t filter;
+
+ if (pict->transform)
+ {
+ /* For source images, adjust the transform to account
+ * for the drawable offset within the pixman image,
+ * then set the offset to 0 as it will be used
+ * to compute positions within the transformed image.
+ */
+ if (!has_clip) {
+ struct pixman_transform adjusted;
+
+ adjusted = *pict->transform;
+ pixman_transform_translate(&adjusted,
+ NULL,
+ pixman_int_to_fixed(*xoff),
+ pixman_int_to_fixed(*yoff));
+ pixman_image_set_transform (image, &adjusted);
+ *xoff = 0;
+ *yoff = 0;
+ } else
+ pixman_image_set_transform (image, pict->transform);
+ }
+
+ switch (pict->repeatType)
+ {
+ default:
+ case RepeatNone:
+ repeat = PIXMAN_REPEAT_NONE;
+ break;
+
+ case RepeatPad:
+ repeat = PIXMAN_REPEAT_PAD;
+ break;
+
+ case RepeatNormal:
+ repeat = PIXMAN_REPEAT_NORMAL;
+ break;
+
+ case RepeatReflect:
+ repeat = PIXMAN_REPEAT_REFLECT;
+ break;
+ }
+
+ pixman_image_set_repeat (image, repeat);
+
+ if (pict->alphaMap)
+ {
+ int alpha_xoff, alpha_yoff;
+ pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
+
+ pixman_image_set_alpha_map (
+ image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
+
+ free_pixman_pict (pict->alphaMap, alpha_map);
+ }
+
+ pixman_image_set_component_alpha (image, pict->componentAlpha);
+
+ switch (pict->filter)
+ {
+ default:
+ case PictFilterNearest:
+ case PictFilterFast:
+ filter = PIXMAN_FILTER_NEAREST;
+ break;
+
+ case PictFilterBilinear:
+ case PictFilterGood:
+ filter = PIXMAN_FILTER_BILINEAR;
+ break;
+
+ case PictFilterConvolution:
+ filter = PIXMAN_FILTER_CONVOLUTION;
+ break;
+ }
+
+ pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
+ pixman_image_set_source_clipping (image, TRUE);
+}
+
+pixman_image_t *
+image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+{
+ pixman_image_t *image = NULL;
+
+ if (!pict)
+ return NULL;
+
+ if (pict->pDrawable)
+ {
+ image = create_bits_picture (pict, has_clip, xoff, yoff);
+ }
+ else if (pict->pSourcePict)
+ {
+ SourcePict *sp = pict->pSourcePict;
+
+ if (sp->type == SourcePictTypeSolidFill)
+ {
+ image = create_solid_fill_image (pict);
+ }
+ else
+ {
+ PictGradient *gradient = &pict->pSourcePict->gradient;
+
+ if (sp->type == SourcePictTypeLinear)
+ image = create_linear_gradient_image (gradient);
+ else if (sp->type == SourcePictTypeRadial)
+ image = create_radial_gradient_image (gradient);
+ else if (sp->type == SourcePictTypeConical)
+ image = create_conical_gradient_image (gradient);
+ }
+ *xoff = *yoff = 0;
+ }
+
+ if (image)
+ set_image_properties (image, pict, has_clip, xoff, yoff);
+
+ return image;
+}
+
+void
+free_pixman_pict (PicturePtr pict, pixman_image_t *image)
+{
+ if (image && pixman_image_unref (image) && pict->pDrawable)
+ fbFinishAccess (pict->pDrawable);
+}
+
+Bool
+fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+
+ PictureScreenPtr ps;
+
+ if (!miPictureInit (pScreen, formats, nformats))
+ return FALSE;
+ ps = GetPictureScreen(pScreen);
+ ps->Composite = fbComposite;
+ ps->Glyphs = miGlyphs;
+ ps->CompositeRects = miCompositeRects;
+ ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
+ ps->AddTraps = fbAddTraps;
+ ps->AddTriangles = fbAddTriangles;
+
+ return TRUE;
+}
diff --git a/xorg-server/fb/fbtrap.c b/xorg-server/fb/fbtrap.c
index 515e2e1c1..9f5c39f65 100644
--- a/xorg-server/fb/fbtrap.c
+++ b/xorg-server/fb/fbtrap.c
@@ -26,8 +26,6 @@
#include "fb.h"
-#ifdef RENDER
-
#include "picturestr.h"
#include "mipict.h"
#include "renderedge.h"
@@ -160,4 +158,3 @@ fbAddTriangles (PicturePtr pPicture,
}
}
-#endif /* RENDER */
diff --git a/xorg-server/hw/dmx/dmx.h b/xorg-server/hw/dmx/dmx.h
index 6ebd00efd..fbb8b96ed 100644
--- a/xorg-server/hw/dmx/dmx.h
+++ b/xorg-server/hw/dmx/dmx.h
@@ -62,9 +62,7 @@
#include "globals.h"
#include "scrnintstr.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#ifdef GLXEXT
#include <GL/glx.h>
@@ -233,7 +231,6 @@ typedef struct _DMXScreenInfo {
SetShapeProcPtr SetShape;
-#ifdef RENDER
CreatePictureProcPtr CreatePicture;
DestroyPictureProcPtr DestroyPicture;
ChangePictureClipProcPtr ChangePictureClip;
@@ -254,7 +251,6 @@ typedef struct _DMXScreenInfo {
TrianglesProcPtr Triangles;
TriStripProcPtr TriStrip;
TriFanProcPtr TriFan;
-#endif
} DMXScreenInfo;
/* Global variables available to all Xserver/hw/dmx routines. */
diff --git a/xorg-server/hw/dmx/dmxclient.h b/xorg-server/hw/dmx/dmxclient.h
index 147d14ed8..c45f71fc0 100644
--- a/xorg-server/hw/dmx/dmxclient.h
+++ b/xorg-server/hw/dmx/dmxclient.h
@@ -86,10 +86,8 @@ typedef XID KeySym64;
#include <X11/extensions/shape.h>
-#ifdef RENDER
#include <X11/extensions/Xrender.h>
#undef PictFormatType
-#endif
#include <X11/extensions/XKB.h>
#include "xkbstr.h"
diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c
index 22660419c..4e555330e 100644
--- a/xorg-server/hw/dmx/dmxextension.c
+++ b/xorg-server/hw/dmx/dmxextension.c
@@ -53,9 +53,7 @@
#include "dmxgc.h"
#include "dmxfont.h"
#include "dmxcmap.h"
-#ifdef RENDER
#include "dmxpict.h"
-#endif
#include "dmxinput.h"
#include "dmxsync.h"
#include "dmxscrinit.h"
@@ -896,14 +894,12 @@ static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
if (pCmap->pScreen->myNum == scrnNum)
(void)dmxBECreateColormap((ColormapPtr)value);
#if 0
-#ifdef RENDER
/* TODO: Recreate Picture and GlyphSet resources */
} else if ((type & TypeMask) == (PictureType & TypeMask)) {
/* Picture resources are created when windows are created */
} else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
#endif
-#endif
} else {
/* Other resource types??? */
}
@@ -1057,7 +1053,6 @@ static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
return TRUE;
}
-#ifdef RENDER
/** Restore Render's picture */
static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
{
@@ -1164,7 +1159,6 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
free(gids);
free(glyphs);
}
-#endif
/** Reattach previously detached back-end screen. */
int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
@@ -1284,7 +1278,6 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx);
-#ifdef RENDER
/* Restore the picture state for RENDER */
for (i = currentMaxClients; --i >= 0; )
if (clients[i])
@@ -1296,7 +1289,6 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
if (clients[i])
FindClientResourcesByType(clients[i],GlyphSetType,
dmxBERestoreRenderGlyph,(pointer)idx);
-#endif
/* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx);
@@ -1482,7 +1474,6 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
ColormapPtr pCmap = value;
if (pCmap->pScreen->myNum == scrnNum)
dmxBEFreeColormap((ColormapPtr)value);
-#ifdef RENDER
} else if ((type & TypeMask) == (PictureType & TypeMask)) {
PicturePtr pPict = value;
if (pPict->pDrawable->pScreen->myNum == scrnNum) {
@@ -1496,7 +1487,6 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
}
} else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
-#endif
} else {
/* Other resource types??? */
}
diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c
index 739c4ca7f..617ec5e49 100644
--- a/xorg-server/hw/dmx/dmxinit.c
+++ b/xorg-server/hw/dmx/dmxinit.c
@@ -53,9 +53,7 @@
#include "dmxcb.h"
#include "dmxprop.h"
#include "dmxstat.h"
-#ifdef RENDER
#include "dmxpict.h"
-#endif
#include <X11/Xos.h> /* For gettimeofday */
#include "dixstruct.h"
@@ -795,11 +793,9 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
*/
dmxInitFonts();
-#ifdef RENDER
/* Initialize the render extension */
if (!noRenderExtension)
dmxInitRender();
-#endif
/* Initialized things that need timer hooks */
dmxStatInit();
diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c
index 09734f56d..c1beb9ba5 100644
--- a/xorg-server/hw/dmx/dmxscrinit.c
+++ b/xorg-server/hw/dmx/dmxscrinit.c
@@ -53,9 +53,7 @@
#include "dmxprop.h"
#include "dmxdpms.h"
-#ifdef RENDER
#include "dmxpict.h"
-#endif
#include "fb.h"
#include "mipointer.h"
@@ -78,12 +76,10 @@ static int dmxScreenPrivateKeyIndex;
DevPrivateKey dmxScreenPrivateKey = &dmxScreenPrivateKeyIndex; /**< Private index for Screens */
static int dmxColormapPrivateKeyIndex;
DevPrivateKey dmxColormapPrivateKey = &dmxColormapPrivateKeyIndex; /**< Private index for Colormaps */
-#ifdef RENDER
static int dmxPictPrivateKeyIndex;
DevPrivateKey dmxPictPrivateKey = &dmxPictPrivateKeyIndex; /**< Private index for Picts */
static int dmxGlyphSetPrivateKeyIndex;
DevPrivateKey dmxGlyphSetPrivateKey = &dmxGlyphSetPrivateKeyIndex; /**< Private index for GlyphSets */
-#endif
/** Initialize the parts of screen \a idx that require access to the
* back-end server. */
@@ -278,9 +274,7 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
dmxScreen->beXDPI,
dmxScreen->scrnWidth,
dmxScreen->beBPP);
-#ifdef RENDER
(void)dmxPictureInit(pScreen, 0, 0);
-#endif
/* Not yet... */
pScreen->GetWindowPixmap = NULL;
@@ -435,9 +429,7 @@ Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
/* Reset the proc vectors */
if (idx == 0) {
-#ifdef RENDER
dmxResetRender();
-#endif
dmxResetFonts();
}
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
index f9e46db1e..ea2f2c579 100644
--- a/xorg-server/hw/dmx/dmxwindow.c
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -46,9 +46,7 @@
#include "dmxvisual.h"
#include "dmxinput.h"
#include "dmxextension.h"
-#ifdef RENDER
#include "dmxpict.h"
-#endif
#include "windowstr.h"
@@ -288,9 +286,7 @@ void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
pWinPriv->window = dmxCreateNonRootWindow(pWindow);
if (pWinPriv->restacked) dmxDoRestackWindow(pWindow);
if (pWinPriv->isShaped) dmxDoSetShape(pWindow);
-#ifdef RENDER
if (pWinPriv->hasPict) dmxCreatePictureList(pWindow);
-#endif
if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay,
pWinPriv->window);
if (doSync) dmxSync(dmxScreen, False);
@@ -320,9 +316,7 @@ Bool dmxCreateWindow(WindowPtr pWindow)
pWinPriv->restacked = FALSE;
pWinPriv->attribMask = 0;
pWinPriv->isShaped = FALSE;
-#ifdef RENDER
pWinPriv->hasPict = FALSE;
-#endif
#ifdef GLXEXT
pWinPriv->swapGroup = NULL;
pWinPriv->barrier = 0;
@@ -405,10 +399,8 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
-#ifdef RENDER
/* Destroy any picture list associated with this window */
needSync |= dmxDestroyPictureList(pWindow);
-#endif
/* Destroy window on back-end server */
needSync |= dmxBEDestroyWindow(pWindow);
diff --git a/xorg-server/hw/dmx/dmxwindow.h b/xorg-server/hw/dmx/dmxwindow.h
index 353d0a3ba..740a21f0b 100644
--- a/xorg-server/hw/dmx/dmxwindow.h
+++ b/xorg-server/hw/dmx/dmxwindow.h
@@ -49,9 +49,7 @@ typedef struct _dmxWinPriv {
Colormap cmap;
Visual *visual;
Bool isShaped;
-#ifdef RENDER
Bool hasPict;
-#endif
#ifdef GLXEXT
void *swapGroup;
int barrier;
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 84e456be7..a8eb3996b 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -1005,10 +1005,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->BlockHandler = KdBlockHandler;
pScreen->WakeupHandler = KdWakeupHandler;
-#ifdef RENDER
if (!fbPictureInit (pScreen, 0, 0))
return FALSE;
-#endif
if (card->cfuncs->initScreen)
if (!(*card->cfuncs->initScreen) (pScreen))
return FALSE;
@@ -1274,9 +1272,7 @@ void
OsVendorFatalError(void)
{
}
-#endif
-#ifndef _MSC_VER
int
DPMSSet(ClientPtr client, int level)
{
diff --git a/xorg-server/hw/vfb/InitOutput.c b/xorg-server/hw/vfb/InitOutput.c
index e7dd1d95f..60915fdbf 100644
--- a/xorg-server/hw/vfb/InitOutput.c
+++ b/xorg-server/hw/vfb/InitOutput.c
@@ -248,10 +248,8 @@ ddxUseMsg(void)
{
ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
ErrorF("-pixdepths list-of-int support given pixmap depths\n");
-#ifdef RENDER
- ErrorF("+/-render turn on/of RENDER extension support"
+ ErrorF("+/-render turn on/off RENDER extension support"
"(default on)\n");
-#endif
ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n");
@@ -904,10 +902,8 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
-#ifdef RENDER
if (ret && Render)
fbPictureInit (pScreen, 0, 0);
-#endif
if (!ret) return FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 1e9543fa2..9a2837e7b 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -67,9 +67,7 @@ extern DeviceAssocRec mouse_assoc;
#include "xkbsrv.h"
-#ifdef RENDER
#include "picture.h"
-#endif
/*
* These paths define the way the config file search is done. The escape
@@ -925,7 +923,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
}
-#ifdef RENDER
{
if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){
int policy = PictureParseCmapPolicy (s);
@@ -938,7 +935,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
}
}
-#endif
#ifdef RANDR
xf86Info.disableRandR = FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index 71ac9a9fe..03a29ea0f 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -74,9 +74,7 @@
#include "xf86DDC.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#include "xf86VGAarbiter.h"
#include "globals.h"
@@ -110,15 +108,9 @@ static PixmapFormatRec formats[MAXFORMATS] = {
{ 15, 16, BITMAP_SCANLINE_PAD },
{ 16, 16, BITMAP_SCANLINE_PAD },
{ 24, 32, BITMAP_SCANLINE_PAD },
-#ifdef RENDER
{ 32, 32, BITMAP_SCANLINE_PAD },
-#endif
};
-#ifdef RENDER
static int numFormats = 7;
-#else
-static int numFormats = 6;
-#endif
static Bool formatsDone = FALSE;
#ifndef OSNAME
@@ -1082,7 +1074,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Screens[i]->pScreen->CreateWindow);
xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
-#ifdef RENDER
if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
{
xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
@@ -1092,7 +1083,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
SubPixelHorizontalRGB : SubPixelNone) :
SubPixelUnknown);
}
-#endif
#ifdef RANDR
if (!xf86Info.disableRandR)
xf86RandRInit (screenInfo.screens[scr_index]);
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index a3eccdfff..52a8b9a60 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -1,1113 +1,1101 @@
-/*
- * This code was stolen from RAC and adapted to control the legacy vga
- * interface.
- *
- *
- * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti
- *
- * 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 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 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
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS 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.
- *
- */
-
-#include "xorg-config.h"
-
-#include "xf86VGAarbiter.h"
-
-#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
-#include "xf86VGAarbiterPriv.h"
-#include "xf86Bus.h"
-#include "xf86Priv.h"
-#include "pciaccess.h"
-
-
-static GCFuncs VGAarbiterGCFuncs = {
- VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
- VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
- VGAarbiterCopyClip
-};
-
-static GCOps VGAarbiterGCOps = {
- VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage,
- VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint,
- VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle,
- VGAarbiterPolyArc, VGAarbiterFillPolygon, VGAarbiterPolyFillRect,
- VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16,
- VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt,
- VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels,
- {NULL} /* devPrivate */
-};
-
-static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = {
- VGAarbiterSpriteRealizeCursor, VGAarbiterSpriteUnrealizeCursor,
- VGAarbiterSpriteSetCursor, VGAarbiterSpriteMoveCursor,
- VGAarbiterDeviceCursorInitialize, VGAarbiterDeviceCursorCleanup
-};
-
-static int VGAarbiterKeyIndex;
-static DevPrivateKey VGAarbiterScreenKey = &VGAarbiterKeyIndex;
-static int VGAarbiterGCIndex;
-static DevPrivateKey VGAarbiterGCKey = &VGAarbiterGCIndex;
-
-static int vga_no_arb = 0;
-void
-xf86VGAarbiterInit(void)
-{
- if (pci_device_vgaarb_init() != 0) {
- vga_no_arb = 1;
- xf86Msg(X_WARNING, "VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
- }
-}
-
-void
-xf86VGAarbiterFini(void)
-{
- if (vga_no_arb)
- return;
- pci_device_vgaarb_fini();
-}
-
-void
-xf86VGAarbiterLock(ScrnInfoPtr pScrn)
-{
- if (vga_no_arb)
- return;
- pci_device_vgaarb_set_target(pScrn->vgaDev);
- pci_device_vgaarb_lock();
-}
-
-void
-xf86VGAarbiterUnlock(ScrnInfoPtr pScrn)
-{
- if (vga_no_arb)
- return;
- pci_device_vgaarb_unlock();
-}
-
-Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
-{
- int vga_count;
- int rsrc_decodes;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if (vga_no_arb)
- return TRUE;
-
- pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes);
- if (vga_count > 1) {
- if (rsrc_decodes) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-void
-xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
-{
- struct pci_device *dev;
- EntityPtr pEnt;
-
- if (vga_no_arb)
- return;
-
- pEnt = xf86Entities[pScrn->entityList[0]];
- if (pEnt->bus.type != BUS_PCI)
- return;
-
- dev = pEnt->bus.id.pci;
- pScrn->vgaDev = dev;
-}
-
-void
-xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn)
-{
- if (vga_no_arb)
- return;
- pci_device_vgaarb_decodes(VGA_ARB_RSRC_LEGACY_MEM | VGA_ARB_RSRC_LEGACY_IO);
-}
-
-Bool
-xf86VGAarbiterWrapFunctions(void)
-{
- ScrnInfoPtr pScrn;
- VGAarbiterScreenPtr pScreenPriv;
- miPointerScreenPtr PointPriv;
-#ifdef RENDER
- PictureScreenPtr ps;
-#endif
- ScreenPtr pScreen;
- int vga_count, i;
-
- if (vga_no_arb)
- 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);
-
- 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);
-#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;
- }
-
- return TRUE;
-}
-
-/* Screen funcs */
-static Bool
-VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
-{
- Bool val;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
- miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, miPointerScreenKey);
-#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
-
- UNWRAP_SCREEN(CreateGC);
- UNWRAP_SCREEN(CloseScreen);
- UNWRAP_SCREEN(GetImage);
- UNWRAP_SCREEN(GetSpans);
- UNWRAP_SCREEN(SourceValidate);
- UNWRAP_SCREEN(CopyWindow);
- UNWRAP_SCREEN(ClearToBackground);
- UNWRAP_SCREEN(SaveScreen);
- UNWRAP_SCREEN(StoreColors);
- UNWRAP_SCREEN(DisplayCursor);
- UNWRAP_SCREEN(RealizeCursor);
- UNWRAP_SCREEN(UnrealizeCursor);
- UNWRAP_SCREEN(RecolorCursor);
- UNWRAP_SCREEN(SetCursorPosition);
-#ifdef RENDER
- UNWRAP_PICT(Composite);
- UNWRAP_PICT(Glyphs);
- UNWRAP_PICT(CompositeRects);
-#endif
- UNWRAP_SCREEN_INFO(AdjustFrame);
- UNWRAP_SCREEN_INFO(SwitchMode);
- UNWRAP_SCREEN_INFO(EnterVT);
- UNWRAP_SCREEN_INFO(LeaveVT);
- UNWRAP_SCREEN_INFO(FreeScreen);
- UNWRAP_SPRITE;
-
- xfree ((pointer) pScreenPriv);
- xf86VGAarbiterLock(xf86Screens[i]);
- val = (*pScreen->CloseScreen) (i, pScreen);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- return val;
-}
-
-static void
-VGAarbiterBlockHandler(int i,
- pointer blockData, pointer pTimeout, pointer pReadmask)
-{
- ScreenPtr pScreen = screenInfo.screens[i];
- SCREEN_PROLOG(BlockHandler);
- VGAGet();
- pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
- VGAPut();
- SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
-}
-
-static void
-VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask)
-{
- ScreenPtr pScreen = screenInfo.screens[i];
- SCREEN_PROLOG(WakeupHandler);
- VGAGet();
- pScreen->WakeupHandler(i, blockData, result, pReadmask);
- VGAPut();
- SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
-}
-
-static void
-VGAarbiterGetImage (
- DrawablePtr pDrawable,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
- )
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- SCREEN_PROLOG(GetImage);
-// if (xf86Screens[pScreen->myNum]->vtSema) {
- VGAGet();
-// }
- (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
- format, planemask, pdstLine);
- VGAPut();
- SCREEN_EPILOG (GetImage, VGAarbiterGetImage);
-}
-
-static void
-VGAarbiterGetSpans (
- DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart
- )
-{
- ScreenPtr pScreen = pDrawable->pScreen;
-
- SCREEN_PROLOG (GetSpans);
- VGAGet();
- (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- VGAPut();
- SCREEN_EPILOG (GetSpans, VGAarbiterGetSpans);
-}
-
-static void
-VGAarbiterSourceValidate (
- DrawablePtr pDrawable,
- int x, int y, int width, int height )
-{
- ScreenPtr pScreen = pDrawable->pScreen;
- SCREEN_PROLOG (SourceValidate);
- VGAGet();
- if (pScreen->SourceValidate)
- (*pScreen->SourceValidate) (pDrawable, x, y, width, height);
- VGAPut();
- SCREEN_EPILOG (SourceValidate, VGAarbiterSourceValidate);
-}
-
-static void
-VGAarbiterCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc )
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- SCREEN_PROLOG (CopyWindow);
- VGAGet();
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- VGAPut();
- SCREEN_EPILOG (CopyWindow, VGAarbiterCopyWindow);
-}
-
-static void
-VGAarbiterClearToBackground (
- WindowPtr pWin,
- int x, int y,
- int w, int h,
- Bool generateExposures )
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- SCREEN_PROLOG ( ClearToBackground);
- VGAGet();
- (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
- VGAPut();
- SCREEN_EPILOG (ClearToBackground, VGAarbiterClearToBackground);
-}
-
-static PixmapPtr
-VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
-{
- PixmapPtr pPix;
-
- SCREEN_PROLOG ( CreatePixmap);
- VGAGet();
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
- VGAPut();
- SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
-
- return pPix;
-}
-
-static Bool
-VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank)
-{
- Bool val;
-
- SCREEN_PROLOG (SaveScreen);
- VGAGet();
- val = (*pScreen->SaveScreen) (pScreen, unblank);
- VGAPut();
- SCREEN_EPILOG (SaveScreen, VGAarbiterSaveScreen);
-
- return val;
-}
-
-static void
-VGAarbiterStoreColors (
- ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs)
-{
- ScreenPtr pScreen = pmap->pScreen;
-
- SCREEN_PROLOG (StoreColors);
- VGAGet();
- (*pScreen->StoreColors) (pmap,ndef,pdefs);
- VGAPut();
- SCREEN_EPILOG ( StoreColors, VGAarbiterStoreColors);
-}
-
-static void
-VGAarbiterRecolorCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCurs,
- Bool displayed
- )
-{
- SCREEN_PROLOG (RecolorCursor);
- VGAGet();
- (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed);
- VGAPut();
- SCREEN_EPILOG ( RecolorCursor, VGAarbiterRecolorCursor);
-}
-
-static Bool
-VGAarbiterRealizeCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
-{
- Bool val;
-
- SCREEN_PROLOG (RealizeCursor);
- VGAGet();
- val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor);
- VGAPut();
- SCREEN_EPILOG ( RealizeCursor, VGAarbiterRealizeCursor);
- return val;
-}
-
-static Bool
-VGAarbiterUnrealizeCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
-{
- Bool val;
-
- SCREEN_PROLOG (UnrealizeCursor);
- VGAGet();
- val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
- VGAPut();
- SCREEN_EPILOG ( UnrealizeCursor, VGAarbiterUnrealizeCursor);
- return val;
-}
-
-static Bool
-VGAarbiterDisplayCursor (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor
- )
-{
- Bool val;
-
- SCREEN_PROLOG (DisplayCursor);
- VGAGet();
- val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
- VGAPut();
- SCREEN_EPILOG ( DisplayCursor, VGAarbiterDisplayCursor);
- return val;
-}
-
-static Bool
-VGAarbiterSetCursorPosition (
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x, int y,
- Bool generateEvent)
-{
- Bool val;
-
- SCREEN_PROLOG (SetCursorPosition);
- VGAGet();
- val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
- VGAPut();
- SCREEN_EPILOG ( SetCursorPosition, VGAarbiterSetCursorPosition);
- return val;
-}
-
-static void
-VGAarbiterAdjustFrame(int index, int x, int y, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
-
- VGAGet();
- (*pScreenPriv->AdjustFrame)(index, x, y, flags);
- VGAPut();
-}
-
-static Bool
-VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
-{
- Bool val;
- ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
-
- VGAGet();
- val = (*pScreenPriv->SwitchMode)(index, mode, flags);
- VGAPut();
- return val;
-}
-
-static Bool
-VGAarbiterEnterVT(int index, int flags)
-{
- Bool val;
- ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
-
- VGAGet();
- val = (*pScreenPriv->EnterVT)(index, flags);
- VGAPut();
- return val;
-}
-
-static void
-VGAarbiterLeaveVT(int index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
-
- VGAGet();
- (*pScreenPriv->LeaveVT)(index, flags);
- VGAPut();
-}
-
-static void
-VGAarbiterFreeScreen(int index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, VGAarbiterScreenKey);
-
- VGAGet();
- (*pScreenPriv->FreeScreen)(index, flags);
- VGAPut();
-}
-
-static Bool
-VGAarbiterCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- VGAarbiterGCPtr pGCPriv = (VGAarbiterGCPtr)dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey);
- Bool ret;
-
- SCREEN_PROLOG(CreateGC);
- VGAGet();
- ret = (*pScreen->CreateGC)(pGC);
- VGAPut();
- GC_WRAP(pGC);
- SCREEN_EPILOG(CreateGC,VGAarbiterCreateGC);
-
- return ret;
-}
-
-/* GC funcs */
-static void
-VGAarbiterValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw )
-{
- GC_UNWRAP(pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
- GC_WRAP(pGC);
-}
-
-
-static void
-VGAarbiterDestroyGC(GCPtr pGC)
-{
- GC_UNWRAP (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- GC_WRAP (pGC);
-}
-
-static void
-VGAarbiterChangeGC (
- GCPtr pGC,
- unsigned long mask)
-{
- GC_UNWRAP (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- GC_WRAP (pGC);
-}
-
-static void
-VGAarbiterCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
-{
- GC_UNWRAP (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- GC_WRAP (pGCDst);
-}
-
-static void
-VGAarbiterChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects )
-{
- GC_UNWRAP (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- GC_WRAP (pGC);
-}
-
-static void
-VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- GC_UNWRAP (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- GC_WRAP (pgcDst);
-}
-
-static void
-VGAarbiterDestroyClip(GCPtr pGC)
-{
- GC_UNWRAP (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- GC_WRAP (pGC);
-}
-
-/* GC Ops */
-static void
-VGAarbiterFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static RegionPtr
-VGAarbiterCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty )
-{
- RegionPtr ret;
-
- GC_UNWRAP(pGC);
- VGAGet_GC();
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- VGAPut_GC();
- GC_WRAP(pGC);
- return ret;
-}
-
-static RegionPtr
-VGAarbiterCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane )
-{
- RegionPtr ret;
-
- GC_UNWRAP(pGC);
- VGAGet_GC();
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane);
- VGAPut_GC();
- GC_WRAP(pGC);
- return ret;
-}
-
-static void
-VGAarbiterPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-
-static void
-VGAarbiterPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit)
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static int
-VGAarbiterPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- int ret;
-
- GC_UNWRAP(pGC);
- VGAGet_GC();
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- VGAPut_GC();
- GC_WRAP(pGC);
- return ret;
-}
-
-static int
-VGAarbiterPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- int ret;
-
- GC_UNWRAP(pGC);
- VGAGet_GC();
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- VGAPut_GC();
- GC_WRAP(pGC);
- return ret;
-}
-
-static void
-VGAarbiterImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-
-static void
-VGAarbiterImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
- nglyph, ppci, pglyphBase);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
- nglyph, ppci, pglyphBase);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-static void
-VGAarbiterPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg )
-{
- GC_UNWRAP(pGC);
- VGAGet_GC();
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- VGAPut_GC();
- GC_WRAP(pGC);
-}
-
-
-/* miSpriteFuncs */
-static Bool
-VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
-{
- Bool val;
- SPRITE_PROLOG;
- VGAGet();
- val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur);
- VGAPut();
- SPRITE_EPILOG;
- return val;
-}
-
-static Bool
-VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
-{
- Bool val;
- SPRITE_PROLOG;
- VGAGet();
- val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur);
- VGAPut();
- SPRITE_EPILOG;
- return val;
-}
-
-static void
-VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y)
-{
- SPRITE_PROLOG;
- VGAGet();
- PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y);
- VGAPut();
- SPRITE_EPILOG;
-}
-
-static void
-VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- SPRITE_PROLOG;
- VGAGet();
- PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y);
- VGAPut();
- SPRITE_EPILOG;
-}
-
-static Bool
-VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- Bool val;
- SPRITE_PROLOG;
- VGAGet();
- val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
- VGAPut();
- SPRITE_EPILOG;
- return val;
-}
-
-static void
-VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- SPRITE_PROLOG;
- VGAGet();
- PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
- VGAPut();
- SPRITE_EPILOG;
-}
-
-#ifdef RENDER
-static void
-VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
- PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
- INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- PICTURE_PROLOGUE(Composite);
-
- VGAGet();
- (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
- yDst, width, height);
- VGAPut();
- PICTURE_EPILOGUE(Composite, VGAarbiterComposite);
-}
-
-static void
-VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- PICTURE_PROLOGUE(Glyphs);
-
- VGAGet();
- (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
- VGAPut();
- PICTURE_EPILOGUE (Glyphs, VGAarbiterGlyphs);
-}
-
-static void
-VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
- xRectangle *rects)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- PICTURE_PROLOGUE(CompositeRects);
-
- VGAGet();
- (*ps->CompositeRects)(op, pDst, color, nRect, rects);
- VGAPut();
- PICTURE_EPILOGUE (CompositeRects, VGAarbiterCompositeRects);
-}
-#endif
-#else
-/* dummy functions */
-void xf86VGAarbiterInit(void) {}
-void xf86VGAarbiterFini(void) {}
-
-void xf86VGAarbiterLock(ScrnInfoPtr pScrn) {}
-void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {}
-Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; }
-void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {}
-void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {}
-Bool xf86VGAarbiterWrapFunctions(void) { return FALSE; }
-
-#endif
+/*
+ * This code was stolen from RAC and adapted to control the legacy vga
+ * interface.
+ *
+ *
+ * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti
+ *
+ * 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 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 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
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS 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.
+ *
+ */
+
+#include "xorg-config.h"
+
+#include "xf86VGAarbiter.h"
+
+#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
+#include "xf86VGAarbiterPriv.h"
+#include "xf86Bus.h"
+#include "xf86Priv.h"
+#include "pciaccess.h"
+
+
+static GCFuncs VGAarbiterGCFuncs = {
+ VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
+ VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
+ VGAarbiterCopyClip
+};
+
+static GCOps VGAarbiterGCOps = {
+ VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage,
+ VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint,
+ VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle,
+ VGAarbiterPolyArc, VGAarbiterFillPolygon, VGAarbiterPolyFillRect,
+ VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16,
+ VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt,
+ VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels,
+ {NULL} /* devPrivate */
+};
+
+static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = {
+ VGAarbiterSpriteRealizeCursor, VGAarbiterSpriteUnrealizeCursor,
+ VGAarbiterSpriteSetCursor, VGAarbiterSpriteMoveCursor,
+ VGAarbiterDeviceCursorInitialize, VGAarbiterDeviceCursorCleanup
+};
+
+static int VGAarbiterKeyIndex;
+static DevPrivateKey VGAarbiterScreenKey = &VGAarbiterKeyIndex;
+static int VGAarbiterGCIndex;
+static DevPrivateKey VGAarbiterGCKey = &VGAarbiterGCIndex;
+
+static int vga_no_arb = 0;
+void
+xf86VGAarbiterInit(void)
+{
+ if (pci_device_vgaarb_init() != 0) {
+ vga_no_arb = 1;
+ xf86Msg(X_WARNING, "VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
+ }
+}
+
+void
+xf86VGAarbiterFini(void)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_fini();
+}
+
+void
+xf86VGAarbiterLock(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_set_target(pScrn->vgaDev);
+ pci_device_vgaarb_lock();
+}
+
+void
+xf86VGAarbiterUnlock(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_unlock();
+}
+
+Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
+{
+ int vga_count;
+ int rsrc_decodes;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (vga_no_arb)
+ return TRUE;
+
+ pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes);
+ if (vga_count > 1) {
+ if (rsrc_decodes) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+void
+xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
+{
+ struct pci_device *dev;
+ EntityPtr pEnt;
+
+ if (vga_no_arb)
+ return;
+
+ pEnt = xf86Entities[pScrn->entityList[0]];
+ if (pEnt->bus.type != BUS_PCI)
+ return;
+
+ dev = pEnt->bus.id.pci;
+ pScrn->vgaDev = dev;
+}
+
+void
+xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_decodes(VGA_ARB_RSRC_LEGACY_MEM | VGA_ARB_RSRC_LEGACY_IO);
+}
+
+Bool
+xf86VGAarbiterWrapFunctions(void)
+{
+ ScrnInfoPtr pScrn;
+ VGAarbiterScreenPtr pScreenPriv;
+ miPointerScreenPtr PointPriv;
+ PictureScreenPtr ps;
+ ScreenPtr pScreen;
+ int vga_count, i;
+
+ if (vga_no_arb)
+ 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;
+ ps = GetPictureScreenIfSet(pScreen);
+ pScrn = xf86Screens[pScreen->myNum];
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ 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);
+ WRAP_PICT(Composite,VGAarbiterComposite);
+ WRAP_PICT(Glyphs,VGAarbiterGlyphs);
+ WRAP_PICT(CompositeRects,VGAarbiterCompositeRects);
+ 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;
+}
+
+/* Screen funcs */
+static Bool
+VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
+{
+ Bool val;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ UNWRAP_SCREEN(CreateGC);
+ UNWRAP_SCREEN(CloseScreen);
+ UNWRAP_SCREEN(GetImage);
+ UNWRAP_SCREEN(GetSpans);
+ UNWRAP_SCREEN(SourceValidate);
+ UNWRAP_SCREEN(CopyWindow);
+ UNWRAP_SCREEN(ClearToBackground);
+ UNWRAP_SCREEN(SaveScreen);
+ UNWRAP_SCREEN(StoreColors);
+ UNWRAP_SCREEN(DisplayCursor);
+ UNWRAP_SCREEN(RealizeCursor);
+ UNWRAP_SCREEN(UnrealizeCursor);
+ UNWRAP_SCREEN(RecolorCursor);
+ UNWRAP_SCREEN(SetCursorPosition);
+ UNWRAP_PICT(Composite);
+ UNWRAP_PICT(Glyphs);
+ UNWRAP_PICT(CompositeRects);
+ UNWRAP_SCREEN_INFO(AdjustFrame);
+ UNWRAP_SCREEN_INFO(SwitchMode);
+ UNWRAP_SCREEN_INFO(EnterVT);
+ UNWRAP_SCREEN_INFO(LeaveVT);
+ UNWRAP_SCREEN_INFO(FreeScreen);
+ UNWRAP_SPRITE;
+
+ xfree ((pointer) pScreenPriv);
+ xf86VGAarbiterLock(xf86Screens[i]);
+ val = (*pScreen->CloseScreen) (i, pScreen);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ return val;
+}
+
+static void
+VGAarbiterBlockHandler(int i,
+ pointer blockData, pointer pTimeout, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ SCREEN_PROLOG(BlockHandler);
+ VGAGet();
+ pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+ VGAPut();
+ SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
+}
+
+static void
+VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ SCREEN_PROLOG(WakeupHandler);
+ VGAGet();
+ pScreen->WakeupHandler(i, blockData, result, pReadmask);
+ VGAPut();
+ SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
+}
+
+static void
+VGAarbiterGetImage (
+ DrawablePtr pDrawable,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ SCREEN_PROLOG(GetImage);
+// if (xf86Screens[pScreen->myNum]->vtSema) {
+ VGAGet();
+// }
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
+ format, planemask, pdstLine);
+ VGAPut();
+ SCREEN_EPILOG (GetImage, VGAarbiterGetImage);
+}
+
+static void
+VGAarbiterGetSpans (
+ DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ SCREEN_PROLOG (GetSpans);
+ VGAGet();
+ (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ VGAPut();
+ SCREEN_EPILOG (GetSpans, VGAarbiterGetSpans);
+}
+
+static void
+VGAarbiterSourceValidate (
+ DrawablePtr pDrawable,
+ int x, int y, int width, int height )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ SCREEN_PROLOG (SourceValidate);
+ VGAGet();
+ if (pScreen->SourceValidate)
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height);
+ VGAPut();
+ SCREEN_EPILOG (SourceValidate, VGAarbiterSourceValidate);
+}
+
+static void
+VGAarbiterCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOG (CopyWindow);
+ VGAGet();
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ VGAPut();
+ SCREEN_EPILOG (CopyWindow, VGAarbiterCopyWindow);
+}
+
+static void
+VGAarbiterClearToBackground (
+ WindowPtr pWin,
+ int x, int y,
+ int w, int h,
+ Bool generateExposures )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOG ( ClearToBackground);
+ VGAGet();
+ (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
+ VGAPut();
+ SCREEN_EPILOG (ClearToBackground, VGAarbiterClearToBackground);
+}
+
+static PixmapPtr
+VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ PixmapPtr pPix;
+
+ SCREEN_PROLOG ( CreatePixmap);
+ VGAGet();
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ VGAPut();
+ SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
+
+ return pPix;
+}
+
+static Bool
+VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank)
+{
+ Bool val;
+
+ SCREEN_PROLOG (SaveScreen);
+ VGAGet();
+ val = (*pScreen->SaveScreen) (pScreen, unblank);
+ VGAPut();
+ SCREEN_EPILOG (SaveScreen, VGAarbiterSaveScreen);
+
+ return val;
+}
+
+static void
+VGAarbiterStoreColors (
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+
+ SCREEN_PROLOG (StoreColors);
+ VGAGet();
+ (*pScreen->StoreColors) (pmap,ndef,pdefs);
+ VGAPut();
+ SCREEN_EPILOG ( StoreColors, VGAarbiterStoreColors);
+}
+
+static void
+VGAarbiterRecolorCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCurs,
+ Bool displayed
+ )
+{
+ SCREEN_PROLOG (RecolorCursor);
+ VGAGet();
+ (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed);
+ VGAPut();
+ SCREEN_EPILOG ( RecolorCursor, VGAarbiterRecolorCursor);
+}
+
+static Bool
+VGAarbiterRealizeCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ SCREEN_PROLOG (RealizeCursor);
+ VGAGet();
+ val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( RealizeCursor, VGAarbiterRealizeCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterUnrealizeCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ SCREEN_PROLOG (UnrealizeCursor);
+ VGAGet();
+ val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( UnrealizeCursor, VGAarbiterUnrealizeCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterDisplayCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ SCREEN_PROLOG (DisplayCursor);
+ VGAGet();
+ val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( DisplayCursor, VGAarbiterDisplayCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterSetCursorPosition (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ int x, int y,
+ Bool generateEvent)
+{
+ Bool val;
+
+ SCREEN_PROLOG (SetCursorPosition);
+ VGAGet();
+ val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
+ VGAPut();
+ SCREEN_EPILOG ( SetCursorPosition, VGAarbiterSetCursorPosition);
+ return val;
+}
+
+static void
+VGAarbiterAdjustFrame(int index, int x, int y, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ VGAGet();
+ (*pScreenPriv->AdjustFrame)(index, x, y, flags);
+ VGAPut();
+}
+
+static Bool
+VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ Bool val;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ VGAGet();
+ val = (*pScreenPriv->SwitchMode)(index, mode, flags);
+ VGAPut();
+ return val;
+}
+
+static Bool
+VGAarbiterEnterVT(int index, int flags)
+{
+ Bool val;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ VGAGet();
+ val = (*pScreenPriv->EnterVT)(index, flags);
+ VGAPut();
+ return val;
+}
+
+static void
+VGAarbiterLeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ VGAGet();
+ (*pScreenPriv->LeaveVT)(index, flags);
+ VGAPut();
+}
+
+static void
+VGAarbiterFreeScreen(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ VGAGet();
+ (*pScreenPriv->FreeScreen)(index, flags);
+ VGAPut();
+}
+
+static Bool
+VGAarbiterCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ VGAarbiterGCPtr pGCPriv = (VGAarbiterGCPtr)dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey);
+ Bool ret;
+
+ SCREEN_PROLOG(CreateGC);
+ VGAGet();
+ ret = (*pScreen->CreateGC)(pGC);
+ VGAPut();
+ GC_WRAP(pGC);
+ SCREEN_EPILOG(CreateGC,VGAarbiterCreateGC);
+
+ return ret;
+}
+
+/* GC funcs */
+static void
+VGAarbiterValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ GC_UNWRAP(pGC);
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterDestroyGC(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterChangeGC (
+ GCPtr pGC,
+ unsigned long mask)
+{
+ GC_UNWRAP (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst)
+{
+ GC_UNWRAP (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ GC_WRAP (pGCDst);
+}
+
+static void
+VGAarbiterChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects )
+{
+ GC_UNWRAP (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ GC_UNWRAP (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ GC_WRAP (pgcDst);
+}
+
+static void
+VGAarbiterDestroyClip(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ GC_WRAP (pGC);
+}
+
+/* GC Ops */
+static void
+VGAarbiterFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static RegionPtr
+VGAarbiterCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static RegionPtr
+VGAarbiterCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+VGAarbiterPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit)
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static int
+VGAarbiterPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static int
+VGAarbiterPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+VGAarbiterImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg )
+{
+ GC_UNWRAP(pGC);
+ VGAGet_GC();
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+/* miSpriteFuncs */
+static Bool
+VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ VGAGet();
+ val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static Bool
+VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ VGAGet();
+ val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static void
+VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y)
+{
+ SPRITE_PROLOG;
+ VGAGet();
+ PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+static void
+VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ SPRITE_PROLOG;
+ VGAGet();
+ PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+static Bool
+VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ VGAGet();
+ val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static void
+VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ SPRITE_PROLOG;
+ VGAGet();
+ PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+static void
+VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Composite);
+
+ VGAGet();
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height);
+ VGAPut();
+ PICTURE_EPILOGUE(Composite, VGAarbiterComposite);
+}
+
+static void
+VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Glyphs);
+
+ VGAGet();
+ (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+ VGAPut();
+ PICTURE_EPILOGUE (Glyphs, VGAarbiterGlyphs);
+}
+
+static void
+VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
+ xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(CompositeRects);
+
+ VGAGet();
+ (*ps->CompositeRects)(op, pDst, color, nRect, rects);
+ VGAPut();
+ PICTURE_EPILOGUE (CompositeRects, VGAarbiterCompositeRects);
+}
+#else
+/* dummy functions */
+void xf86VGAarbiterInit(void) {}
+void xf86VGAarbiterFini(void) {}
+
+void xf86VGAarbiterLock(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {}
+Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; }
+void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {}
+Bool xf86VGAarbiterWrapFunctions(void) { return FALSE; }
+
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index 40d436856..9b4a59731 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -43,9 +43,7 @@
#include "xf86str.h"
#include "mipointer.h"
#include "mipointrst.h"
-#ifdef RENDER
# include "picturestr.h"
-#endif
#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
@@ -139,11 +137,9 @@ typedef struct _VGAarbiterScreen {
void (*LeaveVT)(int, int);
void (*FreeScreen)(int, int);
miPointerSpriteFuncPtr miSprite;
-#ifdef RENDER
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
CompositeRectsProcPtr CompositeRects;
-#endif
} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
typedef struct _VGAarbiterGC {
@@ -254,7 +250,6 @@ static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScree
static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
-#ifdef RENDER
static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
@@ -263,4 +258,3 @@ static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
list, GlyphPtr *glyphs);
static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor
*color, int nRect, xRectangle *rects);
-#endif
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
index 299562592..7d2086802 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -47,15 +47,6 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef MULTIBUFFER
- {
- MultibufferExtensionInit,
- MULTIBUFFER_PROTOCOL_NAME,
- &noMultibufferExtension,
- NULL,
- NULL
- },
-#endif
#ifdef SCREENSAVER
{
ScreenSaverExtensionInit,
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
index 6210526aa..1154e4601 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
@@ -9,11 +9,6 @@
#include <X11/extensions/shapeproto.h>
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#include <X11/extensions/multibufproto.h>
-#endif
-
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#include <X11/extensions/xtestproto.h>
diff --git a/xorg-server/hw/xfree86/i2c/fi1236.c b/xorg-server/hw/xfree86/i2c/fi1236.c
index 7c39edbee..61224eaa5 100644
--- a/xorg-server/hw/xfree86/i2c/fi1236.c
+++ b/xorg-server/hw/xfree86/i2c/fi1236.c
@@ -398,10 +398,6 @@ int TUNER_get_afc_hint(FI1236Ptr f)
{
if(f->afc_timer_installed)return TUNER_STILL_TUNING;
return f->last_afc_hint;
-if(f->type==TUNER_TYPE_MT2032)
- return MT2032_get_afc_hint(f);
- else
- return FI1236_get_afc_hint(f);
}
static void MT2032_dump_status(FI1236Ptr f)
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 860e520ad..1ccaffc10 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -42,9 +42,7 @@
#include "X11/extensions/render.h"
#include "X11/extensions/dpmsconst.h"
#include "X11/Xatom.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#include "xf86xv.h"
@@ -184,7 +182,6 @@ xf86CrtcInUse (xf86CrtcPtr crtc)
void
xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
{
-#ifdef RENDER
int subpixel_order = SubPixelUnknown;
Bool has_none = FALSE;
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
@@ -243,7 +240,6 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
if (subpixel_order == SubPixelUnknown && has_none)
subpixel_order = SubPixelNone;
PictureSetSubpixelOrder (pScreen, subpixel_order);
-#endif
}
/**
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index e2e174e59..f90ecc227 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -41,9 +41,7 @@
#include "X11/extensions/render.h"
#include "X11/extensions/dpmsconst.h"
#include "X11/Xatom.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#include "cursorstr.h"
#include "inputstr.h"
diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
index 4ba8599ab..da57939cf 100644
--- a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
+++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
@@ -340,14 +340,9 @@ xf86SetSerial (int fd, pointer options)
if ((xf86SetBoolOption (options, "ClearRTS", FALSE)))
{
-#ifdef CLEARRTS_SUPPORT
- val = TIOCM_RTS;
- SYSCALL (ioctl(fd, TIOCMBIC, &val));
-#else
xf86Msg (X_WARNING,
"Option ClearRTS not supported on this OS\n");
return (-1);
-#endif
xf86MarkOptionUsedByName (options, "ClearRTS");
}
diff --git a/xorg-server/hw/xfree86/parser/read.c b/xorg-server/hw/xfree86/parser/read.c
index 1091be5e5..4e42b24f0 100644
--- a/xorg-server/hw/xfree86/parser/read.c
+++ b/xorg-server/hw/xfree86/parser/read.c
@@ -219,15 +219,15 @@ xf86readConfigFile (void)
}
else
{
- Error (INVALID_SECTION_MSG, xf86tokenString ());
free(val.str);
val.str = NULL;
+ Error (INVALID_SECTION_MSG, xf86tokenString ());
}
break;
default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
free(val.str);
val.str = NULL;
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
}
}
diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c
index 8aab0cf41..06710d55a 100644
--- a/xorg-server/hw/xfree86/parser/scan.c
+++ b/xorg-server/hw/xfree86/parser/scan.c
@@ -845,10 +845,13 @@ static int
ConfigFilter(const struct dirent *de)
{
const char *name = de->d_name;
- size_t len = strlen(name);
+ size_t len;
size_t suflen = strlen(XCONFIGSUFFIX);
- if (!name || name[0] == '.' || len <= suflen)
+ if (!name || name[0] == '.')
+ return 0;
+ len = strlen(name);
+ if(len <= suflen)
return 0;
if (strcmp(&name[len-suflen], XCONFIGSUFFIX) != 0)
return 0;
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
index 9c9aa0d55..1c8170104 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadow.c
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -27,9 +27,7 @@
#include "xf86str.h"
#include "shadowfb.h"
-#ifdef RENDER
# include "picturestr.h"
-#endif
static Bool ShadowCloseScreen (int i, ScreenPtr pScreen);
static void ShadowCopyWindow(
@@ -51,7 +49,6 @@ static Bool ShadowModifyPixmapHeader(
static Bool ShadowEnterVT(int index, int flags);
static void ShadowLeaveVT(int index, int flags);
-#ifdef RENDER
static void ShadowComposite(
CARD8 op,
PicturePtr pSrc,
@@ -66,7 +63,6 @@ static void ShadowComposite(
CARD16 width,
CARD16 height
);
-#endif /* RENDER */
typedef struct {
@@ -77,9 +73,7 @@ typedef struct {
CopyWindowProcPtr CopyWindow;
CreateGCProcPtr CreateGC;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
-#ifdef RENDER
CompositeProcPtr Composite;
-#endif /* RENDER */
Bool (*EnterVT)(int, int);
void (*LeaveVT)(int, int);
Bool vtSema;
@@ -164,9 +158,7 @@ ShadowFBInit2 (
){
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ShadowScreenPtr pPriv;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif /* RENDER */
if(!preRefreshArea && !postRefreshArea) return FALSE;
@@ -199,12 +191,10 @@ ShadowFBInit2 (
pScrn->EnterVT = ShadowEnterVT;
pScrn->LeaveVT = ShadowLeaveVT;
-#ifdef RENDER
if(ps) {
pPriv->Composite = ps->Composite;
ps->Composite = ShadowComposite;
}
-#endif /* RENDER */
return TRUE;
}
@@ -251,9 +241,7 @@ ShadowCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif /* RENDER */
pScreen->CloseScreen = pPriv->CloseScreen;
pScreen->CopyWindow = pPriv->CopyWindow;
@@ -263,11 +251,9 @@ ShadowCloseScreen (int i, ScreenPtr pScreen)
pScrn->EnterVT = pPriv->EnterVT;
pScrn->LeaveVT = pPriv->LeaveVT;
-#ifdef RENDER
if(ps) {
ps->Composite = pPriv->Composite;
}
-#endif /* RENDER */
xfree((pointer)pPriv);
@@ -355,7 +341,6 @@ ShadowModifyPixmapHeader(
return retval;
}
-#ifdef RENDER
static void
ShadowComposite(
CARD8 op,
@@ -408,7 +393,6 @@ ShadowComposite(
(*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
}
}
-#endif /* RENDER */
/**********************************************************/
diff --git a/xorg-server/hw/xfree86/xaa/xaa.h b/xorg-server/hw/xfree86/xaa/xaa.h
index 7db6b95d5..2af954fee 100644
--- a/xorg-server/hw/xfree86/xaa/xaa.h
+++ b/xorg-server/hw/xfree86/xaa/xaa.h
@@ -108,9 +108,7 @@
#include "regionstr.h"
#include "xf86fbman.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
/* Flags */
#define PIXMAP_CACHE 0x00000001
@@ -1251,7 +1249,6 @@ typedef struct _XAAInfoRec {
CARD32 FullPlanemasks[32];
-#ifdef RENDER
Bool (*Composite) (
CARD8 op,
PicturePtr pSrc,
@@ -1336,13 +1333,10 @@ typedef struct _XAAInfoRec {
CARD32 * CPUToScreenTextureFormats;
-#endif
-
/* these were added for 4.3.0 */
BoxRec SolidLineLimits;
BoxRec DashedLineLimits;
-#ifdef RENDER
/* These were added for X.Org 6.8.0 */
Bool (*SetupForCPUToScreenAlphaTexture2) (
ScrnInfoPtr pScrn,
@@ -1373,7 +1367,6 @@ typedef struct _XAAInfoRec {
int flags
);
CARD32 *CPUToScreenTextureDstFormats;
-#endif /* RENDER */
} XAAInfoRec, *XAAInfoRecPtr;
#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index 2ce2d9085..7d4583dc2 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -100,9 +100,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
XAAScreenPtr pScreenPriv;
int i;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
/* Return successfully if no acceleration wanted */
if (!infoRec)
@@ -173,7 +171,6 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
pScreenPriv->WindowExposures = pScreen->WindowExposures;
-#ifdef RENDER
if (ps)
{
pScreenPriv->Composite = ps->Composite;
@@ -181,7 +178,6 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
pScreenPriv->Glyphs = ps->Glyphs;
ps->Glyphs = XAAGlyphs;
}
-#endif
if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
XAASetupOverlay8_32Planar(pScreen);
diff --git a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
index 157325e4b..6f3d622e1 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
@@ -1251,7 +1251,6 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
infoRec->ComputeDash = XAAComputeDash;
}
-#ifdef RENDER
{
Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
infoRec->CPUToScreenTextureDstFormats &&
@@ -1271,7 +1270,6 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
infoRec->Glyphs = XAADoGlyphs;
}
}
-#endif
/************ Validation Functions **************/
diff --git a/xorg-server/hw/xfree86/xaa/xaaStateChange.c b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
index 57d8aa318..f33261453 100644
--- a/xorg-server/hw/xfree86/xaa/xaaStateChange.c
+++ b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
@@ -260,7 +260,6 @@ typedef struct _XAAStateWrapRec {
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
CopyWindowProcPtr CopyWindow;
-#ifdef RENDER
Bool (*SetupForCPUToScreenAlphaTexture2)(ScrnInfoPtr pScrn, int op,
CARD16 red, CARD16 green,
CARD16 blue, CARD16 alpha,
@@ -271,7 +270,6 @@ typedef struct _XAAStateWrapRec {
CARD32 srcFormat, CARD32 dstFormat,
CARD8 *texPtr, int texPitch,
int width, int height, int flags);
-#endif
} XAAStateWrapRec, *XAAStateWrapPtr;
static int XAAStateKeyIndex;
@@ -1457,7 +1455,6 @@ static void XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
prgnSrc);
}
-#ifdef RENDER
static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
int op, CARD16 red,
CARD16 green,
@@ -1494,7 +1491,6 @@ static Bool XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
dstFormat, texPtr, texPitch,
width, height, flags);
}
-#endif
/* Setup Function */
Bool
@@ -1624,9 +1620,7 @@ XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
XAA_STATE_WRAP(GetImage);
XAA_STATE_WRAP(GetSpans);
XAA_STATE_WRAP(CopyWindow);
-#ifdef RENDER
XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
-#endif
return TRUE;
}
diff --git a/xorg-server/hw/xfree86/xaa/xaaWrapper.c b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
index 88418946f..d6409887c 100644
--- a/xorg-server/hw/xfree86/xaa/xaaWrapper.c
+++ b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
@@ -62,10 +62,8 @@ typedef struct {
UninstallColormapProcPtr UninstallColormap;
ListInstalledColormapsProcPtr ListInstalledColormaps;
StoreColorsProcPtr StoreColors;
-#ifdef RENDER
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
-#endif
CloseScreenProcPtr wrapCloseScreen;
CreateScreenResourcesProcPtr wrapCreateScreenResources;
@@ -79,10 +77,8 @@ typedef struct {
UninstallColormapProcPtr wrapUninstallColormap;
ListInstalledColormapsProcPtr wrapListInstalledColormaps;
StoreColorsProcPtr wrapStoreColors;
-#ifdef RENDER
CompositeProcPtr wrapComposite;
GlyphsProcPtr wrapGlyphs;
-#endif
int depth;
} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
@@ -270,9 +266,7 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
{
Bool ret;
xaaWrapperScrPrivPtr pScrPriv;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
return FALSE;
@@ -293,12 +287,10 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
get (pScrPriv, pScreen, UninstallColormap, wrapUninstallColormap);
get (pScrPriv, pScreen, ListInstalledColormaps, wrapListInstalledColormaps);
get (pScrPriv, pScreen, StoreColors, wrapStoreColors);
-#ifdef RENDER
if (ps) {
get (pScrPriv, ps, Glyphs, wrapGlyphs);
get (pScrPriv, ps, Composite, wrapComposite);
}
-#endif
if (!(ret = XAAInit(pScreen,infoPtr)))
return FALSE;
@@ -317,12 +309,10 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
xaaWrapperListInstalledColormaps);
wrap (pScrPriv, pScreen, StoreColors, xaaWrapperStoreColors);
-#ifdef RENDER
if (ps) {
wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
}
-#endif
pScrPriv->depth = depth;
dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
@@ -438,7 +428,6 @@ xaaWrapperDestroyClip(GCPtr pGC)
XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
}
-#ifdef RENDER
static void
xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
@@ -470,7 +459,6 @@ xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
}
-#endif
void
XAASync(ScreenPtr pScreen)
diff --git a/xorg-server/hw/xfree86/xaa/xaalocal.h b/xorg-server/hw/xfree86/xaa/xaalocal.h
index 5e3d373c6..129c1d6c4 100644
--- a/xorg-server/hw/xfree86/xaa/xaalocal.h
+++ b/xorg-server/hw/xfree86/xaa/xaalocal.h
@@ -10,9 +10,7 @@
#include "xf86fbman.h"
#include "xaa.h"
#include "mi.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#define GCWhenForced (GCArcMode << 1)
@@ -55,10 +53,8 @@ typedef struct _XAAScreen {
void (*LeaveVT)(int, int);
int (*SetDGAMode)(int, int, DGADevicePtr);
void (*EnableDisableFBAccess)(int, Bool);
-#ifdef RENDER
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
-#endif
} XAAScreenRec, *XAAScreenPtr;
#define OPS_ARE_PIXMAP 0x00000001
@@ -1539,7 +1535,6 @@ extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area);
extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
-#ifdef RENDER
extern _X_EXPORT void
XAAComposite (CARD8 op,
PicturePtr pSrc,
@@ -1627,8 +1622,6 @@ XAAGetPixelFromRGBA (
CARD32 format
);
-#endif
-
/* XXX should be static */
extern _X_EXPORT GCOps XAAFallbackOps;
extern _X_EXPORT GCOps *XAAGetFallbackOps(void);
diff --git a/xorg-server/hw/xfree86/xaa/xaawrap.h b/xorg-server/hw/xfree86/xaa/xaawrap.h
index 857dbc3ed..86ba003d6 100644
--- a/xorg-server/hw/xfree86/xaa/xaawrap.h
+++ b/xorg-server/hw/xfree86/xaa/xaawrap.h
@@ -61,14 +61,12 @@
#include <xorg-config.h>
#endif
-#ifdef RENDER
#define XAA_RENDER_PROLOGUE(pScreen,field)\
(GetPictureScreen(pScreen)->field = \
((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\
(GetPictureScreen(pScreen)->field = wrapper)
-#endif
/* This also works fine for drawables */
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index d3f448820..1fb158b26 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -240,11 +240,9 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
return FALSE;
}
-#ifdef RENDER
if (! fbPictureInit(pScreen, 0, 0)) {
return FALSE;
}
-#endif
#ifdef MITSHM
ShmRegisterFbFuncs(pScreen);
diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.h b/xorg-server/hw/xquartz/mach-startup/launchd_fd.h
index 5083fae21..12caf7193 100644
--- a/xorg-server/hw/xquartz/mach-startup/launchd_fd.h
+++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.h
@@ -33,4 +33,4 @@
int launchd_display_fd(void);
-#endif /* _XQUARTZ_LAUNCHD_FD_H_ */ \ No newline at end of file
+#endif /* _XQUARTZ_LAUNCHD_FD_H_ */
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index f65d7c9b0..ffbc44643 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -47,7 +47,6 @@ from The Open Group.
#if defined(WIN32)
#include "xkbsrv.h"
#endif
-
#ifdef RELOCATE_PROJECTROOT
#undef Status
#include <shlobj.h>
@@ -160,9 +159,7 @@ static PixmapFormatRec g_PixmapFormats[] = {
{ 15, 16, BITMAP_SCANLINE_PAD },
{ 16, 16, BITMAP_SCANLINE_PAD },
{ 24, 32, BITMAP_SCANLINE_PAD },
-#ifdef RENDER
{ 32, 32, BITMAP_SCANLINE_PAD }
-#endif
};
const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]);
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 3672c135e..1adee2136 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -1,1438 +1,1436 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 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
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT 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.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- * Kensuke Matsuzaki
- */
-
-#ifndef _WIN_H_
-#define _WIN_H_
-
-#ifndef NO
-#define NO 0
-#endif
-#ifndef YES
-#define YES 1
-#endif
-
-/* WM_XBUTTON Messages. They should go into w32api. */
-#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-# define WM_XBUTTONUP 524
-#endif
-#ifndef WM_XBUTTONDBLCLK
-# define WM_XBUTTONDBLCLK 525
-#endif
-
-
-#define WIN_DEFAULT_BPP 0
-#define WIN_DEFAULT_WHITEPIXEL 255
-#define WIN_DEFAULT_BLACKPIXEL 0
-#define WIN_DEFAULT_LINEBIAS 0
-#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
-#define WIN_DEFAULT_DPI 75
-#define WIN_DEFAULT_REFRESH 0
-#define WIN_DEFAULT_WIN_KILL TRUE
-#define WIN_DEFAULT_UNIX_KILL FALSE
-#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
-#ifdef XWIN_EMULATEPSEUDO
-#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
-#endif
-#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
-
-#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */
-#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024)
-
-/*
- * Windows only supports 256 color palettes
- */
-#define WIN_NUM_PALETTE_ENTRIES 256
-
-/*
- * Number of times to call Restore in an attempt to restore the primary surface
- */
-#define WIN_REGAIN_SURFACE_RETRIES 1
-
-/*
- * Build a supported display depths mask by shifting one to the left
- * by the number of bits in the supported depth.
- */
-#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
- | (1 << (16 - 1)) | (1 << (15 - 1)) \
- | (1 << ( 8 - 1)))
-#define WIN_CHECK_DEPTH YES
-
-/*
- * Timer IDs for WM_TIMER
- */
-#define WIN_E3B_TIMER_ID 1
-#define WIN_POLLING_MOUSE_TIMER_ID 2
-
-#define MOUSE_POLLING_INTERVAL 50
-
-#define WIN_E3B_OFF -1
-#define WIN_FD_INVALID -1
-
-#define WIN_SERVER_NONE 0x0L /* 0 */
-#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
-#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
-#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
-#endif
-#ifdef XWIN_NATIVEGDI
-# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
-#endif
-
-#define AltMapIndex Mod1MapIndex
-#define NumLockMapIndex Mod2MapIndex
-#define AltLangMapIndex Mod3MapIndex
-#define KanaMapIndex Mod4MapIndex
-#define ScrollLockMapIndex Mod5MapIndex
-
-#define WIN_MOD_LALT 0x00000001
-#define WIN_MOD_RALT 0x00000002
-#define WIN_MOD_LCONTROL 0x00000004
-#define WIN_MOD_RCONTROL 0x00000008
-
-#define WIN_24BPP_MASK_RED 0x00FF0000
-#define WIN_24BPP_MASK_GREEN 0x0000FF00
-#define WIN_24BPP_MASK_BLUE 0x000000FF
-
-#define WIN_MAX_KEYS_PER_KEY 4
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-
-#include <errno.h>
-#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-#define HANDLE void *
-#ifdef _MSC_VER
-typedef int pid_t;
-#endif
-#include <pthread.h>
-#undef HANDLE
-#endif
-
-#ifdef HAS_MMAP
-#include <sys/mman.h>
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif /* MAP_FILE */
-#endif /* HAS_MMAP */
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <X11/Xprotostr.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "pixmap.h"
-#include "region.h"
-#include "gcstruct.h"
-#include "colormap.h"
-#include "colormapst.h"
-#include "miscstruct.h"
-#include "servermd.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "micmap.h"
-#include "mifillarc.h"
-#include "mifpoly.h"
-#include "mibstore.h"
-#include "input.h"
-#include "mipointer.h"
-#include "X11/keysym.h"
-#include "mibstore.h"
-#include "micoord.h"
-#include "dix.h"
-#include "miline.h"
-#include "shadow.h"
-#include "fb.h"
-#include "rootless.h"
-
-#ifdef RENDER
-#include "mipict.h"
-#include "picturestr.h"
-#endif
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-/*
- * Windows headers
- */
-#include "winms.h"
-#include "winresource.h"
-
-
-/*
- * Define Windows constants
- */
-
-#define WM_TRAYICON (WM_USER + 1000)
-#define WM_INIT_SYS_MENU (WM_USER + 1001)
-#define WM_GIVEUP (WM_USER + 1002)
-
-
-/* Local includes */
-#include "winwindow.h"
-#include "winmsg.h"
-
-#define PROFILEPOINT(point,thresh)\
-{\
-static unsigned int PROFPT##point = 0;\
-if (++PROFPT##point % thresh == 0)\
-ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
-}
-
-
-/* We use xor this macro for detecting toggle key state changes */
-#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
-
-#define DEFINE_ATOM_HELPER(func,atom_name) \
-static Atom func (void) { \
- static int generation; \
- static Atom atom; \
- if (generation != serverGeneration) { \
- generation = serverGeneration; \
- atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
- } \
- return atom; \
-}
-
-/*
- * Typedefs for engine dependent function pointers
- */
-
-typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
-
-typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
-
-typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
-
-typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
-
-typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
-
-typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
-
-typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
-
-typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
-
-typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
- int ndef, xColorItem *pdefs);
-
-typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
-
-typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
-
-typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
-
-typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
-
-typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
-
-/* Typedef for DIX wrapper functions */
-typedef int (*winDispatchProcPtr) (ClientPtr);
-
-
-/*
- * GC (graphics context) privates
- */
-
-typedef struct
-{
- HDC hdc;
- HDC hdcMem;
-} winPrivGCRec, *winPrivGCPtr;
-
-
-/*
- * Pixmap privates
- */
-
-typedef struct
-{
- HDC hdcSelected;
- HBITMAP hBitmap;
- BYTE *pbBits;
- DWORD dwScanlineBytes;
- BITMAPINFOHEADER *pbmih;
-} winPrivPixmapRec, *winPrivPixmapPtr;
-
-
-/*
- * Colormap privates
- */
-
-typedef struct
-{
- HPALETTE hPalette;
- LPDIRECTDRAWPALETTE lpDDPalette;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
- PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
-} winPrivCmapRec, *winPrivCmapPtr;
-
-/*
- * Windows Cursor handling.
- */
-
-typedef struct {
- /* from GetSystemMetrics */
- int sm_cx;
- int sm_cy;
-
- BOOL visible;
- HCURSOR handle;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
-} winCursorRec;
-
-/*
- * Screen information structure that we need before privates are available
- * in the server startup sequence.
- */
-
-typedef struct
-{
- ScreenPtr pScreen;
-
- /* Did the user specify a height and width? */
- Bool fUserGaveHeightAndWidth;
-
- DWORD dwScreen;
- DWORD dwUserWidth;
- DWORD dwUserHeight;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwWidth_mm;
- DWORD dwHeight_mm;
- DWORD dwPaddedWidth;
-
- /* Did the user specify a screen position? */
- Bool fUserGavePosition;
- DWORD dwInitialX;
- DWORD dwInitialY;
-
- /*
- * dwStride is the number of whole pixels that occupy a scanline,
- * including those pixels that are not displayed. This is basically
- * a rounding up of the width.
- */
- DWORD dwStride;
-
- /* Offset of the screen in the window when using scrollbars */
- DWORD dwXOffset;
- DWORD dwYOffset;
-
- DWORD dwBPP;
- DWORD dwDepth;
- DWORD dwRefreshRate;
- char *pfb;
- DWORD dwEngine;
- DWORD dwEnginePreferred;
- DWORD dwClipUpdatesNBoxes;
-#ifdef XWIN_EMULATEPSEUDO
- Bool fEmulatePseudo;
-#endif
- Bool fFullScreen;
- Bool fDecoration;
-#ifdef XWIN_MULTIWINDOWEXTWM
- Bool fMWExtWM;
- Bool fInternalWM;
- Bool fAnotherWMRunning;
-#endif
- Bool fRootless;
-#ifdef XWIN_MULTIWINDOW
- Bool fMultiWindow;
-#endif
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- Bool fMultiMonitorOverride;
-#endif
- Bool fMultipleMonitors;
- Bool fLessPointer;
- Bool fScrollbars;
- Bool fNoTrayIcon;
- int iE3BTimeout;
- /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
- Bool fUseWinKillKey;
- Bool fUseUnixKillKey;
- Bool fIgnoreInput;
-
- /* Did the user explicitly set this screen? */
- Bool fExplicitScreen;
-} winScreenInfo, *winScreenInfoPtr;
-
-
-/*
- * Screen privates
- */
-
-typedef struct _winPrivScreenRec
-{
- winScreenInfoPtr pScreenInfo;
-
- Bool fEnabled;
- Bool fClosed;
- Bool fActive;
- Bool fBadDepth;
-
- int iDeltaZ;
-
- int iConnectedClients;
-
- CloseScreenProcPtr CloseScreen;
-
- DWORD dwRedMask;
- DWORD dwGreenMask;
- DWORD dwBlueMask;
- DWORD dwBitsPerRGB;
-
- DWORD dwModeKeyStates;
-
- /* Handle to icons that must be freed */
- HICON hiconNotifyIcon;
-
- /* Last width, height, and depth of the Windows display */
- DWORD dwLastWindowsWidth;
- DWORD dwLastWindowsHeight;
- DWORD dwLastWindowsBitsPixel;
-
- /* Palette management */
- ColormapPtr pcmapInstalled;
-
- /* Pointer to the root visual so we only have to look it up once */
- VisualPtr pRootVisual;
-
- /* 3 button emulation variables */
- int iE3BCachedPress;
- Bool fE3BFakeButton2Sent;
-
- /* Privates used by shadow fb GDI server */
- HBITMAP hbmpShadow;
- HDC hdcScreen;
- HDC hdcShadow;
- HWND hwndScreen;
-
- /* Privates used by shadow fb and primary fb DirectDraw servers */
- LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE pddsPrimary;
- LPDIRECTDRAW2 pdd2;
-
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
-
-#ifdef XWIN_PRIMARYFB
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
-#endif
-
- /* Privates used by shadow fb DirectDraw Nonlocking server */
- LPDIRECTDRAW4 pdd4;
- LPDIRECTDRAWSURFACE4 pddsShadow4;
- LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
-
- /* Privates used by both shadow fb DirectDraw servers */
- LPDIRECTDRAWCLIPPER pddcPrimary;
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- /* Privates used by multi-window external window manager */
- RootlessFrameID widTop;
- Bool fRestacking;
-#endif
-
-#ifdef XWIN_MULTIWINDOW
- /* Privates used by multi-window */
- pthread_t ptWMProc;
- pthread_t ptXMsgProc;
- void *pWMInfo;
-#endif
-
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- /* Privates used by both multi-window and rootless */
- Bool fRootWindowShown;
-#endif
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Privates used for any module running in a seperate thread */
- pthread_mutex_t pmServerStarted;
- Bool fServerStarted;
-#endif
-
- /* Engine specific functions */
- winAllocateFBProcPtr pwinAllocateFB;
- winShadowUpdateProcPtr pwinShadowUpdate;
- winCloseScreenProcPtr pwinCloseScreen;
- winInitVisualsProcPtr pwinInitVisuals;
- winAdjustVideoModeProcPtr pwinAdjustVideoMode;
- winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
- winFinishScreenInitProcPtr pwinFinishScreenInit;
- winBltExposedRegionsProcPtr pwinBltExposedRegions;
- winActivateAppProcPtr pwinActivateApp;
- winRedrawScreenProcPtr pwinRedrawScreen;
- winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
- winInstallColormapProcPtr pwinInstallColormap;
- winStoreColorsProcPtr pwinStoreColors;
- winCreateColormapProcPtr pwinCreateColormap;
- winDestroyColormapProcPtr pwinDestroyColormap;
- winHotKeyAltTabProcPtr pwinHotKeyAltTab;
- winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
- winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
-
- winCreateScreenResourcesProc pwinCreateScreenResources;
-
-#ifdef XWIN_MULTIWINDOW
- /* Window Procedures for MultiWindow mode */
- winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
-#endif
-
- /* Window Procedures for Rootless mode */
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- PositionWindowProcPtr PositionWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- ValidateTreeProcPtr ValidateTree;
- PostValidateTreeProcPtr PostValidateTree;
- WindowExposuresProcPtr WindowExposures;
- CopyWindowProcPtr CopyWindow;
- ClearToBackgroundProcPtr ClearToBackground;
- ClipNotifyProcPtr ClipNotify;
- RestackWindowProcPtr RestackWindow;
- ReparentWindowProcPtr ReparentWindow;
- ResizeWindowProcPtr ResizeWindow;
- MoveWindowProcPtr MoveWindow;
- SetShapeProcPtr SetShape;
-
-#ifdef XWIN_NATIVEGDI
- RealizeFontProcPtr RealizeFont;
- UnrealizeFontProcPtr UnrealizeFont;
-#endif
-
- winCursorRec cursor;
-} winPrivScreenRec;
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-typedef struct {
- RootlessWindowPtr pFrame;
- HWND hWnd;
- int dwWidthBytes;
- BITMAPINFOHEADER *pbmihShadow;
- HBITMAP hbmpShadow;
- HDC hdcShadow;
- HDC hdcScreen;
- BOOL fResized;
- BOOL fRestackingNow;
- BOOL fClose;
- BOOL fMovingOrSizing;
- BOOL fDestroyed;//for debug
- char *pfb;
-} win32RootlessWindowRec, *win32RootlessWindowPtr;
-#endif
-
-
-typedef struct {
- pointer value;
- XID id;
-} WindowIDPairRec, *WindowIDPairPtr;
-
-
-/*
- * Extern declares for general global variables
- */
-
-extern winScreenInfo g_ScreenInfo[];
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern DWORD g_dwEvents;
-#ifdef HAS_DEVWINDOWS
-extern int g_fdMessageQueue;
-#endif
-extern DevPrivateKey g_iScreenPrivateKey;
-extern DevPrivateKey g_iCmapPrivateKey;
-extern DevPrivateKey g_iGCPrivateKey;
-extern DevPrivateKey g_iPixmapPrivateKey;
-extern DevPrivateKey g_iWindowPrivateKey;
-extern unsigned long g_ulServerGeneration;
-extern DWORD g_dwEnginesSupported;
-extern HINSTANCE g_hInstance;
-extern int g_copyROP[];
-extern int g_patternROP[];
-extern const char * g_pszQueryHost;
-extern DeviceIntPtr g_pwinPointer;
-extern DeviceIntPtr g_pwinKeyboard;
-
-
-/*
- * Extern declares for dynamically loaded libraries and function pointers
- */
-
-extern HMODULE g_hmodDirectDraw;
-extern FARPROC g_fpDirectDrawCreate;
-extern FARPROC g_fpDirectDrawCreateClipper;
-
-extern HMODULE g_hmodCommonControls;
-extern FARPROC g_fpTrackMouseEvent;
-
-
-/*
- * Screen privates macros
- */
-
-#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
-
-#define winSetScreenPriv(pScreen,v) \
- dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
-
-#define winScreenPriv(pScreen) \
- winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
-
-
-/*
- * Colormap privates macros
- */
-
-#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
- dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
-
-#define winSetCmapPriv(pCmap,v) \
- dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
-
-#define winCmapPriv(pCmap) \
- winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
-
-
-/*
- * GC privates macros
- */
-
-#define winGetGCPriv(pGC) ((winPrivGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
-
-#define winSetGCPriv(pGC,v) \
- dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
-
-#define winGCPriv(pGC) \
- winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
-
-
-/*
- * Pixmap privates macros
- */
-
-#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
-
-#define winSetPixmapPriv(pPixmap,v) \
- dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
-
-#define winPixmapPriv(pPixmap) \
- winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
-
-
-/*
- * Window privates macros
- */
-
-#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
-
-#define winSetWindowPriv(pWin,v) \
- dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
-
-#define winWindowPriv(pWin) \
- winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
-
-/*
- * wrapper macros
- */
-#define _WIN_WRAP(priv, real, mem, func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define _WIN_UNWRAP(priv, real, mem) {\
- real->mem = priv->mem; \
-}
-
-#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
-
-#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
-
-/*
- * BEGIN DDX and DIX Function Prototypes
- */
-
-
-/*
- * winallpriv.c
- */
-
-Bool
-winAllocatePrivates (ScreenPtr pScreen);
-
-Bool
-winInitCmapPrivates (ColormapPtr pCmap, int index);
-
-Bool
-winAllocateCmapPrivates (ColormapPtr pCmap);
-
-
-/*
- * winauth.c
- */
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-Bool
-winGenerateAuthorization (void);
-void winSetAuthorization(void);
-#endif
-
-
-/*
- * winblock.c
- */
-
-void
-winBlockHandler (int nScreen,
- pointer pBlockData,
- pointer pTimeout,
- pointer pReadMask);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winclip.c
- */
-
-RegionPtr
-winPixmapToRegionNativeGDI (PixmapPtr pPix);
-#endif
-
-
-#ifdef XWIN_CLIPBOARD
-/*
- * winclipboardinit.c
- */
-
-Bool
-winInitClipboard (void);
-
-void
-winFixClipboardChain (void);
-#endif
-
-
-/*
- * wincmap.c
- */
-
-void
-winSetColormapFunctions (ScreenPtr pScreen);
-
-Bool
-winCreateDefColormap (ScreenPtr pScreen);
-
-
-/*
- * wincreatewnd.c
- */
-
-Bool
-winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
-
-Bool
-winCreateBoundingWindowWindowed (ScreenPtr pScreen);
-
-
-/*
- * windialogs.c
- */
-
-int
-GetLiveClients (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
-
-void
-winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winengine.c
- */
-
-void
-winDetectSupportedEngines (void);
-
-Bool
-winSetEngine (ScreenPtr pScreen);
-
-Bool
-winGetDDProcAddresses (void);
-
-
-/*
- * winerror.c
- */
-
-#ifdef DDXOSVERRORF
-void
-OSVenderVErrorF (const char *pszFormat, va_list va_args);
-#endif
-
-void
-winMessageBoxF (const char *pszError, UINT uType, ...);
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfillsp.c
- */
-
-void
-winFillSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSpans,
- DDXPointPtr pPoints,
- int *pWidths,
- int fSorted);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfont.c
- */
-
-Bool
-winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-
-Bool
-winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingc.c
- */
-
-Bool
-winCreateGCNativeGDI (GCPtr pGC);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingetsp.c
- */
-
-void
-winGetSpansNativeGDI (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr pPoints,
- int *pWidths,
- int nSpans,
- char *pDst);
-#endif
-
-
-/*
- * winglobals.c
- */
-
-void
-winInitializeGlobals (void);
-
-
-/*
- * winkeybd.c
- */
-
-void
-winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
-
-int
-winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
-
-void
-winInitializeModeKeyStates (void);
-
-void
-winRestoreModeKeyStates (void);
-
-Bool
-winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
-
-void
-winKeybdReleaseKeys (void);
-
-void
-winSendKeyEvent (DWORD dwKey, Bool fDown);
-
-BOOL
-winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
-
-void
-winFixShiftKeys (int iScanCode);
-
-/*
- * winkeyhook.c
- */
-
-Bool
-winInstallKeyboardHookLL (void);
-
-void
-winRemoveKeyboardHookLL (void);
-
-
-/*
- * winmisc.c
- */
-
-#ifdef XWIN_NATIVEGDI
-void
-winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
- unsigned short *pHeight, ScreenPtr pScreen);
-#endif
-
-CARD8
-winCountBits (DWORD dw);
-
-Bool
-winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
-
-#ifdef XWIN_NATIVEGDI
-BOOL
-winPaintBackground (HWND hwnd, COLORREF colorref);
-#endif
-
-
-/*
- * winmouse.c
- */
-
-int
-winMouseProc (DeviceIntPtr pDeviceInt, int iState);
-
-int
-winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
-
-void
-winMouseButtonsSendEvent (int iEventType, int iButton);
-
-int
-winMouseButtonsHandle (ScreenPtr pScreen,
- int iEventType, int iButton,
- WPARAM wParam);
-
-void
-winEnqueueMotion(int x, int y);
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winnativegdi.c
- */
-
-HBITMAP
-winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
- BYTE **ppbBits, BITMAPINFO **ppbmi);
-
-Bool
-winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_PRIMARYFB
-/*
- * winpfbddd.c
- */
-
-Bool
-winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpixmap.c
- */
-
-PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
-
-Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
-
-Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpolyline.c
- */
-
-void
-winPolyLineNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
-#endif
-
-
-/*
- * winscrinit.c
- */
-
-Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-
-#if defined(XWIN_NATIVEGDI)
-Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv);
-#endif
-
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winsetsp.c
- */
-
-void
-winSetSpansNativeGDI (DrawablePtr pDrawable,
- GCPtr pGC,
- char *pSrc,
- DDXPointPtr pPoints,
- int *pWidth,
- int nSpans,
- int fSorted);
-#endif
-
-
-/*
- * winshaddd.c
- */
-
-Bool
-winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
-
-
-/*
- * winshadddnl.c
- */
-
-Bool
-winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
-
-
-/*
- * winshadgdi.c
- */
-
-Bool
-winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
-
-
-/*
- * winwakeup.c
- */
-
-void
-winWakeupHandler (int nScreen,
- pointer pWakeupData,
- unsigned long ulResult,
- pointer pReadmask);
-
-
-/*
- * winwindow.c
- */
-
-#ifdef XWIN_NATIVEGDI
-Bool
-winCreateWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winDestroyWindowNativeGDI (WindowPtr pWin);
-
-Bool
-winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
-
-void
-winCopyWindowNativeGDI (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-Bool
-winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
-
-Bool
-winUnmapWindowNativeGDI (WindowPtr pWindow);
-
-Bool
-winMapWindowNativeGDI (WindowPtr pWindow);
-#endif
-
-Bool
-winCreateWindowRootless (WindowPtr pWindow);
-
-Bool
-winDestroyWindowRootless (WindowPtr pWindow);
-
-Bool
-winPositionWindowRootless (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowRootless (WindowPtr pWindow);
-
-Bool
-winMapWindowRootless (WindowPtr pWindow);
-
-void
-winSetShapeRootless (WindowPtr pWindow);
-
-
-/*
- * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
- */
-
-HICON
-winXIconToHICON (WindowPtr pWin, int iconSize);
-
-void
-winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowshape.c
- */
-
-void
-winReshapeMultiWindow (WindowPtr pWin);
-
-void
-winSetShapeMultiWindow (WindowPtr pWindow);
-
-void
-winUpdateRgnMultiWindow (WindowPtr pWindow);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwindow.c
- */
-
-Bool
-winCreateWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winDestroyWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
-
-Bool
-winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
-
-Bool
-winUnmapWindowMultiWindow (WindowPtr pWindow);
-
-Bool
-winMapWindowMultiWindow (WindowPtr pWindow);
-
-void
-winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
-
-void
-winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
-
-void
-winReorderWindowsMultiWindow (void);
-
-void
-winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
- unsigned int h, WindowPtr pSib);
-void
-winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
- WindowPtr pSib, VTKind kind);
-
-void
-winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
- RegionPtr oldRegion);
-
-XID
-winGetWindowID (WindowPtr pWin);
-
-int
-winAdjustXWindow (WindowPtr pWin, HWND hwnd);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOW
-/*
- * winmultiwindowwndproc.c
- */
-
-LRESULT CALLBACK
-winTopLevelWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * wintrayicon.c
- */
-
-void
-winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
-
-void
-winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
-
-LRESULT
-winHandleIconMessage (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam,
- winPrivScreenPtr pScreenPriv);
-
-
-/*
- * winwndproc.c
- */
-
-LRESULT CALLBACK
-winWindowProc (HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootless.c
- */
-
-Bool
-winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
- int newX, int newY, RegionPtr pShape);
-
-void
-winMWExtWMDestroyFrame (RootlessFrameID wid);
-
-void
-winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
-
-void
-winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
- int newX, int newY, unsigned int newW, unsigned int newH,
- unsigned int gravity);
-
-void
-winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
-
-void
-winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
-
-void
-winMWExtWMUnmapFrame (RootlessFrameID wid);
-
-void
-winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
-
-void
-winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
-
-void
-winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
-
-void
-winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
- int shift_x, int shift_y);
-
-void
-winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
-
-void
-winMWExtWMCopyBytes (unsigned int width, unsigned int height,
- const void *src, unsigned int srcRowBytes,
- void *dst, unsigned int dstRowBytes);
-
-void
-winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
- void *dst, unsigned int dstRowBytes);
-
-int
-winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
- void *src[2], unsigned int srcRowBytes[2],
- void *mask, unsigned int maskRowBytes,
- void *dst[2], unsigned int dstRowBytes[2]);
-
-void
-winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
- int dx, int dy);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswindow.c
- */
-
-void
-winMWExtWMReorderWindows (ScreenPtr pScreen);
-
-void
-winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
-
-void
-winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
-
-void
-winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
-
-void
-winMWExtWMUpdateIcon (Window id);
-
-void
-winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
- winScreenInfoPtr pScreenInfo);
-
-wBOOL CALLBACK
-winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
-
-Bool
-winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
-
-void
-winMWExtWMRestackWindows (ScreenPtr pScreen);
-#endif
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-/*
- * winwin32rootlesswndproc.c
- */
-
-LRESULT CALLBACK
-winMWExtWMWindowProc (HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam);
-#endif
-
-
-/*
- * winwindowswm.c
- */
-
-void
-winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
- Window window, int x, int y, int w, int h);
-
-void
-winWindowsWMExtensionInit (void);
-
-/*
- * wincursor.c
- */
-
-Bool
-winInitCursor (ScreenPtr pScreen);
-
-/*
- * windisplay.c
- */
-
-void
-winGetDisplayName(char *szDisplay, unsigned int screen);
-
-/*
- * END DDX and DIX Function Prototypes
- */
-
-#endif /* _WIN_H_ */
-
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 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
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT 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.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifndef _WIN_H_
+#define _WIN_H_
+
+#ifndef NO
+#define NO 0
+#endif
+#ifndef YES
+#define YES 1
+#endif
+
+/* WM_XBUTTON Messages. They should go into w32api. */
+#ifndef WM_XBUTTONDOWN
+# define WM_XBUTTONDOWN 523
+#endif
+#ifndef WM_XBUTTONUP
+# define WM_XBUTTONUP 524
+#endif
+#ifndef WM_XBUTTONDBLCLK
+# define WM_XBUTTONDBLCLK 525
+#endif
+
+
+#define WIN_DEFAULT_BPP 0
+#define WIN_DEFAULT_WHITEPIXEL 255
+#define WIN_DEFAULT_BLACKPIXEL 0
+#define WIN_DEFAULT_LINEBIAS 0
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_DPI 75
+#define WIN_DEFAULT_REFRESH 0
+#define WIN_DEFAULT_WIN_KILL TRUE
+#define WIN_DEFAULT_UNIX_KILL FALSE
+#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
+#ifdef XWIN_EMULATEPSEUDO
+#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
+#endif
+#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
+
+#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */
+#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024)
+
+/*
+ * Windows only supports 256 color palettes
+ */
+#define WIN_NUM_PALETTE_ENTRIES 256
+
+/*
+ * Number of times to call Restore in an attempt to restore the primary surface
+ */
+#define WIN_REGAIN_SURFACE_RETRIES 1
+
+/*
+ * Build a supported display depths mask by shifting one to the left
+ * by the number of bits in the supported depth.
+ */
+#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
+ | (1 << (16 - 1)) | (1 << (15 - 1)) \
+ | (1 << ( 8 - 1)))
+#define WIN_CHECK_DEPTH YES
+
+/*
+ * Timer IDs for WM_TIMER
+ */
+#define WIN_E3B_TIMER_ID 1
+#define WIN_POLLING_MOUSE_TIMER_ID 2
+
+#define MOUSE_POLLING_INTERVAL 50
+
+#define WIN_E3B_OFF -1
+#define WIN_FD_INVALID -1
+
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#ifdef XWIN_PRIMARYFB
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#endif
+#ifdef XWIN_NATIVEGDI
+# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+#endif
+
+#define AltMapIndex Mod1MapIndex
+#define NumLockMapIndex Mod2MapIndex
+#define AltLangMapIndex Mod3MapIndex
+#define KanaMapIndex Mod4MapIndex
+#define ScrollLockMapIndex Mod5MapIndex
+
+#define WIN_MOD_LALT 0x00000001
+#define WIN_MOD_RALT 0x00000002
+#define WIN_MOD_LCONTROL 0x00000004
+#define WIN_MOD_RCONTROL 0x00000008
+
+#define WIN_24BPP_MASK_RED 0x00FF0000
+#define WIN_24BPP_MASK_GREEN 0x0000FF00
+#define WIN_24BPP_MASK_BLUE 0x000000FF
+
+#define WIN_MAX_KEYS_PER_KEY 4
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+
+#include <errno.h>
+#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+#define HANDLE void *
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
+#include <pthread.h>
+#undef HANDLE
+#endif
+
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif /* MAP_FILE */
+#endif /* HAS_MMAP */
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include <X11/Xprotostr.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "region.h"
+#include "gcstruct.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "miscstruct.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "micmap.h"
+#include "mifillarc.h"
+#include "mifpoly.h"
+#include "mibstore.h"
+#include "input.h"
+#include "mipointer.h"
+#include "X11/keysym.h"
+#include "mibstore.h"
+#include "micoord.h"
+#include "dix.h"
+#include "miline.h"
+#include "shadow.h"
+#include "fb.h"
+#include "rootless.h"
+
+#include "mipict.h"
+#include "picturestr.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+/*
+ * Windows headers
+ */
+#include "winms.h"
+#include "winresource.h"
+
+
+/*
+ * Define Windows constants
+ */
+
+#define WM_TRAYICON (WM_USER + 1000)
+#define WM_INIT_SYS_MENU (WM_USER + 1001)
+#define WM_GIVEUP (WM_USER + 1002)
+
+
+/* Local includes */
+#include "winwindow.h"
+#include "winmsg.h"
+
+#define PROFILEPOINT(point,thresh)\
+{\
+static unsigned int PROFPT##point = 0;\
+if (++PROFPT##point % thresh == 0)\
+ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
+}
+
+
+/* We use xor this macro for detecting toggle key state changes */
+#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+static Atom func (void) { \
+ static int generation; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+}
+
+/*
+ * Typedefs for engine dependent function pointers
+ */
+
+typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
+
+typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
+
+typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
+
+typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
+
+typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
+
+typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
+
+typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
+
+typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
+ int ndef, xColorItem *pdefs);
+
+typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+
+typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
+
+/* Typedef for DIX wrapper functions */
+typedef int (*winDispatchProcPtr) (ClientPtr);
+
+
+/*
+ * GC (graphics context) privates
+ */
+
+typedef struct
+{
+ HDC hdc;
+ HDC hdcMem;
+} winPrivGCRec, *winPrivGCPtr;
+
+
+/*
+ * Pixmap privates
+ */
+
+typedef struct
+{
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
+} winPrivPixmapRec, *winPrivPixmapPtr;
+
+
+/*
+ * Colormap privates
+ */
+
+typedef struct
+{
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+} winPrivCmapRec, *winPrivCmapPtr;
+
+/*
+ * Windows Cursor handling.
+ */
+
+typedef struct {
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} winCursorRec;
+
+/*
+ * Screen information structure that we need before privates are available
+ * in the server startup sequence.
+ */
+
+typedef struct
+{
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
+
+ DWORD dwScreen;
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwWidth_mm;
+ DWORD dwHeight_mm;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
+#ifdef XWIN_EMULATEPSEUDO
+ Bool fEmulatePseudo;
+#endif
+ Bool fFullScreen;
+ Bool fDecoration;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ Bool fMWExtWM;
+ Bool fInternalWM;
+ Bool fAnotherWMRunning;
+#endif
+ Bool fRootless;
+#ifdef XWIN_MULTIWINDOW
+ Bool fMultiWindow;
+#endif
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ Bool fMultiMonitorOverride;
+#endif
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ Bool fScrollbars;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
+} winScreenInfo, *winScreenInfoPtr;
+
+
+/*
+ * Screen privates
+ */
+
+typedef struct _winPrivScreenRec
+{
+ winScreenInfoPtr pScreenInfo;
+
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
+
+ int iDeltaZ;
+
+ int iConnectedClients;
+
+ CloseScreenProcPtr CloseScreen;
+
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
+
+ DWORD dwModeKeyStates;
+
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
+
+ /* Last width, height, and depth of the Windows display */
+ DWORD dwLastWindowsWidth;
+ DWORD dwLastWindowsHeight;
+ DWORD dwLastWindowsBitsPixel;
+
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
+
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
+
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
+
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
+
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
+
+#ifdef XWIN_PRIMARYFB
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
+#endif
+
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
+
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
+#endif
+
+#ifdef XWIN_MULTIWINDOW
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
+#endif
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+ winCreateScreenResourcesProc pwinCreateScreenResources;
+
+#ifdef XWIN_MULTIWINDOW
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+#endif
+
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+ SetShapeProcPtr SetShape;
+
+#ifdef XWIN_NATIVEGDI
+ RealizeFontProcPtr RealizeFont;
+ UnrealizeFontProcPtr UnrealizeFont;
+#endif
+
+ winCursorRec cursor;
+} winPrivScreenRec;
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+typedef struct {
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed;//for debug
+ char *pfb;
+} win32RootlessWindowRec, *win32RootlessWindowPtr;
+#endif
+
+
+typedef struct {
+ pointer value;
+ XID id;
+} WindowIDPairRec, *WindowIDPairPtr;
+
+
+/*
+ * Extern declares for general global variables
+ */
+
+extern winScreenInfo g_ScreenInfo[];
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern DevPrivateKey g_iScreenPrivateKey;
+extern DevPrivateKey g_iCmapPrivateKey;
+extern DevPrivateKey g_iGCPrivateKey;
+extern DevPrivateKey g_iPixmapPrivateKey;
+extern DevPrivateKey g_iWindowPrivateKey;
+extern unsigned long g_ulServerGeneration;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char * g_pszQueryHost;
+extern DeviceIntPtr g_pwinPointer;
+extern DeviceIntPtr g_pwinKeyboard;
+
+
+/*
+ * Extern declares for dynamically loaded libraries and function pointers
+ */
+
+extern HMODULE g_hmodDirectDraw;
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
+
+extern HMODULE g_hmodCommonControls;
+extern FARPROC g_fpTrackMouseEvent;
+
+
+/*
+ * Screen privates macros
+ */
+
+#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
+
+#define winSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
+
+#define winScreenPriv(pScreen) \
+ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
+
+
+/*
+ * Colormap privates macros
+ */
+
+#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
+ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
+
+#define winSetCmapPriv(pCmap,v) \
+ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
+
+#define winCmapPriv(pCmap) \
+ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
+
+
+/*
+ * GC privates macros
+ */
+
+#define winGetGCPriv(pGC) ((winPrivGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
+
+#define winSetGCPriv(pGC,v) \
+ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
+
+#define winGCPriv(pGC) \
+ winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
+
+
+/*
+ * Pixmap privates macros
+ */
+
+#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
+
+#define winSetPixmapPriv(pPixmap,v) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
+
+#define winPixmapPriv(pPixmap) \
+ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
+
+
+/*
+ * Window privates macros
+ */
+
+#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
+
+#define winSetWindowPriv(pWin,v) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
+
+#define winWindowPriv(pWin) \
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
+
+/*
+ * wrapper macros
+ */
+#define _WIN_WRAP(priv, real, mem, func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define _WIN_UNWRAP(priv, real, mem) {\
+ real->mem = priv->mem; \
+}
+
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+
+#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
+
+/*
+ * BEGIN DDX and DIX Function Prototypes
+ */
+
+
+/*
+ * winallpriv.c
+ */
+
+Bool
+winAllocatePrivates (ScreenPtr pScreen);
+
+Bool
+winInitCmapPrivates (ColormapPtr pCmap, int index);
+
+Bool
+winAllocateCmapPrivates (ColormapPtr pCmap);
+
+
+/*
+ * winauth.c
+ */
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+Bool
+winGenerateAuthorization (void);
+void winSetAuthorization(void);
+#endif
+
+
+/*
+ * winblock.c
+ */
+
+void
+winBlockHandler (int nScreen,
+ pointer pBlockData,
+ pointer pTimeout,
+ pointer pReadMask);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winclip.c
+ */
+
+RegionPtr
+winPixmapToRegionNativeGDI (PixmapPtr pPix);
+#endif
+
+
+#ifdef XWIN_CLIPBOARD
+/*
+ * winclipboardinit.c
+ */
+
+Bool
+winInitClipboard (void);
+
+void
+winFixClipboardChain (void);
+#endif
+
+
+/*
+ * wincmap.c
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen);
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen);
+
+
+/*
+ * wincreatewnd.c
+ */
+
+Bool
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
+
+Bool
+winCreateBoundingWindowWindowed (ScreenPtr pScreen);
+
+
+/*
+ * windialogs.c
+ */
+
+int
+GetLiveClients (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winengine.c
+ */
+
+void
+winDetectSupportedEngines (void);
+
+Bool
+winSetEngine (ScreenPtr pScreen);
+
+Bool
+winGetDDProcAddresses (void);
+
+
+/*
+ * winerror.c
+ */
+
+#ifdef DDXOSVERRORF
+void
+OSVenderVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winMessageBoxF (const char *pszError, UINT uType, ...);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfillsp.c
+ */
+
+void
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfont.c
+ */
+
+Bool
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+
+Bool
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingc.c
+ */
+
+Bool
+winCreateGCNativeGDI (GCPtr pGC);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingetsp.c
+ */
+
+void
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ char *pDst);
+#endif
+
+
+/*
+ * winglobals.c
+ */
+
+void
+winInitializeGlobals (void);
+
+
+/*
+ * winkeybd.c
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
+
+void
+winInitializeModeKeyStates (void);
+
+void
+winRestoreModeKeyStates (void);
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
+
+void
+winKeybdReleaseKeys (void);
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown);
+
+BOOL
+winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
+
+void
+winFixShiftKeys (int iScanCode);
+
+/*
+ * winkeyhook.c
+ */
+
+Bool
+winInstallKeyboardHookLL (void);
+
+void
+winRemoveKeyboardHookLL (void);
+
+
+/*
+ * winmisc.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+void
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
+#endif
+
+CARD8
+winCountBits (DWORD dw);
+
+Bool
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
+
+#ifdef XWIN_NATIVEGDI
+BOOL
+winPaintBackground (HWND hwnd, COLORREF colorref);
+#endif
+
+
+/*
+ * winmouse.c
+ */
+
+int
+winMouseProc (DeviceIntPtr pDeviceInt, int iState);
+
+int
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
+
+void
+winMouseButtonsSendEvent (int iEventType, int iButton);
+
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam);
+
+void
+winEnqueueMotion(int x, int y);
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winnativegdi.c
+ */
+
+HBITMAP
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi);
+
+Bool
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_PRIMARYFB
+/*
+ * winpfbddd.c
+ */
+
+Bool
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpixmap.c
+ */
+
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData);
+#endif
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpolyline.c
+ */
+
+void
+winPolyLineNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpushpxl.c
+ */
+
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+#endif
+
+
+/*
+ * winscrinit.c
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+#if defined(XWIN_NATIVEGDI)
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winsetsp.c
+ */
+
+void
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidth,
+ int nSpans,
+ int fSorted);
+#endif
+
+
+/*
+ * winshaddd.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
+
+
+/*
+ * winshadddnl.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
+
+
+/*
+ * winshadgdi.c
+ */
+
+Bool
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
+
+
+/*
+ * winwakeup.c
+ */
+
+void
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult,
+ pointer pReadmask);
+
+
+/*
+ * winwindow.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+Bool
+winCreateWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winDestroyWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
+
+void
+winCopyWindowNativeGDI (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+Bool
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
+
+Bool
+winUnmapWindowNativeGDI (WindowPtr pWindow);
+
+Bool
+winMapWindowNativeGDI (WindowPtr pWindow);
+#endif
+
+Bool
+winCreateWindowRootless (WindowPtr pWindow);
+
+Bool
+winDestroyWindowRootless (WindowPtr pWindow);
+
+Bool
+winPositionWindowRootless (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowRootless (WindowPtr pWindow);
+
+Bool
+winMapWindowRootless (WindowPtr pWindow);
+
+void
+winSetShapeRootless (WindowPtr pWindow);
+
+
+/*
+ * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
+ */
+
+HICON
+winXIconToHICON (WindowPtr pWin, int iconSize);
+
+void
+winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowshape.c
+ */
+
+void
+winReshapeMultiWindow (WindowPtr pWin);
+
+void
+winSetShapeMultiWindow (WindowPtr pWindow);
+
+void
+winUpdateRgnMultiWindow (WindowPtr pWindow);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwindow.c
+ */
+
+Bool
+winCreateWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winDestroyWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winMapWindowMultiWindow (WindowPtr pWindow);
+
+void
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
+
+void
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
+
+void
+winReorderWindowsMultiWindow (void);
+
+void
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
+void
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
+
+void
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
+
+XID
+winGetWindowID (WindowPtr pWin);
+
+int
+winAdjustXWindow (WindowPtr pWin, HWND hwnd);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwndproc.c
+ */
+
+LRESULT CALLBACK
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * wintrayicon.c
+ */
+
+void
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify);
+
+void
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
+
+LRESULT
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winwndproc.c
+ */
+
+LRESULT CALLBACK
+winWindowProc (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootless.c
+ */
+
+Bool
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
+
+void
+winMWExtWMDestroyFrame (RootlessFrameID wid);
+
+void
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+void
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+
+void
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
+
+void
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
+
+void
+winMWExtWMUnmapFrame (RootlessFrameID wid);
+
+void
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+void
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
+
+void
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
+
+void
+winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
+ int shift_x, int shift_y);
+
+void
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
+
+void
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
+
+void
+winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
+ void *dst, unsigned int dstRowBytes);
+
+int
+winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
+ void *src[2], unsigned int srcRowBytes[2],
+ void *mask, unsigned int maskRowBytes,
+ void *dst[2], unsigned int dstRowBytes[2]);
+
+void
+winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswindow.c
+ */
+
+void
+winMWExtWMReorderWindows (ScreenPtr pScreen);
+
+void
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
+
+void
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
+
+void
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
+
+void
+winMWExtWMUpdateIcon (Window id);
+
+void
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
+
+wBOOL CALLBACK
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
+
+Bool
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
+
+void
+winMWExtWMRestackWindows (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswndproc.c
+ */
+
+LRESULT CALLBACK
+winMWExtWMWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * winwindowswm.c
+ */
+
+void
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
+
+void
+winWindowsWMExtensionInit (void);
+
+/*
+ * wincursor.c
+ */
+
+Bool
+winInitCursor (ScreenPtr pScreen);
+
+/*
+ * windisplay.c
+ */
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen);
+
+/*
+ * END DDX and DIX Function Prototypes
+ */
+
+#endif /* _WIN_H_ */
+
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index 992b277e7..84341c8fb 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -1,777 +1,775 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 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
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT 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.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- * Kensuke Matsuzaki
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-#include "winmsg.h"
-
-
-#ifdef XWIN_MULTIWINDOWEXTWM
-static RootlessFrameProcsRec
-winMWExtWMProcs = {
- winMWExtWMCreateFrame,
- winMWExtWMDestroyFrame,
-
- winMWExtWMMoveFrame,
- winMWExtWMResizeFrame,
- winMWExtWMRestackFrame,
- winMWExtWMReshapeFrame,
- winMWExtWMUnmapFrame,
-
- winMWExtWMStartDrawing,
- winMWExtWMStopDrawing,
- winMWExtWMUpdateRegion,
-#ifndef ROOTLESS_TRACK_DAMAGE
- winMWExtWMDamageRects,
-#endif
- winMWExtWMRootlessSwitchWindow,
- NULL,//winMWExtWMDoReorderWindow,
- NULL,//winMWExtWMHideWindow,
- NULL,//winMWExtWMUpdateColorMap,
-
- NULL,//winMWExtWMCopyBytes,
- NULL,//winMWExtWMFillBytes,
- NULL,//winMWExtWMCompositePixels,
- winMWExtWMCopyWindow
-};
-#endif
-
-
-/*
- * References to external symbols
- */
-
-extern Bool g_fSoftwareCursor;
-
-
-/*
- * Prototypes
- */
-
-Bool
-winRandRInit (ScreenPtr pScreen);
-
-
-/*
- * Local functions
- */
-
-static Bool
-winSaveScreen (ScreenPtr pScreen, int on);
-
-
-/*
- * Determine what type of screen we are initializing
- * and call the appropriate procedure to intiailize
- * that type of screen.
- */
-
-Bool
-winScreenInit (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
-{
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- winPrivScreenPtr pScreenPriv;
- HDC hdc;
-
- winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
- pScreenInfo->dwWidth, pScreenInfo->dwHeight);
-
- /* Allocate privates for this screen */
- if (!winAllocatePrivates (pScreen))
- {
- ErrorF ("winScreenInit - Couldn't allocate screen privates\n");
- return FALSE;
- }
-
- /* Get a pointer to the privates structure that was allocated */
- pScreenPriv = winGetScreenPriv (pScreen);
-
- /* Save a pointer to this screen in the screen info structure */
- pScreenInfo->pScreen = pScreen;
-
- /* Save a pointer to the screen info in the screen privates structure */
- /* This allows us to get back to the screen info from a screen pointer */
- pScreenPriv->pScreenInfo = pScreenInfo;
-
- /*
- * Determine which engine to use.
- *
- * NOTE: This is done once per screen because each screen possibly has
- * a preferred engine specified on the command line.
- */
- if (!winSetEngine (pScreen))
- {
- ErrorF ("winScreenInit - winSetEngine () failed\n");
- return FALSE;
- }
-
- /* Adjust the video mode for our engine type */
- if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
- {
- ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
- return FALSE;
- }
-
- /* Check for supported display depth */
- if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1))))
- {
- ErrorF ("winScreenInit - Unsupported display depth: %d\n" \
- "Change your Windows display depth to 15, 16, 24, or 32 bits "
- "per pixel.\n",
- (int) pScreenInfo->dwBPP);
- ErrorF ("winScreenInit - Supported depths: %08x\n",
- WIN_SUPPORTED_BPPS);
-#if WIN_CHECK_DEPTH
- return FALSE;
-#endif
- }
-
- /*
- * Check that all monitors have the same display depth if we are using
- * multiple monitors
- */
- if (pScreenInfo->fMultipleMonitors
- && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT))
- {
- ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
- "display depth.\n"
- "Using primary display only.\n");
- pScreenInfo->fMultipleMonitors = FALSE;
- }
-
- /* Create display window */
- if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
- {
- ErrorF ("winScreenInit - pwinCreateBoundingWindow () "
- "failed\n");
- return FALSE;
- }
-
- /* Get a device context */
- hdc = GetDC (pScreenPriv->hwndScreen);
-
- /* Store the initial height, width, and depth of the display */
- /* Are we using multiple monitors? */
- if (pScreenInfo->fMultipleMonitors)
- {
- pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
- pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
-
- /*
- * In this case, some of the defaults set in
- * winInitializeDefaultScreens () are not correct ...
- */
- if (!pScreenInfo->fUserGaveHeightAndWidth)
- {
- pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
- pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
- pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth /
- WIN_DEFAULT_DPI) * 25.4;
- pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight /
- WIN_DEFAULT_DPI) * 25.4;
- }
- }
- else
- {
- pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
- pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
- }
-
- /* Save the original bits per pixel */
- pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL);
-
- /* Release the device context */
- ReleaseDC (pScreenPriv->hwndScreen, hdc);
-
- /* Clear the visuals list */
- miClearVisualTypes ();
-
- /* Set the padded screen width */
- pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
- pScreenInfo->dwBPP);
-
- /* Call the engine dependent screen initialization procedure */
- if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
- {
- ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
- return FALSE;
- }
-
- if (!g_fSoftwareCursor)
- winInitCursor(pScreen);
-#ifdef WINDBG
- else
- winDebug("winScreenInit - Using software cursor\n");
-#endif
-
- /*
- Note the screen origin in a normalized coordinate space where (0,0) is at the top left
- of the native virtual desktop area
- */
- dixScreenOrigins[index].x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
- dixScreenOrigins[index].y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- winDebug("Screen %d added at virtual desktop coordinate (%d,%d).\n",
- index, dixScreenOrigins[index].x, dixScreenOrigins[index].y);
- winDebug ("winScreenInit - returning\n");
-
- return TRUE;
-}
-
-static Bool
-winCreateScreenResources(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- Bool result;
-
- result = pScreenPriv->pwinCreateScreenResources(pScreen);
-
- /* Now the screen bitmap has been wrapped in a pixmap,
- add that to the Shadow framebuffer */
- if (!shadowAdd(pScreen, pScreen->devPrivate,
- pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
- {
- ErrorF ("winCreateScreenResources - shadowAdd () failed\n");
- return FALSE;
- }
-
- return result;
-}
-
-/* See Porting Layer Definition - p. 20 */
-Bool
-winFinishScreenInitFB (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- VisualPtr pVisual = NULL;
- char *pbits = NULL;
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- int iReturn;
-#endif
-
- /* Create framebuffer */
- if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
- return FALSE;
- }
-
- /*
- * Grab the number of bits that are used to represent color in each pixel.
- */
- if (pScreenInfo->dwBPP == 8)
- pScreenInfo->dwDepth = 8;
- else
- pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
- + winCountBits (pScreenPriv->dwGreenMask)
- + winCountBits (pScreenPriv->dwBlueMask);
-
- winDebug ("winFinishScreenInitFB - Masks: %08x %08x %08x\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask);
-
- /* Init visuals */
- if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n");
- return FALSE;
- }
-
- /* Setup a local variable to point to the framebuffer */
- pbits = pScreenInfo->pfb;
-
- /* Apparently we need this for the render extension */
- miSetPixmapDepths ();
-
- /* Start fb initialization */
- if (!fbSetupScreen (pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- pScreenInfo->dwBPP))
- {
- ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n");
- return FALSE;
- }
-
- /* Override default colormap routines if visual class is dynamic */
- if (pScreenInfo->dwDepth == 8
- && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
- && pScreenInfo->fFullScreen)
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- && pScreenInfo->fFullScreen)))
- {
- winSetColormapFunctions (pScreen);
-
- /*
- * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
- * own colormap, as it cannot allocate 7 planes in the default
- * colormap. Setting whitePixel to 1 allows Magic to get 7
- * planes in the default colormap, so it doesn't create its
- * own colormap. This latter situation is highly desireable,
- * as it keeps the Magic window viewable when switching to
- * other X clients that use the default colormap.
- */
- pScreen->blackPixel = 0;
- pScreen->whitePixel = 1;
- }
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Finish fb initialization */
- if (!fbFinishScreenInit (pScreen,
- pScreenInfo->pfb,
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- pScreenInfo->dwBPP))
- {
- ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n");
- return FALSE;
- }
-
- /* Save a pointer to the root visual */
- for (pVisual = pScreen->visuals;
- pVisual->vid != pScreen->rootVisual;
- pVisual++);
- pScreenPriv->pRootVisual = pVisual;
-
- /*
- * Setup points to the block and wakeup handlers. Pass a pointer
- * to the current screen as pWakeupdata.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
-#ifdef RENDER
- /* Render extension initialization, calls miPictureInit */
- if (!fbPictureInit (pScreen, NULL, 0))
- {
- ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n");
- return FALSE;
- }
-#endif
-
-#ifdef RANDR
- /* Initialize resize and rotate support */
- if (!winRandRInit (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
- return FALSE;
- }
-#endif
-
- /*
- * Backing store support should reduce network traffic and increase
- * performance.
- */
- miInitializeBackingStore (pScreen);
-
- /* KDrive does miDCInitialize right after miInitializeBackingStore */
- /* Setup the cursor routines */
- winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
- miDCInitialize (pScreen, &g_winPointerCursorFuncs);
-
- /* KDrive does winCreateDefColormap right after miDCInitialize */
- /* Create a default colormap */
- winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
- if (!winCreateDefColormap (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - Could not create colormap\n");
- return FALSE;
- }
-
- /* Initialize the shadow framebuffer layer */
- if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
-#ifdef XWIN_MULTIWINDOWEXTWM
- && !pScreenInfo->fMWExtWM
-#endif
- )
- {
- winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n");
- if (!shadowSetup(pScreen))
- {
- ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n");
- return FALSE;
- }
-
- /* Wrap CreateScreenResources so we can add the screen pixmap
- to the Shadow framebuffer after it's been created */
- pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = winCreateScreenResources;
- }
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- /* Handle multi-window external window manager mode */
- if (pScreenInfo->fMWExtWM)
- {
- winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
-
- RootlessInit(pScreen, &winMWExtWMProcs);
-
- winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
-
- rootless_CopyBytes_threshold = 0;
- rootless_FillBytes_threshold = 0;
- rootless_CompositePixels_threshold = 0;
- /* FIXME: How many? Profiling needed? */
- rootless_CopyWindow_threshold = 1;
-
- winWindowsWMExtensionInit ();
- }
-#endif
-
- /* Handle rootless mode */
- if (pScreenInfo->fRootless)
- {
- /* Define the WRAP macro temporarily for local use */
-#define WRAP(a) \
- if (pScreen->a) { \
- pScreenPriv->a = pScreen->a; \
- } else { \
- ErrorF("null screen fn " #a "\n"); \
- pScreenPriv->a = NULL; \
- }
-
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(SetShape);
-
- /* Assign rootless window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowRootless;
- pScreen->DestroyWindow = winDestroyWindowRootless;
- pScreen->PositionWindow = winPositionWindowRootless;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/
- pScreen->RealizeWindow = winMapWindowRootless;
- pScreen->UnrealizeWindow = winUnmapWindowRootless;
- pScreen->SetShape = winSetShapeRootless;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
-#undef WRAP
- }
-
-
-#ifdef XWIN_MULTIWINDOW
- /* Handle multi window mode */
- else if (pScreenInfo->fMultiWindow)
- {
- /* Define the WRAP macro temporarily for local use */
-#define WRAP(a) \
- if (pScreen->a) { \
- pScreenPriv->a = pScreen->a; \
- } else { \
- ErrorF("null screen fn " #a "\n"); \
- pScreenPriv->a = NULL; \
- }
-
- /* Save a pointer to each lower-level window procedure */
- WRAP(CreateWindow);
- WRAP(DestroyWindow);
- WRAP(RealizeWindow);
- WRAP(UnrealizeWindow);
- WRAP(PositionWindow);
- WRAP(ChangeWindowAttributes);
- WRAP(ReparentWindow);
- WRAP(RestackWindow);
- WRAP(ResizeWindow);
- WRAP(MoveWindow);
- WRAP(CopyWindow);
- WRAP(SetShape);
-
- /* Assign multi-window window procedures to be top level procedures */
- pScreen->CreateWindow = winCreateWindowMultiWindow;
- pScreen->DestroyWindow = winDestroyWindowMultiWindow;
- pScreen->PositionWindow = winPositionWindowMultiWindow;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/
- pScreen->RealizeWindow = winMapWindowMultiWindow;
- pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
- pScreen->ReparentWindow = winReparentWindowMultiWindow;
- pScreen->RestackWindow = winRestackWindowMultiWindow;
- pScreen->ResizeWindow = winResizeWindowMultiWindow;
- pScreen->MoveWindow = winMoveWindowMultiWindow;
- pScreen->CopyWindow = winCopyWindowMultiWindow;
- pScreen->SetShape = winSetShapeMultiWindow;
-
- /* Undefine the WRAP macro, as it is not needed elsewhere */
-#undef WRAP
- }
-#endif
-
- /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Create a mutex for modules in separate threads to wait for */
- iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
- if (iReturn != 0)
- {
- ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
- iReturn);
- return FALSE;
- }
-
- /* Own the mutex for modules in separate threads */
- iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
- if (iReturn != 0)
- {
- ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
- iReturn);
- return FALSE;
- }
-
- /* Set the ServerStarted flag to false */
- pScreenPriv->fServerStarted = FALSE;
-#endif
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- pScreenPriv->fRestacking = FALSE;
-#endif
-
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
- if (FALSE
-#ifdef XWIN_MULTIWINDOW
- || pScreenInfo->fMultiWindow
-#endif
-#ifdef XWIN_MULTIWINDOWEXTWM
- || pScreenInfo->fInternalWM
-#endif
- )
- {
- winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
-
- /* Initialize multi window mode */
- if (!winInitWM (&pScreenPriv->pWMInfo,
- &pScreenPriv->ptWMProc,
- &pScreenPriv->ptXMsgProc,
- &pScreenPriv->pmServerStarted,
- pScreenInfo->dwScreen,
- (HWND)&pScreenPriv->hwndScreen,
-#ifdef XWIN_MULTIWINDOWEXTWM
- pScreenInfo->fInternalWM ||
-#endif
- FALSE))
- {
- ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
- return FALSE;
- }
- }
-#endif
-
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
-
- /* Tell the server that we have a valid depth */
- pScreenPriv->fBadDepth = FALSE;
-
- winDebug ("winFinishScreenInitFB - returning\n");
-
- return TRUE;
-}
-
-#ifdef XWIN_NATIVEGDI
-/* See Porting Layer Definition - p. 20 */
-
-Bool
-winFinishScreenInitNativeGDI (int index,
- ScreenPtr pScreen,
- int argc, char **argv)
-{
- winScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
- VisualPtr pVisuals = NULL;
- DepthPtr pDepths = NULL;
- VisualID rootVisual = 0;
- int nVisuals = 0, nDepths = 0, nRootDepth = 0;
-
- /* Ignore user input (mouse, keyboard) */
- pScreenInfo->fIgnoreInput = FALSE;
-
- /* Get device contexts for the screen and shadow bitmap */
- pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
- if (pScreenPriv->hdcScreen == NULL)
- FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
-
- /* Init visuals */
- if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
- {
- ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
- return FALSE;
- }
-
- /* Initialize the mi visuals */
- if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
- &rootVisual,
- ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
- TrueColor))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
- return FALSE;
- }
-
- /* Initialize the CloseScreen procedure pointer */
- pScreen->CloseScreen = NULL;
-
- /* Initialize the mi code */
- if (!miScreenInit (pScreen,
- NULL, /* No framebuffer */
- pScreenInfo->dwWidth, pScreenInfo->dwHeight,
- monitorResolution, monitorResolution,
- pScreenInfo->dwStride,
- nRootDepth, nDepths, pDepths, rootVisual,
- nVisuals, pVisuals))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
- return FALSE;
- }
-
- pScreen->defColormap = FakeClientID(0);
-
- /*
- * Register our block and wakeup handlers; these procedures
- * process messages in our Windows message queue; specifically,
- * they process mouse and keyboard input.
- */
- pScreen->BlockHandler = winBlockHandler;
- pScreen->WakeupHandler = winWakeupHandler;
- pScreen->blockData = pScreen;
- pScreen->wakeupData = pScreen;
-
- /* Place our save screen function */
- pScreen->SaveScreen = winSaveScreen;
-
- /* Pixmaps */
- pScreen->CreatePixmap = winCreatePixmapNativeGDI;
- pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
-
- /* Other Screen Routines */
- pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
- pScreen->SaveScreen = winSaveScreen;
- pScreen->GetImage = miGetImage;
- pScreen->GetSpans = winGetSpansNativeGDI;
-
- /* Window Procedures */
- pScreen->CreateWindow = winCreateWindowNativeGDI;
- pScreen->DestroyWindow = winDestroyWindowNativeGDI;
- pScreen->PositionWindow = winPositionWindowNativeGDI;
- /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
- pScreen->RealizeWindow = winMapWindowNativeGDI;
- pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
-
- /* Paint window */
- pScreen->CopyWindow = winCopyWindowNativeGDI;
-
- /* Fonts */
- pScreen->RealizeFont = winRealizeFontNativeGDI;
- pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
-
- /* GC */
- pScreen->CreateGC = winCreateGCNativeGDI;
-
- /* Colormap Routines */
- pScreen->CreateColormap = miInitializeColormap;
- pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
- pScreen->ResolveColor = miResolveColor;
-
- /* Bitmap */
- pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
-
- winDebug ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
-
- /* Set the default white and black pixel positions */
- pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
-
- /* Initialize the cursor */
- if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
- return FALSE;
- }
-
- /* Create a default colormap */
- if (!miCreateDefColormap (pScreen))
- {
- ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "failed\n");
- return FALSE;
- }
-
- winDebug ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
- "returned\n");
-
- /* mi doesn't use a CloseScreen procedure, so no need to wrap */
- pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
-
- /* Tell the server that we are enabled */
- pScreenPriv->fEnabled = TRUE;
-
- winDebug ("winFinishScreenInitNativeGDI - Successful addition of "
- "screen %08x\n",
- (unsigned int) pScreen);
-
- return TRUE;
-}
-#endif
-
-
-/* See Porting Layer Definition - p. 33 */
-static Bool
-winSaveScreen (ScreenPtr pScreen, int on)
-{
- return TRUE;
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 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
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT 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.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+static RootlessFrameProcsRec
+winMWExtWMProcs = {
+ winMWExtWMCreateFrame,
+ winMWExtWMDestroyFrame,
+
+ winMWExtWMMoveFrame,
+ winMWExtWMResizeFrame,
+ winMWExtWMRestackFrame,
+ winMWExtWMReshapeFrame,
+ winMWExtWMUnmapFrame,
+
+ winMWExtWMStartDrawing,
+ winMWExtWMStopDrawing,
+ winMWExtWMUpdateRegion,
+#ifndef ROOTLESS_TRACK_DAMAGE
+ winMWExtWMDamageRects,
+#endif
+ winMWExtWMRootlessSwitchWindow,
+ NULL,//winMWExtWMDoReorderWindow,
+ NULL,//winMWExtWMHideWindow,
+ NULL,//winMWExtWMUpdateColorMap,
+
+ NULL,//winMWExtWMCopyBytes,
+ NULL,//winMWExtWMFillBytes,
+ NULL,//winMWExtWMCompositePixels,
+ winMWExtWMCopyWindow
+};
+#endif
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fSoftwareCursor;
+
+
+/*
+ * Prototypes
+ */
+
+Bool
+winRandRInit (ScreenPtr pScreen);
+
+
+/*
+ * Local functions
+ */
+
+static Bool
+winSaveScreen (ScreenPtr pScreen, int on);
+
+
+/*
+ * Determine what type of screen we are initializing
+ * and call the appropriate procedure to intiailize
+ * that type of screen.
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ winPrivScreenPtr pScreenPriv;
+ HDC hdc;
+
+ winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight);
+
+ /* Allocate privates for this screen */
+ if (!winAllocatePrivates (pScreen))
+ {
+ ErrorF ("winScreenInit - Couldn't allocate screen privates\n");
+ return FALSE;
+ }
+
+ /* Get a pointer to the privates structure that was allocated */
+ pScreenPriv = winGetScreenPriv (pScreen);
+
+ /* Save a pointer to this screen in the screen info structure */
+ pScreenInfo->pScreen = pScreen;
+
+ /* Save a pointer to the screen info in the screen privates structure */
+ /* This allows us to get back to the screen info from a screen pointer */
+ pScreenPriv->pScreenInfo = pScreenInfo;
+
+ /*
+ * Determine which engine to use.
+ *
+ * NOTE: This is done once per screen because each screen possibly has
+ * a preferred engine specified on the command line.
+ */
+ if (!winSetEngine (pScreen))
+ {
+ ErrorF ("winScreenInit - winSetEngine () failed\n");
+ return FALSE;
+ }
+
+ /* Adjust the video mode for our engine type */
+ if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
+ {
+ ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
+ return FALSE;
+ }
+
+ /* Check for supported display depth */
+ if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1))))
+ {
+ ErrorF ("winScreenInit - Unsupported display depth: %d\n" \
+ "Change your Windows display depth to 15, 16, 24, or 32 bits "
+ "per pixel.\n",
+ (int) pScreenInfo->dwBPP);
+ ErrorF ("winScreenInit - Supported depths: %08x\n",
+ WIN_SUPPORTED_BPPS);
+#if WIN_CHECK_DEPTH
+ return FALSE;
+#endif
+ }
+
+ /*
+ * Check that all monitors have the same display depth if we are using
+ * multiple monitors
+ */
+ if (pScreenInfo->fMultipleMonitors
+ && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT))
+ {
+ ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
+ "display depth.\n"
+ "Using primary display only.\n");
+ pScreenInfo->fMultipleMonitors = FALSE;
+ }
+
+ /* Create display window */
+ if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
+ {
+ ErrorF ("winScreenInit - pwinCreateBoundingWindow () "
+ "failed\n");
+ return FALSE;
+ }
+
+ /* Get a device context */
+ hdc = GetDC (pScreenPriv->hwndScreen);
+
+ /* Store the initial height, width, and depth of the display */
+ /* Are we using multiple monitors? */
+ if (pScreenInfo->fMultipleMonitors)
+ {
+ pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+
+ /*
+ * In this case, some of the defaults set in
+ * winInitializeDefaultScreens () are not correct ...
+ */
+ if (!pScreenInfo->fUserGaveHeightAndWidth)
+ {
+ pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth /
+ WIN_DEFAULT_DPI) * 25.4;
+ pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight /
+ WIN_DEFAULT_DPI) * 25.4;
+ }
+ }
+ else
+ {
+ pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
+ pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
+ }
+
+ /* Save the original bits per pixel */
+ pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* Release the device context */
+ ReleaseDC (pScreenPriv->hwndScreen, hdc);
+
+ /* Clear the visuals list */
+ miClearVisualTypes ();
+
+ /* Set the padded screen width */
+ pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
+ pScreenInfo->dwBPP);
+
+ /* Call the engine dependent screen initialization procedure */
+ if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
+ {
+ ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
+ return FALSE;
+ }
+
+ if (!g_fSoftwareCursor)
+ winInitCursor(pScreen);
+#ifdef WINDBG
+ else
+ winDebug("winScreenInit - Using software cursor\n");
+#endif
+
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ dixScreenOrigins[index].x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ dixScreenOrigins[index].y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ winDebug("Screen %d added at virtual desktop coordinate (%d,%d).\n",
+ index, dixScreenOrigins[index].x, dixScreenOrigins[index].y);
+ winDebug ("winScreenInit - returning\n");
+
+ return TRUE;
+}
+
+static Bool
+winCreateScreenResources(ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ Bool result;
+
+ result = pScreenPriv->pwinCreateScreenResources(pScreen);
+
+ /* Now the screen bitmap has been wrapped in a pixmap,
+ add that to the Shadow framebuffer */
+ if (!shadowAdd(pScreen, pScreen->devPrivate,
+ pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
+ {
+ ErrorF ("winCreateScreenResources - shadowAdd () failed\n");
+ return FALSE;
+ }
+
+ return result;
+}
+
+/* See Porting Layer Definition - p. 20 */
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ VisualPtr pVisual = NULL;
+ char *pbits = NULL;
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ int iReturn;
+#endif
+
+ /* Create framebuffer */
+ if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
+ return FALSE;
+ }
+
+ /*
+ * Grab the number of bits that are used to represent color in each pixel.
+ */
+ if (pScreenInfo->dwBPP == 8)
+ pScreenInfo->dwDepth = 8;
+ else
+ pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
+ + winCountBits (pScreenPriv->dwGreenMask)
+ + winCountBits (pScreenPriv->dwBlueMask);
+
+ winDebug ("winFinishScreenInitFB - Masks: %08x %08x %08x\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask);
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Setup a local variable to point to the framebuffer */
+ pbits = pScreenInfo->pfb;
+
+ /* Apparently we need this for the render extension */
+ miSetPixmapDepths ();
+
+ /* Start fb initialization */
+ if (!fbSetupScreen (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ pScreenInfo->dwBPP))
+ {
+ ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n");
+ return FALSE;
+ }
+
+ /* Override default colormap routines if visual class is dynamic */
+ if (pScreenInfo->dwDepth == 8
+ && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ && pScreenInfo->fFullScreen)
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ && pScreenInfo->fFullScreen)))
+ {
+ winSetColormapFunctions (pScreen);
+
+ /*
+ * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
+ * own colormap, as it cannot allocate 7 planes in the default
+ * colormap. Setting whitePixel to 1 allows Magic to get 7
+ * planes in the default colormap, so it doesn't create its
+ * own colormap. This latter situation is highly desireable,
+ * as it keeps the Magic window viewable when switching to
+ * other X clients that use the default colormap.
+ */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ }
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Finish fb initialization */
+ if (!fbFinishScreenInit (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ pScreenInfo->dwBPP))
+ {
+ ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the root visual */
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++);
+ pScreenPriv->pRootVisual = pVisual;
+
+ /*
+ * Setup points to the block and wakeup handlers. Pass a pointer
+ * to the current screen as pWakeupdata.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Render extension initialization, calls miPictureInit */
+ if (!fbPictureInit (pScreen, NULL, 0))
+ {
+ ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n");
+ return FALSE;
+ }
+
+#ifdef RANDR
+ /* Initialize resize and rotate support */
+ if (!winRandRInit (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
+ return FALSE;
+ }
+#endif
+
+ /*
+ * Backing store support should reduce network traffic and increase
+ * performance.
+ */
+ miInitializeBackingStore (pScreen);
+
+ /* KDrive does miDCInitialize right after miInitializeBackingStore */
+ /* Setup the cursor routines */
+ winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
+ miDCInitialize (pScreen, &g_winPointerCursorFuncs);
+
+ /* KDrive does winCreateDefColormap right after miDCInitialize */
+ /* Create a default colormap */
+ winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
+ if (!winCreateDefColormap (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - Could not create colormap\n");
+ return FALSE;
+ }
+
+ /* Initialize the shadow framebuffer layer */
+ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+ )
+ {
+ winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n");
+ if (!shadowSetup(pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n");
+ return FALSE;
+ }
+
+ /* Wrap CreateScreenResources so we can add the screen pixmap
+ to the Shadow framebuffer after it's been created */
+ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = winCreateScreenResources;
+ }
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Handle multi-window external window manager mode */
+ if (pScreenInfo->fMWExtWM)
+ {
+ winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
+
+ RootlessInit(pScreen, &winMWExtWMProcs);
+
+ winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
+
+ rootless_CopyBytes_threshold = 0;
+ rootless_FillBytes_threshold = 0;
+ rootless_CompositePixels_threshold = 0;
+ /* FIXME: How many? Profiling needed? */
+ rootless_CopyWindow_threshold = 1;
+
+ winWindowsWMExtensionInit ();
+ }
+#endif
+
+ /* Handle rootless mode */
+ if (pScreenInfo->fRootless)
+ {
+ /* Define the WRAP macro temporarily for local use */
+#define WRAP(a) \
+ if (pScreen->a) { \
+ pScreenPriv->a = pScreen->a; \
+ } else { \
+ ErrorF("null screen fn " #a "\n"); \
+ pScreenPriv->a = NULL; \
+ }
+
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(SetShape);
+
+ /* Assign rootless window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowRootless;
+ pScreen->DestroyWindow = winDestroyWindowRootless;
+ pScreen->PositionWindow = winPositionWindowRootless;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/
+ pScreen->RealizeWindow = winMapWindowRootless;
+ pScreen->UnrealizeWindow = winUnmapWindowRootless;
+ pScreen->SetShape = winSetShapeRootless;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
+#undef WRAP
+ }
+
+
+#ifdef XWIN_MULTIWINDOW
+ /* Handle multi window mode */
+ else if (pScreenInfo->fMultiWindow)
+ {
+ /* Define the WRAP macro temporarily for local use */
+#define WRAP(a) \
+ if (pScreen->a) { \
+ pScreenPriv->a = pScreen->a; \
+ } else { \
+ ErrorF("null screen fn " #a "\n"); \
+ pScreenPriv->a = NULL; \
+ }
+
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(ReparentWindow);
+ WRAP(RestackWindow);
+ WRAP(ResizeWindow);
+ WRAP(MoveWindow);
+ WRAP(CopyWindow);
+ WRAP(SetShape);
+
+ /* Assign multi-window window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowMultiWindow;
+ pScreen->DestroyWindow = winDestroyWindowMultiWindow;
+ pScreen->PositionWindow = winPositionWindowMultiWindow;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/
+ pScreen->RealizeWindow = winMapWindowMultiWindow;
+ pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
+ pScreen->ReparentWindow = winReparentWindowMultiWindow;
+ pScreen->RestackWindow = winRestackWindowMultiWindow;
+ pScreen->ResizeWindow = winResizeWindowMultiWindow;
+ pScreen->MoveWindow = winMoveWindowMultiWindow;
+ pScreen->CopyWindow = winCopyWindowMultiWindow;
+ pScreen->SetShape = winSetShapeMultiWindow;
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
+#undef WRAP
+ }
+#endif
+
+ /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Create a mutex for modules in separate threads to wait for */
+ iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
+ if (iReturn != 0)
+ {
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Own the mutex for modules in separate threads */
+ iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
+ if (iReturn != 0)
+ {
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Set the ServerStarted flag to false */
+ pScreenPriv->fServerStarted = FALSE;
+#endif
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pScreenPriv->fRestacking = FALSE;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (FALSE
+#ifdef XWIN_MULTIWINDOW
+ || pScreenInfo->fMultiWindow
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || pScreenInfo->fInternalWM
+#endif
+ )
+ {
+ winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
+
+ /* Initialize multi window mode */
+ if (!winInitWM (&pScreenPriv->pWMInfo,
+ &pScreenPriv->ptWMProc,
+ &pScreenPriv->ptXMsgProc,
+ &pScreenPriv->pmServerStarted,
+ pScreenInfo->dwScreen,
+ (HWND)&pScreenPriv->hwndScreen,
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pScreenInfo->fInternalWM ||
+#endif
+ FALSE))
+ {
+ ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
+ return FALSE;
+ }
+ }
+#endif
+
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
+
+ /* Tell the server that we have a valid depth */
+ pScreenPriv->fBadDepth = FALSE;
+
+ winDebug ("winFinishScreenInitFB - returning\n");
+
+ return TRUE;
+}
+
+#ifdef XWIN_NATIVEGDI
+/* See Porting Layer Definition - p. 20 */
+
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ VisualPtr pVisuals = NULL;
+ DepthPtr pDepths = NULL;
+ VisualID rootVisual = 0;
+ int nVisuals = 0, nDepths = 0, nRootDepth = 0;
+
+ /* Ignore user input (mouse, keyboard) */
+ pScreenInfo->fIgnoreInput = FALSE;
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ if (pScreenPriv->hdcScreen == NULL)
+ FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the mi visuals */
+ if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
+ &rootVisual,
+ ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
+ TrueColor))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the CloseScreen procedure pointer */
+ pScreen->CloseScreen = NULL;
+
+ /* Initialize the mi code */
+ if (!miScreenInit (pScreen,
+ NULL, /* No framebuffer */
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ nRootDepth, nDepths, pDepths, rootVisual,
+ nVisuals, pVisuals))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
+ return FALSE;
+ }
+
+ pScreen->defColormap = FakeClientID(0);
+
+ /*
+ * Register our block and wakeup handlers; these procedures
+ * process messages in our Windows message queue; specifically,
+ * they process mouse and keyboard input.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Pixmaps */
+ pScreen->CreatePixmap = winCreatePixmapNativeGDI;
+ pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
+
+ /* Other Screen Routines */
+ pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
+ pScreen->SaveScreen = winSaveScreen;
+ pScreen->GetImage = miGetImage;
+ pScreen->GetSpans = winGetSpansNativeGDI;
+
+ /* Window Procedures */
+ pScreen->CreateWindow = winCreateWindowNativeGDI;
+ pScreen->DestroyWindow = winDestroyWindowNativeGDI;
+ pScreen->PositionWindow = winPositionWindowNativeGDI;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
+ pScreen->RealizeWindow = winMapWindowNativeGDI;
+ pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
+
+ /* Paint window */
+ pScreen->CopyWindow = winCopyWindowNativeGDI;
+
+ /* Fonts */
+ pScreen->RealizeFont = winRealizeFontNativeGDI;
+ pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
+
+ /* GC */
+ pScreen->CreateGC = winCreateGCNativeGDI;
+
+ /* Colormap Routines */
+ pScreen->CreateColormap = miInitializeColormap;
+ pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->InstallColormap = miInstallColormap;
+ pScreen->UninstallColormap = miUninstallColormap;
+ pScreen->ListInstalledColormaps = miListInstalledColormaps;
+ pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->ResolveColor = miResolveColor;
+
+ /* Bitmap */
+ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
+
+ winDebug ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
+
+ /* Set the default white and black pixel positions */
+ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
+
+ /* Initialize the cursor */
+ if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
+ return FALSE;
+ }
+
+ /* Create a default colormap */
+ if (!miCreateDefColormap (pScreen))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "failed\n");
+ return FALSE;
+ }
+
+ winDebug ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "returned\n");
+
+ /* mi doesn't use a CloseScreen procedure, so no need to wrap */
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
+
+ winDebug ("winFinishScreenInitNativeGDI - Successful addition of "
+ "screen %08x\n",
+ (unsigned int) pScreen);
+
+ return TRUE;
+}
+#endif
+
+
+/* See Porting Layer Definition - p. 33 */
+static Bool
+winSaveScreen (ScreenPtr pScreen, int on)
+{
+ return TRUE;
+}
diff --git a/xorg-server/include/cursor.h b/xorg-server/include/cursor.h
index acc95c3b3..dadedfd1d 100644
--- a/xorg-server/include/cursor.h
+++ b/xorg-server/include/cursor.h
@@ -55,9 +55,7 @@ SOFTWARE.
#define NullCursor ((CursorPtr)NULL)
/* Provide support for alpha composited cursors */
-#ifdef RENDER
#define ARGB_CURSOR
-#endif
struct _DeviceIntRec;
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 058c8fd14..7759aac6a 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -360,9 +360,6 @@
/* Support Xv extension */
#undef XV
-/* Build Multibuffer extension */
-#undef MULTIBUFFER
-
/* Support DRI extension */
#undef XF86DRI
@@ -411,9 +408,6 @@
/* Support HAL for hotplug */
#undef CONFIG_HAL
-/* Use only built-in fonts */
-#undef BUILTIN_FONTS
-
/* Have a monotonic clock from clock_gettime() */
#undef MONOTONIC_CLOCK
diff --git a/xorg-server/include/globals.h b/xorg-server/include/globals.h
index 6aadb8bdf..9c804ee52 100644
--- a/xorg-server/include/globals.h
+++ b/xorg-server/include/globals.h
@@ -67,17 +67,11 @@ extern _X_EXPORT Bool noScreenSaverExtension;
extern _X_EXPORT Bool noMITShmExtension;
#endif
-#ifdef MULTIBUFFER
-extern _X_EXPORT Bool noMultibufferExtension;
-#endif
-
#ifdef RANDR
extern _X_EXPORT Bool noRRExtension;
#endif
-#ifdef RENDER
extern _X_EXPORT Bool noRenderExtension;
-#endif
#ifdef XCSECURITY
extern _X_EXPORT Bool noSecurityExtension;
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index 3a31b74d5..3fb7e02b5 100644
--- a/xorg-server/mi/midispcur.c
+++ b/xorg-server/mi/midispcur.c
@@ -59,9 +59,9 @@ static DevPrivateKey miDCScreenKey = &miDCScreenKeyIndex;
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
-/* per device per-screen private data */
-static int miDCSpriteKeyIndex[MAXSCREENS];
-static DevPrivateKey miDCSpriteKey = miDCSpriteKeyIndex;
+/* per device private data */
+static int miDCSpriteKeyIndex;
+static DevPrivateKey miDCSpriteKey = &miDCSpriteKeyIndex;
typedef struct {
GCPtr pSourceGC, pMaskGC;
@@ -75,10 +75,10 @@ typedef struct {
#endif
} miDCBufferRec, *miDCBufferPtr;
-#define MIDCBUFFER(dev, screen) \
+#define MIDCBUFFER(dev) \
((DevHasCursor(dev)) ? \
- (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey + (screen)->myNum) : \
- (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey + (screen)->myNum))
+ (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey) : \
+ (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey))
/*
* The core pointer buffer will point to the index of the virtual core pointer
@@ -158,6 +158,10 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
return TRUE;
}
+#define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0)
+#define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE)
+#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0)
+
static Bool
miDCCloseScreen (int index, ScreenPtr pScreen)
{
@@ -179,6 +183,7 @@ miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
}
#ifdef ARGB_CURSOR
+#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
static VisualPtr
miDCGetWindowVisual (WindowPtr pWin)
@@ -410,8 +415,12 @@ miDCPutBits (
(*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y);
}
+#define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win))
+
static GCPtr
-miDCMakeGC(WindowPtr pWin)
+miDCMakeGC(
+ GCPtr *ppGC,
+ WindowPtr pWin)
{
GCPtr pGC;
int status;
@@ -422,6 +431,7 @@ miDCMakeGC(WindowPtr pWin)
pGC = CreateGC((DrawablePtr)pWin,
GCSubwindowMode|GCGraphicsExposures, gcvals, &status,
(XID)0, serverClient);
+ *ppGC = pGC;
return pGC;
}
@@ -446,11 +456,22 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRootPicture &&
+ pBuffer->pRootPicture->pDrawable &&
+ pBuffer->pRootPicture->pDrawable->pScreen != pScreen)
+ {
+ tossPict(pBuffer->pRootPicture);
+ pBuffer->pRootPicture = NULL;
+ }
+
+ if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
+ return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -463,6 +484,33 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
else
#endif
{
+ /**
+ * XXX: Before MPX, the sourceGC and maskGC were attached to the
+ * screen, and would switch as the screen switches. With mpx we have
+ * the GC's attached to the device now, so each time we switch screen
+ * we need to make sure the GC's are allocated on the new screen.
+ * This is ... not optimal. (whot)
+ */
+ if (pBuffer->pSourceGC && pScreen != pBuffer->pSourceGC->pScreen)
+ {
+ tossGC(pBuffer->pSourceGC);
+ pBuffer->pSourceGC = NULL;
+ }
+
+ if (pBuffer->pMaskGC && pScreen != pBuffer->pMaskGC->pScreen)
+ {
+ tossGC(pBuffer->pMaskGC);
+ pBuffer->pMaskGC = NULL;
+ }
+
+ if (!EnsureGC(pBuffer->pSourceGC, pWin))
+ return FALSE;
+ if (!EnsureGC(pBuffer->pMaskGC, pWin))
+ {
+ FreeGC (pBuffer->pSourceGC, (GContext) 0);
+ pBuffer->pSourceGC = 0;
+ return FALSE;
+ }
miDCPutBits ((DrawablePtr)pWin, pPriv,
pBuffer->pSourceGC, pBuffer->pMaskGC,
x, y, pCursor->bits->width, pCursor->bits->height,
@@ -483,7 +531,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -496,7 +544,14 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
if (!pSave)
return FALSE;
}
-
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pSaveGC);
+ pBuffer->pSaveGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pSaveGC, pWin))
+ return FALSE;
pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
@@ -517,13 +572,20 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
if (!pSave)
return FALSE;
-
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
+ return FALSE;
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -545,7 +607,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
@@ -554,7 +616,14 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
*/
if (!pSave)
return FALSE;
-
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
+ return FALSE;
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -593,7 +662,14 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
(*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
0, sourcey, -dx, copyh, x + dx, desty);
}
-
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pSaveGC);
+ pBuffer->pSaveGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pSaveGC, pWin))
+ return FALSE;
pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
@@ -690,7 +766,7 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = MIDCBUFFER(pDev);
pTemp = pBuffer->pTemp;
if (!pTemp ||
@@ -733,9 +809,17 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- if (!pBuffer->pTempPicture)
- miDCMakePicture(&pBuffer->pTempPicture, &pTemp->drawable, pWin);
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pTempPicture &&
+ pBuffer->pTempPicture->pDrawable &&
+ pBuffer->pTempPicture->pDrawable->pScreen != pScreen)
+ {
+ tossPict(pBuffer->pTempPicture);
+ pBuffer->pTempPicture = NULL;
+ }
+ if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
+ return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
@@ -748,12 +832,38 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
else
#endif
{
+ if (!pBuffer->pPixSourceGC)
+ {
+ pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
+ if (!pBuffer->pPixSourceGC)
+ return FALSE;
+ }
+ if (!pBuffer->pPixMaskGC)
+ {
+ pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
+ if (!pBuffer->pPixMaskGC)
+ return FALSE;
+ }
miDCPutBits ((DrawablePtr)pTemp, pPriv,
pBuffer->pPixSourceGC, pBuffer->pPixMaskGC,
dx, dy, pCursor->bits->width, pCursor->bits->height,
source, mask);
}
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
+ /*
+ * copy the temporary pixmap onto the screen
+ */
+
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
+ return FALSE;
pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -767,113 +877,51 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
static Bool
miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miDCBufferPtr pBuffer;
- WindowPtr pWin;
- XID gcval = FALSE;
- int status;
- int i;
-
- if (!DevHasCursor(pDev))
- return TRUE;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
-
- pBuffer = xalloc(sizeof(miDCBufferRec));
- if (!pBuffer)
- goto failure;
-
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, pBuffer);
- pWin = WindowTable[pScreen->myNum];
-
- pBuffer->pSourceGC = miDCMakeGC(pWin);
- if (!pBuffer->pSourceGC)
- goto failure;
-
- pBuffer->pMaskGC = miDCMakeGC(pWin);
- if (!pBuffer->pMaskGC)
- goto failure;
-
- pBuffer->pSaveGC = miDCMakeGC(pWin);
- if (!pBuffer->pSaveGC)
- goto failure;
-
- pBuffer->pRestoreGC = miDCMakeGC(pWin);
- if (!pBuffer->pRestoreGC)
- goto failure;
-
- pBuffer->pMoveGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pMoveGC)
- goto failure;
-
- pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixSourceGC)
- goto failure;
-
- pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixMaskGC)
- goto failure;
-
+ miDCBufferPtr pBuffer;
+
+ pBuffer = xalloc(sizeof(miDCBufferRec));
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, pBuffer);
+
+ pBuffer->pSourceGC =
+ pBuffer->pMaskGC =
+ pBuffer->pSaveGC =
+ pBuffer->pRestoreGC =
+ pBuffer->pMoveGC =
+ pBuffer->pPixSourceGC =
+ pBuffer->pPixMaskGC = NULL;
#ifdef ARGB_CURSOR
- miDCMakePicture(&pBuffer->pRootPicture, &pWin->drawable, pWin);
- if (!pBuffer->pRootPicture)
- goto failure;
-
- pBuffer->pTempPicture = NULL;
+ pBuffer->pRootPicture = NULL;
+ pBuffer->pTempPicture = NULL;
#endif
-
- // these get (re)allocated lazily depending on the cursor size
- pBuffer->pSave = pBuffer->pTemp = NULL;
- }
+ pBuffer->pSave = pBuffer->pTemp = NULL;
return TRUE;
-
-failure:
-
- miDCDeviceCleanup(pDev, pScreen);
-
- return FALSE;
}
static void
miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miDCBufferPtr pBuffer;
- int i;
if (DevHasCursor(pDev))
{
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
-
- pBuffer = MIDCBUFFER(pDev, pScreen);
-
- if (pBuffer)
- {
- if (pBuffer->pSourceGC) FreeGC(pBuffer->pSourceGC, (GContext) 0);
- if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0);
- if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0);
- if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0);
- if (pBuffer->pMoveGC) FreeGC(pBuffer->pMoveGC, (GContext) 0);
- if (pBuffer->pPixSourceGC) FreeGC(pBuffer->pPixSourceGC, (GContext) 0);
- if (pBuffer->pPixMaskGC) FreeGC(pBuffer->pPixMaskGC, (GContext) 0);
-
+ pBuffer = MIDCBUFFER(pDev);
+ tossGC (pBuffer->pSourceGC);
+ tossGC (pBuffer->pMaskGC);
+ tossGC (pBuffer->pSaveGC);
+ tossGC (pBuffer->pRestoreGC);
+ tossGC (pBuffer->pMoveGC);
+ tossGC (pBuffer->pPixSourceGC);
+ tossGC (pBuffer->pPixMaskGC);
+ tossPix (pBuffer->pSave);
+ tossPix (pBuffer->pTemp);
#ifdef ARGB_CURSOR
- if (pBuffer->pRootPicture) FreePicture(pBuffer->pRootPicture, 0);
- if (pBuffer->pTempPicture) FreePicture(pBuffer->pTempPicture, 0);
+#if 0 /* This has been free()d before */
+ tossPict (pScreenPriv->pRootPicture);
+#endif
+ tossPict (pBuffer->pTempPicture);
#endif
-
- if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
- if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp);
-
- xfree(pBuffer);
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL);
- }
- }
+ xfree(pBuffer);
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, NULL);
}
}
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index eb4ecf21b..3d4b2ba6f 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -55,7 +55,6 @@ SOFTWARE.
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
-#undef MULTIBUFFER
#undef XV
#undef DBE
#undef XF86VIDMODE
@@ -116,15 +115,10 @@ extern Bool noScreenSaverExtension;
#ifdef MITSHM
extern Bool noMITShmExtension;
#endif
-#ifdef MULTIBUFFER
-extern Bool noMultibufferExtension;
-#endif
#ifdef RANDR
extern Bool noRRExtension;
#endif
-#ifdef RENDER
extern Bool noRenderExtension;
-#endif
#ifdef XCSECURITY
extern Bool noSecurityExtension;
#endif
@@ -195,9 +189,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef MITSHM
extern void ShmExtensionInit(INITARGS);
#endif
-#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit(INITARGS);
-#endif
#ifdef PANORAMIX
extern void PanoramiXExtensionInit(INITARGS);
#endif
@@ -252,9 +243,7 @@ extern void XFree86DRIExtensionInit(INITARGS);
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#endif
-#ifdef RENDER
extern void RenderExtensionInit(INITARGS);
-#endif
#ifdef RANDR
extern void RRExtensionInit(INITARGS);
#endif
@@ -308,15 +297,10 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef MITSHM
{ SHMNAME, &noMITShmExtension },
#endif
-#ifdef MULTIBUFFER
- { "Multi-Buffering", &noMultibufferExtension },
-#endif
#ifdef RANDR
{ "RANDR", &noRRExtension },
#endif
-#ifdef RENDER
{ "RENDER", &noRenderExtension },
-#endif
#ifdef XCSECURITY
{ "SECURITY", &noSecurityExtension },
#endif
@@ -416,9 +400,6 @@ InitExtensions(int argc, char *argv[])
#ifdef MITSHM
if (!noMITShmExtension) ShmExtensionInit();
#endif
-#ifdef MULTIBUFFER
- if (!noMultibufferExtension) MultibufferExtensionInit();
-#endif
XInputExtensionInit();
#ifdef XTEST
if (!noTestExtensions) XTestExtensionInit();
@@ -469,9 +450,7 @@ InitExtensions(int argc, char *argv[])
/* must be before Render to layer DisplayCursor correctly */
if (!noXFixesExtension) XFixesExtensionInit();
#endif
-#ifdef RENDER
if (!noRenderExtension) RenderExtensionInit();
-#endif
#ifdef RANDR
if (!noRRExtension) RRExtensionInit();
#endif
@@ -527,9 +506,7 @@ static ExtensionModule staticExtensions[] = {
#ifdef XF86BIGFONT
{ XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, NULL, NULL },
#endif
-#ifdef RENDER
{ RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL },
-#endif
#ifdef RANDR
{ RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
#endif
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index e1f63be4e..1b33f82d5 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -497,14 +497,14 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
miPointerPtr pPointer;
+ if (!pDev || !pDev->coreEvents)
+ return;
+
pPointer = MIPOINTER(pDev);
pScreen = pPointer->pScreen;
if (!pScreen)
return; /* called before ready */
- if (!pDev || !pDev->coreEvents)
- return;
-
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
{
pScreenPriv = GetScreenPrivate (pScreen);
diff --git a/xorg-server/miext/cw/cw.c b/xorg-server/miext/cw/cw.c
index 74000ffa0..247cb83e1 100644
--- a/xorg-server/miext/cw/cw.c
+++ b/xorg-server/miext/cw/cw.c
@@ -49,10 +49,8 @@ static int cwScreenKeyIndex;
DevPrivateKey cwScreenKey = &cwScreenKeyIndex;
static int cwWindowKeyIndex;
DevPrivateKey cwWindowKey = &cwWindowKeyIndex;
-#ifdef RENDER
static int cwPictureKeyIndex;
DevPrivateKey cwPictureKey = &cwPictureKeyIndex;
-#endif
extern GCOps cwGCOps;
static Bool
@@ -477,9 +475,7 @@ void
miInitializeCompositeWrapper(ScreenPtr pScreen)
{
cwScreenPtr pScreenPriv;
-#ifdef RENDER
Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
-#endif
if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec)))
return;
@@ -499,19 +495,15 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
-#ifdef RENDER
if (has_render)
cwInitializeRender(pScreen);
-#endif
}
static Bool
cwCloseScreen (int i, ScreenPtr pScreen)
{
cwScreenPtr pScreenPriv;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
pScreenPriv = (cwScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
cwScreenKey);
@@ -521,10 +513,8 @@ cwCloseScreen (int i, ScreenPtr pScreen)
pScreen->CreateGC = pScreenPriv->CreateGC;
pScreen->CopyWindow = pScreenPriv->CopyWindow;
-#ifdef RENDER
if (ps)
cwFiniRender(pScreen);
-#endif
xfree((pointer)pScreenPriv);
diff --git a/xorg-server/miext/cw/cw.h b/xorg-server/miext/cw/cw.h
index ae65503f5..79051dfa2 100644
--- a/xorg-server/miext/cw/cw.h
+++ b/xorg-server/miext/cw/cw.h
@@ -90,7 +90,6 @@ typedef struct {
GetWindowPixmapProcPtr GetWindowPixmap;
SetWindowPixmapProcPtr SetWindowPixmap;
-#ifdef RENDER
DestroyPictureProcPtr DestroyPicture;
ChangePictureClipProcPtr ChangePictureClip;
DestroyPictureClipProcPtr DestroyPictureClip;
@@ -107,7 +106,6 @@ typedef struct {
TriFanProcPtr TriFan;
RasterizeTrapezoidProcPtr RasterizeTrapezoid;
-#endif
} cwScreenRec, *cwScreenPtr;
extern _X_EXPORT DevPrivateKey cwScreenKey;
diff --git a/xorg-server/miext/cw/cw_render.c b/xorg-server/miext/cw/cw_render.c
index 6e0c727c2..dfe2681e0 100644
--- a/xorg-server/miext/cw/cw_render.c
+++ b/xorg-server/miext/cw/cw_render.c
@@ -30,8 +30,6 @@
#include "windowstr.h"
#include "cw.h"
-#ifdef RENDER
-
#define cwPsDecl(pScreen) \
PictureScreenPtr ps = GetPictureScreen (pScreen); \
cwScreenPtr pCwScreen = getCwScreen (pScreen)
@@ -469,4 +467,3 @@ cwFiniRender (ScreenPtr pScreen)
cwPsUnwrap(TriFan);
}
-#endif /* RENDER */
diff --git a/xorg-server/miext/damage/damage.c b/xorg-server/miext/damage/damage.c
index b48d570a3..2c6b14610 100644
--- a/xorg-server/miext/damage/damage.c
+++ b/xorg-server/miext/damage/damage.c
@@ -596,8 +596,6 @@ damageDestroyClip(GCPtr pGC)
REGION_NOTEMPTY(d->pScreen, \
g->pCompositeClip)))
-#ifdef RENDER
-
#define TRIM_PICTURE_BOX(box, pDst) { \
BoxPtr extents = &pDst->pCompositeClip->extents;\
if(box.x1 < extents->x1) box.x1 = extents->x1; \
@@ -774,7 +772,6 @@ damageAddTraps (PicturePtr pPicture,
damageRegionProcessPending (pPicture->pDrawable);
wrap (pScrPriv, ps, AddTraps, damageAddTraps);
}
-#endif
/**********************************************************/
@@ -1882,9 +1879,7 @@ Bool
DamageSetup (ScreenPtr pScreen)
{
DamageScrPrivPtr pScrPriv;
-#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
const DamageScreenFuncsRec miFuncs = {
miDamageCreate, miDamageRegister, miDamageUnregister, miDamageDestroy
};
@@ -1908,13 +1903,11 @@ DamageSetup (ScreenPtr pScreen)
wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap (pScrPriv, pScreen, CloseScreen, damageCloseScreen);
-#ifdef RENDER
if (ps) {
wrap (pScrPriv, ps, Glyphs, damageGlyphs);
wrap (pScrPriv, ps, Composite, damageComposite);
wrap (pScrPriv, ps, AddTraps, damageAddTraps);
}
-#endif
pScrPriv->funcs = miFuncs;
diff --git a/xorg-server/miext/damage/damagestr.h b/xorg-server/miext/damage/damagestr.h
index d7435b2a1..b224958d1 100644
--- a/xorg-server/miext/damage/damagestr.h
+++ b/xorg-server/miext/damage/damagestr.h
@@ -30,9 +30,7 @@
#include "damage.h"
#include "gcstruct.h"
#include "privates.h"
-#ifdef RENDER
# include "picturestr.h"
-#endif
typedef struct _damage {
DamagePtr pNext;
@@ -72,11 +70,9 @@ typedef struct _damageScrPriv {
DestroyPixmapProcPtr DestroyPixmap;
SetWindowPixmapProcPtr SetWindowPixmap;
DestroyWindowProcPtr DestroyWindow;
-#ifdef RENDER
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
AddTrapsProcPtr AddTraps;
-#endif
/* Table of wrappable function pointers */
DamageScreenFuncsRec funcs;
diff --git a/xorg-server/miext/rootless/rootlessCommon.h b/xorg-server/miext/rootless/rootlessCommon.h
index d4a94f8ca..f44c4e8cf 100644
--- a/xorg-server/miext/rootless/rootlessCommon.h
+++ b/xorg-server/miext/rootless/rootlessCommon.h
@@ -42,9 +42,7 @@
#include "scrnintstr.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
// Debug output, or not.
@@ -100,10 +98,8 @@ typedef struct _RootlessScreenRec {
SetShapeProcPtr SetShape;
-#ifdef RENDER
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
-#endif
InstallColormapProcPtr InstallColormap;
UninstallColormapProcPtr UninstallColormap;
diff --git a/xorg-server/miext/rootless/rootlessScreen.c b/xorg-server/miext/rootless/rootlessScreen.c
index 7a799d98c..5f249467b 100644
--- a/xorg-server/miext/rootless/rootlessScreen.c
+++ b/xorg-server/miext/rootless/rootlessScreen.c
@@ -242,8 +242,6 @@ RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h)
SCREEN_WRAP(pDrawable->pScreen, SourceValidate);
}
-#ifdef RENDER
-
static void
RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
@@ -363,8 +361,6 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
}
}
-#endif // RENDER
-
/*
* RootlessValidateTree
@@ -698,7 +694,6 @@ RootlessWrap(ScreenPtr pScreen)
WRAP(SetShape);
-#ifdef RENDER
{
// Composite and Glyphs don't use normal screen wrapping
PictureScreenPtr ps = GetPictureScreen(pScreen);
@@ -707,7 +702,6 @@ RootlessWrap(ScreenPtr pScreen)
s->Glyphs = ps->Glyphs;
ps->Glyphs = RootlessGlyphs;
}
-#endif
// WRAP(ClearToBackground); fixme put this back? useful for shaped wins?
diff --git a/xorg-server/miext/shadow/shadow.h b/xorg-server/miext/shadow/shadow.h
index ef85c0bb9..f4473052d 100644
--- a/xorg-server/miext/shadow/shadow.h
+++ b/xorg-server/miext/shadow/shadow.h
@@ -26,9 +26,7 @@
#include "scrnintstr.h"
-#ifdef RENDER
#include "picturestr.h"
-#endif
#include "damage.h"
#include "damagestr.h"
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index c413fb272..9a10be7c4 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -120,9 +120,7 @@ __stdcall unsigned long GetTickCount(void);
#include "xkbsrv.h"
-#ifdef RENDER
#include "picture.h"
-#endif
Bool noTestExtensions;
#ifdef COMPOSITE
@@ -148,15 +146,10 @@ Bool noScreenSaverExtension = FALSE;
#ifdef MITSHM
Bool noMITShmExtension = FALSE;
#endif
-#ifdef MULTIBUFFER
-Bool noMultibufferExtension = FALSE;
-#endif
#ifdef RANDR
Bool noRRExtension = FALSE;
#endif
-#ifdef RENDER
Bool noRenderExtension = FALSE;
-#endif
#ifdef XCSECURITY
Bool noSecurityExtension = FALSE;
#endif
@@ -530,9 +523,7 @@ void UseMsg(void)
ErrorF("-nopn reject failure to listen on all ports\n");
ErrorF("-r turns off auto-repeat\n");
ErrorF("r turns on auto-repeat \n");
-#ifdef RENDER
ErrorF("-render [default|mono|gray|color] set render color alloc policy\n");
-#endif
ErrorF("-retro start with classic stipple and cursor\n");
ErrorF("-s # screen-saver timeout (minutes)\n");
ErrorF("-t # default pointer threshold (pixels/t)\n");
@@ -933,7 +924,6 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
-#ifdef RENDER
else if ( strcmp( argv[i], "-render" ) == 0)
{
if (++i < argc)
@@ -948,7 +938,6 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg ();
}
-#endif
else if ( strcmp( argv[i], "+extension") == 0)
{
if (++i < argc)
diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h
index 975fe3396..b163a73da 100644
--- a/xorg-server/randr/randrstr.h
+++ b/xorg-server/randr/randrstr.h
@@ -47,10 +47,8 @@
#include "rrtransform.h"
#include <X11/extensions/randr.h>
#include <X11/extensions/randrproto.h>
-#ifdef RENDER
#include <X11/extensions/render.h> /* we share subpixel order information */
#include "picturestr.h"
-#endif
#include <X11/Xfuncproto.h>
/* required for ABI compatibility for now */
diff --git a/xorg-server/randr/rrinfo.c b/xorg-server/randr/rrinfo.c
index 12b9a4aab..20066d5fc 100644
--- a/xorg-server/randr/rrinfo.c
+++ b/xorg-server/randr/rrinfo.c
@@ -99,9 +99,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
return;
RROutputSetCrtcs (output, &crtc, 1);
RROutputSetConnection (output, RR_Connected);
-#ifdef RENDER
RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
-#endif
}
output = pScrPriv->outputs[0];
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index e88a42816..45e6ed724 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -111,11 +111,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
se.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
se.root = pRoot->drawable.id;
se.window = pWin->drawable.id;
-#ifdef RENDER
se.subpixelOrder = PictureGetSubpixelOrder (pScreen);
-#else
- se.subpixelOrder = SubPixelUnknown;
-#endif
se.sequenceNumber = client->sequence;
se.sizeID = RR10CurrentSizeID (pScreen);
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index 1b4accb3e..795caf013 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -26,10 +26,8 @@
#include "xfixesint.h"
#include "scrnintstr.h"
-#ifdef RENDER
#include <picturestr.h>
extern int RenderErrBase;
-#endif
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
@@ -265,7 +263,6 @@ SProcXFixesCreateRegionFromGC (ClientPtr client)
int
ProcXFixesCreateRegionFromPicture (ClientPtr client)
{
-#ifdef RENDER
RegionPtr pRegion;
PicturePtr pPicture;
REQUEST (xXFixesCreateRegionFromPictureReq);
@@ -296,9 +293,6 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client)
return BadAlloc;
return(client->noClientException);
-#else
- return BadRequest;
-#endif
}
int
@@ -769,7 +763,6 @@ SProcXFixesSetWindowShapeRegion (ClientPtr client)
int
ProcXFixesSetPictureClipRegion (ClientPtr client)
{
-#ifdef RENDER
PicturePtr pPicture;
RegionPtr pRegion;
ScreenPtr pScreen;
@@ -785,9 +778,6 @@ ProcXFixesSetPictureClipRegion (ClientPtr client)
return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
pRegion);
-#else
- return BadRequest;
-#endif
}
int
diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c
index 33741e9c6..9755f9846 100644
--- a/xorg-server/xkb/xkbEvents.c
+++ b/xorg-server/xkb/xkbEvents.c
@@ -1041,8 +1041,7 @@ XkbInterestPtr interest;
return ((interest->resource==id)?interest:NULL);
interest = interest->next;
}
- interest = xalloc(sizeof(XkbInterestRec));
- bzero(interest,sizeof(XkbInterestRec));
+ interest = xcalloc(1, sizeof(XkbInterestRec));
if (interest) {
interest->dev = dev;
interest->client = client;
diff --git a/xorg-server/xkb/xkbout.c b/xorg-server/xkb/xkbout.c
index 68ede902f..082c85ee9 100644
--- a/xorg-server/xkb/xkbout.c
+++ b/xorg-server/xkb/xkbout.c
@@ -353,9 +353,13 @@ XkbClientMapPtr map;
XkbServerMapPtr srv;
Bool showActions;
+ if (!xkb) {
+ _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
+ return FALSE;
+ }
+
map= xkb->map;
- srv= xkb->server;
- if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) {
+ if ((!map)||(!map->syms)||(!map->key_sym_map)) {
_XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0);
return FALSE;
}
@@ -376,6 +380,7 @@ Bool showActions;
}
if (tmp>0)
fprintf(file,"\n");
+ srv= xkb->server;
for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
Bool simple;
if ((int)XkbKeyNumSyms(xkb,i)<1)