diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index 2c4c16e8..09b032cd 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -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; diff --git a/host/include/interface/capture.h b/host/include/interface/capture.h index 4db37f02..17e5a2e8 100644 --- a/host/include/interface/capture.h +++ b/host/include/interface/capture.h @@ -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 , diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index ff4a7248..7d0e80e9 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -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; diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 76d0c7cf..f7b2ac5c 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -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; } diff --git a/host/src/app.c b/host/src/app.c index 87fe4b53..10255116 100644 --- a/host/src/app.c +++ b/host/src/app.c @@ -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));