xorg: work on xorg driver

This commit is contained in:
Jay Sorg 2014-01-22 10:31:05 -08:00
parent 448b7a5d4b
commit 320ce8ba47
20 changed files with 335 additions and 23 deletions

View File

@ -110,7 +110,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
RegionRec clip_reg;
int cd;
LLOGLN(10, ("rdpCopyArea:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
rdpRegionInit(&clip_reg, NullBox, 0);

View File

@ -61,7 +61,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
{
RegionPtr rv;
LLOGLN(10, ("rdpCopyPlane:"));
LLOGLN(0, ("rdpCopyPlane:"));
/* do original call */
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane);

View File

@ -27,6 +27,7 @@ misc draw calls
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
@ -365,7 +366,7 @@ rdpCloseScreen(int index, ScreenPtr pScreen)
WindowPtr
rdpGetRootWindowPtr(ScreenPtr pScreen)
{
#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0)
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 0, 0, 0)
return WindowTable[pScreen->myNum]; /* in globals.c */
#else
return pScreen->root;

View File

@ -27,7 +27,7 @@ misc draw calls
#include <xorg-server.h>
#include <xf86.h>
/* true is drawable is window or pixmap is screen */
/* true if drawable is window or pixmap is screen */
#define XRDP_DRAWABLE_IS_VISIBLE(_dev, _drw) \
(((_drw)->type == DRAWABLE_WINDOW && ((WindowPtr)(_drw))->viewable) || \
((_drw)->type == DRAWABLE_PIXMAP && \

View File

@ -56,7 +56,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
LLOGLN(10, ("rdpFillPolygon:"));
LLOGLN(0, ("rdpFillPolygon:"));
/* do original call */
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
}

View File

@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
@ -56,7 +58,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
LLOGLN(10, ("rdpImageGlyphBlt:"));
LLOGLN(0, ("rdpImageGlyphBlt:"));
/* do original call */
rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}

View File

@ -39,6 +39,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpImageText8Pre(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars,
BoxPtr box)
{
}
/******************************************************************************/
void
rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
@ -51,13 +61,65 @@ rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpImageText8Post(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars,
BoxPtr box)
{
RegionRec reg;
if (cd == 0)
{
return;
}
if (!XRDP_DRAWABLE_IS_VISIBLE(dev, pDrawable))
{
return;
}
rdpRegionInit(&reg, box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/
void
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
LLOGLN(0, ("rdpImageText8:"));
rdpPtr dev;
rdpClientCon *clientCon;
RegionRec clip_reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpImageText8:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpImageText8: cd %d", cd));
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpImageText8Pre(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
/* do original call */
rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
return;
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpImageText8Post(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
RegionUninit(&clip_reg);
}

View File

@ -52,7 +52,7 @@ rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
void
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
LLOGLN(10, ("rdpPolyArc:"));
LLOGLN(0, ("rdpPolyArc:"));
/* do original call */
rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
}

View File

@ -43,7 +43,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static void
rdpPolyFillRectPre(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC, RegionPtr fill_reg)
DrawablePtr pDrawable, GCPtr pGC,
int nrectFill, xRectangle *prectInit,
RegionPtr fill_reg)
{
}
@ -63,7 +65,9 @@ rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
static void
rdpPolyFillRectPost(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC, RegionPtr fill_reg)
DrawablePtr pDrawable, GCPtr pGC,
int nrectFill, xRectangle *prectInit,
RegionPtr fill_reg)
{
if (cd == 0)
{
@ -105,7 +109,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
while (clientCon != NULL)
{
rdpPolyFillRectPre(dev, clientCon, cd, &clip_reg, pDrawable,
pGC, fill_reg);
pGC, nrectFill, prectInit, fill_reg);
clientCon = clientCon->next;
}
/* do original call */
@ -114,9 +118,9 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
while (clientCon != NULL)
{
rdpPolyFillRectPost(dev, clientCon, cd, &clip_reg, pDrawable,
pGC, fill_reg);
pGC, nrectFill, prectInit, fill_reg);
clientCon = clientCon->next;
}
RegionUninit(&clip_reg);
rdpRegionUninit(&clip_reg);
rdpRegionDestroy(fill_reg);
}

View File

@ -56,7 +56,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
LLOGLN(10, ("rdpPolyGlyphBlt:"));
LLOGLN(0, ("rdpPolyGlyphBlt:"));
/* do original call */
rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}

View File

@ -54,7 +54,7 @@ void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
LLOGLN(10, ("rdpPolyPoint:"));
LLOGLN(0, ("rdpPolyPoint:"));
/* do original call */
rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
}

View File

