xorg: work on delayed/dirty updates

master
Jay Sorg 12 years ago
parent ea98b503ca
commit 68ef2fadde

@ -311,6 +311,8 @@ int
g_chmod_hex(const char* filename, int flags); g_chmod_hex(const char* filename, int flags);
void void
hexdump(unsigned char *p, unsigned int len); hexdump(unsigned char *p, unsigned int len);
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg);
/* rdpdraw.c */ /* rdpdraw.c */
Bool Bool

@ -346,6 +346,25 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
LLOGLN(10, ("rdpCopyArea:")); LLOGLN(10, ("rdpCopyArea:"));
if (pSrc->type == DRAWABLE_PIXMAP)
{
pSrcPixmap = (PixmapPtr)pSrc;
pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv))
{
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
}
}
if (pDst->type == DRAWABLE_PIXMAP)
{
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
{
rdpup_check_dirty(pDstPixmap, pDstPriv);
}
}
if (pSrc->type == DRAWABLE_WINDOW) if (pSrc->type == DRAWABLE_WINDOW)
{ {
pSrcWnd = (WindowPtr)pSrc; pSrcWnd = (WindowPtr)pSrc;
@ -373,7 +392,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
can_do_screen_blt = pGC->alu == GXcopy; can_do_screen_blt = pGC->alu == GXcopy;
if (can_do_screen_blt) if (can_do_screen_blt)
{ {
rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC, return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
srcx, srcy, w, h, dstx, dsty); srcx, srcy, w, h, dstx, dsty);
} }
@ -387,7 +405,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pSrcPriv = GETPIXPRIV(pSrcPixmap); pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv)) if (XRDP_IS_OS(pSrcPriv))
{ {
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
if (pDst->type == DRAWABLE_WINDOW) if (pDst->type == DRAWABLE_WINDOW)
{ {
pDstWnd = (WindowPtr)pDst; pDstWnd = (WindowPtr)pDst;
@ -403,7 +420,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv, return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
pDstPixmap, pDstPriv, pDstPixmap, pDstPriv,
pGC, srcx, srcy, w, h, pGC, srcx, srcy, w, h,

@ -86,11 +86,34 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
PixmapPtr pSrcPixmap;
rdpPixmapRec* pSrcPriv;
LLOGLN(10, ("rdpCopyPlane:")); LLOGLN(10, ("rdpCopyPlane:"));
if (pSrc->type == DRAWABLE_PIXMAP)
{
pSrcPixmap = (PixmapPtr)pSrc;
pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv))
{
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
}
}
if (pDst->type == DRAWABLE_PIXMAP)
{
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
{
rdpup_check_dirty(pDstPixmap, pDstPriv);
}
}
/* do original call */ /* do original call */
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h, rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane); dstx, dsty, bitPlane);
dirty_type = 0; dirty_type = 0;
pDirtyPriv = 0; pDirtyPriv = 0;
post_process = 0; post_process = 0;
@ -108,7 +131,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
LLOGLN(10, ("rdpCopyPlane: gettig dirty")); LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
pDstPriv->is_dirty = 1; pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv; pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY; dirty_type = RDI_IMGLL;
} }
else else
{ {

@ -87,6 +87,41 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
LLOGLN(10, ("rdpFillPolygon:")); LLOGLN(10, ("rdpFillPolygon:"));
box.x1 = 0;
box.y1 = 0;
box.x2 = 0;
box.y2 = 0;
if (count > 0)
{
maxx = pPts[0].x;
maxy = pPts[0].y;
minx = maxx;
miny = maxy;
for (i = 1; i < count; i++)
{
if (pPts[i].x > maxx)
{
maxx = pPts[i].x;
}
if (pPts[i].x < minx)
{
minx = pPts[i].x;
}
if (pPts[i].y > maxy)
{
maxy = pPts[i].y;
}
if (pPts[i].y < miny)
{
miny = pPts[i].y;
}
}
box.x1 = pDrawable->x + minx;
box.y1 = pDrawable->y + miny;
box.x2 = pDrawable->x + maxx + 1;
box.y2 = pDrawable->y + maxy + 1;
}
/* do original call */ /* do original call */
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts); rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
@ -107,7 +142,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
LLOGLN(10, ("rdpFillPolygon: gettig dirty")); LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
pDstPriv->is_dirty = 1; pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv; pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY; dirty_type = RDI_IMGLL;
} }
else else
{ {
@ -138,43 +173,6 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
RegionInit(&clip_reg, NullBox, 0); RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDrawable, pGC); cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
if (cd != 0)
{
box.x1 = 0;
box.y1 = 0;
box.x2 = 0;
box.y2 = 0;
if (count > 0)
{
maxx = pPts[0].x;
maxy = pPts[0].y;
minx = maxx;
miny = maxy;
for (i = 1; i < count; i++)
{
if (pPts[i].x > maxx)
{
maxx = pPts[i].x;
}
if (pPts[i].x < minx)
{
minx = pPts[i].x;
}
if (pPts[i].y > maxy)
{
maxy = pPts[i].y;
}
if (pPts[i].y < miny)
{
miny = pPts[i].y;
}
box.x1 = pDrawable->x + minx;
box.y1 = pDrawable->y + miny;
box.x2 = pDrawable->x + maxx + 1;
box.y2 = pDrawable->y + maxy + 1;
}
}
}
if (cd == 1) if (cd == 1)
{ {
if (dirty_type != 0) if (dirty_type != 0)

@ -68,7 +68,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
LLOGLN(0, ("rdpFillSpans: todo")); LLOGLN(10, ("rdpFillSpans: todo"));
/* do original call */ /* do original call */
rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);

@ -62,6 +62,8 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts) int npt, DDXPointPtr in_pts)
{ {
RegionRec clip_reg; RegionRec clip_reg;
RegionRec reg1;
RegionRec reg2;
int num_clips; int num_clips;
int cd; int cd;
int x; int x;
@ -83,6 +85,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyPoint:")); LLOGLN(10, ("rdpPolyPoint:"));
LLOGLN(10, ("rdpPolyPoint: npt %d", npt));
if (npt > 32) if (npt > 32)
{ {
@ -145,7 +148,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
LLOGLN(10, ("rdpPolyPoint: gettig dirty")); LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
pDstPriv->is_dirty = 1; pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv; pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY; dirty_type = RDI_IMGLL;
} }
else else
{ {
@ -182,7 +185,20 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{ {
if (dirty_type != 0) if (dirty_type != 0)
{ {
/* TODO */ RegionInit(&reg1, NullBox, 0);
for (i = 0; i < npt; i++)
{
box.x1 = pts[i].x;
box.y1 = pts[i].y;
box.x2 = box.x1 + 1;
box.y2 = box.y1 + 1;
RegionInit(&reg2, &box, 0);
RegionUnion(&reg1, &reg1, &reg2);
RegionUninit(&reg2);
}
draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
pGC->alu);
RegionUninit(&reg1);
} }
else if (got_id) else if (got_id)
{ {
@ -205,7 +221,21 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{ {
if (dirty_type != 0) if (dirty_type != 0)
{ {
/* TODO */ RegionInit(&reg1, NullBox, 0);
for (i = 0; i < npt; i++)
{
box.x1 = pts[i].x;
box.y1 = pts[i].y;
box.x2 = box.x1 + 1;
box.y2 = box.y1 + 1;
RegionInit(&reg2, &box, 0);
RegionUnion(&reg1, &reg1, &reg2);
RegionUninit(&reg2);
}
RegionIntersect(&reg1, &reg1, &clip_reg);
draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
pGC->alu);
RegionUninit(&reg1);
} }
else if (got_id) else if (got_id)
{ {

@ -55,10 +55,6 @@ rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
GC_OP_EPILOGUE(pGC); GC_OP_EPILOGUE(pGC);
} }
/* in rdpPolylines.c */
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nsegs);
/******************************************************************************/ /******************************************************************************/
void void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
@ -79,7 +75,8 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolySegment: %d", nseg)); LLOGLN(10, ("rdpPolySegment:"));
LLOGLN(10, (" nseg %d", nseg));
segs = 0; segs = 0;
if (nseg) /* get the rects */ if (nseg) /* get the rects */
@ -114,7 +111,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
LLOGLN(10, ("rdpPolySegment: gettig dirty")); LLOGLN(10, ("rdpPolySegment: gettig dirty"));
pDstPriv->is_dirty = 1; pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv; pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY; dirty_type = RDI_IMGLL;
} }
else else
{ {

@ -56,46 +56,6 @@ rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
GC_OP_EPILOGUE(pGC); GC_OP_EPILOGUE(pGC);
} }
/******************************************************************************/
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
{
int index;
BoxRec box;
RegionRec treg;
index = 0;
while (index < nseg)
{
if (segs[index].x1 < segs[index].x2)
{
box.x1 = segs[index].x1;
box.x2 = segs[index].x2;
}
else
{
box.x1 = segs[index].x2;
box.x2 = segs[index].x1;
}
box.x2++;
if (segs[index].y1 < segs[index].y2)
{
box.y1 = segs[index].y1;
box.y2 = segs[index].y2;
}
else
{
box.y1 = segs[index].y2;
box.y2 = segs[index].y1;
}
box.y2++;
RegionInit(&treg, &box, 0);
RegionUnion(reg, reg, &treg);
RegionUninit(&treg);
index++;
}
}
/******************************************************************************/ /******************************************************************************/
void void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
@ -119,46 +79,61 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
LLOGLN(0, ("rdpPolylines:")); LLOGLN(10, ("rdpPolylines:"));
LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode,
pDrawable->x, pDrawable->y));
#if 0
LLOGLN(0, (" points"));
for (i = 0; i < npt; i++)
{
LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y));
}
#endif
/* convert lines to line segments */ /* convert lines to line segments */
nseg = npt - 1; nseg = npt - 1;
segs = 0; segs = 0;
if (npt > 1) if (npt > 1)
{ {
segs = (xSegment*)g_malloc(sizeof(xSegment) * npt - 1, 0); segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 0);
segs[0].x1 = pptInit[0].x + pDrawable->x; segs[0].x1 = pptInit[0].x + pDrawable->x;
segs[0].y1 = pptInit[0].y + pDrawable->y; segs[0].y1 = pptInit[0].y + pDrawable->y;
if (mode == CoordModeOrigin) if (mode == CoordModeOrigin)
{ {
segs[0].x2 = pptInit[1].x + pDrawable->x; segs[0].x2 = pptInit[1].x + pDrawable->x;
segs[0].y2 = pptInit[1].y + pDrawable->y; segs[0].y2 = pptInit[1].y + pDrawable->y;
for (i = 2; i < npt; i++)
{
segs[i - 1].x1 = segs[i - 2].x2;
segs[i - 1].y1 = segs[i - 2].y2;
segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
segs[i - 1].y2 = pptInit[i].y + pDrawable->y;
}
} }
else else
{ {
segs[0].x2 = segs[0].x1 + pptInit[1].x; segs[0].x2 = segs[0].x1 + pptInit[1].x;
segs[0].y2 = segs[0].y1 + pptInit[1].y; segs[0].y2 = segs[0].y1 + pptInit[1].y;
} for (i = 2; i < npt; i++)
for (i = 2; i < npt; i++)
{
segs[i - 1].x1 = segs[i - 2].x2;
segs[i - 1].y1 = segs[i - 2].y2;
if (mode == CoordModeOrigin)
{
segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
segs[i - 1].y2 = pptInit[i].x + pDrawable->x;
}
else
{ {
segs[i - 1].x2 = segs[i - 2].x2 + pptInit[i].x; segs[i - 1].x1 = segs[i - 2].x2;
segs[i - 1].y2 = segs[i - 2].y2 + pptInit[i].y; segs[i - 1].y1 = segs[i - 2].y2;
segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x;
segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y;
} }
} }
} }
else else
{ {
LLOGLN(10, ("rdpPolylines: weird npt [%d]", npt)); LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt));
}
#if 0
LLOGLN(0, (" segments"));
for (i = 0; i < nseg; i++)
{
LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1,
segs[i].x2, segs[i].y2));
} }
#endif
/* do original call */ /* do original call */
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit); rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
@ -180,7 +155,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
LLOGLN(10, ("rdpPolylines: gettig dirty")); LLOGLN(10, ("rdpPolylines: gettig dirty"));
pDstPriv->is_dirty = 1; pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv; pDirtyPriv = pDstPriv;
dirty_type = RDI_LINE; dirty_type = RDI_IMGLL;
} }
else else
{ {

@ -78,13 +78,11 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
LLOGLN(0, ("rdpPushPixels:")); LLOGLN(10, ("rdpPushPixels:"));
/* do original call */ /* do original call */
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y); rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
//return;
dirty_type = 0; dirty_type = 0;
pDirtyPriv = 0; pDirtyPriv = 0;
post_process = 0; post_process = 0;

@ -73,7 +73,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv; rdpPixmapRec* pDirtyPriv;
LLOGLN(0, ("rdpSetSpans: todo")); LLOGLN(10, ("rdpSetSpans: todo"));
/* do original call */ /* do original call */
rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);

