mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-11-17 07:28:44 +00:00
Compare commits
3 Commits
master
...
frame-timi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ee30b2308 | ||
|
|
714b1bce70 | ||
|
|
3ec632dd3c |
@@ -478,10 +478,11 @@ void core_handleMouseNormal(double ex, double ey)
|
||||
if (!g_state.stopVideo &&
|
||||
g_state.kvmfrFeatures & KVMFR_FEATURE_SETCURSORPOS)
|
||||
{
|
||||
const KVMFRSetCursorPos msg = {
|
||||
.msg.type = KVMFR_MESSAGE_SETCURSORPOS,
|
||||
.x = round(guest.x),
|
||||
.y = round(guest.y)
|
||||
const KVMFRMessage_SetCursorPos msg = {
|
||||
.msg.type = KVMFR_MESSAGE_SETCURSORPOS,
|
||||
.msg.clientID = g_state.clientID,
|
||||
.x = round(guest.x),
|
||||
.y = round(guest.y)
|
||||
};
|
||||
|
||||
uint32_t setPosSerial;
|
||||
|
||||
@@ -1433,7 +1433,8 @@ restart:
|
||||
initialSpiceEnable = 0;
|
||||
}
|
||||
|
||||
status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata);
|
||||
status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata,
|
||||
&g_state.clientID);
|
||||
switch(status)
|
||||
{
|
||||
case LGMP_OK:
|
||||
|
||||
@@ -121,6 +121,7 @@ struct AppState
|
||||
|
||||
struct IVSHMEM shm;
|
||||
PLGMPClient lgmp;
|
||||
uint32_t clientID;
|
||||
PLGMPClientQueue pointerQueue;
|
||||
LG_Lock pointerQueueLock;
|
||||
KVMFRFeatureFlags kvmfrFeatures;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#define KVMFR_MAGIC "KVMFR---"
|
||||
#define KVMFR_VERSION 19
|
||||
#define KVMFR_VERSION 20
|
||||
|
||||
#define KVMFR_MAX_DAMAGE_RECTS 64
|
||||
|
||||
@@ -56,7 +56,8 @@ typedef uint32_t KVMFRFeatureFlags;
|
||||
|
||||
enum
|
||||
{
|
||||
KVMFR_MESSAGE_SETCURSORPOS
|
||||
KVMFR_MESSAGE_SETCURSORPOS,
|
||||
KVMFR_MESSAGE_FRAME_TIME
|
||||
};
|
||||
|
||||
typedef uint32_t KVMFRMessageType;
|
||||
@@ -137,6 +138,8 @@ typedef struct KVMFRFrame
|
||||
{
|
||||
uint32_t formatVer; // the frame format version number
|
||||
uint32_t frameSerial; // the unique frame number
|
||||
uint64_t frameTimeUs; // when the capture was started
|
||||
uint64_t frameElapsedUs; // total time elapsed to capture the frame
|
||||
FrameType type; // the frame data type
|
||||
uint32_t screenWidth; // the client's screen width
|
||||
uint32_t screenHeight; // the client's screen height
|
||||
@@ -155,14 +158,28 @@ KVMFRFrame;
|
||||
typedef struct KVMFRMessage
|
||||
{
|
||||
KVMFRMessageType type;
|
||||
uint32_t clientID;
|
||||
}
|
||||
KVMFRMessage;
|
||||
|
||||
typedef struct KVMFRSetCursorPos
|
||||
typedef struct KVMFRMessage_SetCursorPos
|
||||
{
|
||||
KVMFRMessage msg;
|
||||
int32_t x, y;
|
||||
}
|
||||
KVMFRSetCursorPos;
|
||||
KVMFRMessage_SetCursorPos;
|
||||
|
||||
typedef struct KVMFRMessage_FrameTime
|
||||
{
|
||||
KVMFRMessage msg;
|
||||
/* this is the desired time to start the next capture operation where zero is
|
||||
* immediate. This is only a hint to the host application and may not be
|
||||
* honored. The value provided should be offset from the latest frame's
|
||||
* frameTimeUs. When multiple clients are sending this message, the one with
|
||||
* the lowest value will be used.
|
||||
*/
|
||||
uint64_t frameTimeUs;
|
||||
}
|
||||
KVMFRMessage_FrameTime;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -96,6 +96,7 @@ struct app
|
||||
unsigned int frameIndex;
|
||||
bool frameValid;
|
||||
uint32_t frameSerial;
|
||||
uint64_t frameTimeUs;
|
||||
|
||||
CaptureInterface * iface;
|
||||
|
||||
@@ -268,6 +269,7 @@ static bool sendFrame(void)
|
||||
}
|
||||
|
||||
fi->formatVer = frame.formatVer;
|
||||
fi->frameTimeUs = app.frameTimeUs;
|
||||
fi->frameSerial = app.frameSerial++;
|
||||
fi->screenWidth = frame.screenWidth;
|
||||
fi->screenHeight = frame.screenHeight;
|
||||
@@ -295,6 +297,11 @@ static bool sendFrame(void)
|
||||
FrameBuffer * fb = (FrameBuffer *)(((uint8_t*)fi) + fi->offset);
|
||||
framebuffer_prepare(fb);
|
||||
|
||||
// calculate the elapsed time as late as possible, note that this does not
|
||||
// take into account the memory copy time and the client's that care about
|
||||
// this value will need to take this into account
|
||||
fi->frameElapsedUs = microtime() - app.frameTimeUs;
|
||||
|
||||
/* we post and then get the frame, this is intentional! */
|
||||
if ((status = lgmpHostQueuePost(app.frameQueue, 0,
|
||||
app.frameMemory[app.frameIndex])) != LGMP_OK)
|
||||
@@ -911,6 +918,7 @@ int app_main(int argc, char * argv[])
|
||||
else
|
||||
previousFrameTime = now;
|
||||
|
||||
app.frameTimeUs = microtime();
|
||||
switch(iface->capture())
|
||||
{
|
||||
case CAPTURE_RESULT_OK:
|
||||
|
||||
Submodule repos/LGMP updated: 66ac3bae0b...1b170ad8d7
Reference in New Issue
Block a user