From 69b20aee05eab2ac52b9b0dbe8a943754eb4c569 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 10 Jul 2021 18:38:44 -0400 Subject: [PATCH] [common] kvmfr: add damage rectangles to the protocol Co-Authored-By: Tudor Brindus --- common/include/common/KVMFR.h | 28 ++++++++++++++++------------ common/include/common/types.h | 11 +++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index 9166802c..9075f03e 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -28,7 +28,9 @@ #include "types.h" #define KVMFR_MAGIC "KVMFR---" -#define KVMFR_VERSION 10 +#define KVMFR_VERSION 11 + +#define KVMFR_MAX_DAMAGE_RECTS 64 #define LGMP_Q_POINTER 1 #define LGMP_Q_FRAME 2 @@ -66,17 +68,19 @@ KVMFRCursor; typedef struct KVMFRFrame { - uint32_t formatVer; // the frame format version number - FrameType type; // the frame data type - uint32_t width; // the frame width - uint32_t height; // the frame height - uint32_t realHeight; // the real height if the frame was truncated due to low mem - FrameRotation rotation; // the frame rotation - uint32_t stride; // the row stride (zero if compressed data) - uint32_t pitch; // the row pitch (stride in bytes or the compressed frame size) - uint32_t offset; // offset from the start of this header to the FrameBuffer header - uint32_t mouseScalePercent; // movement scale factor of the mouse (relates to DPI of display, 100 = no scale) - bool blockScreensaver; // whether the guest has requested to block screensavers + uint32_t formatVer; // the frame format version number + FrameType type; // the frame data type + uint32_t width; // the frame width + uint32_t height; // the frame height + uint32_t realHeight; // the real height if the frame was truncated due to low mem + FrameRotation rotation; // the frame rotation + uint32_t stride; // the row stride (zero if compressed data) + uint32_t pitch; // the row pitch (stride in bytes or the compressed frame size) + uint32_t offset; // offset from the start of this header to the FrameBuffer header + uint32_t damageRectsCount; // the number of damage rectangles (zero for full-frame damage) + FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS]; + uint32_t mouseScalePercent; // movement scale factor of the mouse (relates to DPI of display, 100 = no scale) + bool blockScreensaver; // whether the guest has requested to block screensavers } KVMFRFrame; diff --git a/common/include/common/types.h b/common/include/common/types.h index cf1b3491..b308dd4e 100644 --- a/common/include/common/types.h +++ b/common/include/common/types.h @@ -21,6 +21,8 @@ #ifndef _LG_TYPES_H_ #define _LG_TYPES_H_ +#include + struct Point { int x, y; @@ -61,6 +63,15 @@ typedef enum FrameRotation } FrameRotation; +typedef struct FrameDamageRect +{ + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; +} +FrameDamageRect; + extern const char * FrameTypeStr[FRAME_TYPE_MAX]; typedef enum CursorType