mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-05-17 20:11:17 +00:00
[host] all: pass back the desktop rotation to the client
This commit is contained in:
parent
842bb59955
commit
f5587b6b6b
@ -38,6 +38,15 @@ typedef enum FrameType
|
|||||||
}
|
}
|
||||||
FrameType;
|
FrameType;
|
||||||
|
|
||||||
|
typedef enum FrameRotation
|
||||||
|
{
|
||||||
|
FRAME_ROT_0,
|
||||||
|
FRAME_ROT_90,
|
||||||
|
FRAME_ROT_180,
|
||||||
|
FRAME_ROT_270
|
||||||
|
}
|
||||||
|
FrameRotation;
|
||||||
|
|
||||||
extern const char * FrameTypeStr[FRAME_TYPE_MAX];
|
extern const char * FrameTypeStr[FRAME_TYPE_MAX];
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -57,7 +66,7 @@ typedef enum CursorType
|
|||||||
CursorType;
|
CursorType;
|
||||||
|
|
||||||
#define KVMFR_MAGIC "KVMFR---"
|
#define KVMFR_MAGIC "KVMFR---"
|
||||||
#define KVMFR_VERSION 6
|
#define KVMFR_VERSION 7
|
||||||
|
|
||||||
typedef struct KVMFR
|
typedef struct KVMFR
|
||||||
{
|
{
|
||||||
@ -80,13 +89,14 @@ KVMFRCursor;
|
|||||||
|
|
||||||
typedef struct KVMFRFrame
|
typedef struct KVMFRFrame
|
||||||
{
|
{
|
||||||
uint32_t formatVer; // the frame format version number
|
uint32_t formatVer; // the frame format version number
|
||||||
FrameType type; // the frame data type
|
FrameType type; // the frame data type
|
||||||
uint32_t width; // the width
|
uint32_t width; // the width
|
||||||
uint32_t height; // the height
|
uint32_t height; // the height
|
||||||
uint32_t stride; // the row stride (zero if compressed data)
|
FrameRotation rotation; // the frame rotation
|
||||||
uint32_t pitch; // the row pitch (stride in bytes or the compressed frame size)
|
uint32_t stride; // the row stride (zero if compressed data)
|
||||||
uint32_t offset; // offset from the start of this header to the FrameBuffer header
|
uint32_t pitch; // the row pitch (stride in bytes or the compressed frame size)
|
||||||
uint32_t mouseScalePercent; // movement scale factor of the mouse (relates to DPI of display, 100 = no scale)
|
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)
|
||||||
}
|
}
|
||||||
KVMFRFrame;
|
KVMFRFrame;
|
||||||
|
@ -50,14 +50,24 @@ typedef enum CaptureFormat
|
|||||||
}
|
}
|
||||||
CaptureFormat;
|
CaptureFormat;
|
||||||
|
|
||||||
|
typedef enum CaptureRotation
|
||||||
|
{
|
||||||
|
CAPTURE_ROT_0,
|
||||||
|
CAPTURE_ROT_90,
|
||||||
|
CAPTURE_ROT_180,
|
||||||
|
CAPTURE_ROT_270
|
||||||
|
}
|
||||||
|
CaptureRotation;
|
||||||
|
|
||||||
typedef struct CaptureFrame
|
typedef struct CaptureFrame
|
||||||
{
|
{
|
||||||
unsigned int formatVer;
|
unsigned int formatVer;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
unsigned int pitch;
|
unsigned int pitch;
|
||||||
unsigned int stride;
|
unsigned int stride;
|
||||||
CaptureFormat format;
|
CaptureFormat format;
|
||||||
|
CaptureRotation rotation;
|
||||||
}
|
}
|
||||||
CaptureFrame;
|
CaptureFrame;
|
||||||
|
|
||||||
|
@ -203,11 +203,12 @@ static CaptureResult xcb_waitFrame(CaptureFrame * frame)
|
|||||||
{
|
{
|
||||||
lgWaitEvent(this->frameEvent, TIMEOUT_INFINITE);
|
lgWaitEvent(this->frameEvent, TIMEOUT_INFINITE);
|
||||||
|
|
||||||
frame->width = this->width;
|
frame->width = this->width;
|
||||||
frame->height = this->height;
|
frame->height = this->height;
|
||||||
frame->pitch = this->width * 4;
|
frame->pitch = this->width * 4;
|
||||||
frame->stride = this->width;
|
frame->stride = this->width;
|
||||||
frame->format = CAPTURE_FMT_BGRA;
|
frame->format = CAPTURE_FMT_BGRA;
|
||||||
|
frame->rotation = CAPTURE_ROT_0;
|
||||||
|
|
||||||
return CAPTURE_RESULT_OK;
|
return CAPTURE_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
@ -93,13 +93,14 @@ struct iface
|
|||||||
CapturePostPointerBuffer postPointerBufferFn;
|
CapturePostPointerBuffer postPointerBufferFn;
|
||||||
LGEvent * frameEvent;
|
LGEvent * frameEvent;
|
||||||
|
|
||||||
unsigned int formatVer;
|
unsigned int formatVer;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
unsigned int pitch;
|
unsigned int pitch;
|
||||||
unsigned int stride;
|
unsigned int stride;
|
||||||
CaptureFormat format;
|
CaptureFormat format;
|
||||||
unsigned int dpi;
|
CaptureRotation rotation;
|
||||||
|
unsigned int dpi;
|
||||||
|
|
||||||
int lastPointerX, lastPointerY;
|
int lastPointerX, lastPointerY;
|
||||||
bool lastPointerVisible;
|
bool lastPointerVisible;
|
||||||
@ -371,9 +372,46 @@ static bool dxgi_init(void)
|
|||||||
|
|
||||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||||
IDXGIAdapter1_GetDesc1(this->adapter, &adapterDesc);
|
IDXGIAdapter1_GetDesc1(this->adapter, &adapterDesc);
|
||||||
this->width = outputDesc.DesktopCoordinates.right - outputDesc.DesktopCoordinates.left;
|
|
||||||
this->height = outputDesc.DesktopCoordinates.bottom - outputDesc.DesktopCoordinates.top;
|
switch(outputDesc.Rotation)
|
||||||
this->dpi = monitor_dpi(outputDesc.Monitor);
|
{
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE90:
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE270:
|
||||||
|
this->width = outputDesc.DesktopCoordinates.bottom -
|
||||||
|
outputDesc.DesktopCoordinates.top;
|
||||||
|
this->height = outputDesc.DesktopCoordinates.right -
|
||||||
|
outputDesc.DesktopCoordinates.left;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this->width = outputDesc.DesktopCoordinates.right -
|
||||||
|
outputDesc.DesktopCoordinates.left;
|
||||||
|
this->height = outputDesc.DesktopCoordinates.bottom -
|
||||||
|
outputDesc.DesktopCoordinates.top;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(outputDesc.Rotation)
|
||||||
|
{
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE90:
|
||||||
|
this->rotation = CAPTURE_ROT_90;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE180:
|
||||||
|
this->rotation = CAPTURE_ROT_180;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE270:
|
||||||
|
this->rotation = CAPTURE_ROT_270;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this->rotation = CAPTURE_ROT_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->dpi = monitor_dpi(outputDesc.Monitor);
|
||||||
++this->formatVer;
|
++this->formatVer;
|
||||||
|
|
||||||
DEBUG_INFO("Device Descripion: %ls" , adapterDesc.Description);
|
DEBUG_INFO("Device Descripion: %ls" , adapterDesc.Description);
|
||||||
@ -928,6 +966,7 @@ static CaptureResult dxgi_waitFrame(CaptureFrame * frame)
|
|||||||
frame->pitch = this->pitch;
|
frame->pitch = this->pitch;
|
||||||
frame->stride = this->stride;
|
frame->stride = this->stride;
|
||||||
frame->format = this->format;
|
frame->format = this->format;
|
||||||
|
frame->rotation = this->rotation;
|
||||||
|
|
||||||
atomic_fetch_sub_explicit(&this->texReady, 1, memory_order_release);
|
atomic_fetch_sub_explicit(&this->texReady, 1, memory_order_release);
|
||||||
return CAPTURE_RESULT_OK;
|
return CAPTURE_RESULT_OK;
|
||||||
|
@ -312,6 +312,7 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame)
|
|||||||
frame->height = this->grabHeight;
|
frame->height = this->grabHeight;
|
||||||
frame->pitch = this->grabStride * 4;
|
frame->pitch = this->grabStride * 4;
|
||||||
frame->stride = this->grabStride;
|
frame->stride = this->grabStride;
|
||||||
|
frame->rotation = CAPTURE_ROT_0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//NvFBC never sets bIsHDR so instead we check for any data in the alpha channel
|
//NvFBC never sets bIsHDR so instead we check for any data in the alpha channel
|
||||||
|
@ -186,6 +186,18 @@ static int frameThread(void * opaque)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(frame.rotation)
|
||||||
|
{
|
||||||
|
case CAPTURE_ROT_0 : fi->rotation = FRAME_ROT_0 ; break;
|
||||||
|
case CAPTURE_ROT_90 : fi->rotation = FRAME_ROT_90 ; break;
|
||||||
|
case CAPTURE_ROT_180: fi->rotation = FRAME_ROT_180; break;
|
||||||
|
case CAPTURE_ROT_270: fi->rotation = FRAME_ROT_270; break;
|
||||||
|
default:
|
||||||
|
DEBUG_WARN("Unsupported frame rotation %d", frame.rotation);
|
||||||
|
fi->rotation = FRAME_ROT_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fi->formatVer = frame.formatVer;
|
fi->formatVer = frame.formatVer;
|
||||||
fi->width = frame.width;
|
fi->width = frame.width;
|
||||||
fi->height = frame.height;
|
fi->height = frame.height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user