summaryrefslogtreecommitdiffstats
path: root/xorg/server/module
diff options
context:
space:
mode:
authorjsorg71 <jay.sorg@gmail.com>2013-07-21 20:44:53 -0700
committerjsorg71 <jay.sorg@gmail.com>2013-07-21 20:44:53 -0700
commit759d508635a742690aebcf07d4d9dfa2c08beda9 (patch)
tree133b52ca935dd45a8bb3892e8daa7371e53e45d2 /xorg/server/module
parent6794d6e244381effbe544d8044bd885bab18b375 (diff)
parentc176208133d7da718ca1f580ad2604982ba0d05a (diff)
downloadxrdp-proprietary-759d508635a742690aebcf07d4d9dfa2c08beda9.tar.gz
xrdp-proprietary-759d508635a742690aebcf07d4d9dfa2c08beda9.zip
Merge pull request #89 from neutrinolabs/master
neutrinordp
Diffstat (limited to 'xorg/server/module')
-rw-r--r--xorg/server/module/Makefile22
-rw-r--r--xorg/server/module/rdp.h96
-rw-r--r--xorg/server/module/rdpComposite.c76
-rw-r--r--xorg/server/module/rdpComposite.h32
-rw-r--r--xorg/server/module/rdpCopyArea.c55
-rw-r--r--xorg/server/module/rdpCopyArea.h29
-rw-r--r--xorg/server/module/rdpCopyPlane.c59
-rw-r--r--xorg/server/module/rdpCopyPlane.h30
-rw-r--r--xorg/server/module/rdpCursor.c91
-rw-r--r--xorg/server/module/rdpCursor.h44
-rw-r--r--xorg/server/module/rdpDraw.c148
-rw-r--r--xorg/server/module/rdpDraw.h70
-rw-r--r--xorg/server/module/rdpFillPolygon.c52
-rw-r--r--xorg/server/module/rdpFillPolygon.h30
-rw-r--r--xorg/server/module/rdpFillSpans.c52
-rw-r--r--xorg/server/module/rdpFillSpans.h29
-rw-r--r--xorg/server/module/rdpGC.c236
-rw-r--r--xorg/server/module/rdpGC.h30
-rw-r--r--xorg/server/module/rdpGlyphs.c79
-rw-r--r--xorg/server/module/rdpGlyphs.h33
-rw-r--r--xorg/server/module/rdpImageGlyphBlt.c52
-rw-r--r--xorg/server/module/rdpImageGlyphBlt.h30
-rw-r--r--xorg/server/module/rdpImageText16.c50
-rw-r--r--xorg/server/module/rdpImageText16.h29
-rw-r--r--xorg/server/module/rdpImageText8.c51
-rw-r--r--xorg/server/module/rdpImageText8.h29
-rw-r--r--xorg/server/module/rdpMain.c86
-rw-r--r--xorg/server/module/rdpMisc.c415
-rw-r--r--xorg/server/module/rdpMisc.h78
-rw-r--r--xorg/server/module/rdpPolyArc.c48
-rw-r--r--xorg/server/module/rdpPolyArc.h28
-rw-r--r--xorg/server/module/rdpPolyFillArc.c48
-rw-r--r--xorg/server/module/rdpPolyFillArc.h28
-rw-r--r--xorg/server/module/rdpPolyFillRect.c50
-rw-r--r--xorg/server/module/rdpPolyFillRect.h29
-rw-r--r--xorg/server/module/rdpPolyGlyphBlt.c52
-rw-r--r--xorg/server/module/rdpPolyGlyphBlt.h30
-rw-r--r--xorg/server/module/rdpPolyPoint.c50
-rw-r--r--xorg/server/module/rdpPolyPoint.h29
-rw-r--r--xorg/server/module/rdpPolyRectangle.c51
-rw-r--r--xorg/server/module/rdpPolyRectangle.h29
-rw-r--r--xorg/server/module/rdpPolySegment.c48
-rw-r--r--xorg/server/module/rdpPolySegment.h28
-rw-r--r--xorg/server/module/rdpPolyText16.c55
-rw-r--r--xorg/server/module/rdpPolyText16.h29
-rw-r--r--xorg/server/module/rdpPolyText8.c55
-rw-r--r--xorg/server/module/rdpPolyText8.h29
-rw-r--r--xorg/server/module/rdpPolylines.c50
-rw-r--r--xorg/server/module/rdpPolylines.h29
-rw-r--r--xorg/server/module/rdpPri.c176
-rw-r--r--xorg/server/module/rdpPri.h47
-rw-r--r--xorg/server/module/rdpPushPixels.c50
-rw-r--r--xorg/server/module/rdpPushPixels.h29
-rw-r--r--xorg/server/module/rdpPutImage.c51
-rw-r--r--xorg/server/module/rdpPutImage.h29
-rw-r--r--xorg/server/module/rdpRandR.c309
-rw-r--r--xorg/server/module/rdpRandR.h60
-rw-r--r--xorg/server/module/rdpReg.c233
-rw-r--r--xorg/server/module/rdpReg.h60
-rw-r--r--xorg/server/module/rdpSetSpans.c52
-rw-r--r--xorg/server/module/rdpSetSpans.h29
61 files changed, 4033 insertions, 0 deletions
diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile
new file mode 100644
index 00000000..66b09f91
--- /dev/null
+++ b/xorg/server/module/Makefile
@@ -0,0 +1,22 @@
+
+OBJS = rdpDraw.o rdpPri.o rdpGC.o rdpFillSpans.o rdpSetSpans.o rdpPutImage.o \
+rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \
+rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
+rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
+rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
+rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
+rdpComposite.o rdpGlyphs.o
+
+CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1
+
+LDFLAGS =
+
+LIBS =
+
+all: libxorgxrdp.so
+
+libxorgxrdp.so: $(OBJS) Makefile
+ $(CC) -shared -o libxorgxrdp.so $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) libxorgxrdp.so
diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h
new file mode 100644
index 00000000..085e114f
--- /dev/null
+++ b/xorg/server/module/rdp.h
@@ -0,0 +1,96 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef _RDP_H
+#define _RDP_H
+
+#include <xorg-server.h>
+#include <scrnintstr.h>
+#include <gcstruct.h>
+#include <mipointer.h>
+#include <randrstr.h>
+
+#include "rdpPri.h"
+
+#define PixelDPI 100
+#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10))
+
+/* move this to common header */
+struct _rdpRec
+{
+ int width;
+ int height;
+ int depth;
+ int paddedWidthInBytes;
+ int sizeInBytes;
+ int num_modes;
+ int bitsPerPixel;
+ char *pfbMemory;
+ ScreenPtr pScreen;
+ rdpDevPrivateKey privateKeyRecGC;
+ rdpDevPrivateKey privateKeyRecPixmap;
+
+ CopyWindowProcPtr CopyWindow;
+ CreateGCProcPtr CreateGC;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+ CloseScreenProcPtr CloseScreen;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+
+ miPointerScreenFuncPtr pCursorFuncs;
+
+ /* RandR */
+ RRSetConfigProcPtr rrSetConfig;
+ RRGetInfoProcPtr rrGetInfo;
+ RRScreenSetSizeProcPtr rrScreenSetSize;
+ RRCrtcSetProcPtr rrCrtcSet;
+ RRCrtcSetGammaProcPtr rrCrtcSetGamma;
+ RRCrtcGetGammaProcPtr rrCrtcGetGamma;
+ RROutputSetPropertyProcPtr rrOutputSetProperty;
+ RROutputValidateModeProcPtr rrOutputValidateMode;
+ RRModeDestroyProcPtr rrModeDestroy;
+ RROutputGetPropertyProcPtr rrOutputGetProperty;
+ RRGetPanningProcPtr rrGetPanning;
+ RRSetPanningProcPtr rrSetPanning;
+
+};
+typedef struct _rdpRec rdpRec;
+typedef struct _rdpRec * rdpPtr;
+#define XRDPPTR(_p) ((rdpPtr)((_p)->driverPrivate))
+
+struct _rdpGCRec
+{
+ GCFuncs *funcs;
+ GCOps *ops;
+};
+typedef struct _rdpGCRec rdpGCRec;
+typedef struct _rdpGCRec * rdpGCPtr;
+
+struct _rdpPixmapRec
+{
+ int i1;
+};
+typedef struct _rdpPixmapRec rdpPixmapRec;
+typedef struct _rdpPixmapRec * rdpPixmapPtr;
+
+#endif
diff --git a/xorg/server/module/rdpComposite.c b/xorg/server/module/rdpComposite.c
new file mode 100644
index 00000000..a2c5568e
--- /dev/null
+++ b/xorg/server/module/rdpComposite.c
@@ -0,0 +1,76 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+composite(alpha blending) calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <picture.h>
+
+#include "rdp.h"
+#include "rdpComposite.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpCompositeOrg(PictureScreenPtr ps, rdpPtr dev,
+ CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height)
+{
+ ps->Composite = dev->Composite;
+ ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+ ps->Composite = rdpComposite;
+}
+
+/******************************************************************************/
+void
+rdpComposite(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;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+ PictureScreenPtr ps;
+
+ LLOGLN(10, ("rdpComposite:"));
+ pScreen = pSrc->pDrawable->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ ps = GetPictureScreen(pScreen);
+ rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+}
diff --git a/xorg/server/module/rdpComposite.h b/xorg/server/module/rdpComposite.h
new file mode 100644
index 00000000..8924c1b4
--- /dev/null
+++ b/xorg/server/module/rdpComposite.h
@@ -0,0 +1,32 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+composite(alpha blending) calls
+
+*/
+
+#ifndef _RDPCOMPOSITE_H
+#define _RDPCOMPOSITE_H
+
+void
+rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+
+#endif
diff --git a/xorg/server/module/rdpCopyArea.c b/xorg/server/module/rdpCopyArea.c
new file mode 100644
index 00000000..dd32644e
--- /dev/null
+++ b/xorg/server/module/rdpCopyArea.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static RegionPtr
+rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+ RegionPtr rv;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+RegionPtr
+rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ RegionPtr rv;
+
+ LLOGLN(10, ("rdpCopyArea:"));
+ /* do original call */
+ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+ return rv;
+}
diff --git a/xorg/server/module/rdpCopyArea.h b/xorg/server/module/rdpCopyArea.h
new file mode 100644
index 00000000..654b6edc
--- /dev/null
+++ b/xorg/server/module/rdpCopyArea.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPCOPYAREA_H
+#define __RDPCOPYAREA_H
+
+RegionPtr
+rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty);
+
+#endif
diff --git a/xorg/server/module/rdpCopyPlane.c b/xorg/server/module/rdpCopyPlane.c
new file mode 100644
index 00000000..9b89125c
--- /dev/null
+++ b/xorg/server/module/rdpCopyPlane.c
@@ -0,0 +1,59 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static RegionPtr
+rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy,
+ w, h, dstx, dsty, bitPlane);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+RegionPtr
+rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ RegionPtr rv;
+
+ LLOGLN(10, ("rdpCopyPlane:"));
+ /* do original call */
+ rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, bitPlane);
+ return rv;
+}
diff --git a/xorg/server/module/rdpCopyPlane.h b/xorg/server/module/rdpCopyPlane.h
new file mode 100644
index 00000000..85a79e76
--- /dev/null
+++ b/xorg/server/module/rdpCopyPlane.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPCOPYPLANE_H
+#define __RDPCOPYPLANE_H
+
+RegionPtr
+rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane);
+
+#endif
diff --git a/xorg/server/module/rdpCursor.c b/xorg/server/module/rdpCursor.c
new file mode 100644
index 00000000..82aafd78
--- /dev/null
+++ b/xorg/server/module/rdpCursor.c
@@ -0,0 +1,91 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+cursor
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+Bool
+rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
+{
+ LLOGLN(0, ("rdpSpriteRealizeCursor:"));
+ return 1;
+}
+
+/******************************************************************************/
+Bool
+rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
+{
+ LLOGLN(0, ("rdpSpriteUnrealizeCursor:"));
+ return 1;
+}
+
+/******************************************************************************/
+void
+rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
+ int x, int y)
+{
+ LLOGLN(0, ("rdpSpriteSetCursor:"));
+}
+
+/******************************************************************************/
+void
+rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
+{
+ LLOGLN(0, ("rdpSpriteMoveCursor:"));
+}
+
+/******************************************************************************/
+Bool
+rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ LLOGLN(0, ("rdpSpriteDeviceCursorInitialize:"));
+ return 1;
+}
+
+/******************************************************************************/
+void
+rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ LLOGLN(0, ("rdpSpriteDeviceCursorCleanup:"));
+}
diff --git a/xorg/server/module/rdpCursor.h b/xorg/server/module/rdpCursor.h
new file mode 100644
index 00000000..b847d842
--- /dev/null
+++ b/xorg/server/module/rdpCursor.h
@@ -0,0 +1,44 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+misc draw calls
+
+*/
+
+#ifndef __RDPCURSOR_H
+#define __RDPCURSOR_H
+
+#include <xorg-server.h>
+#include <xf86.h>
+
+Bool
+rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
+Bool
+rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
+void
+rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
+ int x, int y);
+void
+rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y);
+Bool
+rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr);
+void
+rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr);
+
+#endif
diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c
new file mode 100644
index 00000000..7abcb406
--- /dev/null
+++ b/xorg/server/module/rdpDraw.c
@@ -0,0 +1,148 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+misc draw calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/*****************************************************************************/
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ PixmapPtr rv;
+
+ LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d",
+ width, height, depth));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->CreatePixmap = dev->CreatePixmap;
+ rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
+ pScreen->CreatePixmap = rdpCreatePixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+
+ LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
+ pScreen = pPixmap->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->DestroyPixmap = dev->DestroyPixmap;
+ rv = pScreen->DestroyPixmap(pPixmap);
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+
+ LLOGLN(10, ("rdpModifyPixmapHeader:"));
+ pScreen = pPixmap->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
+ rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
+ devKind, pPixData);
+ pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
+ return rv;
+}
+
+/*****************************************************************************/
+void
+rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
+{
+ ScrnInfoPtr pScrn;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+
+ pScreen = pWin->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ dev->pScreen->CopyWindow = dev->CopyWindow;
+ dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
+ dev->pScreen->CopyWindow = rdpCopyWindow;
+}
+
+/*****************************************************************************/
+Bool
+rdpCloseScreen(int index, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ Bool rv;
+
+ LLOGLN(0, ("rdpCloseScreen:"));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ dev->pScreen->CloseScreen = dev->CloseScreen;
+ rv = dev->pScreen->CloseScreen(index, pScreen);
+ dev->pScreen->CloseScreen = rdpCloseScreen;
+ return rv;
+}
+
+/******************************************************************************/
+WindowPtr
+rdpGetRootWindowPtr(ScreenPtr pScreen)
+{
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+ return WindowTable[pScreen->myNum]; /* in globals.c */
+#else
+ return pScreen->root;
+#endif
+}
diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h
new file mode 100644
index 00000000..ba696541
--- /dev/null
+++ b/xorg/server/module/rdpDraw.h
@@ -0,0 +1,70 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+misc draw calls
+
+*/
+
+#ifndef __RDPDRAW_H
+#define __RDPDRAW_H
+
+#include <xorg-server.h>
+#include <xf86.h>
+
+/******************************************************************************/
+#define GC_OP_PROLOGUE(_pGC) \
+do { \
+ rdpPtr dev; \
+ ScreenPtr pScreen; \
+ ScrnInfoPtr pScrn; \
+ pScreen = (_pGC)->pScreen; \
+ pScrn = xf86Screens[pScreen->myNum]; \
+ dev = XRDPPTR(pScrn); \
+ priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
+ oldFuncs = (_pGC)->funcs; \
+ (_pGC)->funcs = priv->funcs; \
+ (_pGC)->ops = priv->ops; \
+} while (0)
+
+/******************************************************************************/
+#define GC_OP_EPILOGUE(_pGC) \
+do { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->funcs = oldFuncs; \
+ (_pGC)->ops = &g_rdpGCOps; \
+} while (0)
+
+extern GCOps g_rdpGCOps; /* in rdpGC.c */
+
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap);
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData);
+void
+rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
+Bool
+rdpCloseScreen(int index, ScreenPtr pScreen);
+WindowPtr
+rdpGetRootWindowPtr(ScreenPtr pScreen);
+
+#endif
diff --git a/xorg/server/module/rdpFillPolygon.c b/xorg/server/module/rdpFillPolygon.c
new file mode 100644
index 00000000..38043c0b
--- /dev/null
+++ b/xorg/server/module/rdpFillPolygon.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts)
+{
+ LLOGLN(10, ("rdpFillPolygon:"));
+ /* do original call */
+ rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
+}
diff --git a/xorg/server/module/rdpFillPolygon.h b/xorg/server/module/rdpFillPolygon.h
new file mode 100644
index 00000000..89da9ae0
--- /dev/null
+++ b/xorg/server/module/rdpFillPolygon.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPFILLPOLYGON_H
+#define __RDPFILLPOLYGON_H
+
+void
+rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+
+#endif
diff --git a/xorg/server/module/rdpFillSpans.c b/xorg/server/module/rdpFillSpans.c
new file mode 100644
index 00000000..dbd4cc1e
--- /dev/null
+++ b/xorg/server/module/rdpFillSpans.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LDEBUG 0
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted)
+{
+ LLOGLN(0, ("rdpFillSpans:"));
+ /* do original call */
+ rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
+}
diff --git a/xorg/server/module/rdpFillSpans.h b/xorg/server/module/rdpFillSpans.h
new file mode 100644
index 00000000..7e014e6b
--- /dev/null
+++ b/xorg/server/module/rdpFillSpans.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPFILLSPANS_H
+#define __RDPFILLSPANS_H
+
+void
+rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int* pwidthInit, int fSorted);
+
+#endif
diff --git a/xorg/server/module/rdpGC.c b/xorg/server/module/rdpGC.c
new file mode 100644
index 00000000..3a585e2c
--- /dev/null
+++ b/xorg/server/module/rdpGC.c
@@ -0,0 +1,236 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+GC related calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+#include "rdpFillSpans.h"
+#include "rdpSetSpans.h"
+#include "rdpPutImage.h"
+#include "rdpCopyArea.h"
+#include "rdpCopyPlane.h"
+#include "rdpPolyPoint.h"
+#include "rdpPolylines.h"
+#include "rdpPolySegment.h"
+#include "rdpPolyRectangle.h"
+#include "rdpPolyArc.h"
+#include "rdpFillPolygon.h"
+#include "rdpPolyFillRect.h"
+#include "rdpPolyFillArc.h"
+#include "rdpPolyText8.h"
+#include "rdpPolyText16.h"
+#include "rdpImageText8.h"
+#include "rdpImageText16.h"
+#include "rdpImageGlyphBlt.h"
+#include "rdpPolyGlyphBlt.h"
+#include "rdpPushPixels.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+#define GC_FUNC_PROLOGUE(_pGC) \
+ do { \
+ rdpPtr dev; \
+ ScreenPtr pScreen; \
+ ScrnInfoPtr pScrn; \
+ pScreen = _pGC->pScreen; \
+ pScrn = xf86Screens[pScreen->myNum]; \
+ dev = XRDPPTR(pScrn); \
+ priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
+ (_pGC)->funcs = priv->funcs; \
+ if (priv->ops != 0) \
+ { \
+ (_pGC)->ops = priv->ops; \
+ } \
+ } while (0)
+
+/******************************************************************************/
+#define GC_FUNC_EPILOGUE(_pGC) \
+ do { \
+ priv->funcs = (_pGC)->funcs; \
+ (_pGC)->funcs = &g_rdpGCFuncs; \
+ if (priv->ops != 0) \
+ { \
+ priv->ops = (_pGC)->ops; \
+ (_pGC)->ops = &g_rdpGCOps; \
+ } \
+ } while (0)
+
+static void
+rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d);
+static void
+rdpChangeGC(GCPtr pGC, unsigned long mask);
+static void
+rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst);
+static void
+rdpDestroyGC(GCPtr pGC);
+static void
+rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
+static void
+rdpDestroyClip(GCPtr pGC);
+static void
+rdpCopyClip(GCPtr dst, GCPtr src);
+
+GCFuncs g_rdpGCFuncs =
+{
+ rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
+ rdpDestroyClip, rdpCopyClip
+};
+
+GCOps g_rdpGCOps =
+{
+ rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
+ rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
+ rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
+ rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
+ rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
+};
+
+/******************************************************************************/
+static void
+rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpValidateGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ValidateGC(pGC, changes, d);
+ priv->ops = pGC->ops;
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpChangeGC(GCPtr pGC, unsigned long mask)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpChangeGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeGC(pGC, mask);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpCopyGC:"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyGC(src, mask, dst);
+ GC_FUNC_EPILOGUE(dst);
+}
+
+/******************************************************************************/
+static void
+rdpDestroyGC(GCPtr pGC)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpDestroyGC:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyGC(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpChangeClip:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpDestroyClip(GCPtr pGC)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpDestroyClip:"));
+ GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyClip(pGC);
+ GC_FUNC_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+static void
+rdpCopyClip(GCPtr dst, GCPtr src)
+{
+ rdpGCRec *priv;
+
+ LLOGLN(10, ("rdpCopyClip:"));
+ GC_FUNC_PROLOGUE(dst);
+ dst->funcs->CopyClip(dst, src);
+ GC_FUNC_EPILOGUE(dst);
+}
+
+/*****************************************************************************/
+Bool
+rdpCreateGC(GCPtr pGC)
+{
+ Bool rv;
+ rdpPtr dev;
+ ScreenPtr pScreen;
+ ScrnInfoPtr pScrn;
+ rdpGCPtr priv;
+
+ LLOGLN(10, ("rdpCreateGC:"));
+ pScreen = pGC->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
+ pScreen->CreateGC = dev->CreateGC;
+ rv = pScreen->CreateGC(pGC);
+ if (rv)
+ {
+ priv->funcs = pGC->funcs;
+ priv->ops = 0;
+ pGC->funcs = &g_rdpGCFuncs;
+ }
+ pScreen->CreateGC = rdpCreateGC;
+ return rv;
+}
diff --git a/xorg/server/module/rdpGC.h b/xorg/server/module/rdpGC.h
new file mode 100644
index 00000000..4ad129a2
--- /dev/null
+++ b/xorg/server/module/rdpGC.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+GC related calls
+
+*/
+
+#ifndef _RDPGC_H
+#define _RDPGC_H
+
+Bool
+rdpCreateGC(GCPtr pGC);
+
+#endif
diff --git a/xorg/server/module/rdpGlyphs.c b/xorg/server/module/rdpGlyphs.c
new file mode 100644
index 00000000..3a222e79
--- /dev/null
+++ b/xorg/server/module/rdpGlyphs.c
@@ -0,0 +1,79 @@
+/*
+Copyright 2012-2013 Jay Sorg
+
+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.
+
+gylph(font) calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <picture.h>
+#include <glyphstr.h>
+
+#include "rdp.h"
+#include "rdpGlyphs.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpGlyphsOrg(PictureScreenPtr ps, rdpPtr dev,
+ CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs)
+{
+ ps->Glyphs = dev->Glyphs;
+ ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlists, lists, glyphs);
+ ps->Glyphs = rdpGlyphs;
+}
+
+/******************************************************************************/
+void
+rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen;
+ rdpPtr dev;
+ ScrnInfoPtr pScrn;
+ PictureScreenPtr ps;
+
+ LLOGLN(10, ("rdpGlyphs:"));
+ pScreen = pSrc->pDrawable->pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ ps = GetPictureScreen(pScreen);
+ rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlists, lists, glyphs);
+}
diff --git a/xorg/server/module/rdpGlyphs.h b/xorg/server/module/rdpGlyphs.h
new file mode 100644
index 00000000..d451d9f9
--- /dev/null
+++ b/xorg/server/module/rdpGlyphs.h
@@ -0,0 +1,33 @@
+/*
+Copyright 2012-2013 Jay Sorg
+
+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.
+
+gylph(font) calls
+
+*/
+
+#ifndef _RDPGLYPHS_H
+#define _RDPGLYPHS_H
+
+void
+rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
+ GlyphPtr *glyphs);
+
+#endif
diff --git a/xorg/server/module/rdpImageGlyphBlt.c b/xorg/server/module/rdpImageGlyphBlt.c
new file mode 100644
index 00000000..0b0d7ce8
--- /dev/null
+++ b/xorg/server/module/rdpImageGlyphBlt.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ LLOGLN(10, ("rdpImageGlyphBlt:"));
+ /* do original call */
+ rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
diff --git a/xorg/server/module/rdpImageGlyphBlt.h b/xorg/server/module/rdpImageGlyphBlt.h
new file mode 100644
index 00000000..c5483c7e
--- /dev/null
+++ b/xorg/server/module/rdpImageGlyphBlt.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPIMAGEGLYPHBLT_H
+#define __RDPIMAGEGLYPHBLT_H
+
+void
+rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr* ppci, pointer pglyphBase);
+
+#endif
diff --git a/xorg/server/module/rdpImageText16.c b/xorg/server/module/rdpImageText16.c
new file mode 100644
index 00000000..8ddd9bf3
--- /dev/null
+++ b/xorg/server/module/rdpImageText16.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ LLOGLN(10, ("rdpImageText16:"));
+ /* do original call */
+ rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
+}
diff --git a/xorg/server/module/rdpImageText16.h b/xorg/server/module/rdpImageText16.h
new file mode 100644
index 00000000..0ffb90f2
--- /dev/null
+++ b/xorg/server/module/rdpImageText16.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPIMAGETEXT16_H
+#define __RDPIMAGETEXT16_H
+
+void
+rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short* chars);
+
+#endif
diff --git a/xorg/server/module/rdpImageText8.c b/xorg/server/module/rdpImageText8.c
new file mode 100644
index 00000000..ab41753b
--- /dev/null
+++ b/xorg/server/module/rdpImageText8.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ LLOGLN(10, ("rdpImageText8:"));
+ /* do original call */
+ rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
+ return;
+}
diff --git a/xorg/server/module/rdpImageText8.h b/xorg/server/module/rdpImageText8.h
new file mode 100644
index 00000000..dc0c4ec5
--- /dev/null
+++ b/xorg/server/module/rdpImageText8.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPIMAGETEXT8_H
+#define __RDPIMAGETEXT8_H
+
+void
+rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char* chars);
+
+#endif
diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpMain.c
new file mode 100644
index 00000000..9930764c
--- /dev/null
+++ b/xorg/server/module/rdpMain.c
@@ -0,0 +1,86 @@
+/*
+Copyright 2013 Jay Sorg
+
+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.
+
+rdp module main
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define XRDP_DRIVER_NAME "XORGXRDP"
+#define XRDP_NAME "XORGXRDP"
+#define XRDP_VERSION 1000
+
+#define PACKAGE_VERSION_MAJOR 1
+#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_PATCHLEVEL 0
+
+static int g_initialised = 0;
+
+/*****************************************************************************/
+static pointer
+xorgxrdpSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
+{
+ LLOGLN(0, ("xorgxrdpSetup:"));
+ if (!g_initialised)
+ {
+ g_initialised = 1;
+ }
+ return (pointer) 1;
+}
+
+static MODULESETUPPROTO(xorgxrdpSetup);
+static XF86ModuleVersionInfo RDPVersRec =
+{
+ XRDP_DRIVER_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ 0,
+ { 0, 0, 0, 0 }
+};
+
+XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, xorgxrdpSetup, NULL };
diff --git a/xorg/server/module/rdpMisc.c b/xorg/server/module/rdpMisc.c
new file mode 100644
index 00000000..34e71110
--- /dev/null
+++ b/xorg/server/module/rdpMisc.c
@@ -0,0 +1,415 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+the rest
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+/******************************************************************************/
+int
+rdpBitsPerPixel(int depth)
+{
+ if (depth == 1)
+ {
+ return 1;
+ }
+ else if (depth <= 8)
+ {
+ return 8;
+ }
+ else if (depth <= 16)
+ {
+ return 16;
+ }
+ else
+ {
+ return 32;
+ }
+}
+
+/* the g_ functions from os_calls.c */
+
+/*****************************************************************************/
+int
+g_tcp_recv(int sck, void *ptr, int len, int flags)
+{
+ return recv(sck, ptr, len, flags);
+}
+
+/*****************************************************************************/
+void
+g_tcp_close(int sck)
+{
+ if (sck == 0)
+ {
+ return;
+ }
+
+ shutdown(sck, 2);
+ close(sck);
+}
+
+/*****************************************************************************/
+int
+g_tcp_last_error_would_block(int sck)
+{
+ return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
+}
+
+/*****************************************************************************/
+void
+g_sleep(int msecs)
+{
+ usleep(msecs * 1000);
+}
+
+/*****************************************************************************/
+int
+g_tcp_send(int sck, void *ptr, int len, int flags)
+{
+ return send(sck, ptr, len, flags);
+}
+
+/*****************************************************************************/
+void *
+g_malloc(int size, int zero)
+{
+ char *rv;
+
+ rv = (char *)malloc(size);
+ if (zero)
+ {
+ if (rv != 0)
+ {
+ memset(rv, 0, size);
+ }
+ }
+ return rv;
+}
+
+/*****************************************************************************/
+void
+g_free(void *ptr)
+{
+ if (ptr != 0)
+ {
+ free(ptr);
+ }
+}
+
+/*****************************************************************************/
+void
+g_sprintf(char *dest, char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vsprintf(dest, format, ap);
+ va_end(ap);
+}
+
+/*****************************************************************************/
+int
+g_tcp_socket(void)
+{
+ int rv;
+ int i;
+
+ i = 1;
+ rv = socket(PF_INET, SOCK_STREAM, 0);
+ setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
+ setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i));
+ return rv;
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_socket_dgram(void)
+{
+ return socket(AF_UNIX, SOCK_DGRAM, 0);
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_socket_stream(void)
+{
+ return socket(AF_UNIX, SOCK_STREAM, 0);
+}
+
+/*****************************************************************************/
+void
+g_memcpy(void *d_ptr, const void *s_ptr, int size)
+{
+ memcpy(d_ptr, s_ptr, size);
+}
+
+/*****************************************************************************/
+void
+g_memset(void *d_ptr, const unsigned char chr, int size)
+{
+ memset(d_ptr, chr, size);
+}
+
+/*****************************************************************************/
+int
+g_tcp_set_no_delay(int sck)
+{
+ int i;
+
+ i = 1;
+ setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
+ return 0;
+}
+
+/*****************************************************************************/
+int
+g_tcp_set_non_blocking(int sck)
+{
+ unsigned long i;
+
+ i = fcntl(sck, F_GETFL);
+ i = i | O_NONBLOCK;
+ fcntl(sck, F_SETFL, i);
+ return 0;
+}
+
+/*****************************************************************************/
+int
+g_tcp_accept(int sck)
+{
+ struct sockaddr_in s;
+ unsigned int i;
+
+ i = sizeof(struct sockaddr_in);
+ memset(&s, 0, i);
+ return accept(sck, (struct sockaddr *)&s, &i);
+}
+
+/*****************************************************************************/
+int
+g_tcp_select(int sck1, int sck2, int sck3)
+{
+ fd_set rfds;
+ struct timeval time;
+ int max;
+ int rv;
+
+ time.tv_sec = 0;
+ time.tv_usec = 0;
+ FD_ZERO(&rfds);
+
+ if (sck1 > 0)
+ {
+ FD_SET(((unsigned int)sck1), &rfds);
+ }
+
+ if (sck2 > 0)
+ {
+ FD_SET(((unsigned int)sck2), &rfds);
+ }
+
+ if (sck3 > 0)
+ {
+ FD_SET(((unsigned int)sck3), &rfds);
+ }
+
+ max = sck1;
+
+ if (sck2 > max)
+ {
+ max = sck2;
+ }
+
+ if (sck3 > max)
+ {
+ max = sck3;
+ }
+
+ rv = select(max + 1, &rfds, 0, 0, &time);
+
+ if (rv > 0)
+ {
+ rv = 0;
+
+ if (FD_ISSET(((unsigned int)sck1), &rfds))
+ {
+ rv = rv | 1;
+ }
+
+ if (FD_ISSET(((unsigned int)sck2), &rfds))
+ {
+ rv = rv | 2;
+ }
+
+ if (FD_ISSET(((unsigned int)sck3), &rfds))
+ {
+ rv = rv | 4;
+ }
+ }
+ else
+ {
+ rv = 0;
+ }
+
+ return rv;
+}
+
+/*****************************************************************************/
+int
+g_tcp_bind(int sck, char *port)
+{
+ struct sockaddr_in s;
+
+ memset(&s, 0, sizeof(struct sockaddr_in));
+ s.sin_family = AF_INET;
+ s.sin_port = htons(atoi(port));
+ s.sin_addr.s_addr = INADDR_ANY;
+ return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
+}
+
+/*****************************************************************************/
+int
+g_tcp_local_bind(int sck, char *port)
+{
+ struct sockaddr_un s;
+
+ memset(&s, 0, sizeof(struct sockaddr_un));
+ s.sun_family = AF_UNIX;
+ strcpy(s.sun_path, port);
+ return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un));
+}
+
+/*****************************************************************************/
+int
+g_tcp_listen(int sck)
+{
+ return listen(sck, 2);
+}
+
+/*****************************************************************************/
+/* returns boolean */
+int
+g_create_dir(const char *dirname)
+{
+ return mkdir(dirname, (mode_t) - 1) == 0;
+}
+
+/*****************************************************************************/
+/* returns boolean, non zero if the directory exists */
+int
+g_directory_exist(const char *dirname)
+{
+ struct stat st;
+
+ if (stat(dirname, &st) == 0)
+ {
+ return S_ISDIR(st.st_mode);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*****************************************************************************/
+/* returns error */
+int
+g_chmod_hex(const char *filename, int flags)
+{
+ int fl;
+
+ fl = 0;
+ fl |= (flags & 0x4000) ? S_ISUID : 0;
+ fl |= (flags & 0x2000) ? S_ISGID : 0;
+ fl |= (flags & 0x1000) ? S_ISVTX : 0;
+ fl |= (flags & 0x0400) ? S_IRUSR : 0;
+ fl |= (flags & 0x0200) ? S_IWUSR : 0;
+ fl |= (flags & 0x0100) ? S_IXUSR : 0;
+ fl |= (flags & 0x0040) ? S_IRGRP : 0;
+ fl |= (flags & 0x0020) ? S_IWGRP : 0;
+ fl |= (flags & 0x0010) ? S_IXGRP : 0;
+ fl |= (flags & 0x0004) ? S_IROTH : 0;
+ fl |= (flags & 0x0002) ? S_IWOTH : 0;
+ fl |= (flags & 0x0001) ? S_IXOTH : 0;
+ return chmod(filename, fl);
+}
+
+/*****************************************************************************/
+/* produce a hex dump */
+void
+g_hexdump(unsigned char *p, unsigned int len)
+{
+ unsigned char *line;
+ int i;
+ int thisline;
+ int offset;
+
+ offset = 0;
+ line = p;
+
+ while (offset < len)
+ {
+ ErrorF("%04x ", offset);
+ thisline = len - offset;
+
+ if (thisline > 16)
+ {
+ thisline = 16;
+ }
+
+ for (i = 0; i < thisline; i++)
+ {
+ ErrorF("%02x ", line[i]);
+ }
+
+ for (; i < 16; i++)
+ {
+ ErrorF(" ");
+ }
+
+ for (i = 0; i < thisline; i++)
+ {
+ ErrorF("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
+ }
+
+ ErrorF("\n");
+ offset += thisline;
+ line += thisline;
+ }
+}
diff --git a/xorg/server/module/rdpMisc.h b/xorg/server/module/rdpMisc.h
new file mode 100644
index 00000000..8318f7bd
--- /dev/null
+++ b/xorg/server/module/rdpMisc.h
@@ -0,0 +1,78 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+the rest
+
+*/
+
+#ifndef __RDPMISC_H
+#define __RDPMISC_H
+
+int
+rdpBitsPerPixel(int depth);
+int
+g_tcp_recv(int sck, void *ptr, int len, int flags);
+void
+g_tcp_close(int sck);
+int
+g_tcp_last_error_would_block(int sck);
+void
+g_sleep(int msecs);
+int
+g_tcp_send(int sck, void *ptr, int len, int flags);
+void *
+g_malloc(int size, int zero);
+void
+g_free(void *ptr);
+void
+g_sprintf(char *dest, char *format, ...);
+int
+g_tcp_socket(void);
+int
+g_tcp_local_socket_dgram(void);
+int
+g_tcp_local_socket_stream(void);
+void
+g_memcpy(void *d_ptr, const void *s_ptr, int size);
+void
+g_memset(void *d_ptr, const unsigned char chr, int size);
+int
+g_tcp_set_no_delay(int sck);
+int
+g_tcp_set_non_blocking(int sck);
+int
+g_tcp_accept(int sck);
+int
+g_tcp_select(int sck1, int sck2, int sck3);
+int
+g_tcp_bind(int sck, char *port);
+int
+g_tcp_local_bind(int sck, char *port);
+int
+g_tcp_listen(int sck);
+int
+g_create_dir(const char *dirname);
+int
+g_directory_exist(const char *dirname);
+int
+g_chmod_hex(const char *filename, int flags);
+void
+g_hexdump(unsigned char *p, unsigned int len);
+
+#endif
diff --git a/xorg/server/module/rdpPolyArc.c b/xorg/server/module/rdpPolyArc.c
new file mode 100644
index 00000000..63fc699b
--- /dev/null
+++ b/xorg/server/module/rdpPolyArc.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ LLOGLN(10, ("rdpPolyArc:"));
+ /* do original call */
+ rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
+}
diff --git a/xorg/server/module/rdpPolyArc.h b/xorg/server/module/rdpPolyArc.h
new file mode 100644
index 00000000..7ebadc35
--- /dev/null
+++ b/xorg/server/module/rdpPolyArc.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYARC_H
+#define __RDPPOLYARC_H
+
+void
+rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyFillArc.c b/xorg/server/module/rdpPolyFillArc.c
new file mode 100644
index 00000000..b53a1131
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillArc.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
+{
+ LLOGLN(10, ("rdpPolyFillArc:"));
+ /* do original call */
+ rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
+}
diff --git a/xorg/server/module/rdpPolyFillArc.h b/xorg/server/module/rdpPolyFillArc.h
new file mode 100644
index 00000000..9a9846e1
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillArc.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYFILLARC_H
+#define __RDPPOLYFILLARC_H
+
+void
+rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyFillRect.c b/xorg/server/module/rdpPolyFillRect.c
new file mode 100644
index 00000000..dc929f9f
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillRect.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ LLOGLN(10, ("rdpPolyFillRect:"));
+ /* do original call */
+ rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
+}
diff --git a/xorg/server/module/rdpPolyFillRect.h b/xorg/server/module/rdpPolyFillRect.h
new file mode 100644
index 00000000..94ac4b59
--- /dev/null
+++ b/xorg/server/module/rdpPolyFillRect.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYFILLRECT_H
+#define __RDPPOLYFILLRECT_H
+
+void
+rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
+ xRectangle* prectInit);
+
+#endif
diff --git a/xorg/server/module/rdpPolyGlyphBlt.c b/xorg/server/module/rdpPolyGlyphBlt.c
new file mode 100644
index 00000000..5265ed72
--- /dev/null
+++ b/xorg/server/module/rdpPolyGlyphBlt.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ LLOGLN(10, ("rdpPolyGlyphBlt:"));
+ /* do original call */
+ rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
diff --git a/xorg/server/module/rdpPolyGlyphBlt.h b/xorg/server/module/rdpPolyGlyphBlt.h
new file mode 100644
index 00000000..9c6519d8
--- /dev/null
+++ b/xorg/server/module/rdpPolyGlyphBlt.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYGLYPHBLT_H
+#define __RDPPOLYGLYPHBLT_H
+
+void
+rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr* ppci, pointer pglyphBase);
+
+#endif
diff --git a/xorg/server/module/rdpPolyPoint.c b/xorg/server/module/rdpPolyPoint.c
new file mode 100644
index 00000000..6c9c77c1
--- /dev/null
+++ b/xorg/server/module/rdpPolyPoint.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts)
+{
+ LLOGLN(10, ("rdpPolyPoint:"));
+ /* do original call */
+ rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
+}
diff --git a/xorg/server/module/rdpPolyPoint.h b/xorg/server/module/rdpPolyPoint.h
new file mode 100644
index 00000000..87bf9459
--- /dev/null
+++ b/xorg/server/module/rdpPolyPoint.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYPOINT_H
+#define __RDPPOLYPOINT_H
+
+void
+rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr in_pts);
+
+#endif
diff --git a/xorg/server/module/rdpPolyRectangle.c b/xorg/server/module/rdpPolyRectangle.c
new file mode 100644
index 00000000..e80b8178
--- /dev/null
+++ b/xorg/server/module/rdpPolyRectangle.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle *rects)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */
+void
+rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle *rects)
+{
+ LLOGLN(10, ("rdpPolyRectangle:"));
+ /* do original call */
+ rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
+}
diff --git a/xorg/server/module/rdpPolyRectangle.h b/xorg/server/module/rdpPolyRectangle.h
new file mode 100644
index 00000000..d09446d5
--- /dev/null
+++ b/xorg/server/module/rdpPolyRectangle.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYRECTANGLE_H
+#define __RDPPOLYRECTANGLE_H
+
+void
+rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
+ xRectangle* rects);
+
+#endif
diff --git a/xorg/server/module/rdpPolySegment.c b/xorg/server/module/rdpPolySegment.c
new file mode 100644
index 00000000..f4a9d40c
--- /dev/null
+++ b/xorg/server/module/rdpPolySegment.c
@@ -0,0 +1,48 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
+{
+ LLOGLN(10, ("rdpPolySegment:"));
+ /* do original call */
+ rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
+}
diff --git a/xorg/server/module/rdpPolySegment.h b/xorg/server/module/rdpPolySegment.h
new file mode 100644
index 00000000..8c5f33ab
--- /dev/null
+++ b/xorg/server/module/rdpPolySegment.h
@@ -0,0 +1,28 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYSEGMENT_H
+#define __RDPPOLYSEGMENT_H
+
+void
+rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs);
+
+#endif
diff --git a/xorg/server/module/rdpPolyText16.c b/xorg/server/module/rdpPolyText16.c
new file mode 100644
index 00000000..b5eac8c5
--- /dev/null
+++ b/xorg/server/module/rdpPolyText16.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+int
+rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+int
+rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ int rv;
+
+ LLOGLN(10, ("rdpPolyText16:"));
+ /* do original call */
+ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
+ return rv;
+}
diff --git a/xorg/server/module/rdpPolyText16.h b/xorg/server/module/rdpPolyText16.h
new file mode 100644
index 00000000..bcfa8379
--- /dev/null
+++ b/xorg/server/module/rdpPolyText16.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYTEXT16_H
+#define __RDPPOLYTEXT16_H
+
+int
+rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short* chars);
+
+#endif
diff --git a/xorg/server/module/rdpPolyText8.c b/xorg/server/module/rdpPolyText8.c
new file mode 100644
index 00000000..8931a4c1
--- /dev/null
+++ b/xorg/server/module/rdpPolyText8.c
@@ -0,0 +1,55 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+int
+rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ int rv;
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars);
+ GC_OP_EPILOGUE(pGC);
+ return rv;
+}
+
+/******************************************************************************/
+int
+rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ int rv;
+
+ LLOGLN(10, ("rdpPolyText8:"));
+ /* do original call */
+ rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
+ return rv;
+}
diff --git a/xorg/server/module/rdpPolyText8.h b/xorg/server/module/rdpPolyText8.h
new file mode 100644
index 00000000..95e80412
--- /dev/null
+++ b/xorg/server/module/rdpPolyText8.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYTEXT8_H
+#define __RDPPOLYTEXT8_H
+
+int
+rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char* chars);
+
+#endif
diff --git a/xorg/server/module/rdpPolylines.c b/xorg/server/module/rdpPolylines.c
new file mode 100644
index 00000000..b439db28
--- /dev/null
+++ b/xorg/server/module/rdpPolylines.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit)
+{
+ LLOGLN(10, ("rdpPolylines:"));
+ /* do original call */
+ rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
+}
diff --git a/xorg/server/module/rdpPolylines.h b/xorg/server/module/rdpPolylines.h
new file mode 100644
index 00000000..2df3d388
--- /dev/null
+++ b/xorg/server/module/rdpPolylines.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPOLYLINES_H
+#define __RDPPOLYLINES_H
+
+void
+rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit);
+
+#endif
diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c
new file mode 100644
index 00000000..43f3d883
--- /dev/null
+++ b/xorg/server/module/rdpPri.c
@@ -0,0 +1,176 @@
+/*
+Copyright 2013 Jay Sorg
+
+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.
+
+to deal with privates changing in xorg versions
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdpPri.h"
+#include "rdpMisc.h"
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((0) * 1000) + 0)
+/* 1.1, 1.2, 1.3, 1.4 */
+#define XRDP_PRI 1
+#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+/* 1.5, 1.6, 1.7, 1.8 */
+#define XRDP_PRI 2
+#else
+/* 1.9, 1.10, 1.11, 1.12 */
+#define XRDP_PRI 3
+#endif
+
+#define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr))))
+#define INT2PTR(_int) ((void *) ((long) ((int) (_int))))
+
+#if XRDP_PRI == 3
+static DevPrivateKeyRec g_privateKeyRecGC;
+static DevPrivateKeyRec g_privateKeyRecPixmap;
+static DevPrivateKeyRec g_privateKeyRecWindow;
+#elif XRDP_PRI == 2
+static int g_privateKeyRecGC = 0;
+static int g_privateKeyRecPixmap = 0;
+static int g_privateKeyRecWindow = 0;
+#endif
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocateGCPrivateIndex());
+ AllocateGCPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecGC, bytes);
+ rv = &g_privateKeyRecGC;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes);
+ rv = &g_privateKeyRecGC;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocatePixmapPrivateIndex());
+ AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecPixmap, bytes);
+ rv = &g_privateKeyRecPixmap;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes);
+ rv = &g_privateKeyRecPixmap;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+rdpDevPrivateKey
+rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes)
+{
+ rdpDevPrivateKey rv;
+
+#if XRDP_PRI == 1
+ rv = INT2PTR(AllocateWindowPrivateIndex());
+ AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes);
+#elif XRDP_PRI == 2
+ dixRequestPrivate(&g_privateKeyRecWindow, bytes);
+ rv = &g_privateKeyRecWindow;
+#else
+ dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes);
+ rv = &g_privateKeyRecWindow;
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pGC->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pGC->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pPixmap->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pPixmap->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+void *
+rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key)
+{
+ void *rv;
+
+#if XRDP_PRI == 1
+ rv = pWindow->devPrivates[PTR2INT(key)].ptr;
+#else
+ rv = dixLookupPrivate(&(pWindow->devPrivates), key);
+#endif
+ return rv;
+}
+
+/*****************************************************************************/
+int
+rdpPrivateInit(void)
+{
+#if XRDP_PRI == 3
+ g_memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC));
+ g_memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow));
+ g_memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap));
+#endif
+ return 0;
+}
diff --git a/xorg/server/module/rdpPri.h b/xorg/server/module/rdpPri.h
new file mode 100644
index 00000000..625947a3
--- /dev/null
+++ b/xorg/server/module/rdpPri.h
@@ -0,0 +1,47 @@
+/*
+Copyright 2013 Jay Sorg
+
+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.
+
+to deal with privates changing in xorg versions
+
+*/
+
+#ifndef _XRDPPRI_H
+#define _XRDPPRI_H
+
+#include <screenint.h>
+#include <gc.h>
+
+typedef void* rdpDevPrivateKey;
+
+rdpDevPrivateKey
+rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes);
+rdpDevPrivateKey
+rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes);
+rdpDevPrivateKey
+rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes);
+void*
+rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key);
+void*
+rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key);
+void*
+rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key);
+int
+rdpPrivateInit(void);
+
+#endif
diff --git a/xorg/server/module/rdpPushPixels.c b/xorg/server/module/rdpPushPixels.c
new file mode 100644
index 00000000..3491d556
--- /dev/null
+++ b/xorg/server/module/rdpPushPixels.c
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
+{
+ LLOGLN(10, ("rdpPushPixels:"));
+ /* do original call */
+ rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
+}
diff --git a/xorg/server/module/rdpPushPixels.h b/xorg/server/module/rdpPushPixels.h
new file mode 100644
index 00000000..2e0cd1d1
--- /dev/null
+++ b/xorg/server/module/rdpPushPixels.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPUSHPIXELS_H
+#define __RDPPUSHPIXELS_H
+
+void
+rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y);
+
+#endif
diff --git a/xorg/server/module/rdpPutImage.c b/xorg/server/module/rdpPutImage.c
new file mode 100644
index 00000000..2d9faa89
--- /dev/null
+++ b/xorg/server/module/rdpPutImage.c
@@ -0,0 +1,51 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+static void
+rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pBits)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
+ format, pBits);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pBits)
+{
+ LLOGLN(10, ("rdpPutImage:"));
+ /* do original call */
+ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+}
diff --git a/xorg/server/module/rdpPutImage.h b/xorg/server/module/rdpPutImage.h
new file mode 100644
index 00000000..82e27872
--- /dev/null
+++ b/xorg/server/module/rdpPutImage.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPPUTIMAGE_H
+#define __RDPPUTIMAGE_H
+
+void
+rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char* pBits);
+
+#endif
diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c
new file mode 100644
index 00000000..fd080184
--- /dev/null
+++ b/xorg/server/module/rdpRandR.c
@@ -0,0 +1,309 @@
+/*
+Copyright 2011-2013 Jay Sorg
+
+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.
+
+RandR draw calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include <mipointer.h>
+#include <fb.h>
+#include <micmap.h>
+#include <mi.h>
+
+#include "rdp.h"
+#include "rdpDraw.h"
+#include "rdpReg.h"
+#include "rdpMisc.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+Bool
+rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
+{
+ int mmwidth;
+ int mmheight;
+ RRScreenSizePtr pSize;
+
+ LLOGLN(0, ("rdpRRRegisterSize: width %d height %d", width, height));
+ mmwidth = PixelToMM(width);
+ mmheight = PixelToMM(height);
+ pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
+ /* Tell RandR what the current config is */
+ RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize);
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ rrScrPrivPtr pRRScrPriv;
+ Bool rv;
+
+ LLOGLN(0, ("rdpRRSetConfig:"));
+ rv = TRUE;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+#if 0
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ if (pRRScrPriv != 0)
+ {
+ if (dev->rrSetConfig != 0)
+ {
+ LLOGLN(0, ("rdpRRSetConfig: here"));
+ pRRScrPriv->rrSetConfig = dev->rrSetConfig;
+ rv = pRRScrPriv->rrSetConfig(pScreen, rotateKind, rate, pSize);
+ pRRScrPriv->rrSetConfig = rdpRRSetConfig;
+ }
+ }
+#endif
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
+{
+ int width;
+ int height;
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+ rrScrPrivPtr pRRScrPriv;
+ Bool rv;
+
+ LLOGLN(0, ("rdpRRGetInfo:"));
+ rv = TRUE;
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+#if 0
+ pRRScrPriv = rrGetScrPriv(pScreen);
+ if (pRRScrPriv != 0)
+ {
+ if (dev->rrGetInfo != 0)
+ {
+ LLOGLN(0, ("rdpRRGetInfo: here"));
+ pRRScrPriv->rrGetInfo = dev->rrGetInfo;
+ rv = pRRScrPriv->rrGetInfo(pScreen, pRotations);
+ pRRScrPriv->rrGetInfo = rdpRRGetInfo;
+ }
+ }
+#else
+ *pRotations = RR_Rotate_0;
+ width = dev->width;
+ height = dev->height;
+ rdpRRRegisterSize(pScreen, width, height);
+#endif
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight)
+{
+ WindowPtr root;
+ PixmapPtr screenPixmap;
+ BoxRec box;
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+
+ LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d",
+ width, height, (int)mmWidth, (int)mmHeight));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+ root = rdpGetRootWindowPtr(pScreen);
+ if ((width < 1) || (height < 1))
+ {
+ LLOGLN(10, (" error width %d height %d", width, height));
+ return FALSE;
+ }
+ dev->width = width;
+ dev->height = height;
+ dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
+ dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ screenPixmap = pScreen->GetScreenPixmap(pScreen);
+ g_free(dev->pfbMemory);
+ dev->pfbMemory = (char *) g_malloc(dev->sizeInBytes, 1);
+ if (screenPixmap != 0)
+ {
+ pScreen->ModifyPixmapHeader(screenPixmap, width, height,
+ -1, -1,
+ dev->paddedWidthInBytes,
+ dev->pfbMemory);
+ }
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ rdpRegionInit(&root->winSize, &box, 1);
+ rdpRegionInit(&root->borderSize, &box, 1);
+ rdpRegionReset(&root->borderClip, &box);
+ rdpRegionBreak(&root->clipList);
+ root->drawable.width = width;
+ root->drawable.height = height;
+ ResizeChildrenWinSize(root, 0, 0, 0, 0);
+ RRGetInfo(pScreen, 1);
+ LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height));
+ RRScreenSizeNotify(pScreen);
+ xf86EnableDisableFBAccess(pScreen->myNum, FALSE);
+ xf86EnableDisableFBAccess(pScreen->myNum, TRUE);
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
+ int x, int y, Rotation rotation, int numOutputs,
+ RROutputPtr *outputs)
+{
+ LLOGLN(0, ("rdpRRCrtcSet:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ LLOGLN(0, ("rdpRRCrtcSetGamma:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
+{
+ LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p %p", crtc, crtc->gammaRed,
+ crtc->gammaBlue, crtc->gammaGreen));
+ crtc->gammaSize = 1;
+ if (crtc->gammaRed == NULL)
+ {
+ crtc->gammaRed = g_malloc(32, 1);
+ }
+ if (crtc->gammaBlue == NULL)
+ {
+ crtc->gammaBlue = g_malloc(32, 1);
+ }
+ if (crtc->gammaGreen == NULL)
+ {
+ crtc->gammaGreen = g_malloc(32, 1);
+ }
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ LLOGLN(0, ("rdpRROutputSetProperty:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
+ RRModePtr mode)
+{
+ LLOGLN(0, ("rdpRROutputValidateMode:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+void
+rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode)
+{
+ LLOGLN(0, ("rdpRRModeDestroy:"));
+}
+
+/******************************************************************************/
+Bool
+rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property)
+{
+ LLOGLN(0, ("rdpRROutputGetProperty:"));
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+
+ LLOGLN(0, ("rdpRRGetPanning: %p", crtc));
+ pScrn = xf86Screens[pScreen->myNum];
+ dev = XRDPPTR(pScrn);
+
+ if (totalArea != 0)
+ {
+ totalArea->x1 = 0;
+ totalArea->y1 = 0;
+ totalArea->x2 = dev->width;
+ totalArea->y2 = dev->height;
+ }
+
+ if (trackingArea != 0)
+ {
+ trackingArea->x1 = 0;
+ trackingArea->y1 = 0;
+ trackingArea->x2 = dev->width;
+ trackingArea->y2 = dev->height;
+ }
+
+ if (border != 0)
+ {
+ border[0] = 0;
+ border[1] = 0;
+ border[2] = 0;
+ border[3] = 0;
+ }
+ return TRUE;
+}
+
+/******************************************************************************/
+Bool
+rdpRRSetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16 *border)
+{
+ LLOGLN(0, ("rdpRRSetPanning:"));
+ return TRUE;
+}
diff --git a/xorg/server/module/rdpRandR.h b/xorg/server/module/rdpRandR.h
new file mode 100644
index 00000000..3aba7e1a
--- /dev/null
+++ b/xorg/server/module/rdpRandR.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2011-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef _RDPRANDR_H
+#define _RDPRANDR_H
+
+Bool
+rdpRRRegisterSize(ScreenPtr pScreen, int width, int height);
+Bool
+rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations);
+Bool
+rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
+ RRScreenSizePtr pSize);
+Bool
+rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
+ CARD32 mmWidth, CARD32 mmHeight);
+Bool
+rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
+ int x, int y, Rotation rotation, int numOutputs,
+ RROutputPtr* outputs);
+Bool
+rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
+Bool
+rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
+Bool
+rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
+ RRPropertyValuePtr value);
+Bool
+rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
+ RRModePtr mode);
+void
+rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode);
+Bool
+rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property);
+Bool
+rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16* border);
+Bool
+rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
+ BoxPtr trackingArea, INT16* border);
+
+#endif
diff --git a/xorg/server/module/rdpReg.c b/xorg/server/module/rdpReg.c
new file mode 100644
index 00000000..3a343f14
--- /dev/null
+++ b/xorg/server/module/rdpReg.c
@@ -0,0 +1,233 @@
+/*
+Copyright 2013 Jay Sorg
+
+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.
+
+to deal with regions changing in xorg versions
+
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+/*
+miRegionCopy -> RegionCopy
+miTranslateRegion -> RegionTranslate
+miRegionNotEmpty -> RegionNotEmpty
+miIntersect -> RegionIntersect
+miRectIn -> RegionContainsRect
+miRegionInit -> RegionInit
+miRegionUninit -> RegionUninit
+miRectsToRegion -> RegionFromRects
+miRegionDestroy -> RegionDestroy
+miRegionCreate -> RegionCreate
+miUnion -> RegionUnion
+miRegionExtents -> RegionExtents
+miRegionReset -> RegionReset
+miRegionBreak -> RegionBreak
+*/
+
+#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
+/* 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 */
+#define XRDP_REG 1
+#else
+/* 1.9, 1.10, 1.11, 1.12 */
+#define XRDP_REG 2
+#endif
+
+/*****************************************************************************/
+Bool
+rdpRegionCopy(RegionPtr dst, RegionPtr src)
+{
+#if XRDP_REG == 1
+ return miRegionCopy(dst, src);
+#else
+ return RegionCopy(dst, src);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionTranslate(RegionPtr pReg, int x, int y)
+{
+#if XRDP_REG == 1
+ miTranslateRegion(pReg, x, y);
+#else
+ RegionTranslate(pReg, x, y);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionNotEmpty(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionNotEmpty(pReg);
+#else
+ return RegionNotEmpty(pReg);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miIntersect(newReg, reg1, reg2);
+#else
+ return RegionIntersect(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+int
+rdpRegionContainsRect(RegionPtr region, BoxPtr prect)
+{
+#if XRDP_REG == 1
+ return miRectIn(region, prect);
+#else
+ return RegionContainsRect(region, prect);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size)
+{
+#if XRDP_REG == 1
+ miRegionInit(pReg, rect, size);
+#else
+ RegionInit(pReg, rect, size);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionUninit(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ miRegionUninit(pReg);
+#else
+ RegionUninit(pReg);
+#endif
+}
+
+/*****************************************************************************/
+RegionPtr
+rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype)
+{
+#if XRDP_REG == 1
+ return miRectsToRegion(nrects, prect, ctype);
+#else
+ return RegionFromRects(nrects, prect, ctype);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionDestroy(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ miRegionDestroy(pReg);
+#else
+ RegionDestroy(pReg);
+#endif
+}
+
+/*****************************************************************************/
+RegionPtr
+rdpRegionCreate(BoxPtr rect, int size)
+{
+#if XRDP_REG == 1
+ return miRegionCreate(rect, size);
+#else
+ return RegionCreate(rect, size);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miUnion(newReg, reg1, reg2);
+#else
+ return RegionUnion(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
+{
+#if XRDP_REG == 1
+ return miSubtract(newReg, reg1, reg2);
+#else
+ return RegionSubtract(newReg, reg1, reg2);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect)
+{
+#if XRDP_REG == 1
+ return miInverse(newReg, reg1, invRect);
+#else
+ return RegionInverse(newReg, reg1, invRect);
+#endif
+}
+
+/*****************************************************************************/
+BoxPtr
+rdpRegionExtents(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionExtents(pReg);
+#else
+ return RegionExtents(pReg);
+#endif
+}
+
+/*****************************************************************************/
+void
+rdpRegionReset(RegionPtr pReg, BoxPtr pBox)
+{
+#if XRDP_REG == 1
+ miRegionReset(pReg, pBox);
+#else
+ RegionReset(pReg, pBox);
+#endif
+}
+
+/*****************************************************************************/
+Bool
+rdpRegionBreak(RegionPtr pReg)
+{
+#if XRDP_REG == 1
+ return miRegionBreak(pReg);
+#else
+ return RegionBreak(pReg);
+#endif
+}
diff --git a/xorg/server/module/rdpReg.h b/xorg/server/module/rdpReg.h
new file mode 100644
index 00000000..b788cd69
--- /dev/null
+++ b/xorg/server/module/rdpReg.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2013 Jay Sorg
+
+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.
+
+to deal with regions changing in xorg versions
+
+*/
+
+#ifndef __RDPREG_H
+#define __RDPREG_H
+
+Bool
+rdpRegionCopy(RegionPtr dst, RegionPtr src);
+void
+rdpRegionTranslate(RegionPtr pReg, int x, int y);
+Bool
+rdpRegionNotEmpty(RegionPtr pReg);
+Bool
+rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+int
+rdpRegionContainsRect(RegionPtr region, BoxPtr prect);
+void
+rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size);
+void
+rdpRegionUninit(RegionPtr pReg);
+RegionPtr
+rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype);
+void
+rdpRegionDestroy(RegionPtr pReg);
+RegionPtr
+rdpRegionCreate(BoxPtr rect, int size);
+Bool
+rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+Bool
+rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
+Bool
+rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect);
+BoxPtr
+rdpRegionExtents(RegionPtr pReg);
+void
+rdpRegionReset(RegionPtr pReg, BoxPtr pBox);
+Bool
+rdpRegionBreak(RegionPtr pReg);
+
+#endif
diff --git a/xorg/server/module/rdpSetSpans.c b/xorg/server/module/rdpSetSpans.c
new file mode 100644
index 00000000..1bd9ed80
--- /dev/null
+++ b/xorg/server/module/rdpSetSpans.c
@@ -0,0 +1,52 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+#define LDEBUG 0
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/******************************************************************************/
+void
+rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ rdpGCPtr priv;
+ GCFuncs *oldFuncs;
+
+ GC_OP_PROLOGUE(pGC);
+ pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+ GC_OP_EPILOGUE(pGC);
+}
+
+/******************************************************************************/
+void
+rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ LLOGLN(0, ("rdpSetSpans:"));
+ /* do original call */
+ rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+}
diff --git a/xorg/server/module/rdpSetSpans.h b/xorg/server/module/rdpSetSpans.h
new file mode 100644
index 00000000..acaedd66
--- /dev/null
+++ b/xorg/server/module/rdpSetSpans.h
@@ -0,0 +1,29 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+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.
+
+*/
+
+#ifndef __RDPSETSPANS_H
+#define __RDPSETSPANS_H
+
+void
+rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
+ DDXPointPtr ppt, int* pwidth, int nspans, int fSorted);
+
+#endif