Skip to content

Commit

Permalink
Decrease gpu scheduling priority for NVIDIA
Browse files Browse the repository at this point in the history
Fixes #1031
  • Loading branch information
ns6089 authored and cgutman committed Jul 9, 2023
1 parent c5bf781 commit 6dfe565
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/platform/windows/display_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,11 @@ namespace platf::dxgi {
PD3DKMTSetProcessSchedulingPriorityClass fn =
(PD3DKMTSetProcessSchedulingPriorityClass) GetProcAddress(gdi32, "D3DKMTSetProcessSchedulingPriorityClass");
if (fn) {
status = fn(GetCurrentProcess(), D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME);
// Set scheduling priority to "high" for NVIDIA, or to "realtime" for other gpu vendors
// As of 2023.07, NVIDIA driver has unfixed bug(s) where "realtime" can cause unrecoverable encoding freeze or outright driver crash
// This issue happens more frequently with HAGS, in DX12 games or when VRAM is filled close to max capacity
// Track OBS to see if they find better workaround or NVIDIA fixes it on their end, they seem to be in communication
status = fn(GetCurrentProcess(), adapter_desc.VendorId == 0x10DE ? D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH : D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME);
if (FAILED(status)) {
BOOST_LOG(warning) << "Failed to set realtime GPU priority. Please run application as administrator for optimal performance.";
}
Expand Down

0 comments on commit 6dfe565

Please sign in to comment.