summaryrefslogtreecommitdiffstats
path: root/xorg/server/module/rdpClientCon.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg/server/module/rdpClientCon.c')
-rw-r--r--xorg/server/module/rdpClientCon.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/xorg/server/module/rdpClientCon.c b/xorg/server/module/rdpClientCon.c
index 24870557..622a3f8a 100644
--- a/xorg/server/module/rdpClientCon.c
+++ b/xorg/server/module/rdpClientCon.c
@@ -523,6 +523,8 @@ rdpClientConProcessMsgVersion(rdpPtr dev, rdpClientCon *clientCon,
return 0;
}
+#define LALIGN(_num, _po2) ((_num + ((_po2) - 1)) & ~((_po2) - 1))
+
/******************************************************************************/
/*
this from miScreenInit
@@ -544,6 +546,8 @@ rdpClientConProcessScreenSizeMsg(rdpPtr dev, rdpClientCon *clientCon,
clientCon->rdp_width = width;
clientCon->rdp_height = height;
clientCon->rdp_bpp = bpp;
+ clientCon->cap_width = width;
+ clientCon->cap_height = height;
if (bpp < 15)
{
@@ -649,12 +653,13 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon)
}
else if (msg == 300) /* resize desktop */
{
- rdpClientConProcessScreenSizeMsg(dev, clientCon, param1, param2, param3);
+ rdpClientConProcessScreenSizeMsg(dev, clientCon, param1,
+ param2, param3);
}
else if (msg == 301) /* version */
{
rdpClientConProcessMsgVersion(dev, clientCon,
- param1, param2, param3, param4);
+ param1, param2, param3, param4);
}
else
{
@@ -691,11 +696,30 @@ rdpClientConProcessMsgClientInfo(rdpPtr dev, rdpClientCon *clientCon)
i1 = clientCon->client_info.offscreen_cache_entries;
LLOGLN(0, (" offscreen entries %d", i1));
- if ((clientCon->client_info.mcs_connection_type == 6) && /* LAN */
- (clientCon->client_info.jpeg_codec_id == 2))
+ if (clientCon->client_info.capture_format != 0)
+ {
+ clientCon->rdp_format = clientCon->client_info.capture_format;
+ }
+
+ if (clientCon->client_info.capture_code == 2) /* RFX */
{
- /* jpeg capture needs swap */
- clientCon->rdp_format = XRDP_a8b8g8r8;
+ LLOGLN(0, ("rdpClientConProcessMsgClientInfo: got RFX capture"));
+ clientCon->cap_width = LALIGN(clientCon->rdp_width, 64);
+ clientCon->cap_height = LALIGN(clientCon->rdp_height, 64);
+ LLOGLN(0, (" cap_width %d cap_height %d",
+ clientCon->cap_width, clientCon->cap_height));
+ if (clientCon->shmemptr != 0)
+ {
+ shmdt(clientCon->shmemptr);
+ }
+ bytes = clientCon->cap_width * clientCon->cap_height *
+ clientCon->rdp_Bpp;
+ clientCon->shmemid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777);
+ clientCon->shmemptr = shmat(clientCon->shmemid, 0, 0);
+ shmctl(clientCon->shmemid, IPC_RMID, NULL);
+ LLOGLN(0, ("rdpClientConProcessMsgClientInfo: shmemid %d shmemptr %p "
+ "bytes %d", clientCon->shmemid, clientCon->shmemptr, bytes));
+ clientCon->shmem_lineBytes = clientCon->rdp_Bpp * clientCon->cap_width;
}
if (clientCon->client_info.offscreen_support_level > 0)
@@ -1944,8 +1968,8 @@ rdpClientConSendPaintRectShmEx(rdpPtr dev, rdpClientCon *clientCon,
out_uint32_le(s, clientCon->rect_id);
out_uint32_le(s, id->shmem_id);
out_uint32_le(s, id->shmem_offset);
- out_uint16_le(s, clientCon->rdp_width);
- out_uint16_le(s, clientCon->rdp_height);
+ out_uint16_le(s, clientCon->cap_width);
+ out_uint16_le(s, clientCon->cap_height);
rdpClientConEndUpdate(dev, clientCon);
@@ -1964,7 +1988,9 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
LLOGLN(10, ("rdpDeferredUpdateCallback:"));
clientCon = (rdpClientCon *) arg;
- if (clientCon->rect_id > clientCon->rect_id_ack)
+ if ((clientCon->rect_id > clientCon->rect_id_ack) ||
+ /* do not allow captures until we have the client_info */
+ clientCon->client_info.size == 0)
{
LLOGLN(0, ("rdpDeferredUpdateCallback: reschedual rect_id %d "
"rect_id_ack %d",
@@ -1986,13 +2012,16 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
clientCon->updateSchedualed = FALSE;
rects = 0;
num_rects = 0;
- if (rdpCapture(clientCon->dirtyRegion, &rects, &num_rects,
+ LLOGLN(10, ("rdpDeferredUpdateCallback: capture_code %d",
+ clientCon->client_info.capture_code));
+ if (rdpCapture(clientCon, clientCon->dirtyRegion, &rects, &num_rects,
id.pixels, id.width, id.height,
id.lineBytes, XRDP_a8r8g8b8, id.shmem_pixels,
- clientCon->rdp_width, clientCon->rdp_height,
- clientCon->rdp_width * clientCon->rdp_Bpp,
- clientCon->rdp_format, 0))
+ clientCon->cap_width, clientCon->cap_height,
+ clientCon->cap_width * clientCon->rdp_Bpp,
+ clientCon->rdp_format, clientCon->client_info.capture_code))
{
+ LLOGLN(10, ("rdpDeferredUpdateCallback: num_rects %d", num_rects));
rdpClientConSendPaintRectShmEx(clientCon->dev, clientCon, &id,
clientCon->dirtyRegion,
rects, num_rects);