[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; HANDLE event;
if (!NvFBCToSysSetup( if (!NvFBCToSysSetup(
this->nvfbc, this->nvfbc,
BUFFER_FMT_ARGB, BUFFER_FMT_ARGB10,
!this->seperateCursor, !this->seperateCursor,
this->seperateCursor, this->seperateCursor,
true, true,
@ -733,23 +733,7 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
updateDamageRects(frame); updateDamageRects(frame);
#if 0 frame->format = CAPTURE_FMT_RGBA10;
//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;
return CAPTURE_RESULT_OK; 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_RGB_PLANAR: params.eMode = NVFBC_TOSYS_RGB_PLANAR; break;
case BUFFER_FMT_XOR : params.eMode = NVFBC_TOSYS_XOR ; break; case BUFFER_FMT_XOR : params.eMode = NVFBC_TOSYS_XOR ; break;
case BUFFER_FMT_YUV444p : params.eMode = NVFBC_TOSYS_YUV444p ; break; case BUFFER_FMT_YUV444p : params.eMode = NVFBC_TOSYS_YUV444p ; break;
case BUFFER_FMT_ARGB10 : case BUFFER_FMT_ARGB10 : params.eMode = NVFBC_TOSYS_ARGB10 ; break;
params.eMode = NVFBC_TOSYS_ARGB10;
params.bHDRRequest = TRUE;
break; break;
default: default:
@ -237,6 +235,7 @@ bool NvFBCToSysSetup(
return false; return false;
} }
params.bHDRRequest = TRUE;
params.bWithHWCursor = hwCursor ? TRUE : FALSE; params.bWithHWCursor = hwCursor ? TRUE : FALSE;
params.bEnableSeparateCursorCapture = seperateCursorCapture ? TRUE : FALSE; params.bEnableSeparateCursorCapture = seperateCursorCapture ? TRUE : FALSE;
params.bDiffMap = useDiffMap ? TRUE : FALSE; params.bDiffMap = useDiffMap ? TRUE : FALSE;