@ -424,7 +424,7 @@ draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di)
{ {
if (di->u.line.segs != 0) if (di->u.line.segs != 0)
{ {
free(di->u.line.segs); g_free(di->u.line.segs);
} }
} }
RegionDestroy(di->reg); RegionDestroy(di->reg);
@ -736,7 +736,7 @@ rdpRealizeWindow(WindowPtr pWindow)
rdpWindowRec* priv; rdpWindowRec* priv;
Bool rv; Bool rv;
LLOGLN(0, ("rdpRealizeWindow:")); LLOGLN(10, ("rdpRealizeWindow:"));
priv = GETWINPRIV(pWindow); priv = GETWINPRIV(pWindow);
pScreen = pWindow->drawable.pScreen; pScreen = pWindow->drawable.pScreen;
pScreen->RealizeWindow = g_rdpScreen.RealizeWindow; pScreen->RealizeWindow = g_rdpScreen.RealizeWindow;
@ -771,7 +771,7 @@ rdpUnrealizeWindow(WindowPtr pWindow)
rdpWindowRec* priv; rdpWindowRec* priv;
Bool rv; Bool rv;
LLOGLN(0, ("rdpUnrealizeWindow:")); LLOGLN(10, ("rdpUnrealizeWindow:"));
priv = GETWINPRIV(pWindow); priv = GETWINPRIV(pWindow);
pScreen = pWindow->drawable.pScreen; pScreen = pWindow->drawable.pScreen;
pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow; pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow;

@ -530,3 +530,43 @@ void
FontCacheExtensionInit(INITARGS) FontCacheExtensionInit(INITARGS)
{ {
} }
/******************************************************************************/
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
{
int index;
BoxRec box;
RegionRec treg;
index = 0;
while (index < nseg)
{
if (segs[index].x1 < segs[index].x2)
{
box.x1 = segs[index].x1;
box.x2 = segs[index].x2;
}
else
{
box.x1 = segs[index].x2;
box.x2 = segs[index].x1;
}
box.x2++;
if (segs[index].y1 < segs[index].y2)
{
box.y1 = segs[index].y1;
box.y2 = segs[index].y2;
}
else
{
box.y1 = segs[index].y2;
box.y2 = segs[index].y1;
}
box.y2++;
RegionInit(&treg, &box, 0);
RegionUnion(reg, reg, &treg);
RegionUninit(&treg);
index++;
}
}

Loading…
Cancel
Save