From 1afb67850157392e2d8c35857388d515ddcdf0b4 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 24 Sep 2013 17:24:46 -0700 Subject: X11rdp: fixes for off screen bitmap limits --- xorg/X11R7.6/rdp/rdpdraw.c | 10 ++++++---- xorg/X11R7.6/rdp/rdpup.c | 34 ++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 16 deletions(-) (limited to 'xorg') diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index 2bb6ccc4..b573f1a8 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -769,9 +769,11 @@ rdpDestroyPixmap(PixmapPtr pPixmap) { if (XRDP_IS_OS(priv)) { - rdpup_remove_os_bitmap(priv->rdpindex); - rdpup_delete_os_surface(priv->rdpindex); - draw_item_remove_all(priv); + if (priv->rdpindex >= 0) + { + rdpup_remove_os_bitmap(priv->rdpindex); + rdpup_delete_os_surface(priv->rdpindex); + } } } @@ -1112,7 +1114,7 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) if ((num_clip_rects > 16) && (num_reg_rects > 16)) { box3 = RegionExtents(®); - rdpup_send_area(10, box3->x1 + dx, box3->y1 + dy, + rdpup_send_area(0, box3->x1 + dx, box3->y1 + dy, box3->x2 - box3->x1, box3->y2 - box3->y1); } diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 0277fc20..c380f285 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -85,6 +85,7 @@ struct rdpup_os_bitmap int stamp; }; +#define USE_MAX_OS_BYTES 1 #define MAX_OS_BYTES (16 * 1024 * 1024) static struct rdpup_os_bitmap *g_os_bitmaps = 0; static int g_max_os_bitmaps = 0; @@ -232,6 +233,7 @@ rdpup_disconnect(void) } /*****************************************************************************/ +/* returns -1 on error */ int rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) { @@ -241,13 +243,16 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) int oldest_index; int this_bytes; + LLOGLN(10, ("rdpup_add_os_bitmap:")); if (!g_connected) { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 1")); return -1; } if (g_os_bitmaps == 0) { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 2")); return -1; } @@ -255,8 +260,8 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) if (this_bytes > MAX_OS_BYTES) { LLOGLN(10, ("rdpup_add_os_bitmap: error, too big this_bytes %d " - "width %d height %d", this_bytes, - pixmap->drawable.height, pixmap->drawable.height)); + "width %d height %d", this_bytes, + pixmap->drawable.height, pixmap->drawable.height)); return -1; } @@ -297,11 +302,14 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) } else { + LLOGLN(10, ("rdpup_add_os_bitmap: too many pixmaps removing " + "oldest_index %d", oldest_index)); rdpup_remove_os_bitmap(oldest_index); - 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; + rdpup_delete_os_surface(oldest_index); + g_os_bitmaps[oldest_index].used = 1; + 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++; g_pixmap_num_used++; rv = oldest_index; @@ -310,12 +318,14 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) if (rv < 0) { + LLOGLN(10, ("rdpup_add_os_bitmap: test error 3")); return rv; } g_os_bitmap_alloc_size += this_bytes; LLOGLN(10, ("rdpup_add_os_bitmap: this_bytes %d g_os_bitmap_alloc_size %d", this_bytes, g_os_bitmap_alloc_size)); +#if USE_MAX_OS_BYTES while (g_os_bitmap_alloc_size > MAX_OS_BYTES) { LLOGLN(10, ("rdpup_add_os_bitmap: must delete g_pixmap_num_used %d", @@ -326,7 +336,7 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) index = 0; while (index < g_max_os_bitmaps) { - if (g_os_bitmaps[index].used && g_os_bitmaps[index].stamp < oldest) + if (g_os_bitmaps[index].used && (g_os_bitmaps[index].stamp < oldest)) { oldest = g_os_bitmaps[index].stamp; oldest_index = index; @@ -346,6 +356,7 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) rdpup_remove_os_bitmap(oldest_index); rdpup_delete_os_surface(oldest_index); } +#endif LLOGLN(10, ("rdpup_add_os_bitmap: new bitmap index %d", rv)); LLOGLN(10, ("rdpup_add_os_bitmap: g_pixmap_num_used %d " "g_os_bitmap_stamp 0x%8.8x", g_pixmap_num_used, g_os_bitmap_stamp)); @@ -365,11 +376,13 @@ rdpup_remove_os_bitmap(int rdpindex) if (g_os_bitmaps == 0) { + LLOGLN(10, ("rdpup_remove_os_bitmap: test error 1")); return 1; } if ((rdpindex < 0) && (rdpindex >= g_max_os_bitmaps)) { + LLOGLN(10, ("rdpup_remove_os_bitmap: test error 2")); return 1; } @@ -396,7 +409,8 @@ rdpup_remove_os_bitmap(int rdpindex) LLOGLN(0, ("rdpup_remove_os_bitmap: error")); } - LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used)); + LLOGLN(10, ("rdpup_remove_os_bitmap: g_pixmap_num_used %d", + g_pixmap_num_used)); return 0; } @@ -404,10 +418,6 @@ rdpup_remove_os_bitmap(int rdpindex) int rdpup_update_os_use(int rdpindex) { - PixmapPtr pixmap; - rdpPixmapPtr priv; - int this_bytes; - LLOGLN(10, ("rdpup_update_use: index %d stamp %d", rdpindex, g_os_bitmaps[rdpindex].stamp)); -- cgit v1.2.1