From 1f84c36ddd9803ae328713960bac4694374382ab Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 21 Jul 2013 23:30:39 -0700 Subject: [PATCH] xorg driver, added rdpPixmap.c/h --- xorg/server/module/Makefile | 2 +- xorg/server/module/rdpDraw.c | 64 ---------------------- xorg/server/module/rdpDraw.h | 8 --- xorg/server/module/rdpPixmap.c | 99 ++++++++++++++++++++++++++++++++++ xorg/server/module/rdpPixmap.h | 36 +++++++++++++ xorg/server/xrdpdev/xrdpdev.c | 3 +- 6 files changed, 138 insertions(+), 74 deletions(-) create mode 100644 xorg/server/module/rdpPixmap.c create mode 100644 xorg/server/module/rdpPixmap.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 66b09f91..eb8f1e29 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -5,7 +5,7 @@ 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 +rdpComposite.o rdpGlyphs.o rdpPixmap.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index 7abcb406..462d7a13 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -39,70 +39,6 @@ misc draw calls #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) diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h index ba696541..0b77abde 100644 --- a/xorg/server/module/rdpDraw.h +++ b/xorg/server/module/rdpDraw.h @@ -52,14 +52,6 @@ do { \ 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 diff --git a/xorg/server/module/rdpPixmap.c b/xorg/server/module/rdpPixmap.c new file mode 100644 index 00000000..191bb9e9 --- /dev/null +++ b/xorg/server/module/rdpPixmap.c @@ -0,0 +1,99 @@ +/* +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. + +pixmap calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#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; +} diff --git a/xorg/server/module/rdpPixmap.h b/xorg/server/module/rdpPixmap.h new file mode 100644 index 00000000..8456593f --- /dev/null +++ b/xorg/server/module/rdpPixmap.h @@ -0,0 +1,36 @@ +/* +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. + +pixmap calls + +*/ + +#ifndef __RDPPIXMAP_H +#define __RDPPIXAMP_H + +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); + +#endif diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index cc863d4d..ac7c79c8 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -47,6 +47,7 @@ This is the main driver file #include "rdpMisc.h" #include "rdpComposite.h" #include "rdpGlyphs.h" +#include "rdpPixmap.h" #define XRDP_DRIVER_NAME "XRDPDEV" #define XRDP_NAME "XRDPDEV" @@ -413,7 +414,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) miClearVisualTypes(); miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, TrueColor); + pScrn->rgbBits, TrueColor); miSetPixmapDepths(); LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d rgbBits %d depth %d", pScrn->virtualX, pScrn->virtualY, pScrn->rgbBits, pScrn->depth));