From 4e15f3b68b7e05e4845c336ce94bc30ce9a4c654 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 17 Aug 2026 03:00:54 +1000 Subject: [PATCH] [idd] transport: stream writes to WC mappings --- .../transport/lgmp/CLGMPClipboardTransport.cpp | 5 ++++- idd/LGIdd/transport/lgmp/CLGMPControl.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/idd/LGIdd/transport/lgmp/CLGMPClipboardTransport.cpp b/idd/LGIdd/transport/lgmp/CLGMPClipboardTransport.cpp index 70b5a6b8..b7eecb9a 100644 --- a/idd/LGIdd/transport/lgmp/CLGMPClipboardTransport.cpp +++ b/idd/LGIdd/transport/lgmp/CLGMPClipboardTransport.cpp @@ -27,6 +27,7 @@ #include "CDebug.h" #include "Seq.h" #include "WCCopy.h" +#include "WCWrite.h" #include "transport/lgmp/CLGMPHost.h" #include @@ -1745,8 +1746,10 @@ ClipboardChannelResult CLGMPClipboardTransport::SendData( memcpy(buffer.data, &message, sizeof(message)); if (message.length) - memcpy(static_cast(buffer.data) + sizeof(message), data, + WCWrite::Copy(static_cast(buffer.data) + sizeof(message), data, message.length); + + // Stream commit drains WC writes before publishing the producer cursor. status = lgmpHostStreamWriteCommit( m_hostToClientStream, &buffer, bytes); if (status == LGMP_OK) diff --git a/idd/LGIdd/transport/lgmp/CLGMPControl.cpp b/idd/LGIdd/transport/lgmp/CLGMPControl.cpp index 7a4305c0..2a5bcc1f 100644 --- a/idd/LGIdd/transport/lgmp/CLGMPControl.cpp +++ b/idd/LGIdd/transport/lgmp/CLGMPControl.cpp @@ -21,6 +21,7 @@ #include "transport/lgmp/CLGMPControl.h" #include "CDebug.h" +#include "WCWrite.h" #include @@ -30,6 +31,7 @@ static const uint32_t MAX_POINTER_SIZE = (uint32_t)(sizeof(KVMFRCursor) + (512 * 512 * 4)); static const uint32_t POINTER_POSITION_SIZE = (uint32_t)sizeof(KVMFRCursor); +static const size_t WC_WRITE_MIN_SIZE = 4 * 1024; static const struct LGMPQueueConfig POINTER_QUEUE_CONFIG = { @@ -225,7 +227,12 @@ ControlResult CLGMPControl::SendCursor( if (hasShape) { if (size) - memcpy(cursor + 1, data, size); + { + if (size < WC_WRITE_MIN_SIZE) + memcpy(cursor + 1, data, size); + else + WCWrite::Copy(cursor + 1, data, size); + } cursor->hx = (int8_t )info.CursorShapeInfo.XHot; cursor->hy = (int8_t )info.CursorShapeInfo.YHot; @@ -247,6 +254,7 @@ ControlResult CLGMPControl::SendCursor( flags |= CURSOR_FLAG_SHAPE; } + WCWrite::Flush(); const LGMP_STATUS status = lgmpHostQueuePost(m_pointerQueue, flags, mem); if (status == LGMP_OK) @@ -292,9 +300,10 @@ ControlResult CLGMPControl::SendColorTransform( output->flags |= KVMFR_COLOR_TRANSFORM_LUT; memcpy(output->matrix, transform->matrix, sizeof(output->matrix)); output->scalar = transform->scalar; - memcpy(output->lut, transform->lut, sizeof(output->lut)); + WCWrite::Copy(output->lut, transform->lut, sizeof(output->lut)); } + WCWrite::Flush(); const LGMP_STATUS status = lgmpHostQueuePost(m_pointerQueue, CURSOR_FLAG_COLOR_TRANSFORM, mem); if (status == LGMP_OK)