[idd] transport: stream writes to WC mappings

This commit is contained in:
Geoffrey McRae
2026-08-17 03:00:54 +10:00
parent 4f695b93d6
commit 4e15f3b68b
2 changed files with 15 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
#include "CDebug.h" #include "CDebug.h"
#include "Seq.h" #include "Seq.h"
#include "WCCopy.h" #include "WCCopy.h"
#include "WCWrite.h"
#include "transport/lgmp/CLGMPHost.h" #include "transport/lgmp/CLGMPHost.h"
#include <limits> #include <limits>
@@ -1745,8 +1746,10 @@ ClipboardChannelResult CLGMPClipboardTransport::SendData(
memcpy(buffer.data, &message, sizeof(message)); memcpy(buffer.data, &message, sizeof(message));
if (message.length) if (message.length)
memcpy(static_cast<uint8_t *>(buffer.data) + sizeof(message), data, WCWrite::Copy(static_cast<uint8_t *>(buffer.data) + sizeof(message), data,
message.length); message.length);
// Stream commit drains WC writes before publishing the producer cursor.
status = lgmpHostStreamWriteCommit( status = lgmpHostStreamWriteCommit(
m_hostToClientStream, &buffer, bytes); m_hostToClientStream, &buffer, bytes);
if (status == LGMP_OK) if (status == LGMP_OK)

View File

@@ -21,6 +21,7 @@
#include "transport/lgmp/CLGMPControl.h" #include "transport/lgmp/CLGMPControl.h"
#include "CDebug.h" #include "CDebug.h"
#include "WCWrite.h"
#include <string.h> #include <string.h>
@@ -30,6 +31,7 @@ static const uint32_t MAX_POINTER_SIZE =
(uint32_t)(sizeof(KVMFRCursor) + (512 * 512 * 4)); (uint32_t)(sizeof(KVMFRCursor) + (512 * 512 * 4));
static const uint32_t POINTER_POSITION_SIZE = static const uint32_t POINTER_POSITION_SIZE =
(uint32_t)sizeof(KVMFRCursor); (uint32_t)sizeof(KVMFRCursor);
static const size_t WC_WRITE_MIN_SIZE = 4 * 1024;
static const struct LGMPQueueConfig POINTER_QUEUE_CONFIG = static const struct LGMPQueueConfig POINTER_QUEUE_CONFIG =
{ {
@@ -225,7 +227,12 @@ ControlResult CLGMPControl::SendCursor(
if (hasShape) if (hasShape)
{ {
if (size) 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->hx = (int8_t )info.CursorShapeInfo.XHot;
cursor->hy = (int8_t )info.CursorShapeInfo.YHot; cursor->hy = (int8_t )info.CursorShapeInfo.YHot;
@@ -247,6 +254,7 @@ ControlResult CLGMPControl::SendCursor(
flags |= CURSOR_FLAG_SHAPE; flags |= CURSOR_FLAG_SHAPE;
} }
WCWrite::Flush();
const LGMP_STATUS status = const LGMP_STATUS status =
lgmpHostQueuePost(m_pointerQueue, flags, mem); lgmpHostQueuePost(m_pointerQueue, flags, mem);
if (status == LGMP_OK) if (status == LGMP_OK)
@@ -292,9 +300,10 @@ ControlResult CLGMPControl::SendColorTransform(
output->flags |= KVMFR_COLOR_TRANSFORM_LUT; output->flags |= KVMFR_COLOR_TRANSFORM_LUT;
memcpy(output->matrix, transform->matrix, sizeof(output->matrix)); memcpy(output->matrix, transform->matrix, sizeof(output->matrix));
output->scalar = transform->scalar; 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, const LGMP_STATUS status = lgmpHostQueuePost(m_pointerQueue,
CURSOR_FLAG_COLOR_TRANSFORM, mem); CURSOR_FLAG_COLOR_TRANSFORM, mem);
if (status == LGMP_OK) if (status == LGMP_OK)