mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-09-02 04:03:56 +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:
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(looking-glass-host C)
|
||||
project(looking-glass-host C CXX)
|
||||
|
||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||
|
||||
|
||||
@@ -22,13 +22,9 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "common/KVMFR.h"
|
||||
#include <LGProtocol/KVMFR.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* using common/framebuffer.h breaks compatibillity with C++ due to it's usage
|
||||
* of stdatomic.h, so we need to forward declare the structure here */
|
||||
typedef struct stFrameBuffer FrameBuffer;
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
#include "common/framebuffer.h"
|
||||
#endif
|
||||
|
||||
@@ -95,8 +91,8 @@ typedef struct CaptureFrame
|
||||
uint32_t hdrMaxFrameAverageLightLevel;
|
||||
uint32_t sdrWhiteLevel;
|
||||
|
||||
uint32_t damageRectsCount;
|
||||
FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
|
||||
uint32_t damageRectsCount;
|
||||
KVMFRFrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
|
||||
|
||||
// Producer-local durations. Absolute timestamps must not cross KVMFR as the
|
||||
// client and producer use different monotonic clock domains.
|
||||
@@ -148,18 +144,18 @@ typedef struct CaptureInterface
|
||||
void (*free )(void);
|
||||
|
||||
CaptureResult (*capture )(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame);
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frame);
|
||||
CaptureResult (*waitFrame )(
|
||||
unsigned frameBufferIndex,
|
||||
CaptureFrame * frame,
|
||||
/* Capacity of FrameBuffer::data, excluding the message and header. */
|
||||
const size_t maxFrameSize);
|
||||
CaptureResult (*getFrame )(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame,
|
||||
/* Capacity of FrameBuffer::data, excluding the message and header. */
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame);
|
||||
CaptureFrame * frame,
|
||||
/* Capacity of KVMFRFrameBuffer::data, excluding message and header. */
|
||||
const size_t maxFrameSize);
|
||||
CaptureResult (*getFrame )(
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frame,
|
||||
/* Capacity of KVMFRFrameBuffer::data, excluding message and header. */
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame);
|
||||
}
|
||||
CaptureInterface;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "common/KVMFR.h"
|
||||
#include <LGProtocol/KVMFR.h>
|
||||
|
||||
// exit code for user opted to exit looking-glass-host
|
||||
#define LG_HOST_EXIT_USER 0x10
|
||||
|
||||
@@ -247,7 +247,7 @@ static void xcb_free(void)
|
||||
|
||||
static CaptureResult xcb_capture(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame)
|
||||
KVMFRFrameBuffer * frame)
|
||||
{
|
||||
DEBUG_ASSERT(this);
|
||||
DEBUG_ASSERT(this->initialized);
|
||||
@@ -299,10 +299,10 @@ static CaptureResult xcb_waitFrame(
|
||||
}
|
||||
|
||||
static CaptureResult xcb_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);
|
||||
|
||||
@@ -406,7 +406,7 @@ static void pipewire_free(void)
|
||||
|
||||
static CaptureResult pipewire_capture(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame)
|
||||
KVMFRFrameBuffer * frame)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -463,10 +463,10 @@ static CaptureResult pipewire_waitFrame(
|
||||
}
|
||||
|
||||
static CaptureResult pipewire_getFrame(
|
||||
unsigned frameBufferIndex,
|
||||
FrameBuffer * frame,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
unsigned frameBufferIndex,
|
||||
KVMFRFrameBuffer * frame,
|
||||
const size_t maxFrameSize,
|
||||
CaptureFrame * captureFrame)
|
||||
{
|
||||
(void)captureFrame;
|
||||
if (this->stop || !this->frameData)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "common/debug.h"
|
||||
#include "common/option.h"
|
||||
#include "common/locking.h"
|
||||
#include "common/KVMFR.h"
|
||||
#include "common/LGMPConfig.h"
|
||||
#include <LGProtocol/KVMFR.h>
|
||||
#include <LGProtocol/LGMPConfig.h>
|
||||
#include "common/crash.h"
|
||||
#include "common/thread.h"
|
||||
#include "common/ivshmem.h"
|
||||
@@ -97,13 +97,13 @@ struct app
|
||||
unsigned int pointerIndex;
|
||||
unsigned int pointerShapeIndex;
|
||||
|
||||
unsigned alignSize;
|
||||
size_t frameMemorySize;
|
||||
size_t maxFrameSize;
|
||||
PLGMPHostQueue frameQueue;
|
||||
PLGMPMemory frameMemory[LGMP_Q_FRAME_LEN];
|
||||
KVMFRFrame * frame [LGMP_Q_FRAME_LEN];
|
||||
FrameBuffer * frameBuffer[LGMP_Q_FRAME_LEN];
|
||||
unsigned alignSize;
|
||||
size_t frameMemorySize;
|
||||
size_t maxFrameSize;
|
||||
PLGMPHostQueue frameQueue;
|
||||
PLGMPMemory frameMemory[LGMP_Q_FRAME_LEN];
|
||||
KVMFRFrame * frame [LGMP_Q_FRAME_LEN];
|
||||
KVMFRFrameBuffer * frameBuffer[LGMP_Q_FRAME_LEN];
|
||||
|
||||
unsigned int captureIndex;
|
||||
unsigned int readIndex;
|
||||
@@ -435,7 +435,7 @@ static bool sendFrame(CaptureResult result, bool * restart)
|
||||
}
|
||||
fi->damageRectsCount = frame.damageRectsCount;
|
||||
memcpy(fi->damageRects, frame.damageRects,
|
||||
frame.damageRectsCount * sizeof(FrameDamageRect));
|
||||
frame.damageRectsCount * sizeof(KVMFRFrameDamageRect));
|
||||
|
||||
app.frameValid = true;
|
||||
|
||||
@@ -879,7 +879,8 @@ static bool lgmpSetup(struct IVSHMEM * shmDev)
|
||||
|
||||
const size_t frameMemoryAvail = lgmpHostMemAvail(app.lgmp);
|
||||
if (!app.alignSize ||
|
||||
(size_t)app.alignSize < sizeof(KVMFRFrame) + sizeof(FrameBuffer) ||
|
||||
(size_t)app.alignSize <
|
||||
sizeof(KVMFRFrame) + sizeof(KVMFRFrameBuffer) ||
|
||||
(app.alignSize & (app.alignSize - 1)) ||
|
||||
frameMemoryAvail <= app.alignSize - 1)
|
||||
{
|
||||
@@ -888,8 +889,8 @@ static bool lgmpSetup(struct IVSHMEM * shmDev)
|
||||
}
|
||||
|
||||
/* Reserve the worst-case alignment padding once, then round each message
|
||||
* down so all frame allocations are guaranteed to fit. The FrameBuffer data
|
||||
* begins one alignment unit into each message. */
|
||||
* down so all frame allocations are guaranteed to fit. The KVMFRFrameBuffer
|
||||
* data begins one alignment unit into each message. */
|
||||
app.frameMemorySize = (frameMemoryAvail - (app.alignSize - 1)) /
|
||||
LGMP_Q_FRAME_LEN;
|
||||
app.frameMemorySize &= ~((size_t)app.alignSize - 1);
|
||||
@@ -918,9 +919,10 @@ static bool lgmpSetup(struct IVSHMEM * shmDev)
|
||||
|
||||
/* put the framebuffer on the border of the next page, this is to allow for
|
||||
aligned DMA transfers by the receiver */
|
||||
const unsigned alignOffset = app.alignSize - sizeof(FrameBuffer);
|
||||
const unsigned alignOffset = app.alignSize - sizeof(KVMFRFrameBuffer);
|
||||
app.frame[i]->offset = alignOffset;
|
||||
app.frameBuffer[i] = (FrameBuffer *)(((uint8_t*)app.frame[i]) + alignOffset);
|
||||
app.frameBuffer[i] =
|
||||
(KVMFRFrameBuffer *)(((uint8_t *)app.frame[i]) + alignOffset);
|
||||
}
|
||||
|
||||
atomic_store(&app.sdrWhiteLevel,
|
||||
|
||||
Reference in New Issue
Block a user