[repos] lgprotocol: import shared protocol definitions
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

Add LGProtocol as a pinned submodule and consume its KVMFR protocol
definitions throughout the client, host, IDD, OBS, and profiler.

Keep Looking Glass framebuffer helpers local while removing duplicated
protocol headers and migrating users to KVMFR-scoped types.
This commit is contained in:
Geoffrey McRae
2026-09-01 20:58:25 +10:00
parent 8e43d41873
commit 8fbe3e7454
94 changed files with 619 additions and 2062 deletions

View File

@@ -57,14 +57,14 @@ struct DXGICopyBackend
bool (*preCopy)(ID3D11Texture2D * src,
unsigned textureIndex,
unsigned frameBufferIndex,
FrameBuffer * frameBuffer);
KVMFRFrameBuffer * frameBuffer);
// called to copy the full frame
bool (*copyFull)(ID3D11Texture2D * src, unsigned textureIndex);
// called for each damage rect that needs to be copied
bool (*copyRect)(ID3D11Texture2D * src, unsigned textureIndex,
FrameDamageRect * rect);
KVMFRFrameDamageRect * rect);
// called just after the copy has finished
bool (*postCopy)(ID3D11Texture2D * src, unsigned textureIndex);
@@ -72,8 +72,8 @@ struct DXGICopyBackend
// maps the copied frame into memory
CaptureResult (*mapTexture)(unsigned textureIndex, void ** map);
// [optional] backend specific write into the FrameBuffer
CaptureResult (*writeFrame)(int textureIndex, FrameBuffer * frame);
// [optional] backend specific write into the KVMFRFrameBuffer
CaptureResult (*writeFrame)(int textureIndex, KVMFRFrameBuffer * frame);
// unmaps the copied frame from memory
void (*unmapTexture)(unsigned textureIndex);

View File

@@ -147,7 +147,7 @@ static bool d3d11_preCopy(
ID3D11Texture2D * src,
unsigned textureIndex,
unsigned frameBufferIndex,
FrameBuffer * frameBuffer)
KVMFRFrameBuffer * frameBuffer)
{
dxgi_contextLock();
this->texture[textureIndex].copyTime = microtime();
@@ -166,7 +166,7 @@ static bool d3d11_copyFull(ID3D11Texture2D * src, unsigned textureIndex)
static bool d3d11_copyRect(ID3D11Texture2D * src, unsigned textureIndex,
FrameDamageRect * rect)
KVMFRFrameDamageRect * rect)
{
ID3D11Texture2D * dst = *this->texture[textureIndex].tex;

View File

@@ -29,8 +29,8 @@
#include "common/event.h"
#include "common/rects.h"
#include "common/runningavg.h"
#include "common/KVMFR.h"
#include "common/LGMPConfig.h"
#include <LGProtocol/KVMFR.h>
#include <LGProtocol/LGMPConfig.h>
#include "common/vector.h"
#include <math.h>
@@ -90,9 +90,9 @@ typedef struct Texture
volatile enum TextureState state;
void * map;
uint32_t damageRectsCount;
FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
KVMFRFrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
int texDamageCount;
FrameDamageRect texDamageRects[KVMFR_MAX_DAMAGE_RECTS];
KVMFRFrameDamageRect texDamageRects[KVMFR_MAX_DAMAGE_RECTS];
// post processing
Vector pp;
@@ -101,8 +101,8 @@ Texture;
typedef struct FrameDamage
{
int count;
FrameDamageRect rects[KVMFR_MAX_DAMAGE_RECTS];
int count;
KVMFRFrameDamageRect rects[KVMFR_MAX_DAMAGE_RECTS];
}
FrameDamage;
@@ -1022,9 +1022,9 @@ static CaptureResult dxgi_hResultToCaptureResult(const HRESULT status)
}
}
static void rectToFrameDamageRect(RECT * src, FrameDamageRect * dst)
static void rectToFrameDamageRect(RECT * src, KVMFRFrameDamageRect * dst)
{
*dst = (FrameDamageRect)
*dst = (KVMFRFrameDamageRect)
{
.x = floor((double)src->left * this->scaleX),
.y = floor((double)src->top * this->scaleY),
@@ -1068,7 +1068,7 @@ static void computeFrameDamage(Texture * tex)
const int moveRectsCount = moveRectsBufferSizeRequired / sizeof(*moveRects);
FrameDamageRect * texDamageRect = tex->damageRects;
KVMFRFrameDamageRect * texDamageRect = tex->damageRects;
for (RECT *dirtyRect = dirtyRects;
dirtyRect < dirtyRects + dirtyRectsCount;
dirtyRect++)
@@ -1085,7 +1085,7 @@ static void computeFrameDamage(Texture * tex)
moveRect->SourcePoint.y == moveRect->DestinationRect.top)
continue;
*texDamageRect++ = (FrameDamageRect)
*texDamageRect++ = (KVMFRFrameDamageRect)
{
.x = floor((double)moveRect->SourcePoint.x * this->scaleX),
.y = floor((double)moveRect->SourcePoint.y * this->scaleY),
@@ -1110,14 +1110,14 @@ static void computeTexDamage(Texture * tex)
else
{
memcpy(tex->texDamageRects + tex->texDamageCount, tex->damageRects,
tex->damageRectsCount * sizeof(FrameDamageRect));
tex->damageRectsCount * sizeof(KVMFRFrameDamageRect));
tex->texDamageCount += tex->damageRectsCount;
tex->texDamageCount = rectsMergeOverlapping(tex->texDamageRects, tex->texDamageCount);
}
}
static CaptureResult dxgi_capture(unsigned frameBufferIndex,
FrameBuffer * frameBuffer)
KVMFRFrameBuffer * frameBuffer)
{
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
@@ -1317,7 +1317,7 @@ static CaptureResult dxgi_capture(unsigned frameBufferIndex,
{
for (int i = 0; i < tex->texDamageCount; ++i)
{
FrameDamageRect rect = tex->texDamageRects[i];
KVMFRFrameDamageRect rect = tex->texDamageRects[i];
// correct the damage rect for BGR packed data
if (this->outputFormat == CAPTURE_FMT_BGR_32)
@@ -1505,10 +1505,10 @@ static CaptureResult dxgi_waitFrame(unsigned frameBufferIndex,
}
static CaptureResult dxgi_getFrame(
unsigned frameBufferIndex,
FrameBuffer * frame,
const size_t maxFrameSize,
CaptureFrame * captureFrame)
unsigned frameBufferIndex,
KVMFRFrameBuffer * frame,
const size_t maxFrameSize,
CaptureFrame * captureFrame)
{
(void)captureFrame;
DEBUG_ASSERT(this);
@@ -1550,12 +1550,13 @@ static CaptureResult dxgi_getFrame(
if (this->outputFormat == CAPTURE_FMT_BGR_32)
{
FrameDamageRect scaledDamageRects[damage->count];
for (int i = 0; i < ARRAYSIZE(scaledDamageRects); i++) {
FrameDamageRect rect = damage->rects[i];
int originalX = rect.x;
int scaledX = originalX * 3 / 4;
rect.x = scaledX;
KVMFRFrameDamageRect scaledDamageRects[damage->count];
for (int i = 0; i < ARRAYSIZE(scaledDamageRects); i++)
{
KVMFRFrameDamageRect rect = damage->rects[i];
int originalX = rect.x;
int scaledX = originalX * 3 / 4;
rect.x = scaledX;
rect.width = (((originalX + rect.width) * 3 + 3) / 4) - scaledX;
scaledDamageRects[i] = rect;