diff options
-rw-r--r-- | sesman/chansrv/sound.c | 4 | ||||
-rw-r--r-- | xorg/server/module/rdp.h | 68 | ||||
-rw-r--r-- | xorg/server/module/rdpCapture.c | 59 | ||||
-rw-r--r-- | xorg/server/module/rdpCapture.h | 5 | ||||
-rw-r--r-- | xorg/server/module/rdpClientCon.c | 38 |
5 files changed, 108 insertions, 66 deletions
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index 8c76c9bc..efb7ff85 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -368,6 +368,8 @@ sound_send_wave_data_chunk(char *data, int data_bytes) return 0; } + LOG(20, ("sound_send_wave_data_chunk: g_sent_flag[%d] = %d", + g_cBlockNo + 1, g_sent_flag[(g_cBlockNo + 1) & 0xff])); if (g_sent_flag[(g_cBlockNo + 1) & 0xff] & 1) { LOG(10, ("sound_send_wave_data_chunk: no room")); @@ -469,6 +471,7 @@ sound_send_close(void) /* send any left over data */ sound_send_wave_data_chunk(g_buffer, g_buf_index); g_buf_index = 0; + g_memset(g_sent_flag, 0, sizeof(g_sent_flag)); make_stream(s); init_stream(s, 8182); @@ -696,6 +699,7 @@ sound_init(void) int APP_CC sound_deinit(void) { + LOG(10, ("sound_deinit:")); if (g_audio_l_trans_out != 0) { trans_delete(g_audio_l_trans_out); diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index 9609aeb4..80df5f01 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -67,7 +67,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RDPMIN(_val1, _val2) ((_val1) < (_val2) ? (_val1) : (_val2)) #define RDPMAX(_val1, _val2) ((_val1) < (_val2) ? (_val2) : (_val1)) #define RDPCLAMP(_val, _lo, _hi) \ - (_val) < (_lo) ? (_lo) : (_val) > (_hi) ? (_hi) : (_val) + (_val) < (_lo) ? (_lo) : (_val) > (_hi) ? (_hi) : (_val) #define XRDP_CD_NODRAW 0 #define XRDP_CD_NOCLIP 1 @@ -277,63 +277,63 @@ typedef struct _rdpGCRec * rdpGCPtr; struct urdp_draw_item_fill { - int opcode; - int fg_color; - int bg_color; - int pad0; + int opcode; + int fg_color; + int bg_color; + int pad0; }; struct urdp_draw_item_img { - int opcode; - int pad0; + int opcode; + int pad0; }; struct urdp_draw_item_line { - int opcode; - int fg_color; - int bg_color; - int width; - xSegment* segs; - int nseg; - int flags; + int opcode; + int fg_color; + int bg_color; + int width; + xSegment* segs; + int nseg; + int flags; }; struct urdp_draw_item_scrblt { - int srcx; - int srcy; - int dstx; - int dsty; - int cx; - int cy; + int srcx; + int srcy; + int dstx; + int dsty; + int cx; + int cy; }; struct urdp_draw_item_text { - int opcode; - int fg_color; - struct rdp_text* rtext; /* in rdpglyph.h */ + int opcode; + int fg_color; + struct rdp_text* rtext; /* in rdpglyph.h */ }; union urdp_draw_item { - struct urdp_draw_item_fill fill; - struct urdp_draw_item_img img; - struct urdp_draw_item_line line; - struct urdp_draw_item_scrblt scrblt; - struct urdp_draw_item_text text; + struct urdp_draw_item_fill fill; + struct urdp_draw_item_img img; + struct urdp_draw_item_line line; + struct urdp_draw_item_scrblt scrblt; + struct urdp_draw_item_text text; }; struct rdp_draw_item { - int type; /* RDI_FILL, RDI_IMGLL, ... */ - int flags; - struct rdp_draw_item* prev; - struct rdp_draw_item* next; - RegionPtr reg; - union urdp_draw_item u; + int type; /* RDI_FILL, RDI_IMGLL, ... */ + int flags; + struct rdp_draw_item* prev; + struct rdp_draw_item* next; + RegionPtr reg; + union urdp_draw_item u; }; #define XRDP_USE_COUNT_THRESHOLD 1 diff --git a/xorg/server/module/rdpCapture.c b/xorg/server/module/rdpCapture.c index cf8fc768..189f313a 100644 --- a/xorg/server/module/rdpCapture.c +++ b/xorg/server/module/rdpCapture.c @@ -33,6 +33,7 @@ #include "rdpDraw.h" #include "rdpClientCon.h" #include "rdpReg.h" +#include "rdpMisc.h" #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ @@ -40,13 +41,13 @@ /******************************************************************************/ static Bool -rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, +rdpCapture0(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects, void *src, int src_width, int src_height, int src_stride, int src_format, void *dst, int dst_width, int dst_height, int dst_stride, int dst_format, int max_rects) { - BoxPtr prects; + BoxPtr psrc_rects; BoxRec rect; RegionRec reg; char *src_rect; @@ -88,14 +89,25 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, if (num_regions > max_rects) { num_regions = 1; - prects = rdpRegionExtents(®); - rdpRegionUninit(out_reg); - rdpRegionInit(out_reg, prects, 0); + psrc_rects = rdpRegionExtents(®); } else { - prects = REGION_RECTS(®); - rdpRegionCopy(out_reg, ®); + psrc_rects = REGION_RECTS(®); + } + + if (num_regions < 1) + { + return FALSE; + } + + *num_out_rects = num_regions; + + *out_rects = (BoxPtr) g_malloc(sizeof(BoxRec) * num_regions, 0); + for (i = 0; i < num_regions; i++) + { + rect = psrc_rects[i]; + (*out_rects)[i] = rect; } if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a8r8g8b8)) @@ -105,7 +117,7 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, for (i = 0; i < num_regions; i++) { /* get rect to copy */ - rect = prects[i]; + rect = (*out_rects)[i]; /* get rect dimensions */ width = rect.x2 - rect.x1; @@ -137,7 +149,7 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, for (i = 0; i < num_regions; i++) { /* get rect to copy */ - rect = prects[i]; + rect = (*out_rects)[i]; /* get rect dimensions */ width = rect.x2 - rect.x1; @@ -174,7 +186,7 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, for (i = 0; i < num_regions; i++) { /* get rect to copy */ - rect = prects[i]; + rect = (*out_rects)[i]; /* get rect dimensions */ width = rect.x2 - rect.x1; @@ -211,7 +223,7 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, for (i = 0; i < num_regions; i++) { /* get rect to copy */ - rect = prects[i]; + rect = (*out_rects)[i]; /* get rect dimensions */ width = rect.x2 - rect.x1; @@ -248,7 +260,7 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, for (i = 0; i < num_regions; i++) { /* get rect to copy */ - rect = prects[i]; + rect = (*out_rects)[i]; /* get rect dimensions */ width = rect.x2 - rect.x1; @@ -285,11 +297,22 @@ rdpCapture0(RegionPtr in_reg, RegionPtr out_reg, return rv; } +/******************************************************************************/ +static Bool +rdpCapture1(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects, + void *src, int src_width, int src_height, + int src_stride, int src_format, + void *dst, int dst_width, int dst_height, + int dst_stride, int dst_format, int max_rects) +{ + return FALSE; +} + /** * Copy an array of rectangles from one memory area to another *****************************************************************************/ Bool -rdpCapture(RegionPtr in_reg, RegionPtr out_reg, +rdpCapture(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects, void *src, int src_width, int src_height, int src_stride, int src_format, void *dst, int dst_width, int dst_height, @@ -299,7 +322,13 @@ rdpCapture(RegionPtr in_reg, RegionPtr out_reg, switch (mode) { case 0: - return rdpCapture0(in_reg, out_reg, + return rdpCapture0(in_reg, out_rects, num_out_rects, + src, src_width, src_height, + src_stride, src_format, + dst, dst_width, dst_height, + dst_stride, dst_format, 15); + case 1: + return rdpCapture1(in_reg, out_rects, num_out_rects, src, src_width, src_height, src_stride, src_format, dst, dst_width, dst_height, @@ -308,5 +337,5 @@ rdpCapture(RegionPtr in_reg, RegionPtr out_reg, LLOGLN(0, ("rdpCapture: unimp mode")); break; } - return TRUE; + return FALSE; } diff --git a/xorg/server/module/rdpCapture.h b/xorg/server/module/rdpCapture.h index f92508c4..5810e3b6 100644 --- a/xorg/server/module/rdpCapture.h +++ b/xorg/server/module/rdpCapture.h @@ -19,9 +19,8 @@ */ Bool -rdpCapture(RegionPtr in_reg, RegionPtr out_reg, +rdpCapture(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects, void *src, int src_width, int src_height, int src_stride, int src_format, void *dst, int dst_width, int dst_height, - int dst_stride, int dst_format, - int mode); + int dst_stride, int dst_format, int mode); diff --git a/xorg/server/module/rdpClientCon.c b/xorg/server/module/rdpClientCon.c index 97012428..e375b4e2 100644 --- a/xorg/server/module/rdpClientCon.c +++ b/xorg/server/module/rdpClientCon.c @@ -1874,7 +1874,8 @@ rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon) static int rdpClientConSendPaintRectShmEx(rdpPtr dev, rdpClientCon *clientCon, struct image_data *id, - RegionPtr dirtyReg, RegionPtr copyReg) + RegionPtr dirtyReg, + BoxPtr copyRects, int numCopyRects) { int index; int size; @@ -1890,7 +1891,7 @@ rdpClientConSendPaintRectShmEx(rdpPtr dev, rdpClientCon *clientCon, rdpClientConBeginUpdate(dev, clientCon); num_rects_d = REGION_NUM_RECTS(dirtyReg); - num_rects_c = REGION_NUM_RECTS(copyReg); + num_rects_c = numCopyRects; if ((num_rects_c < 1) || (num_rects_d < 1)) { LLOGLN(0, ("rdpClientConSendPaintRectShmEx: nothing to send")); @@ -1922,7 +1923,7 @@ rdpClientConSendPaintRectShmEx(rdpPtr dev, rdpClientCon *clientCon, out_uint16_le(s, num_rects_c); for (index = 0; index < num_rects_c; index++) { - box = REGION_RECTS(copyReg)[index]; + box = copyRects[index]; x = box.x1; y = box.y1; cx = box.x2 - box.x1; @@ -1951,7 +1952,8 @@ static CARD32 rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) { rdpClientCon *clientCon; - RegionRec reg; + BoxPtr rects; + int num_rects; struct image_data id; LLOGLN(10, ("rdpDeferredUpdateCallback:")); @@ -1977,18 +1979,26 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) clientCon->rdp_width, clientCon->rdp_height, clientCon->rdp_Bpp, id.width, id.height)); clientCon->updateSchedualed = FALSE; - rdpRegionInit(®, NullBox, 0); - rdpCapture(clientCon->dirtyRegion, ®, - 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); - rdpClientConSendPaintRectShmEx(clientCon->dev, clientCon, &id, - clientCon->dirtyRegion, ®); + rects = 0; + num_rects = 0; + if (rdpCapture(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)) + { + rdpClientConSendPaintRectShmEx(clientCon->dev, clientCon, &id, + clientCon->dirtyRegion, + rects, num_rects); + g_free(rects); + } + else + { + LLOGLN(0, ("rdpDeferredUpdateCallback: rdpCapture failed")); + } rdpRegionDestroy(clientCon->dirtyRegion); clientCon->dirtyRegion = rdpRegionCreate(NullBox, 0); - rdpRegionUninit(®); return 0; } |