diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2012-05-19 19:25:08 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2012-05-19 19:25:08 -0700 |
commit | aa3fad894db4e9b02999b229eb7e63fd8e91bdf6 (patch) | |
tree | 409c10184c95a2305edc6b7d04e6116aaa30a936 /xorg/X11R7.6/rdp | |
parent | cc3754a2bdd6801179751d45f1df3b5816e189fc (diff) | |
download | xrdp-proprietary-aa3fad894db4e9b02999b229eb7e63fd8e91bdf6.tar.gz xrdp-proprietary-aa3fad894db4e9b02999b229eb7e63fd8e91bdf6.zip |
xorg: work on offscreen bitmaps
Diffstat (limited to 'xorg/X11R7.6/rdp')
24 files changed, 180 insertions, 103 deletions
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 7df24c48..5cd84a5d 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -173,7 +173,7 @@ typedef rdpWindowRec* rdpWindowPtr; struct _rdpPixmapRec { int status; - int rdpid; /* unique id for xrdp */ + int rdpindex; int allocBytes; int con_number; }; @@ -182,8 +182,7 @@ typedef rdpPixmapRec* rdpPixmapPtr; #define GETPIXPRIV(_pPixmap) \ (rdpPixmapPtr)dixGetPrivateAddr(&(_pPixmap->devPrivates), &g_rdpPixmapIndex) -#define XRDP_IS_OS(_priv) ((_priv->status != 0) && \ - (_priv->con_number == g_con_number)) +#define XRDP_IS_OS(_priv) (_priv->status != 0) /* rdpmisc.c */ void @@ -336,6 +335,10 @@ void KbdSync(int param1); /* rdpup.c */ +int +rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv); +int +rdpup_remove_os_bitmap(int rdpindex); void rdpup_get_screen_image_rect(struct image_data* id); void @@ -375,15 +378,15 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h); int rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask); int -rdpup_create_os_surface(int rdpid, int width, int height); +rdpup_create_os_surface(int rdpindexd, int width, int height); int -rdpup_switch_os_surface(int rdpid); +rdpup_switch_os_surface(int rdpindex); int -rdpup_delete_os_surface(int rdpid); +rdpup_delete_os_surface(int rdpindex); void rdpup_paint_rect_os(int x, int y, int cx, int cy, - int rdpid, int srcx, int srcy); + int rdpindex, int srcx, int srcy); void rdpup_set_hints(int hints, int mask); diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c index 3c3d371b..27ddab28 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -158,7 +158,7 @@ rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd, ldsty = pDstPixmap->drawable.y + dsty; if (cd == 1) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); rdpup_end_update(); @@ -169,7 +169,7 @@ rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd, num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); dx = dstx - srcx; dy = dsty - srcy; @@ -232,7 +232,7 @@ rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv, if (cd == 1) { rdpup_begin_update(); - rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy); + rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy); rdpup_end_update(); } else if (cd == 2) @@ -246,7 +246,7 @@ rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv, box = REGION_RECTS(&clip_reg)[j]; LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2)); rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy); + rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy); } rdpup_reset_clip(); rdpup_end_update(); @@ -287,9 +287,9 @@ rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv, lsrcy = pSrcPixmap->drawable.y + srcy; if (cd == 1) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); - rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy); + rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy); rdpup_end_update(); rdpup_switch_os_surface(-1); } @@ -298,13 +298,13 @@ rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv, num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); for (j = 0; j < num_clips; j++) { box = REGION_RECTS(&clip_reg)[j]; rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpid, lsrcx, lsrcy); + rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy); } rdpup_reset_clip(); rdpup_end_update(); @@ -414,7 +414,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index b6efa0bf..f0a54d9e 100644 --- a/xorg/X11R7.6/rdp/rdpCopyPlane.c +++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c @@ -91,7 +91,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c index 459ba73e..362e8d15 100644 --- a/xorg/X11R7.6/rdp/rdpFillPolygon.c +++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c @@ -91,7 +91,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpFillSpans.c b/xorg/X11R7.6/rdp/rdpFillSpans.c index 0939b50a..1f655d01 100644 --- a/xorg/X11R7.6/rdp/rdpFillSpans.c +++ b/xorg/X11R7.6/rdp/rdpFillSpans.c @@ -80,7 +80,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index 22839af9..35c19bc1 100644 --- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c @@ -91,7 +91,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c index cb6f3cfb..e2261147 100644 --- a/xorg/X11R7.6/rdp/rdpImageText16.c +++ b/xorg/X11R7.6/rdp/rdpImageText16.c @@ -89,7 +89,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c index 81b754c0..34bf35be 100644 --- a/xorg/X11R7.6/rdp/rdpImageText8.c +++ b/xorg/X11R7.6/rdp/rdpImageText8.c @@ -89,7 +89,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c index 3f7dc4b8..be56821a 100644 --- a/xorg/X11R7.6/rdp/rdpPolyArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyArc.c @@ -104,7 +104,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c index 3603b932..91ab7899 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c @@ -104,7 +104,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index 66eb50fe..070dd255 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -88,7 +88,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c index 3ec438db..871e7cf4 100644 --- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c @@ -91,7 +91,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c index 7b4e9842..d6bc5e6b 100644 --- a/xorg/X11R7.6/rdp/rdpPolyPoint.c +++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c @@ -130,7 +130,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c index 0d2e7afa..0d2beede 100644 --- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c +++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c @@ -100,7 +100,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c index 223a5327..2e5609b5 100644 --- a/xorg/X11R7.6/rdp/rdpPolySegment.c +++ b/xorg/X11R7.6/rdp/rdpPolySegment.c @@ -95,7 +95,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c index 4feb2f03..609df35d 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText16.c +++ b/xorg/X11R7.6/rdp/rdpPolyText16.c @@ -92,7 +92,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c index 21f4e18a..3cb7b5a0 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText8.c +++ b/xorg/X11R7.6/rdp/rdpPolyText8.c @@ -92,7 +92,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c index 9f5ca7c3..b8400904 100644 --- a/xorg/X11R7.6/rdp/rdpPolylines.c +++ b/xorg/X11R7.6/rdp/rdpPolylines.c @@ -99,7 +99,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c index 8e774c53..5129f0e2 100644 --- a/xorg/X11R7.6/rdp/rdpPushPixels.c +++ b/xorg/X11R7.6/rdp/rdpPushPixels.c @@ -84,7 +84,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index 7a132f8c..a5072c23 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -73,7 +73,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, rdpPixmapRec* pDstPriv; LLOGLN(10, ("rdpPutImage:")); - LLOGLN(10, ("rdpPutImage: drawable id 0x%x", pDst->id)); + LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id))); /* do original call */ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); @@ -84,7 +84,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c index d7a41e7e..7b763091 100644 --- a/xorg/X11R7.6/rdp/rdpSetSpans.c +++ b/xorg/X11R7.6/rdp/rdpSetSpans.c @@ -81,7 +81,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index 6e2846ed..f35e4de1 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -68,15 +68,8 @@ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ -extern int g_con_number; /* in rdpup.c */ -extern int g_connected; /* in rdpup.c */ - ColormapPtr g_rdpInstalledColormap; -static int g_pixmap_rdpid = 1; -int g_pixmap_byte_total = 0; -int g_pixmap_num_used = 0; - GCFuncs g_rdpGCFuncs = { rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip, @@ -408,20 +401,17 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, pScreen->CreatePixmap = g_rdpScreen.CreatePixmap; rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); priv = GETPIXPRIV(rv); - if ((g_rdpScreen.client_info.offscreen_support_level > 0) && - (rv->drawable.depth == g_rdpScreen.depth) && - (org_width > 1) && (height > 1) && g_connected) + priv->rdpindex = -1; + if ((rv->drawable.depth == g_rdpScreen.depth) && + (org_width > 1) && (height > 1)) { - priv->allocBytes = width * height * 4; - g_pixmap_byte_total += priv->allocBytes; - g_pixmap_num_used++; - priv->status = 1; - priv->rdpid = g_pixmap_rdpid; - g_pixmap_rdpid++; - priv->con_number = g_con_number; - rdpup_create_os_surface(priv->rdpid, width, height); - LLOGLN(0, ("rdpCreatePixmap: g_pixmap_byte_total %d g_pixmap_num_used %d", - g_pixmap_byte_total, g_pixmap_num_used)); + priv->allocBytes = width * height * g_Bpp; + priv->rdpindex = rdpup_add_os_bitmap(rv, priv); + if (priv->rdpindex >= 0) + { + priv->status = 1; + rdpup_create_os_surface(priv->rdpindex, width, height); + } } pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0); pScreen->CreatePixmap = rdpCreatePixmap; @@ -441,15 +431,10 @@ rdpDestroyPixmap(PixmapPtr pPixmap) LLOGLN(10, ("status %d refcnt %d", priv->status, pPixmap->refcnt)); if (pPixmap->refcnt < 2) { - if (XRDP_IS_OS(priv) && g_connected) + if (XRDP_IS_OS(priv)) { - g_pixmap_byte_total -= priv->allocBytes; - g_pixmap_num_used--; - LLOGLN(0, ("rdpDestroyPixmap: id 0x%x " - "rdpid 0x%x g_pixmap_byte_total %d g_pixmap_num_used %d", - pPixmap->drawable.id, priv->rdpid, - g_pixmap_byte_total, g_pixmap_num_used)); - rdpup_delete_os_surface(priv->rdpid); + rdpup_remove_os_bitmap(priv->rdpindex); + rdpup_delete_os_surface(priv->rdpindex); } } pScreen = pPixmap->drawable.pScreen; @@ -748,7 +733,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpid); + rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_get_pixmap_image_rect(pDstPixmap, &id); got_id = 1; } @@ -828,7 +813,7 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, for (index = 0; index < lists->len; index++) { LLOGLN(10, (" index %d size %d refcnt %d width %d height %d", - index, glyphs[index]->size, glyphs[index]->refcnt, + index, (int)(glyphs[index]->size), (int)(glyphs[index]->refcnt), glyphs[index]->info.width, glyphs[index]->info.height)); } ps = GetPictureScreen(g_pScreen); diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c index 29f1c6e3..978e48aa 100644 --- a/xorg/X11R7.6/rdp/rdprandr.c +++ b/xorg/X11R7.6/rdp/rdprandr.c @@ -123,7 +123,7 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, BoxRec box; ErrorF("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d\n", - width, height, mmWidth, mmHeight); + width, height, (int)mmWidth, (int)mmHeight); if ((width < 1) || (height < 1)) { diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 4a8bf9f8..fa2092e2 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -38,9 +38,7 @@ int g_con_number = 0; /* increments for each connection */ static int g_listen_sck = 0; static int g_sck = 0; static int g_sck_closed = 0; - -int g_connected = 0; - +static int g_connected = 0; static int g_dis_listen_sck = 0; //static int g_dis_sck = 0; //static int g_dis_sck_closed = 0; @@ -55,7 +53,7 @@ static int g_cursor_y = 0; static OsTimerPtr g_timer = 0; static int g_scheduled = 0; static int g_count = 0; -static int g_rdpid = -1; +static int g_rdpindex = -1; extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ @@ -69,6 +67,21 @@ extern char g_uds_data[]; /* in rdpmain.c */ extern int g_pixmap_byte_total; /* in rdpdraw.c */ extern int g_pixmap_num_used; /* in rdpdraw.c */ +struct rdpup_os_bitmap +{ + int used; + PixmapPtr pixmap; + rdpPixmapPtr priv; + int stamp; +}; + +static struct rdpup_os_bitmap* g_os_bitmaps = 0; +static int g_max_os_bitmaps = 0; +static int g_os_bitmap_stamp = 0; + +int g_pixmap_byte_total = 0; +int g_pixmap_num_used = 0; + /* 0 GXclear, 0 1 GXnor, DPon @@ -109,6 +122,86 @@ static int g_rdp_opcodes[16] = }; /*****************************************************************************/ +int +rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) +{ + int index; + int rv; + int oldest; + int oldest_index; + + if (!g_connected) + { + return -1; + } + rv = -1; + index = 0; + while (index < g_max_os_bitmaps) + { + if (g_os_bitmaps[index].used == 0) + { + g_os_bitmaps[index].used = 1; + g_os_bitmaps[index].pixmap = pixmap; + g_os_bitmaps[index].priv = priv; + g_os_bitmaps[index].stamp = g_os_bitmap_stamp; + g_os_bitmap_stamp++; + g_pixmap_num_used++; + rv = index; + break; + } + index++; + } + if (rv == -1) + { + /* find oldest */ + oldest = 0x7fffffff; + oldest_index = 0; + index = 0; + while (index < g_max_os_bitmaps) + { + if (g_os_bitmaps[index].stamp < oldest) + { + oldest = g_os_bitmaps[index].stamp; + oldest_index = index; + } + index++; + } + LLOGLN(0, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index)); + /* evict old */ + g_os_bitmaps[oldest_index].priv->status = 0; + /* set new */ + g_os_bitmaps[oldest_index].pixmap = pixmap; + g_os_bitmaps[oldest_index].priv = priv; + g_os_bitmaps[oldest_index].stamp = g_os_bitmap_stamp; + g_os_bitmap_stamp++; + rv = oldest_index; + } + LLOGLN(0, ("rdpup_add_os_bitmap: new bitmap index %d", rv)); + LLOGLN(0, (" g_pixmap_num_used %d", g_pixmap_num_used)); + return rv; +} + +/*****************************************************************************/ +int +rdpup_remove_os_bitmap(int rdpindex) +{ + LLOGLN(0, ("rdpup_remove_os_bitmap: index %d", rdpindex)); + if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps)) + { + return 1; + } + if (g_os_bitmaps[rdpindex].used) + { + g_os_bitmaps[rdpindex].used = 0; + g_os_bitmaps[rdpindex].pixmap = 0; + g_os_bitmaps[rdpindex].priv = 0; + g_pixmap_num_used--; + } + LLOGLN(0, (" g_pixmap_num_used %d", g_pixmap_num_used)); + return 0; +} + +/*****************************************************************************/ /* returns error */ static int rdpup_send(char* data, int len) @@ -250,8 +343,8 @@ rdpup_recv(char* data, int len) g_tcp_close(g_sck); g_sck = 0; g_sck_closed = 1; - g_pixmap_byte_total = 0; - g_pixmap_num_used = 0; + //g_pixmap_byte_total = 0; + //g_pixmap_num_used = 0; return 1; } } @@ -262,8 +355,8 @@ rdpup_recv(char* data, int len) g_tcp_close(g_sck); g_sck = 0; g_sck_closed = 1; - g_pixmap_byte_total = 0; - g_pixmap_num_used = 0; + //g_pixmap_byte_total = 0; + //g_pixmap_num_used = 0; return 1; } else @@ -540,6 +633,15 @@ param4 %d\n", msg, param1, param2, param3, param4)); g_rdpScreen.client_info.offscreen_cache_size); ErrorF(" offscreen entries %d\n", g_rdpScreen.client_info.offscreen_cache_entries); + if (g_rdpScreen.client_info.offscreen_support_level > 0) + { + if (g_rdpScreen.client_info.offscreen_cache_entries > 0) + { + g_max_os_bitmaps = g_rdpScreen.client_info.offscreen_cache_entries; + g_os_bitmaps = (struct rdpup_os_bitmap*) + g_malloc(sizeof(struct rdpup_os_bitmap) * g_max_os_bitmaps, 1); + } + } } else { @@ -1085,7 +1187,7 @@ rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask) /******************************************************************************/ int -rdpup_create_os_surface(int rdpid, int width, int height) +rdpup_create_os_surface(int rdpindex, int width, int height) { LLOGLN(10, ("rdpup_create_os_surface:")); if (g_connected) @@ -1095,7 +1197,7 @@ rdpup_create_os_surface(int rdpid, int width, int height) out_uint16_le(g_out_s, 20); out_uint16_le(g_out_s, 12); g_count++; - out_uint32_le(g_out_s, rdpid); + out_uint32_le(g_out_s, rdpindex); out_uint16_le(g_out_s, width); out_uint16_le(g_out_s, height); } @@ -1104,53 +1206,40 @@ rdpup_create_os_surface(int rdpid, int width, int height) /******************************************************************************/ int -rdpup_switch_os_surface(int rdpid) +rdpup_switch_os_surface(int rdpindex) { LLOGLN(10, ("rdpup_switch_os_surface:")); if (g_connected) { - if (g_rdpid == rdpid) + if (g_rdpindex == rdpindex) { return 0; } - g_rdpid = rdpid; - rdpup_send_pending(); // TODO: do we need this ? - // the protocol allows switch the surface anytime - - LLOGLN(10, ("rdpup_switch_os_surface: rdpid %d", rdpid)); - + g_rdpindex = rdpindex; + LLOGLN(10, ("rdpup_switch_os_surface: rdpindex %d", rdpindex)); /* switch surface */ + rdpup_pre_check(8); out_uint16_le(g_out_s, 21); out_uint16_le(g_out_s, 8); - out_uint32_le(g_out_s, rdpid); - - /* begin update */ - out_uint16_le(g_out_s, 1); - out_uint16_le(g_out_s, 4); - g_begin = 1; - g_count = 2; - + out_uint32_le(g_out_s, rdpindex); + g_count++; } return 0; } /******************************************************************************/ int -rdpup_delete_os_surface(int rdpid) +rdpup_delete_os_surface(int rdpindex) { - LLOGLN(10, ("rdpup_delete_os_surface: rdpid %d", rdpid)); + LLOGLN(10, ("rdpup_delete_os_surface: rdpindex %d", rdpindex)); if (g_connected) { - LLOGLN(10, ("rdpup_delete_os_surface: rdpid %d", rdpid)); - //if (g_current_surface == rdpid) - //{ - // g_current_surface = -1; - //} + LLOGLN(10, ("rdpup_delete_os_surface: rdpindex %d", rdpindex)); rdpup_pre_check(8); out_uint16_le(g_out_s, 22); out_uint16_le(g_out_s, 8); g_count++; - out_uint32_le(g_out_s, rdpid); + out_uint32_le(g_out_s, rdpindex); } return 0; } @@ -1341,7 +1430,7 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h) /******************************************************************************/ void rdpup_paint_rect_os(int x, int y, int cx, int cy, - int rdpid, int srcx, int srcy) + int rdpindex, int srcx, int srcy) { if (g_connected) { @@ -1353,7 +1442,7 @@ rdpup_paint_rect_os(int x, int y, int cx, int cy, out_uint16_le(g_out_s, y); out_uint16_le(g_out_s, cx); out_uint16_le(g_out_s, cy); - out_uint32_le(g_out_s, rdpid); + out_uint32_le(g_out_s, rdpindex); out_uint16_le(g_out_s, srcx); out_uint16_le(g_out_s, srcy); } |