[client] transport: introduce pluggable frame transports
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

Move shared-memory ownership, LGMP session handling, queue access, and
DMA setup behind a transport interface. The LGMP backend preserves the
existing zero-copy frame and DMA paths while owning its lgmp:* options.

Expose the initialized EGL context through a versioned renderer interop
record for future accelerated decode backends. Add an LGMP-independent,
deterministic test transport for graphics-pipeline validation.
This commit is contained in:
Geoffrey McRae
2026-07-20 05:09:43 +00:00
parent d4b3506e6c
commit 36b33033a1
22 changed files with 2138 additions and 819 deletions

View File

@@ -101,8 +101,8 @@ struct EGL_Cursor
_Atomic(float) mapHDRContentPeak;
bool colorTransformUpdate;
KVMFRColorTransform pendingColorTransform;
KVMFRColorTransform activeColorTransform;
LGColorTransform pendingColorTransform;
LGColorTransform activeColorTransform;
GLuint colorLUT;
struct CursorTex norm;
@@ -239,7 +239,7 @@ bool egl_cursorInit(EGL_Cursor ** cursor)
atomic_init(&(*cursor)->scale , 1.0f );
atomic_init(&(*cursor)->sourceTransfer , CURSOR_TRANSFER_SRGB);
atomic_init(&(*cursor)->sdrWhiteLevel ,
KVMFR_SDR_WHITE_LEVEL_DEFAULT);
LG_SDR_WHITE_LEVEL_DEFAULT);
atomic_init(&(*cursor)->mapHDRtoSDR , false);
atomic_init(&(*cursor)->mapHDRGain , 1.0f );
atomic_init(&(*cursor)->mapHDRContentPeak, 1.0f );
@@ -301,7 +301,7 @@ bool egl_cursorSetShape(EGL_Cursor * cursor, const LG_RendererCursor type,
}
void egl_cursorSetColorTransform(EGL_Cursor * cursor,
const KVMFRColorTransform * transform)
const LGColorTransform * transform)
{
LG_LOCK(cursor->lock);
cursor->pendingColorTransform = *transform;
@@ -351,7 +351,7 @@ struct CursorState egl_cursorRender(EGL_Cursor * cursor,
cursor->activeColorTransform = cursor->pendingColorTransform;
cursor->colorTransformUpdate = false;
if (cursor->activeColorTransform.flags & KVMFR_COLOR_TRANSFORM_LUT)
if (cursor->activeColorTransform.flags & LG_COLOR_TRANSFORM_LUT)
{
if (!cursor->colorLUT)
glGenTextures(1, &cursor->colorLUT);
@@ -568,5 +568,5 @@ void egl_cursorSetHDRState(EGL_Cursor * cursor, bool sourceHDR,
void egl_cursorSetSDRWhiteLevel(EGL_Cursor * cursor, float sdrWhiteLevel)
{
atomic_store(&cursor->sdrWhiteLevel, sdrWhiteLevel > 0.0f ?
sdrWhiteLevel : KVMFR_SDR_WHITE_LEVEL_DEFAULT);
sdrWhiteLevel : LG_SDR_WHITE_LEVEL_DEFAULT);
}

View File

@@ -44,7 +44,7 @@ bool egl_cursorSetShape(
const uint8_t * data);
void egl_cursorSetColorTransform(EGL_Cursor * cursor,
const KVMFRColorTransform * transform);
const LGColorTransform * transform);
void egl_cursorSetSize(EGL_Cursor * cursor, const float x, const float y);

View File

@@ -20,7 +20,6 @@
#include "damage.h"
#include "common/debug.h"
#include "common/KVMFR.h"
#include "common/locking.h"
#include "app.h"
@@ -89,7 +88,7 @@ bool egl_damageInit(EGL_Damage ** damage)
return false;
}
if (!egl_desktopRectsInit(&(*damage)->mesh, KVMFR_MAX_DAMAGE_RECTS))
if (!egl_desktopRectsInit(&(*damage)->mesh, LG_MAX_FRAME_DAMAGE_RECTS))
{
DEBUG_ERROR("Failed to initialize the mesh");
return false;

View File

@@ -21,14 +21,14 @@
#pragma once
#include <stdbool.h>
#include "common/KVMFR.h"
#include "common/types.h"
#include "interface/renderer.h"
#include "desktop_rects.h"
struct DesktopDamage
{
int count;
FrameDamageRect rects[KVMFR_MAX_DAMAGE_RECTS];
FrameDamageRect rects[LG_MAX_FRAME_DAMAGE_RECTS];
};
typedef struct EGL_Damage EGL_Damage;

View File

@@ -21,7 +21,6 @@
#include "desktop_rects.h"
#include "state.h"
#include "common/debug.h"
#include "common/KVMFR.h"
#include "common/locking.h"
#include <math.h>

View File

@@ -23,7 +23,6 @@
#include "common/util.h"
#include "common/array.h"
#include "common/debug.h"
#include "common/KVMFR.h"
#include "common/option.h"
#include "common/sysinfo.h"
#include "common/rects.h"
@@ -57,7 +56,7 @@
#define MAX_BUFFER_AGE 3
#define DESKTOP_DAMAGE_COUNT 4
#define DESKTOP_DAMAGE_MARGIN 1
#define MAX_ACCUMULATED_DAMAGE ((KVMFR_MAX_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2) * MAX_BUFFER_AGE)
#define MAX_ACCUMULATED_DAMAGE ((LG_MAX_FRAME_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2) * MAX_BUFFER_AGE)
#define IDX_AGO(counter, i, total) (((counter) + (total) - (i)) % (total))
struct Options
@@ -361,6 +360,23 @@ static bool egl_supports(LG_Renderer * renderer, LG_RendererSupport flag)
}
}
static bool egl_getInterop(LG_Renderer * renderer,
LG_RendererInterop * interop)
{
struct Inst * this = UPCAST(struct Inst, renderer);
if (!this->display || !this->context || !this->configs ||
interop->size < sizeof(*interop))
return false;
interop->version = LG_RENDERER_INTEROP_VERSION;
interop->type = LG_RENDERER_INTEROP_EGL;
interop->egl.display = this->display;
interop->egl.config = this->configs;
interop->egl.shareContext = this->context;
interop->egl.dmaBufImport = this->dmaSupport;
return true;
}
static void egl_onRestart(LG_Renderer * renderer)
{
struct Inst * this = UPCAST(struct Inst, renderer);
@@ -598,7 +614,7 @@ static bool egl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cur
}
static void egl_onMouseColorTransform(LG_Renderer * renderer,
const KVMFRColorTransform * transform)
const LGColorTransform * transform)
{
struct Inst * this = UPCAST(struct Inst, renderer);
egl_cursorSetColorTransform(this->cursor, transform);
@@ -753,7 +769,7 @@ static bool egl_onFrame(LG_Renderer * renderer, const FrameBuffer * frame, int d
if (unlikely(
damage->count == -1 ||
damageRectsCount == 0 ||
damage->count + damageRectsCount >= KVMFR_MAX_DAMAGE_RECTS))
damage->count + damageRectsCount >= LG_MAX_FRAME_DAMAGE_RECTS))
{
damage->count = -1;
}
@@ -1441,7 +1457,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
egl_damageRender(this->damage, rotate, newFrame ? desktopDamage : NULL) |
invalidateWindow;
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2];
struct Rect damage[LG_MAX_FRAME_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2];
int damageIdx = app_renderOverlay(damage, MAX_OVERLAY_RECTS);
if (unlikely(damageIdx != 0))
{
@@ -1631,6 +1647,7 @@ struct LG_RendererOps LGR_EGL =
.initialize = egl_initialize,
.deinitialize = egl_deinitialize,
.supports = egl_supports,
.getInterop = egl_getInterop,
.onRestart = egl_onRestart,
.onResize = egl_onResize,
.onMouseShape = egl_onMouseShape,

View File

@@ -22,13 +22,12 @@
#include "texture_buffer.h"
#include "common/debug.h"
#include "common/KVMFR.h"
#include "common/rects.h"
struct TexDamage
{
int count;
FrameDamageRect rects[KVMFR_MAX_DAMAGE_RECTS];
FrameDamageRect rects[LG_MAX_FRAME_DAMAGE_RECTS];
};
typedef struct TexFB
@@ -90,7 +89,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
struct TexDamage * damage = this->damage + parent->bufIndex;
bool damageAll = !update->rects || update->rectCount == 0 || damage->count < 0 ||
damage->count + update->rectCount > KVMFR_MAX_DAMAGE_RECTS;
damage->count + update->rectCount > LG_MAX_FRAME_DAMAGE_RECTS;
bool complete;
if (damageAll)
@@ -168,7 +167,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
if (i == parent->bufIndex)
damage->count = 0;
else if (update->rects && update->rectCount > 0 && damage->count >= 0 &&
damage->count + update->rectCount <= KVMFR_MAX_DAMAGE_RECTS)
damage->count + update->rectCount <= LG_MAX_FRAME_DAMAGE_RECTS)
{
memcpy(damage->rects + damage->count, update->rects,
update->rectCount * sizeof(FrameDamageRect));