Merge pull request #2259 from jpark37/increase-frame-queue

libobs-d3d11: Increase the frame queue capacity
master
Jim 2019-12-19 12:16:16 -08:00 committed by GitHub
commit c25d53c418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 1 deletions

View File

@ -380,6 +380,25 @@ try {
return false; return false;
} }
static bool increase_maximum_frame_latency(ID3D11Device *device)
{
ComQIPtr<IDXGIDevice1> dxgiDevice(device);
if (!dxgiDevice) {
blog(LOG_DEBUG, "%s: Failed to get IDXGIDevice1", __FUNCTION__);
return false;
}
const HRESULT hr = dxgiDevice->SetMaximumFrameLatency(16);
if (FAILED(hr)) {
blog(LOG_DEBUG, "%s: SetMaximumFrameLatency failed",
__FUNCTION__);
return false;
}
blog(LOG_INFO, "DXGI increase maximum frame latency success");
return true;
}
#if USE_GPU_PRIORITY #if USE_GPU_PRIORITY
static bool set_priority(ID3D11Device *device) static bool set_priority(ID3D11Device *device)
{ {
@ -467,7 +486,12 @@ void gs_device::InitDevice(uint32_t adapterIdx)
blog(LOG_INFO, "D3D11 loaded successfully, feature level used: %x", blog(LOG_INFO, "D3D11 loaded successfully, feature level used: %x",
(unsigned int)levelUsed); (unsigned int)levelUsed);
/* adjust gpu thread priority on non-intel GPUs*/ /* prevent stalls sometimes seen in Present calls */
if (!increase_maximum_frame_latency(device)) {
blog(LOG_INFO, "DXGI increase maximum frame latency failed");
}
/* adjust gpu thread priority on non-intel GPUs */
#if USE_GPU_PRIORITY #if USE_GPU_PRIORITY
if (desc.VendorId != 0x8086 && !set_priority(device)) { if (desc.VendorId != 0x8086 && !set_priority(device)) {
blog(LOG_INFO, "D3D11 GPU priority setup " blog(LOG_INFO, "D3D11 GPU priority setup "