@ -32,11 +32,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpPolyRectanglePre(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects, RegionPtr reg)
{
}
/******************************************************************************/
static void
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
@ -50,12 +61,104 @@ rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
}
/******************************************************************************/
/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */
void
rdpPolyRectanglePost(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects, RegionPtr reg)
{
if (cd == 0)
{
return;
}
if (!XRDP_DRAWABLE_IS_VISIBLE(dev, pDrawable))
{
return;
}
if (cd == 2)
{
rdpRegionIntersect(reg, clip_reg, reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, reg);
}
/******************************************************************************/
void
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects)
{
rdpPtr dev;
rdpClientCon *clientCon;
BoxRec box;
int index;
int up;
int down;
int lw;
int cd;
RegionRec clip_reg;
RegionRec reg;
LLOGLN(10, ("rdpPolyRectangle:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
rdpRegionInit(&reg, NullBox, 0);
lw = pGC->lineWidth;
if (lw < 1)
{
lw = 1;
}
up = lw / 2;
down = 1 + (lw - 1) / 2;
index = 0;
while (index < nrects)
{
box.x1 = (rects[index].x + pDrawable->x) - up;
box.y1 = (rects[index].y + pDrawable->y) - up;
box.x2 = box.x1 + rects[index].width + (up + down);
box.y2 = box.y1 + lw;
rdpRegionUnionRect(&reg, &box);
box.x1 = (rects[index].x + pDrawable->x) - up;
box.y1 = (rects[index].y + pDrawable->y) + down;
box.x2 = box.x1 + lw;
box.y2 = box.y1 + rects[index].height - (up + down);
rdpRegionUnionRect(&reg, &box);
box.x1 = ((rects[index].x + rects[index].width) + pDrawable->x) - up;
box.y1 = (rects[index].y + pDrawable->y) + down;
box.x2 = box.x1 + lw;
box.y2 = box.y1 + rects[index].height - (up + down);
rdpRegionUnionRect(&reg, &box);
box.x1 = (rects[index].x + pDrawable->x) - up;
box.y1 = ((rects[index].y + rects[index].height) + pDrawable->y) - up;
box.x2 = box.x1 + rects[index].width + (up + down);
box.y2 = box.y1 + lw;
rdpRegionUnionRect(&reg, &box);
index++;
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyRectangle: cd %d", cd));
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyRectanglePre(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
nrects, rects, &reg);
clientCon = clientCon->next;
}
/* do original call */
rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyRectanglePost(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
nrects, rects, &reg);
clientCon = clientCon->next;
}
rdpRegionUninit(&reg);
}

View File

@ -52,7 +52,7 @@ rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
LLOGLN(10, ("rdpPolySegment:"));
LLOGLN(0, ("rdpPolySegment:"));
/* do original call */
rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
}

View File

@ -32,11 +32,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpPolyText16Pre(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars,
BoxPtr box)
{
}
/******************************************************************************/
int
rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
@ -51,15 +63,67 @@ rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
return rv;
}
/******************************************************************************/
void
rdpPolyText16Post(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars,
BoxPtr box)
{
RegionRec reg;
if (cd == 0)
{
return;
}
if (!XRDP_DRAWABLE_IS_VISIBLE(dev, pDrawable))
{
return;
}
rdpRegionInit(&reg, box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/
int
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
int rv;
rdpPtr dev;
rdpClientCon *clientCon;
RegionRec clip_reg;
int cd;
BoxRec box;
LLOGLN(0, ("rdpPolyText16:"));
LLOGLN(10, ("rdpPolyText16:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyText16: cd %d", cd));
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyText16Pre(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
/* do original call */
rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyText16Post(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
RegionUninit(&clip_reg);
return rv;
}

View File

@ -32,11 +32,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpPolyText8Pre(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars,
BoxPtr box)
{
}
/******************************************************************************/
int
rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
@ -51,15 +63,67 @@ rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
return rv;
}
/******************************************************************************/
void
rdpPolyText8Post(rdpPtr dev, rdpClientCon *clientCon,
int cd, RegionPtr clip_reg,
DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars,
BoxPtr box)
{
RegionRec reg;
if (cd == 0)
{
return;
}
if (!XRDP_DRAWABLE_IS_VISIBLE(dev, pDrawable))
{
return;
}
rdpRegionInit(&reg, box, 0);
if (cd == 2)
{
rdpRegionIntersect(&reg, clip_reg, &reg);
}
rdpClientConAddDirtyScreenReg(dev, clientCon, &reg);
RegionUninit(&reg);
}
/******************************************************************************/
int
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
int rv;
rdpPtr dev;
rdpClientCon *clientCon;
RegionRec clip_reg;
int cd;
BoxRec box;
LLOGLN(0, ("rdpPolyText8:"));
LLOGLN(10, ("rdpPolyText8:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyText8: cd %d", cd));
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyText8Pre(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
/* do original call */
rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpPolyText8Post(dev, clientCon, cd, &clip_reg, pDrawable, pGC,
x, y, count, chars, &box);
clientCon = clientCon->next;
}
RegionUninit(&clip_reg);
return rv;
}

View File

@ -54,7 +54,7 @@ void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
LLOGLN(10, ("rdpPolylines:"));
LLOGLN(0, ("rdpPolylines:"));
/* do original call */
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2013 Jay Sorg
Copyright 2013-2014 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

View File

@ -54,7 +54,7 @@ void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
LLOGLN(10, ("rdpPushPixels:"));
LLOGLN(0, ("rdpPushPixels:"));
/* do original call */
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
}

View File

@ -233,3 +233,14 @@ rdpRegionBreak(RegionPtr pReg)
return RegionBreak(pReg);
#endif
}
/*****************************************************************************/
void
rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect)
{
RegionRec reg;
rdpRegionInit(&reg, prect, 0);
rdpRegionUnion(pReg, pReg, &reg);
rdpRegionUninit(&reg);
}

View File

@ -56,5 +56,7 @@ void
rdpRegionReset(RegionPtr pReg, BoxPtr pBox);
Bool
rdpRegionBreak(RegionPtr pReg);
void
rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect);
#endif