From 338bc2e0dcc7298944d607db5ab3b42cfbb45527 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 11 Apr 2019 19:30:42 +1000 Subject: [PATCH] [c-host] nvfbc: disable ARGB10 until NVIDIA fix the API (if ever) --- VERSION | 2 +- .../Windows/capture/NVFBC/src/nvfbc.c | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index a12195df..bb71f1ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-154-g32bd6d96e3+1 \ No newline at end of file +a12-155-g8cedad8241+1 \ No newline at end of file diff --git a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c index 5b097a36..2ab0b133 100644 --- a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -138,7 +138,7 @@ static bool nvfbc_init(void * pointerShape, const unsigned int pointerSize) HANDLE event; if (!NvFBCToSysSetup( this->nvfbc, - BUFFER_FMT_ARGB10, + BUFFER_FMT_ARGB, false, true, false, @@ -226,13 +226,21 @@ static CaptureResult nvfbc_getFrame(CaptureFrame * frame) frame->pitch = this->grabInfo.dwBufferWidth * 4; frame->stride = this->grabInfo.dwBufferWidth; - // the bIsHDR check isn't reliable, if it's not set check a few pixels to see if - // the alpha channel has data in it. If not HDR the alpha channel should read zeros - this->grabInfo.bIsHDR = - this->grabInfo.bIsHDR || - (this->frameBuffer[3] != 0) || // top left - (this->frameBuffer[(((frame->height * frame->stride) / 2) + frame->width / 2) * 4 + 3] != 0) || // center - (this->frameBuffer[(((frame->height - 1) * frame->stride) + frame->width - 1) * 4 + 3] != 0); // bottom right +#if 0 + //NvFBC never sets bIsHDR so instead we check for any data in the alpha channel + //If there is data, it's HDR. This is clearly suboptimal + if (!this->grabInfo.bIsHDR) + for(int y = 0; y < frame->height; ++y) + for(int x = 0; x < frame->width; ++x) + { + int offset = (y * frame->pitch) + (x * 4); + if (this->frameBuffer[offset + 3]) + { + this->grabInfo.bIsHDR = 1; + break; + } + } +#endif frame->format = this->grabInfo.bIsHDR ? CAPTURE_FMT_RGBA10 : CAPTURE_FMT_BGRA; memcpy(frame->data, this->frameBuffer, frame->pitch * frame->height);