[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

@@ -959,6 +959,10 @@ target_include_directories(render-tests PRIVATE
"${PROJECT_TOP}/common/include"
)
target_link_libraries(render-tests
LGProtocol::LGProtocol
)
if(TARGET GTest::gtest_main)
target_link_libraries(render-tests GTest::gtest_main)
else()

View File

@@ -23,7 +23,7 @@
#include "test.h"
#include "common/debug.h"
#include "common/KVMFRClipboard.h"
#include <LGProtocol/KVMFRClipboard.h>
#include <fcntl.h>
#include <pthread.h>

View File

@@ -46,14 +46,14 @@ static void testRotations(void)
{ .x = 140, .y = 10, .w = 40, .h = 20 },
{ .x = 20, .y = 10, .w = 40, .h = 20 },
};
const FrameDamageRect damage =
const KVMFRFrameDamageRect damage =
{
.x = 10,
.y = 5,
.width = 20,
.height = 10,
};
const FrameDamageRect full =
const KVMFRFrameDamageRect full =
{
.width = 100,
.height = 50,
@@ -79,7 +79,7 @@ static void testFractional(void)
double matrix[6];
egl_desktopToScreenMatrix(matrix, 3, 2, 0.0, 0.0, 1.0, 1.0,
LG_ROTATE_0, 10.0, 7.0);
const FrameDamageRect damage =
const KVMFRFrameDamageRect damage =
{
.x = 1,
.width = 1,
@@ -90,7 +90,7 @@ static void testFractional(void)
egl_desktopToScreenMatrix(matrix, 100, 50, 0.1, -0.2, 0.5, 0.75,
LG_ROTATE_0, 10.0, 7.0);
const FrameDamageRect full =
const KVMFRFrameDamageRect full =
{
.width = 100,
.height = 50,
@@ -101,7 +101,7 @@ static void testFractional(void)
static void testRoundTrip(void)
{
const FrameDamageRect damage =
const KVMFRFrameDamageRect damage =
{
.x = 10,
.y = 5,
@@ -119,7 +119,7 @@ static void testRoundTrip(void)
(LG_RendererRotate)i, 200.0, 100.0);
const struct Rect screen = egl_desktopToScreen(forward, &damage);
FrameDamageRect result;
KVMFRFrameDamageRect result;
CHECK(egl_screenToDesktop(&result, inverse, &screen, 100, 50));
CHECK(result.x <= damage.x);
CHECK(result.y <= damage.y);
@@ -141,7 +141,7 @@ static void testClipping(void)
.w = 10,
.h = 10,
};
FrameDamageRect result;
KVMFRFrameDamageRect result;
CHECK(!egl_screenToDesktop(&result, matrix, &outside, 100, 50));
const struct Rect edge =

View File

@@ -126,7 +126,7 @@ void renderQueue_sourceCursorImage(RenderQueueSource source,
}
void renderQueue_sourceCursorColorTransform(RenderQueueSource source,
uint64_t generation, const LGColorTransform * transform)
uint64_t generation, const KVMFRColorTransform * transform)
{
(void)source;
(void)generation;

View File

@@ -20,8 +20,8 @@
#include "clipboard.h"
#include "common/KVMFRClipboard.h"
#include "common/LGMPConfig.h"
#include <LGProtocol/KVMFRClipboard.h>
#include <LGProtocol/LGMPConfig.h>
#include "common/debug.h"
#include <lgmp/client.h>

View File

@@ -20,8 +20,8 @@
#include "interface/transport.h"
#include "common/KVMFR.h"
#include "common/LGMPConfig.h"
#include <LGProtocol/KVMFR.h>
#include <LGProtocol/LGMPConfig.h>
#include "common/debug.h"
#include "common/option.h"
@@ -110,7 +110,7 @@ static bool allocMemory(TestState * state, uint32_t size, uint32_t alignment,
static bool newFrame(TestState * state, uint32_t serial, TestFrame * result)
{
const uint32_t size = sizeof(KVMFRFrame) + sizeof(FrameBuffer) +
const uint32_t size = sizeof(KVMFRFrame) + sizeof(KVMFRFrameBuffer) +
TEST_FRAME_DATA;
void * pointer;
CHECK(allocMemory(state, size, _Alignof(KVMFRFrame),
@@ -132,7 +132,8 @@ static bool newFrame(TestState * state, uint32_t serial, TestFrame * result)
result->wire->offset = sizeof(KVMFRFrame);
result->wire->sdrWhiteLevel = KVMFR_SDR_WHITE_LEVEL_DEFAULT;
FrameBuffer * framebuffer = (FrameBuffer *)((uint8_t *)result->wire +
KVMFRFrameBuffer * framebuffer =
(KVMFRFrameBuffer *)((uint8_t *)result->wire +
result->wire->offset);
atomic_store(&framebuffer->wp, TEST_FRAME_DATA);
return true;

View File

@@ -20,8 +20,8 @@
#include "../transports/LGMP/input.h"
#include "common/KVMFRInput.h"
#include "common/LGMPConfig.h"
#include <LGProtocol/KVMFRInput.h>
#include <LGProtocol/LGMPConfig.h>
#include "common/debug.h"
#include <lgmp/client.h>

View File

@@ -20,9 +20,9 @@
#include "interface/transport.h"
#include "common/KVMFR.h"
#include "common/KVMFRRecovery.h"
#include "common/LGMPConfig.h"
#include <LGProtocol/KVMFR.h>
#include <LGProtocol/KVMFRRecovery.h>
#include <LGProtocol/LGMPConfig.h>
#include "common/debug.h"
#include "common/option.h"
@@ -380,7 +380,7 @@ int main(void)
.subTimeout = TEST_TIMEOUT,
};
const uint32_t frameSize =
sizeof(KVMFRFrame) + sizeof(FrameBuffer) + sizeof(uint32_t);
sizeof(KVMFRFrame) + sizeof(KVMFRFrameBuffer) + sizeof(uint32_t);
CHECK(lgmpHostMemAllocAligned(host, frameSize, _Alignof(KVMFRFrame),
&frameMemory) == LGMP_OK);
KVMFRFrame * wireFrame = lgmpHostMemPtr(frameMemory);
@@ -404,7 +404,8 @@ int main(void)
wireFrame->readyTime = 400;
wireFrame->timingSerial = wireFrame->frameSerial;
wireFrame->timingValid = 1;
FrameBuffer * framebuffer = (FrameBuffer *)((uint8_t *)wireFrame +
KVMFRFrameBuffer * framebuffer =
(KVMFRFrameBuffer *)((uint8_t *)wireFrame +
wireFrame->offset);
atomic_store(&framebuffer->wp, sizeof(uint32_t));
CHECK(lgmpHostMemAlloc(host, sizeof(KVMFRFrame) - 1,

View File

@@ -73,26 +73,26 @@ struct Fake
uint8_t bitmap[64];
size_t bitmapSize;
unsigned int shapeCount;
LG_RendererCursor shapeType;
int shapeWidth;
int shapeHeight;
int shapePitch;
uint8_t shape[64];
size_t shapeSize;
unsigned int cursorCount;
bool cursorVisible;
int cursorX;
int cursorY;
int cursorHX;
int cursorHY;
unsigned int colorCount;
LGColorTransformFlags colorFlags;
float colorScalar;
float colorMatrix;
float colorLut;
unsigned int whiteCount;
uint32_t whiteLevel;
unsigned int shapeCount;
LG_RendererCursor shapeType;
int shapeWidth;
int shapeHeight;
int shapePitch;
uint8_t shape[64];
size_t shapeSize;
unsigned int cursorCount;
bool cursorVisible;
int cursorX;
int cursorY;
int cursorHX;
int cursorHY;
unsigned int colorCount;
KVMFRColorTransformFlags colorFlags;
float colorScalar;
float colorMatrix;
float colorLut;
unsigned int whiteCount;
uint32_t whiteLevel;
unsigned int hdrCount;
LG_RendererFormat hdr[8];
@@ -200,7 +200,7 @@ static bool mouseEvent(LG_Renderer * renderer, bool visible,
}
static void mouseColor(LG_Renderer * renderer,
const LGColorTransform * color)
const KVMFRColorTransform * color)
{
(void)renderer;
++f.colorCount;
@@ -436,7 +436,7 @@ static void testPayload(void)
11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26,
};
LGColorTransform color =
KVMFRColorTransform color =
{
.flags = LG_COLOR_TRANSFORM_MATRIX | LG_COLOR_TRANSFORM_LUT,
.matrix[0][0] = 2.0f,
@@ -540,7 +540,7 @@ static void testCache(void)
const uint64_t generation =
renderQueue_sourceBegin(RENDER_QUEUE_SOURCE_PRIMARY);
const uint8_t shape[] = { 1, 2, 3, 4 };
LGColorTransform color =
KVMFRColorTransform color =
{
.flags = LG_COLOR_TRANSFORM_MATRIX,
.matrix[0][0] = 1.5f,
@@ -637,7 +637,7 @@ static void testCursorReplacement(void)
const uint64_t generation =
renderQueue_sourceBegin(RENDER_QUEUE_SOURCE_PRIMARY);
const uint8_t shape[] = { 1, 2, 3, 4 };
LGColorTransform color =
KVMFRColorTransform color =
{
.flags = LG_COLOR_TRANSFORM_LUT,
.scalar = 2.0f,

View File

@@ -57,10 +57,10 @@ constexpr unsigned kFrameSerial = 4;
struct FormatCase
{
const char * name;
FrameType type;
bool hdr;
bool pq;
const char * name;
KVMFRFrameType type;
bool hdr;
bool pq;
};
struct DamageCase

View File

@@ -26,7 +26,7 @@
#include "core/clipboard_files.h"
#include "common/debug.h"
#include "common/KVMFRClipboard.h"
#include <LGProtocol/KVMFRClipboard.h>
#include <stdint.h>
#include <stdio.h>