mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-09-01 11:43:53 +00:00
[repos] lgprotocol: import shared protocol definitions
Some checks are pending
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / module (push) Waiting to run
build / host-linux (push) Waiting to run
build / host-windows-cross (push) Waiting to run
build / host-windows-native (push) Waiting to run
build / idd (push) Waiting to run
build / obs (clang) (push) Waiting to run
build / obs (gcc) (push) Waiting to run
build / docs (push) Waiting to run
Some checks are pending
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Waiting to run
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Waiting to run
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Waiting to run
build / module (push) Waiting to run
build / host-linux (push) Waiting to run
build / host-windows-cross (push) Waiting to run
build / host-windows-native (push) Waiting to run
build / idd (push) Waiting to run
build / obs (clang) (push) Waiting to run
build / obs (gcc) (push) Waiting to run
build / docs (push) Waiting to run
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:
@@ -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 "common/event.h"
|
||||
#include "common/locking.h"
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "kb.h"
|
||||
|
||||
#include "common/KVMFRInput.h"
|
||||
#include "common/LGMPConfig.h"
|
||||
#include <LGProtocol/KVMFRInput.h>
|
||||
#include <LGProtocol/LGMPConfig.h>
|
||||
#include "common/debug.h"
|
||||
#include "common/event.h"
|
||||
#include "common/locking.h"
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
#include "clipboard.h"
|
||||
#include "input.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/event.h"
|
||||
#include "common/ivshmem.h"
|
||||
@@ -1808,10 +1808,11 @@ static bool lgmp_validateFrameMessage(LG_Transport * this,
|
||||
|
||||
const size_t messageSize = message->message.size;
|
||||
if (frame->offset < sizeof(KVMFRFrame) ||
|
||||
frame->offset > messageSize - sizeof(FrameBuffer) ||
|
||||
frameDataSize > messageSize - frame->offset - sizeof(FrameBuffer) ||
|
||||
frame->offset > messageSize - sizeof(KVMFRFrameBuffer) ||
|
||||
frameDataSize > messageSize - frame->offset -
|
||||
sizeof(KVMFRFrameBuffer) ||
|
||||
(uintptr_t)((const uint8_t *)message->message.mem + frame->offset) %
|
||||
_Alignof(FrameBuffer))
|
||||
_Alignof(KVMFRFrameBuffer))
|
||||
{
|
||||
DEBUG_ERROR("LGMP frame payload contains invalid dimensions or offsets");
|
||||
return false;
|
||||
@@ -1876,10 +1877,10 @@ static int lgmp_getDMA(struct LG_Transport * this,
|
||||
const size_t position = address - base;
|
||||
if (position > this->lgmpSize ||
|
||||
frameOffset > this->lgmpSize - position ||
|
||||
sizeof(FrameBuffer) > this->lgmpSize - position - frameOffset)
|
||||
sizeof(KVMFRFrameBuffer) > this->lgmpSize - position - frameOffset)
|
||||
return -1;
|
||||
|
||||
const size_t offset = position + frameOffset + sizeof(FrameBuffer);
|
||||
const size_t offset = position + frameOffset + sizeof(KVMFRFrameBuffer);
|
||||
if (dataSize > this->lgmpSize - offset)
|
||||
return -1;
|
||||
|
||||
@@ -2082,7 +2083,7 @@ static LG_TransportStatus lgmp_nextFrameLocked(LG_Transport * this,
|
||||
memcpy(&lease->format, format, sizeof(lease->format));
|
||||
result->format = &lease->format;
|
||||
|
||||
result->framebuffer = (const FrameBuffer *)
|
||||
result->framebuffer = (const KVMFRFrameBuffer *)
|
||||
((const uint8_t *)selected->sharedFrame + frame->offset);
|
||||
result->dmaFD = -1;
|
||||
if (useDMA)
|
||||
@@ -2214,7 +2215,8 @@ static void lgmp_getFrameTiming(LG_Transport * this,
|
||||
timing->prepareTime = lease->prepareTime;
|
||||
}
|
||||
|
||||
/* The producer writes these immediately after publishing FrameBuffer::wp.
|
||||
/* The producer writes these immediately after publishing
|
||||
* KVMFRFrameBuffer::wp.
|
||||
* nextFrame can observe the header earlier, so briefly observe the
|
||||
* publication tail after onFrame consumes the framebuffer without sleeping
|
||||
* the frame-acquisition thread. */
|
||||
|
||||
@@ -47,11 +47,11 @@ enum TestDamageMode
|
||||
|
||||
struct TestFormat
|
||||
{
|
||||
const char * name;
|
||||
FrameType type;
|
||||
unsigned bytesPerPixel;
|
||||
bool hdr;
|
||||
bool hdrPQ;
|
||||
const char * name;
|
||||
KVMFRFrameType type;
|
||||
unsigned bytesPerPixel;
|
||||
bool hdr;
|
||||
bool hdrPQ;
|
||||
};
|
||||
|
||||
static const struct TestFormat testFormats[] =
|
||||
@@ -66,7 +66,7 @@ static const struct TestFormat testFormats[] =
|
||||
|
||||
struct TestBuffer
|
||||
{
|
||||
FrameBuffer * framebuffer;
|
||||
KVMFRFrameBuffer * framebuffer;
|
||||
};
|
||||
|
||||
struct LG_Transport
|
||||
@@ -89,7 +89,7 @@ struct LG_Transport
|
||||
uint64_t framePrepareTime;
|
||||
unsigned bufferIndex;
|
||||
struct TestBuffer buffers[TEST_BUFFER_COUNT];
|
||||
FrameDamageRect damage[LG_TRANSPORT_MAX_DAMAGE_RECTS];
|
||||
KVMFRFrameDamageRect damage[LG_TRANSPORT_MAX_DAMAGE_RECTS];
|
||||
LG_TransportFrameFormat format;
|
||||
uint16_t pqLUT[TEST_PQ_LUT_SIZE + 1];
|
||||
};
|
||||
@@ -348,7 +348,7 @@ static bool test_create(LG_Transport ** result)
|
||||
stride < 0 || (stride && stride < width) ||
|
||||
bufferStride > UINT32_MAX / maxBytesPerPixel ||
|
||||
frameRate < 1 || frameRate > 1000000000 || frameCount < 0 ||
|
||||
bufferStride > (SIZE_MAX - sizeof(FrameBuffer)) /
|
||||
bufferStride > (SIZE_MAX - sizeof(KVMFRFrameBuffer)) /
|
||||
maxBytesPerPixel / (size_t)height)
|
||||
{
|
||||
DEBUG_ERROR(
|
||||
@@ -373,7 +373,8 @@ static bool test_create(LG_Transport ** result)
|
||||
bufferStride * this->height * maxBytesPerPixel;
|
||||
for (unsigned i = 0; i < TEST_BUFFER_COUNT; ++i)
|
||||
{
|
||||
this->buffers[i].framebuffer = malloc(sizeof(FrameBuffer) + dataSize);
|
||||
this->buffers[i].framebuffer =
|
||||
malloc(sizeof(KVMFRFrameBuffer) + dataSize);
|
||||
if (!this->buffers[i].framebuffer)
|
||||
{
|
||||
for (unsigned j = 0; j < i; ++j)
|
||||
@@ -515,7 +516,8 @@ static void test_getColor(const struct LG_Transport * this,
|
||||
*b = color;
|
||||
}
|
||||
|
||||
static void test_generateFrame(struct LG_Transport * this, FrameBuffer * fb)
|
||||
static void test_generateFrame(struct LG_Transport * this,
|
||||
KVMFRFrameBuffer * fb)
|
||||
{
|
||||
uint8_t * data = framebuffer_get_data(fb);
|
||||
if (this->stride)
|
||||
@@ -653,13 +655,13 @@ static LG_TransportStatus test_nextFrame(LG_Transport * this, bool useDMA,
|
||||
this->width - boxSize : 1;
|
||||
const unsigned rangeY = this->height > boxSize ?
|
||||
this->height - boxSize : 1;
|
||||
this->damage[0] = (FrameDamageRect) {
|
||||
this->damage[0] = (KVMFRFrameDamageRect) {
|
||||
.x = ((this->serial - 1) * 7) % rangeX,
|
||||
.y = ((this->serial - 1) * 5) % rangeY,
|
||||
.width = boxSize,
|
||||
.height = boxSize,
|
||||
};
|
||||
this->damage[1] = (FrameDamageRect) {
|
||||
this->damage[1] = (KVMFRFrameDamageRect) {
|
||||
.x = (this->serial * 7) % rangeX,
|
||||
.y = (this->serial * 5) % rangeY,
|
||||
.width = boxSize,
|
||||
@@ -680,12 +682,12 @@ static LG_TransportStatus test_nextFrame(LG_Transport * this, bool useDMA,
|
||||
|
||||
case TEST_DAMAGE_MAX:
|
||||
for (unsigned i = 2; i < ARRAY_LENGTH(this->damage); ++i)
|
||||
this->damage[i] = (FrameDamageRect) {0};
|
||||
this->damage[i] = (KVMFRFrameDamageRect) {0};
|
||||
frame->damageRectsCount = ARRAY_LENGTH(this->damage);
|
||||
break;
|
||||
|
||||
case TEST_DAMAGE_INVALID:
|
||||
this->damage[0] = (FrameDamageRect) {
|
||||
this->damage[0] = (KVMFRFrameDamageRect) {
|
||||
.x = this->width, .y = 0, .width = 1, .height = 1
|
||||
};
|
||||
frame->damageRectsCount = 1;
|
||||
@@ -697,7 +699,7 @@ static LG_TransportStatus test_nextFrame(LG_Transport * this, bool useDMA,
|
||||
break;
|
||||
|
||||
case TEST_DAMAGE_ZERO:
|
||||
this->damage[2] = (FrameDamageRect) {0};
|
||||
this->damage[2] = (KVMFRFrameDamageRect) {0};
|
||||
frame->damageRectsCount = 3;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user