New upstream version 24.0.3+dfsg1
This commit is contained in:
parent
5a730d6ec3
commit
52fa83f147
16 changed files with 213 additions and 32 deletions
|
|
@ -21,8 +21,10 @@
|
|||
#include <util/dstr.h>
|
||||
#include <util/util.hpp>
|
||||
#include <graphics/matrix3.h>
|
||||
#include <winternl.h>
|
||||
#include <d3d9.h>
|
||||
#include "d3d11-subsystem.hpp"
|
||||
#include "d3d11-config.h"
|
||||
|
||||
struct UnsupportedHWError : HRError {
|
||||
inline UnsupportedHWError(const char *str, HRESULT hr)
|
||||
|
|
@ -351,6 +353,63 @@ try {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if USE_GPU_PRIORITY
|
||||
static bool set_priority(ID3D11Device *device)
|
||||
{
|
||||
typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS {
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE,
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL,
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL,
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL,
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH,
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME
|
||||
} D3DKMT_SCHEDULINGPRIORITYCLASS;
|
||||
|
||||
ComQIPtr<IDXGIDevice> dxgiDevice(device);
|
||||
if (!dxgiDevice) {
|
||||
blog(LOG_DEBUG, "%s: Failed to get IDXGIDevice", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
HMODULE gdi32 = GetModuleHandleW(L"GDI32");
|
||||
if (!gdi32) {
|
||||
blog(LOG_DEBUG, "%s: Failed to get GDI32", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
NTSTATUS(WINAPI * d3dkmt_spspc)(HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS);
|
||||
d3dkmt_spspc = (decltype(d3dkmt_spspc))GetProcAddress(
|
||||
gdi32, "D3DKMTSetProcessSchedulingPriorityClass");
|
||||
if (!d3dkmt_spspc) {
|
||||
blog(LOG_DEBUG, "%s: Failed to get d3dkmt_spspc", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
NTSTATUS status = d3dkmt_spspc(GetCurrentProcess(),
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME);
|
||||
if (status != 0) {
|
||||
blog(LOG_DEBUG, "%s: Failed to set process priority class: %d",
|
||||
__FUNCTION__, (int)status);
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = dxgiDevice->SetGPUThreadPriority(GPU_PRIORITY_VAL);
|
||||
if (FAILED(hr)) {
|
||||
blog(LOG_DEBUG, "%s: SetGPUThreadPriority failed",
|
||||
__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
blog(LOG_INFO, "D3D11 GPU priority setup success");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool is_intel(const wstring &name)
|
||||
{
|
||||
return wstrstri(name.c_str(), L"intel") != nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void gs_device::InitDevice(uint32_t adapterIdx)
|
||||
{
|
||||
wstring adapterName;
|
||||
|
|
@ -385,11 +444,24 @@ void gs_device::InitDevice(uint32_t adapterIdx)
|
|||
blog(LOG_INFO, "D3D11 loaded successfully, feature level used: %x",
|
||||
(unsigned int)levelUsed);
|
||||
|
||||
/* adjust gpu thread priority */
|
||||
#if USE_GPU_PRIORITY
|
||||
if (!is_intel(adapterName) && !set_priority(device)) {
|
||||
blog(LOG_INFO, "D3D11 GPU priority setup "
|
||||
"failed (not admin?)");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------- */
|
||||
/* check for nv12 texture output support */
|
||||
|
||||
nv12Supported = false;
|
||||
|
||||
/* WARP NV12 support is suspected to be buggy on older Windows */
|
||||
if (desc.VendorId == 0x1414 && desc.DeviceId == 0x8c) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Intel CopyResource is very slow with NV12 */
|
||||
if (desc.VendorId == 0x8086) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue