mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[host] app: report to the client if the frame is actually HDR
This commit is contained in:
parent
e4a8424fad
commit
f84165ac66
@ -135,7 +135,8 @@ enum
|
||||
{
|
||||
FRAME_FLAG_BLOCK_SCREENSAVER = 0x1,
|
||||
FRAME_FLAG_REQUEST_ACTIVATION = 0x2,
|
||||
FRAME_FLAG_TRUNCATED = 0x4 // ivshmem was too small for the frame
|
||||
FRAME_FLAG_TRUNCATED = 0x4, // ivshmem was too small for the frame
|
||||
FRAME_FLAG_HDR = 0x8 // RGBA10 may not be HDR
|
||||
};
|
||||
|
||||
typedef uint32_t KVMFRFrameFlags;
|
||||
|
@ -44,10 +44,11 @@ CaptureResult;
|
||||
typedef enum CaptureFormat
|
||||
{
|
||||
// frame formats
|
||||
CAPTURE_FMT_BGRA ,
|
||||
CAPTURE_FMT_RGBA ,
|
||||
CAPTURE_FMT_RGBA10 ,
|
||||
CAPTURE_FMT_RGBA16F,
|
||||
CAPTURE_FMT_BGRA ,
|
||||
CAPTURE_FMT_RGBA ,
|
||||
CAPTURE_FMT_RGBA10_SDR,
|
||||
CAPTURE_FMT_RGBA10_HDR,
|
||||
CAPTURE_FMT_RGBA16F ,
|
||||
|
||||
// pointer formats
|
||||
CAPTURE_FMT_COLOR ,
|
||||
|
@ -600,9 +600,17 @@ next_output:
|
||||
this->bpp = 4;
|
||||
switch(dupDesc.ModeDesc.Format)
|
||||
{
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM : this->format = CAPTURE_FMT_BGRA ; break;
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM : this->format = CAPTURE_FMT_RGBA ; break;
|
||||
case DXGI_FORMAT_R10G10B10A2_UNORM : this->format = CAPTURE_FMT_RGBA10 ; break;
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
this->format = CAPTURE_FMT_BGRA;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
this->format = CAPTURE_FMT_RGBA;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_R10G10B10A2_UNORM:
|
||||
this->format = CAPTURE_FMT_RGBA10_HDR;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_R16G16B16A16_FLOAT:
|
||||
this->format = CAPTURE_FMT_RGBA16F;
|
||||
|
@ -733,7 +733,8 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
|
||||
|
||||
updateDamageRects(frame);
|
||||
|
||||
frame->format = CAPTURE_FMT_RGBA10;
|
||||
frame->format = this->grabInfo.bIsHDR ?
|
||||
CAPTURE_FMT_RGBA10_HDR : CAPTURE_FMT_RGBA10_SDR;
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
||||
|
@ -244,12 +244,27 @@ static bool sendFrame(void)
|
||||
app.frameIndex = 0;
|
||||
|
||||
KVMFRFrame * fi = lgmpHostMemPtr(app.frameMemory[app.frameIndex]);
|
||||
KVMFRFrameFlags flags = 0;
|
||||
|
||||
switch(frame.format)
|
||||
{
|
||||
case CAPTURE_FMT_BGRA : fi->type = FRAME_TYPE_BGRA ; break;
|
||||
case CAPTURE_FMT_RGBA : fi->type = FRAME_TYPE_RGBA ; break;
|
||||
case CAPTURE_FMT_RGBA10 : fi->type = FRAME_TYPE_RGBA10 ; break;
|
||||
case CAPTURE_FMT_RGBA16F: fi->type = FRAME_TYPE_RGBA16F; break;
|
||||
|
||||
case CAPTURE_FMT_RGBA10_SDR:
|
||||
fi->type = FRAME_TYPE_RGBA10;
|
||||
break;
|
||||
|
||||
case CAPTURE_FMT_RGBA10_HDR:
|
||||
fi->type = FRAME_TYPE_RGBA10;
|
||||
flags |= FRAME_FLAG_HDR;
|
||||
break;
|
||||
|
||||
case CAPTURE_FMT_RGBA16F:
|
||||
fi->type = FRAME_TYPE_RGBA16F;
|
||||
flags |= FRAME_FLAG_HDR;
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unsupported frame format %d, skipping frame", frame.format);
|
||||
return true;
|
||||
@ -267,6 +282,15 @@ static bool sendFrame(void)
|
||||
break;
|
||||
}
|
||||
|
||||
if (os_blockScreensaver())
|
||||
flags |= FRAME_FLAG_BLOCK_SCREENSAVER;
|
||||
|
||||
if (os_getAndClearPendingActivationRequest())
|
||||
flags |= FRAME_FLAG_REQUEST_ACTIVATION;
|
||||
|
||||
if (frame.truncated)
|
||||
flags |= FRAME_FLAG_TRUNCATED;
|
||||
|
||||
fi->formatVer = frame.formatVer;
|
||||
fi->frameSerial = app.frameSerial++;
|
||||
fi->screenWidth = frame.screenWidth;
|
||||
@ -276,14 +300,7 @@ static bool sendFrame(void)
|
||||
fi->stride = frame.stride;
|
||||
fi->pitch = frame.pitch;
|
||||
fi->offset = app.pageSize - sizeof(FrameBuffer);
|
||||
fi->flags =
|
||||
(os_blockScreensaver() ?
|
||||
FRAME_FLAG_BLOCK_SCREENSAVER : 0) |
|
||||
(os_getAndClearPendingActivationRequest() ?
|
||||
FRAME_FLAG_REQUEST_ACTIVATION : 0) |
|
||||
(frame.truncated ?
|
||||
FRAME_FLAG_TRUNCATED : 0);
|
||||
|
||||
fi->flags = flags;
|
||||
fi->damageRectsCount = frame.damageRectsCount;
|
||||
memcpy(fi->damageRects, frame.damageRects,
|
||||
frame.damageRectsCount * sizeof(FrameDamageRect));
|
||||
|
Loading…
Reference in New Issue
Block a user