mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-09-02 12:13:54 +00:00
[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
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:
@@ -104,13 +104,13 @@ struct D12Interface
|
||||
struct
|
||||
{
|
||||
// the size of the frame buffer
|
||||
unsigned size;
|
||||
unsigned size;
|
||||
// the frame buffer it itself
|
||||
FrameBuffer * frameBuffer;
|
||||
KVMFRFrameBuffer * frameBuffer;
|
||||
// the resource backed by the framebuffer
|
||||
ID3D12Resource ** resource;
|
||||
ID3D12Resource ** resource;
|
||||
// the mapped resource if indirectCopy is in use
|
||||
void * map;
|
||||
void * map;
|
||||
}
|
||||
frameBuffers[0];
|
||||
};
|
||||
@@ -184,10 +184,10 @@ static bool d12_enumerateDevices(
|
||||
static bool d12_heapTest(ID3D12Device3 * device, ID3D12Heap * heap);
|
||||
|
||||
static ID3D12Resource * d12_frameBufferToResource(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frameBuffer,
|
||||
unsigned size,
|
||||
void ** map);
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frameBuffer,
|
||||
unsigned size,
|
||||
void ** map);
|
||||
|
||||
static bool d12_copyTimingInit(
|
||||
ID3D12Device3 * device, ID3D12CommandQueue * queue);
|
||||
@@ -778,7 +778,7 @@ static void d12_free(void)
|
||||
}
|
||||
|
||||
static CaptureResult d12_capture(
|
||||
unsigned frameBufferIndex, FrameBuffer * frameBuffer)
|
||||
unsigned frameBufferIndex, KVMFRFrameBuffer * frameBuffer)
|
||||
{
|
||||
DEBUG_TRACE("d12_backendCapture");
|
||||
return d12_backendCapture(this->backend, frameBufferIndex);
|
||||
@@ -958,11 +958,11 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
|
||||
|
||||
{
|
||||
// create a clean list of rects
|
||||
FrameDamageRect allRects[D12_MAX_DIRTY_RECTS];
|
||||
unsigned count = 0;
|
||||
KVMFRFrameDamageRect allRects[D12_MAX_DIRTY_RECTS];
|
||||
unsigned count = 0;
|
||||
for(const RECT * rect = desc.dirtyRects;
|
||||
rect < desc.dirtyRects + desc.nbDirtyRects; ++rect)
|
||||
allRects[count++] = (FrameDamageRect){
|
||||
allRects[count++] = (KVMFRFrameDamageRect){
|
||||
.x = rect->left,
|
||||
.y = rect->top,
|
||||
.width = (rect->right - rect->left),
|
||||
@@ -993,10 +993,10 @@ exit:
|
||||
}
|
||||
|
||||
static CaptureResult d12_getFrame(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frameBuffer,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frameBuffer,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
{
|
||||
const uint64_t postProcessStart = nanotime();
|
||||
captureFrame->postProcessTime = 0;
|
||||
@@ -1006,8 +1006,8 @@ static CaptureResult d12_getFrame(
|
||||
CaptureResult result = CAPTURE_RESULT_ERROR;
|
||||
comRef_scopePush(3);
|
||||
|
||||
D12FrameDesc desc;
|
||||
FrameDamageRect allRects[D12_MAX_DIRTY_RECTS * 2];
|
||||
D12FrameDesc desc;
|
||||
KVMFRFrameDamageRect allRects[D12_MAX_DIRTY_RECTS * 2];
|
||||
|
||||
comRef_defineLocal(ID3D12Resource, src);
|
||||
DEBUG_TRACE("d12_backendFetch");
|
||||
@@ -1142,7 +1142,7 @@ static CaptureResult d12_getFrame(
|
||||
* be redrawn by the client, such as under the cursor */
|
||||
for(const RECT * rect = this->dirtyRects;
|
||||
rect < this->dirtyRects + this->nbDirtyRects; ++rect)
|
||||
allRects[rectCount++] = (FrameDamageRect){
|
||||
allRects[rectCount++] = (KVMFRFrameDamageRect){
|
||||
.x = rect->left,
|
||||
.y = rect->top,
|
||||
.width = rect->right - rect->left,
|
||||
@@ -1152,7 +1152,7 @@ static CaptureResult d12_getFrame(
|
||||
/* add the new dirtyRects to the array */
|
||||
for(const RECT * rect = desc.dirtyRects;
|
||||
rect < desc.dirtyRects + desc.nbDirtyRects; ++rect)
|
||||
allRects[rectCount++] = (FrameDamageRect){
|
||||
allRects[rectCount++] = (KVMFRFrameDamageRect){
|
||||
.x = rect->left,
|
||||
.y = rect->top,
|
||||
.width = rect->right - rect->left,
|
||||
@@ -1163,7 +1163,8 @@ static CaptureResult d12_getFrame(
|
||||
rectCount = rectsMergeOverlapping(allRects, rectCount);
|
||||
|
||||
/* copy all the rects */
|
||||
for(FrameDamageRect * rect = allRects; rect < allRects + rectCount; ++rect)
|
||||
for(KVMFRFrameDamageRect * rect = allRects;
|
||||
rect < allRects + rectCount; ++rect)
|
||||
{
|
||||
D3D12_BOX box =
|
||||
{
|
||||
@@ -1476,7 +1477,7 @@ exit:
|
||||
}
|
||||
|
||||
static ID3D12Resource * d12_frameBufferToResource(unsigned frameBufferIndex,
|
||||
FrameBuffer * frameBuffer, unsigned size, void ** map)
|
||||
KVMFRFrameBuffer * frameBuffer, unsigned size, void ** map)
|
||||
{
|
||||
ID3D12Resource * result = NULL;
|
||||
comRef_scopePush(10);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "common/event.h"
|
||||
#include "common/rects.h"
|
||||
#include "common/thread.h"
|
||||
#include "common/KVMFR.h"
|
||||
#include "common/LGMPConfig.h"
|
||||
#include <LGProtocol/KVMFR.h>
|
||||
#include <LGProtocol/LGMPConfig.h>
|
||||
#include "common/vector.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdatomic.h>
|
||||
@@ -456,7 +456,7 @@ static void nvfbc_free(void)
|
||||
}
|
||||
|
||||
static CaptureResult nvfbc_capture(unsigned frameBufferIndex,
|
||||
FrameBuffer * frameBuffer)
|
||||
KVMFRFrameBuffer * frameBuffer)
|
||||
{
|
||||
// this is a bit of a hack as it causes this thread to block until the next
|
||||
// present keeping us locked with the refresh rate of the monitor being
|
||||
@@ -644,10 +644,10 @@ static void updateDamageRects(CaptureFrame * frame)
|
||||
int y1 = ds[c].y1 << this->diffShift;
|
||||
int x2 = min((ds[c].x2 + 1) << this->diffShift, this->grabWidth);
|
||||
int y2 = min((ds[c].y2 + 1) << this->diffShift, this->grabHeight);
|
||||
frame->damageRects[rectId++] = (FrameDamageRect) {
|
||||
.x = x1,
|
||||
.y = y1,
|
||||
.width = x2 - x1,
|
||||
frame->damageRects[rectId++] = (KVMFRFrameDamageRect) {
|
||||
.x = x1,
|
||||
.y = y1,
|
||||
.width = x2 - x1,
|
||||
.height = y2 - y1,
|
||||
};
|
||||
}
|
||||
@@ -719,10 +719,10 @@ static CaptureResult nvfbc_waitFrame(unsigned frameBufferIndex,
|
||||
}
|
||||
|
||||
static CaptureResult nvfbc_getFrame(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frame,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
{
|
||||
(void)captureFrame;
|
||||
const unsigned int h = DIFF_MAP_DIM(this->grabHeight, this->diffShift);
|
||||
|
||||
Reference in New Issue
Block a user