From 070708fa2fefd35672d0ed1625ee3939a5b05f60 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 15 Jul 2024 16:10:24 -0400 Subject: [PATCH] Server: Improve debug tracing of X11 hooks --- unix/Xvnc/programs/Xserver/hw/vnc/draw.c | 154 ++++++++++++++++++----- unix/Xvnc/programs/Xserver/hw/vnc/rfb.h | 3 +- 2 files changed, 124 insertions(+), 33 deletions(-) diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/draw.c b/unix/Xvnc/programs/Xserver/hw/vnc/draw.c index 60cbae7ac..d144c9d8d 100644 --- a/unix/Xvnc/programs/Xserver/hw/vnc/draw.c +++ b/unix/Xvnc/programs/Xserver/hw/vnc/draw.c @@ -9,8 +9,8 @@ * Modified for XFree86 4.x by Alan Hourihane */ -/* Copyright (C) 2010-2012, 2014, 2016-2017, 2019-2021 D. R. Commander. - * All Rights Reserved. +/* Copyright (C) 2010-2012, 2014, 2016-2017, 2019-2021, 2024 + * D. R. Commander. All Rights Reserved. * Copyright (C) 2021 AnatoScope SA. All Rights Reserved. * Copyright (C) 2012-2013, 2016 Pierre Ossman for Cendio AB. * All Rights Reserved. @@ -112,7 +112,10 @@ static inline Bool is_visible(DrawablePtr drawable) */ /****************************************************************************/ -#define TRC(x) /* (rfbLog x) */ +#define TRC(...) /* rfbLog(__VA_ARGS__) */ +#define TRC_REGION(...) /* PrintRegion(__VA_ARGS__, FALSE) */ + +#define XID(drawable) (drawable ? drawable->id : 0) /* ADD_TO_MODIFIED_REGION adds the given region to the modified region for each client */ @@ -304,7 +307,7 @@ Bool rfbCloseScreen(ScreenPtr pScreen) pScreen->StoreColors = prfb->StoreColors; pScreen->SaveScreen = prfb->SaveScreen; - TRC((stderr, "Unwrapped screen functions\n")); + TRC("rfbCloseScreen(): Unwrapped screen functions\n"); return (*pScreen->CloseScreen) (pScreen); } @@ -326,7 +329,7 @@ Bool rfbCreateGC(GCPtr pGC) ret = (*pScreen->CreateGC) (pGC); - TRC((stderr, "rfbCreateGC called\n")); + TRC("rfbCreateGC() pGC=0x%.8lx\n", (unsigned long)pGC); pGCPriv->wrapOps = NULL; pGCPriv->wrapFuncs = pGC->funcs; @@ -356,7 +359,9 @@ void rfbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) SCREEN_PROLOGUE(pWin->drawable.pScreen, CopyWindow); - TRC((stderr, "rfbCopyWindow called\n")); + TRC("rfbCopyWindow() Win=0x%.8x ptOldOrg={%d, %d}\n", pWin->drawable.id, + ptOldOrg.x, ptOldOrg.y); + TRC_REGION(pScreen, pOldRegion, "rfbCopyWindow() pOldRegion"); dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; @@ -385,6 +390,8 @@ void rfbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) } } + TRC_REGION(pScreen, &dstRegion, "rfbCopyWindow() mod"); + REGION_UNINIT(pSrc->pScreen, &dstRegion); (*pScreen->CopyWindow) (pWin, ptOldOrg, pOldRegion); @@ -408,7 +415,8 @@ void rfbClearToBackground(WindowPtr pWin, int x, int y, int w, int h, SCREEN_PROLOGUE(pWin->drawable.pScreen, ClearToBackground); - TRC((stderr, "rfbClearToBackground called\n")); + TRC("rfbClearToBackground() Win=0x%.8x x=%d y=%d w=%d h=%d generateExposures=%d\n", + pWin->drawable.id, x, y, w, h, generateExposures); if (!generateExposures) { box.x1 = x + pWin->drawable.x; @@ -422,6 +430,8 @@ void rfbClearToBackground(WindowPtr pWin, int x, int y, int w, int h, ADD_TO_MODIFIED_REGION(pScreen, &tmpRegion); + TRC_REGION(pScreen, &tmpRegion, "rfbClearToBackground() mod"); + REGION_UNINIT(pScreen, &tmpRegion); } @@ -469,7 +479,8 @@ static void rfbValidateGC(GCPtr pGC, unsigned long changes, { GC_FUNC_PROLOGUE(pGC); - TRC((stderr, "rfbValidateGC called\n")); + TRC("rfbValidateGC() pGC=0x%.8lx changes=%ul Drawable=0x%.8x\n", + (unsigned long)pGC, changes, XID(pDrawable)); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); @@ -482,12 +493,12 @@ static void rfbValidateGC(GCPtr pGC, unsigned long changes, pRegion = &pWin->borderClip; if (REGION_NOTEMPTY(pDrawable->pScreen, pRegion)) { pGCPriv->wrapOps = pGC->ops; - TRC((stderr, "rfbValidateGC: wrapped GC ops\n")); + TRC("rfbValidateGC(): wrapped GC ops\n"); } } else if (pDrawable == &pGC->pScreen->GetScreenPixmap(pGC->pScreen)->drawable) { pGCPriv->wrapOps = pGC->ops; - TRC((stderr, "rfbValidateGC: wrapped GC ops\n")); + TRC("rfbValidateGC(): wrapped GC ops\n"); } GC_FUNC_EPILOGUE(pGC); @@ -578,7 +589,8 @@ static void rfbFillSpans(DrawablePtr pDrawable, GCPtr pGC, { GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbFillSpans called\n")); + TRC("rfbFillSpans() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (pDrawable->type == DRAWABLE_WINDOW) { RegionRec changed; @@ -587,9 +599,11 @@ static void rfbFillSpans(DrawablePtr pDrawable, GCPtr pGC, REGION_INTERSECT(pDrawable->pScreen, &changed, &changed, &((WindowPtr)pDrawable)->borderClip); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &changed); + TRC_REGION(pDrawable->pScreen, &changed, "rfbFillSpans() mod"); REGION_UNINIT(pDrawable->pScreen, &changed); } else { ADD_TO_MODIFIED_REGION(pDrawable->pScreen, pGC->pCompositeClip); + TRC_REGION(pDrawable->pScreen, pGC->pCompositeClip, "rfbFillSpans() mod"); } (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); @@ -610,7 +624,8 @@ static void rfbSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, { GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbSetSpans called\n")); + TRC("rfbSetSpans() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (pDrawable->type == DRAWABLE_WINDOW) { RegionRec changed; @@ -619,9 +634,11 @@ static void rfbSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, REGION_INTERSECT(pDrawable->pScreen, &changed, &changed, &((WindowPtr)pDrawable)->borderClip); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &changed); + TRC_REGION(pDrawable->pScreen, &changed, "rfbSetSpans() mod"); REGION_UNINIT(pDrawable->pScreen, &changed); } else { ADD_TO_MODIFIED_REGION(pDrawable->pScreen, pGC->pCompositeClip); + TRC_REGION(pDrawable->pScreen, pGC->pCompositeClip, "rfbSetSpans() mod"); } (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); @@ -646,7 +663,8 @@ static void rfbPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPutImage called\n")); + TRC("rfbPutImage() Drawable=0x%.8x pGC=0x%.8lx depth=%d x=%d y=%d w=%d h=%d leftPad=%d format=%d\n", + XID(pDrawable), (unsigned long)pGC, depth, x, y, w, h, leftPad, format); box.x1 = x + pDrawable->x; box.y1 = y + pDrawable->y; @@ -661,6 +679,8 @@ static void rfbPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); ADD_TO_ALR_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPutImage() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, @@ -691,7 +711,8 @@ static RegionPtr rfbCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, GC_OP_PROLOGUE(pDst, pGC); - TRC((stderr, "rfbCopyArea called\n")); + TRC("rfbCopyArea() Src=0x%.8x Dst=0x%.8x pGC=0x%.8lx srcx=%d srcy=%d w=%d h=%d dstx=%d dsty=%d\n", + XID(pSrc), XID(pDst), (unsigned long)pGC, srcx, srcy, w, h, dstx, dsty); box.x1 = dstx + pDst->x; box.y1 = dsty + pDst->y; @@ -735,6 +756,8 @@ static RegionPtr rfbCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, ADD_TO_MODIFIED_REGION(pDst->pScreen, &dstRegion); } + TRC_REGION(pDst->pScreen, &dstRegion, "rfbCopyArea() mod"); + REGION_UNINIT(pDst->pScreen, &dstRegion); rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); @@ -763,7 +786,9 @@ static RegionPtr rfbCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GC_OP_PROLOGUE(pDst, pGC); - TRC((stderr, "rfbCopyPlane called\n")); + TRC("rfbCopyPlane() Src=0x%.8x Dst=0x%.8x pGC=0x%.8lx srcx=%d srcy=%d w=%d h=%d dstx=%d dsty=%d plane=%lu\n", + XID(pSrc), XID(pDst), (unsigned long)pGC, srcx, srcy, w, h, dstx, dsty, + plane); box.x1 = dstx + pDst->x; box.y1 = dsty + pDst->y; @@ -776,6 +801,8 @@ static RegionPtr rfbCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, ADD_TO_MODIFIED_REGION(pDst->pScreen, &tmpRegion); + TRC_REGION(pDst->pScreen, &tmpRegion, "rfbCopyPlane() mod"); + REGION_UNINIT(pDst->pScreen, &tmpRegion); rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, @@ -804,7 +831,8 @@ static void rfbPolyPoint(DrawablePtr pDrawable, GCPtr pGC, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyPoint called\n")); + TRC("rfbPolyPoint() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (npt) { int minX = pts[0].x, maxX = pts[0].x; @@ -842,6 +870,8 @@ static void rfbPolyPoint(DrawablePtr pDrawable, GCPtr pGC, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPolyPoint() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -868,7 +898,8 @@ static void rfbPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolylines called\n")); + TRC("rfbPolyLines() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (npt) { lw = pGC->lineWidth; @@ -937,6 +968,8 @@ static void rfbPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolyLines() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)rects); } @@ -964,7 +997,8 @@ static void rfbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolySegment called\n")); + TRC("rfbPolySegment() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (nseg) { rects = (xRectangle *)rfbAlloc(nseg * sizeof(xRectangle)); @@ -999,6 +1033,8 @@ static void rfbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolySegment() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)rects); } @@ -1026,7 +1062,8 @@ static void rfbPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyRectangle called\n")); + TRC("rfbPolyRectangle() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (nrects) { regRects = (xRectangle *)rfbAlloc(nrects * 4 * sizeof(xRectangle)); @@ -1068,6 +1105,8 @@ static void rfbPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolyRectangle() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)regRects); } @@ -1095,7 +1134,8 @@ static void rfbPolyArc(DrawablePtr pDrawable, register GCPtr pGC, int narcs, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyArc called\n")); + TRC("rfbPolyArc() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (narcs) { rects = (xRectangle *)rfbAlloc(narcs * sizeof(xRectangle)); @@ -1119,6 +1159,8 @@ static void rfbPolyArc(DrawablePtr pDrawable, register GCPtr pGC, int narcs, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolyArc() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)rects); } @@ -1145,7 +1187,8 @@ static void rfbFillPolygon(register DrawablePtr pDrawable, register GCPtr pGC, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbFillPolygon called\n")); + TRC("rfbFillPolygon() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (count) { int minX = pts[0].x, maxX = pts[0].x; @@ -1183,6 +1226,8 @@ static void rfbFillPolygon(register DrawablePtr pDrawable, register GCPtr pGC, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbFillPolygon() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1208,7 +1253,8 @@ static void rfbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrects, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyFillRect called\n")); + TRC("rfbPolyFillRect() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (nrects) { regRects = (xRectangle *)rfbAlloc(nrects * sizeof(xRectangle)); @@ -1226,6 +1272,8 @@ static void rfbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrects, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolyFillRect() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)regRects); } @@ -1253,7 +1301,8 @@ static void rfbPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyFillArc called\n")); + TRC("rfbPolyFillArc() Drawable=0x%.8x pGC=0x%.8lx\n", XID(pDrawable), + (unsigned long)pGC); if (narcs) { rects = (xRectangle *)rfbAlloc(narcs * sizeof(xRectangle)); @@ -1277,6 +1326,8 @@ static void rfbPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); + TRC_REGION(pDrawable->pScreen, tmpRegion, "rfbPolyFillArc() mod"); + REGION_DESTROY(pDrawable->pScreen, tmpRegion); free((char *)rects); } @@ -1338,7 +1389,8 @@ static int rfbPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyText8 called '%.*s'\n", count, chars)); + TRC("rfbPolyText8() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d '%.*s'\n", + XID(pDrawable), (unsigned long)pGC, x, y, count, chars); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); @@ -1350,6 +1402,8 @@ static int rfbPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPolyText8() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1376,7 +1430,8 @@ static int rfbPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyText16 called\n")); + TRC("rfbPolyText16() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d count=%d\n", + XID(pDrawable), (unsigned long)pGC, x, y, count); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); @@ -1388,6 +1443,8 @@ static int rfbPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPolyText16() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1413,7 +1470,8 @@ static void rfbImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbImageText8 called '%.*s'\n", count, chars)); + TRC("rfbImageText8() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d '%.*s'\n", + XID(pDrawable), (unsigned long)pGC, x, y, count, chars); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); @@ -1425,6 +1483,8 @@ static void rfbImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbImageText8() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1449,7 +1509,8 @@ static void rfbImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbImageText16 called\n")); + TRC("rfbImageText16() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d count=%d\n", + XID(pDrawable), (unsigned long)pGC, x, y, count); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); @@ -1461,6 +1522,8 @@ static void rfbImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbImageText16() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1487,7 +1550,8 @@ static void rfbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbImageGlyphBlt called\n")); + TRC("rfbImageGlyphBlt() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d nglyph=%d\n", + XID(pDrawable), (unsigned long)pGC, x, y, nglyph); if (nglyph) { GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box); @@ -1499,6 +1563,8 @@ static void rfbImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbImageGlyphBlt() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1525,7 +1591,8 @@ static void rfbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPolyGlyphBlt called\n")); + TRC("rfbPolyGlyphBlt() Drawable=0x%.8x pGC=0x%.8lx x=%d y=%d nglyph=%d\n", + XID(pDrawable), (unsigned long)pGC, x, y, nglyph); if (nglyph) { GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box); @@ -1537,6 +1604,8 @@ static void rfbPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPolyGlyphBlt() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } @@ -1562,7 +1631,8 @@ static void rfbPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, GC_OP_PROLOGUE(pDrawable, pGC); - TRC((stderr, "rfbPushPixels called\n")); + TRC("rfbPushPixels() pGC=0x%.8lx Drawable=0x%.8x w=%d h=%d x=%d y=%d\n", + (unsigned long)pGC, XID(pDrawable), w, h, x, y); box.x1 = x + pDrawable->x; box.y1 = y + pDrawable->y; @@ -1576,6 +1646,8 @@ static void rfbPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); + TRC_REGION(pDrawable->pScreen, &tmpRegion, "rfbPushPixels() mod"); + REGION_UNINIT(pDrawable->pScreen, &tmpRegion); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); @@ -1598,6 +1670,10 @@ void rfbComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, BoxRec box; PictureScreenPtr ps = GetPictureScreen(pScreen); + TRC("rfbComposite() op=%d Src=0x%.8x Dst=0x%.8x xSrc=%d ySrc=%d xMask=0x%.4x yMask=0x%.4x xDst=%d yDst=%d width=%d height=%d\n", + op, XID(pSrc->pDrawable), XID(pDst->pDrawable), xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height); + if (is_visible(pDst->pDrawable)) { box.x1 = max(pDst->pDrawable->x + xDst, 0); box.y1 = max(pDst->pDrawable->y + yDst, 0); @@ -1616,6 +1692,8 @@ void rfbComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, REGION_INTERSECT(pScreen, &tmpRegion, &tmpRegion, &fbRegion); ADD_TO_MODIFIED_REGION(pScreen, &tmpRegion); + + TRC_REGION(pScreen, &tmpRegion, "rfbComposite() mod"); } ps->Composite = prfb->Composite; @@ -1691,6 +1769,9 @@ void rfbGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, RegionRec *tmpRegion = NULL; PictureScreenPtr ps = GetPictureScreen(pScreen); + TRC("rfbGlyphs() op=%d Src=0x%.8x Dst=0x%.8x xSrc=%d ySrc=%d nlists=%d\n", + op, XID(pSrc->pDrawable), XID(pDst->pDrawable), xSrc, ySrc, nlists); + if (is_visible(pDst->pDrawable)) { BoxRec fbBox; RegionRec fbRegion; @@ -1711,6 +1792,8 @@ void rfbGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, ADD_TO_MODIFIED_REGION(pScreen, tmpRegion); + TRC_REGION(pScreen, tmpRegion, "rfbGlyphs() mod"); + REGION_DESTROY(pScreen, tmpRegion); } @@ -1765,6 +1848,10 @@ static void rfbCopyRegion(ScreenPtr pScreen, rfbClientPtr cl, RegionPtr src, { RegionRec tmp; + TRC("%d: rfbCopyRegion() dx=%d dy=%d\n", cl->id, dx, dy); + TRC_REGION(pScreen, src, "rfbCopyRegion() src"); + TRC_REGION(pScreen, dst, "rfbCopyRegion() dst"); + /* src = src - modifiedRegion */ REGION_SUBTRACT(pScreen, src, src, &cl->modifiedRegion); @@ -1892,17 +1979,20 @@ static void rfbScheduleDeferredUpdate(rfbClientPtr cl) * PrintRegion is useful for debugging. */ -void PrintRegion(ScreenPtr pScreen, RegionPtr reg, const char *msg) +void PrintRegion(ScreenPtr pScreen, RegionPtr reg, const char *msg, + Bool printRects) { int nrects = REGION_NUM_RECTS(reg); int i; - rfbLog("Region %s num rects %d extents %d,%d %d,%d\n", msg, nrects, + rfbLog("%s: num rects %d extents %d,%d %d,%d\n", msg, nrects, (REGION_EXTENTS(pScreen, reg))->x1, (REGION_EXTENTS(pScreen, reg))->y1, (REGION_EXTENTS(pScreen, reg))->x2, (REGION_EXTENTS(pScreen, reg))->y2); + if (!printRects) return; + for (i = 0; i < nrects; i++) { rfbLog(" rect %d,%d %dx%d\n", REGION_RECTS(reg)[i].x1, diff --git a/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h b/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h index e4a628ec8..1a843d771 100644 --- a/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h +++ b/unix/Xvnc/programs/Xserver/hw/vnc/rfb.h @@ -814,7 +814,8 @@ extern Bool rfbDCInitialize(ScreenPtr, miPointerScreenFuncPtr); extern int rfbDeferUpdateTime; extern void ClipToScreen(ScreenPtr pScreen, RegionPtr pRegion); -void PrintRegion(ScreenPtr pScreen, RegionPtr reg, const char *msg); +void PrintRegion(ScreenPtr pScreen, RegionPtr reg, const char *msg, + Bool printRects); #ifdef RENDER extern void rfbComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,