[idd] clipboard: batch helper stream delivery

Extend the clipboard target boundary with ordered prefix delivery.
Pass up to four queued LGMP stream records to the Helper ring in one
operation, apply state only to the accepted prefix, and retain the
remaining suffix for exact retries.

The channel holds its write lock across the prefix and emits one pipe
doorbell per stream window instead of one per record.
This commit is contained in:
Geoffrey McRae
2026-08-15 16:32:43 +10:00
parent 5bdfc0fe80
commit 94d5f3729e
5 changed files with 206 additions and 111 deletions

View File

@@ -64,6 +64,14 @@ private:
FAILED,
};
enum class StreamDisposition
{
READY,
DISCARD,
STALE,
INVALID,
};
struct Transfer
{
uint64_t transfer = 0;
@@ -147,9 +155,9 @@ private:
Transfer m_helperToClient;
PendingTarget m_pendingTarget;
StreamTarget m_streamTarget[STREAM_TARGET_COUNT];
unsigned m_streamTargetHead = 0;
unsigned m_streamTargetCount = 0;
bool m_streamTargetBusy = false;
unsigned m_streamTargetHead = 0;
unsigned m_streamTargetCount = 0;
unsigned m_streamTargetPrepared = 0;
KVMFRClipboardMessage m_internalTarget[INTERNAL_TARGET_COUNT] = {};
unsigned m_internalTargetCount = 0;
CLGMPClipboardFiles m_files;
@@ -190,12 +198,14 @@ private:
void ClearQueuedStreamTargets();
bool QueueStreamTarget(const KVMFRClipboardMessage& record,
const uint8_t * data);
void PopStreamTarget();
bool PublishStreamTarget();
bool RetryStreamTarget();
void PopStreamTargets(unsigned count);
StreamDisposition PreviewStreamTarget(
const KVMFRClipboardMessage& record, Transfer& transfer,
CLGMPClipboardFiles& files);
bool PublishStreamTargets();
bool RetryStreamTargets();
bool PumpStreamTarget();
bool DrainStream(bool& received);
bool ProcessStreamTarget();
PLGMPMemory FindAvailable(PLGMPMemory (&memory)[MEMORY_COUNT]) const;
PostResult PostForOwner(uint64_t udata, PLGMPMemory memory);