summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/xrdp_constants.h2
-rw-r--r--libxrdp/libxrdp.h1
-rw-r--r--libxrdp/xrdp_orders.c9
-rw-r--r--libxrdp/xrdp_rdp.c10
-rw-r--r--xorg/X11R7.6/rdp/rdpdraw.c26
-rw-r--r--xrdp/xrdp_cache.c27
-rw-r--r--xrdp/xrdp_types.h6
7 files changed, 60 insertions, 21 deletions
diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h
index b978d2de..53c54852 100644
--- a/common/xrdp_constants.h
+++ b/common/xrdp_constants.h
@@ -559,4 +559,6 @@
#define CMDTYPE_FRAME_MARKER 0x0004
#define CMDTYPE_STREAM_SURFACE_BITS 0x0006
+#define XRDP_BITMAP_CACHE_ENTRIES 2048
+
#endif
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h
index d31edbb4..83d3285c 100644
--- a/libxrdp/libxrdp.h
+++ b/libxrdp/libxrdp.h
@@ -211,6 +211,7 @@ struct xrdp_orders
int order_count;
int order_level; /* inc for every call to xrdp_orders_init */
struct xrdp_orders_state orders_state;
+ int rfx_min_pixel;
};
#define PROTO_RDP_40 1
diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c
index 29234173..17e674af 100644
--- a/libxrdp/xrdp_orders.c
+++ b/libxrdp/xrdp_orders.c
@@ -47,6 +47,11 @@ xrdp_orders_create(struct xrdp_session *session, struct xrdp_rdp *rdp_layer)
init_stream(self->out_s, 16384);
self->orders_state.clip_right = 1; /* silly rdp right clip */
self->orders_state.clip_bottom = 1; /* silly rdp bottom clip */
+ self->rfx_min_pixel = rdp_layer->client_info.rfx_min_pixel;
+ if (self->rfx_min_pixel == 0)
+ {
+ self->rfx_min_pixel = 64 * 32;
+ }
return self;
}
@@ -2246,7 +2251,9 @@ xrdp_orders_send_as_rfx(struct xrdp_orders *self,
return 0;
}
- if (width * height < 64)
+ LLOGLN(10, ("width %d height %d rfx_min_pixel %d", width, height,
+ self->rfx_min_pixel));
+ if (width * height < self->rfx_min_pixel)
{
return 0;
}
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 82ccdea0..8df7f7a9 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -131,6 +131,10 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
{
client_info->max_bpp = g_atoi(value);
}
+ else if (g_strcasecmp(item, "rfx_min_pixel") == 0)
+ {
+ client_info->rfx_min_pixel = g_atoi(value);
+ }
else if (g_strcasecmp(item, "new_cursors") == 0)
{
client_info->pointer_flags = text2bool(value) == 0 ? 2 : 0;
@@ -943,16 +947,16 @@ xrdp_process_capset_bmpcache2(struct xrdp_rdp *self, struct stream *s,
self->client_info.bitmap_cache_persist_enable = i;
in_uint8s(s, 2); /* number of caches in set, 3 */
in_uint32_le(s, i);
- i = MIN(i, 2000);
+ i = MIN(i, XRDP_BITMAP_CACHE_ENTRIES);
self->client_info.cache1_entries = i;
self->client_info.cache1_size = 256 * Bpp;
in_uint32_le(s, i);
- i = MIN(i, 2000);
+ i = MIN(i, XRDP_BITMAP_CACHE_ENTRIES);
self->client_info.cache2_entries = i;
self->client_info.cache2_size = 1024 * Bpp;
in_uint32_le(s, i);
i = i & 0x7fffffff;
- i = MIN(i, 2000);
+ i = MIN(i, XRDP_BITMAP_CACHE_ENTRIES);
self->client_info.cache3_entries = i;
self->client_info.cache3_size = 4096 * Bpp;
DEBUG(("cache1 entries %d size %d", self->client_info.cache1_entries,
diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c
index 602342b7..69a9c72d 100644
--- a/xorg/X11R7.6/rdp/rdpdraw.c
+++ b/xorg/X11R7.6/rdp/rdpdraw.c
@@ -487,6 +487,7 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv)
{
struct rdp_draw_item *di;
struct rdp_draw_item *di_prev;
+ RegionRec treg;
#if 1
@@ -500,19 +501,17 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv)
while (di != 0)
{
- if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL))
+ if ((di_prev->type == RDI_IMGLL || di_prev->type == RDI_IMGLY ||
+ di_prev->type == RDI_FILL) &&
+ (di->type == RDI_IMGLL || di->type == RDI_IMGLY ||
+ di->type == RDI_FILL))
{
- LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL"));
- RegionUnion(di_prev->reg, di_prev->reg, di->reg);
- draw_item_remove(priv, di);
- di = di_prev->next;
- }
- else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY))
- {
- LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY"));
+ LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL / RDI_IMGLY / "
+ "RDI_FILL"));
RegionUnion(di_prev->reg, di_prev->reg, di->reg);
draw_item_remove(priv, di);
di = di_prev->next;
+ di_prev->type = RDI_IMGLL;
}
else
{
@@ -547,7 +546,14 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv)
while (di_prev != 0)
{
/* D = M - S */
- RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
+ RegionInit(&treg, NullBox, 0);
+ RegionSubtract(&treg, di_prev->reg, di->reg);
+ if (!RegionNotEmpty(&treg))
+ {
+ /* copy empty region so this draw item will get removed below */
+ RegionCopy(di_prev->reg, &treg);
+ }
+ RegionUninit(&treg);
di_prev = di_prev->prev;
}
}
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index cac7f114..62da4183 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -21,6 +21,18 @@
#include "xrdp.h"
#include "log.h"
+#define LLOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do \
+ { \
+ if (_level < LLOG_LEVEL) \
+ { \
+ g_write("xrdp:xrdp_cache [%10.10u]: ", g_time3()); \
+ g_writeln _args ; \
+ } \
+ } \
+ while (0)
+
/*****************************************************************************/
struct xrdp_cache *APP_CC
xrdp_cache_create(struct xrdp_wm *owner,
@@ -43,6 +55,8 @@ xrdp_cache_create(struct xrdp_wm *owner,
self->bitmap_cache_version = client_info->bitmap_cache_version;
self->pointer_cache_entries = client_info->pointer_cache_entries;
self->xrdp_os_del_list = list_create();
+ LLOGLN(10, ("xrdp_cache_create: 0 %d 1 %d 2 %d",
+ self->cache1_entries, self->cache2_entries, self->cache3_entries));
return self;
}
@@ -61,7 +75,7 @@ xrdp_cache_delete(struct xrdp_cache *self)
/* free all the cached bitmaps */
for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2000; j++)
+ for (j = 0; j < XRDP_BITMAP_CACHE_ENTRIES; j++)
{
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
}
@@ -100,7 +114,7 @@ xrdp_cache_reset(struct xrdp_cache *self,
/* free all the cached bitmaps */
for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2000; j++)
+ for (j = 0; j < XRDP_BITMAP_CACHE_ENTRIES; j++)
{
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
}
@@ -177,7 +191,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -197,7 +211,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -217,7 +231,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -276,7 +290,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
}
}
- DEBUG(("adding bitmap at %d %d", cache_id, cache_idx));
+ LLOGLN(10, ("adding bitmap at %d %d ptr %p", cache_id, cache_idx,
+ self->bitmap_items[cache_id][cache_idx].bitmap));
/* set, send bitmap and return */
xrdp_bitmap_delete(self->bitmap_items[cache_id][cache_idx].bitmap);
self->bitmap_items[cache_id][cache_idx].bitmap = bitmap;
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index e7bb7baf..7dfd8ef3 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -22,6 +22,7 @@
#define LOG_WINDOW_CHAR_PER_LINE 60
#include "xrdp_rail.h"
+#include "xrdp_constants.h"
#define MAX_NR_CHANNELS 16
#define MAX_CHANNEL_NAME 16
@@ -185,6 +186,9 @@ struct xrdp_brush_item
char pattern[8];
};
+/* moved to xrdp_constants.h
+#define XRDP_BITMAP_CACHE_ENTRIES 2048 */
+
/* differnce caches */
struct xrdp_cache
{
@@ -195,7 +199,7 @@ struct xrdp_cache
struct xrdp_palette_item palette_items[6];
/* bitmap */
int bitmap_stamp;
- struct xrdp_bitmap_item bitmap_items[3][2000];
+ struct xrdp_bitmap_item bitmap_items[3][XRDP_BITMAP_CACHE_ENTRIES];
int use_bitmap_comp;
int cache1_entries;
int cache1_size;