From 6b91ed5830d0feb0ce1747cd349ee250ef6a3942 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Thu, 17 Jan 2013 12:58:01 +0800 Subject: [PATCH] Frame acknowledgement should be sent by client UI. --- client/Windows/wf_gdi.c | 14 ++++++++++++++ client/X11/xf_gdi.c | 9 ++++++++- include/freerdp/update.h | 4 +++- libfreerdp/core/surface.c | 14 -------------- libfreerdp/core/update.c | 11 +++++++++++ 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index fcb681a97..41e268e90 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -544,6 +544,19 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits free(tile_bitmap); } +void wf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker) +{ + wfInfo* wfi; + rdpSettings* settings; + + wfi = ((wfContext*) context)->wfi; + settings = wfi->instance->settings; + if (surface_frame_marker->frameAction == SURFACECMD_FRAMEACTION_END && settings->FrameAcknowledge > 0) + { + IFCALL(wfi->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId); + } +} + void wf_gdi_register_update_callbacks(rdpUpdate* update) { rdpPrimaryUpdate* primary = update->primary; @@ -575,4 +588,5 @@ void wf_gdi_register_update_callbacks(rdpUpdate* update) primary->EllipseCB = NULL; update->SurfaceBits = wf_gdi_surface_bits; + update->SurfaceFrameMarker = wf_gdi_surface_frame_marker; } diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index 7448577af..6f2683a2a 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -880,8 +880,11 @@ void xf_gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb) void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker) { - xfInfo* xfi = ((xfContext*) context)->xfi; + xfInfo* xfi; + rdpSettings* settings; + xfi = ((xfContext*) context)->xfi; + settings = xfi->instance->settings; switch (surface_frame_marker->frameAction) { case SURFACECMD_FRAMEACTION_BEGIN: @@ -906,6 +909,10 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf gdi_InvalidateRegion(xfi->hdc, xfi->frame_x1, xfi->frame_y1, xfi->frame_x2 - xfi->frame_x1, xfi->frame_y2 - xfi->frame_y1); } + if (settings->FrameAcknowledge > 0) + { + IFCALL(xfi->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId); + } break; } } diff --git a/include/freerdp/update.h b/include/freerdp/update.h index 526f22f0d..6aa15ea30 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -152,6 +152,7 @@ typedef void (*pSuppressOutput)(rdpContext* context, BYTE allow, RECTANGLE_16* a typedef void (*pSurfaceCommand)(rdpContext* context, STREAM* s); typedef void (*pSurfaceBits)(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command); typedef void (*pSurfaceFrameMarker)(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker); +typedef void (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId); struct rdp_update { @@ -182,7 +183,8 @@ struct rdp_update pSurfaceCommand SurfaceCommand; /* 64 */ pSurfaceBits SurfaceBits; /* 65 */ pSurfaceFrameMarker SurfaceFrameMarker; /* 66 */ - UINT32 paddingE[80 - 67]; /* 67 */ + pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 67 */ + UINT32 paddingE[80 - 68]; /* 68 */ /* internal */ diff --git a/libfreerdp/core/surface.c b/libfreerdp/core/surface.c index c53a35159..2feb4a5e9 100644 --- a/libfreerdp/core/surface.c +++ b/libfreerdp/core/surface.c @@ -55,15 +55,6 @@ static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, STREAM* s, UINT3 return TRUE; } -static void update_send_frame_acknowledge(rdpRdp* rdp, UINT32 frameId) -{ - STREAM* s; - - s = rdp_data_pdu_init(rdp); - stream_write_UINT32(s, frameId); - rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id); -} - static BOOL update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s, UINT32 *length) { SURFACE_FRAME_MARKER* marker = &update->surface_frame_marker; @@ -75,11 +66,6 @@ static BOOL update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s, UINT3 IFCALL(update->SurfaceFrameMarker, update->context, marker); - if (update->context->rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE] && update->context->rdp->settings->FrameAcknowledge > 0 && marker->frameAction == SURFACECMD_FRAMEACTION_END) - { - update_send_frame_acknowledge(update->context->rdp, marker->frameId); - } - *length = 6; return TRUE; } diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 7e2735763..a4a1a4fff 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -494,6 +494,16 @@ static void update_send_surface_frame_marker(rdpContext* context, SURFACE_FRAME_ fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s); } +static void update_send_frame_acknowledge(rdpContext* context, UINT32 frameId) +{ + STREAM* s; + rdpRdp* rdp = context->rdp; + + s = rdp_data_pdu_init(rdp); + stream_write_UINT32(s, frameId); + rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id); +} + static void update_send_synchronize(rdpContext* context) { STREAM* s; @@ -673,6 +683,7 @@ void update_register_client_callbacks(rdpUpdate* update) { update->RefreshRect = update_send_refresh_rect; update->SuppressOutput = update_send_suppress_output; + update->SurfaceFrameAcknowledge = update_send_frame_acknowledge; } static void* update_thread(void* arg)