[host] nvfbc: fix ARGB10 support

There is no performance penalty to using ARGB10 as it's still a 32-bit copy per
pixel and the nvidia driver internally handles any conversions required to make
this work for both SDR and HDR.
This commit is contained in:
Geoffrey McRae 2023-04-19 19:49:48 +10:00
parent 880d8042a4
commit e4a8424fad
2 changed files with 4 additions and 21 deletions

View File

@ -376,7 +376,7 @@ static bool nvfbc_init(void)
HANDLE event;
if (!NvFBCToSysSetup(
this->nvfbc,
BUFFER_FMT_ARGB,
BUFFER_FMT_ARGB10,
!this->seperateCursor,
this->seperateCursor,
true,
@ -733,23 +733,7 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
updateDamageRects(frame);
#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;
frame->format = CAPTURE_FMT_RGBA10;
return CAPTURE_RESULT_OK;
}

View File

@ -227,9 +227,7 @@ bool NvFBCToSysSetup(
case BUFFER_FMT_RGB_PLANAR: params.eMode = NVFBC_TOSYS_RGB_PLANAR; break;
case BUFFER_FMT_XOR : params.eMode = NVFBC_TOSYS_XOR ; break;
case BUFFER_FMT_YUV444p : params.eMode = NVFBC_TOSYS_YUV444p ; break;
case BUFFER_FMT_ARGB10 :
params.eMode = NVFBC_TOSYS_ARGB10;
params.bHDRRequest = TRUE;
case BUFFER_FMT_ARGB10 : params.eMode = NVFBC_TOSYS_ARGB10 ; break;
break;
default:
@ -237,6 +235,7 @@ bool NvFBCToSysSetup(
return false;
}
params.bHDRRequest = TRUE;
params.bWithHWCursor = hwCursor ? TRUE : FALSE;
params.bEnableSeparateCursorCapture = seperateCursorCapture ? TRUE : FALSE;
params.bDiffMap = useDiffMap ? TRUE : FALSE;