Skip to content

Commit

Permalink
[host] d12: don't attempt to use realtime priority
Browse files Browse the repository at this point in the history
Some GPUs such as the RX580 seem to completely crash when attempting
to use `D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME`.
  • Loading branch information
gnif committed Mar 9, 2024
1 parent 778c210 commit d5b3222
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions host/platform/Windows/capture/D12/d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,28 +291,18 @@ static bool d12_init(void * ivshmemBase, unsigned * alignSize)
goto exit;
}

/* make this static as we downgrade the priority on failure and we want to
remember it */
static D3D12_COMMAND_QUEUE_DESC queueDesc =
D3D12_COMMAND_QUEUE_DESC copyQueueDesc =
{
.Type = D3D12_COMMAND_LIST_TYPE_COPY,
.Priority = D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME,
.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE,
.Priority = D3D12_COMMAND_QUEUE_PRIORITY_HIGH,
.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE
};

comRef_defineLocal(ID3D12CommandQueue, copyQueue);
retryCreateCommandQueue:
hr = ID3D12Device3_CreateCommandQueue(
*device, &queueDesc, &IID_ID3D12CommandQueue, (void **)copyQueue);
*device, &copyQueueDesc, &IID_ID3D12CommandQueue, (void **)copyQueue);
if (FAILED(hr))
{
if (queueDesc.Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME)
{
DEBUG_WARN("Failed to create queue with real time priority");
queueDesc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_HIGH;
goto retryCreateCommandQueue;
}

DEBUG_WINERROR("Failed to create ID3D12CommandQueue (copy)", hr);
goto exit;
}
Expand All @@ -321,10 +311,10 @@ static bool d12_init(void * ivshmemBase, unsigned * alignSize)
// create the compute queue
D3D12_COMMAND_QUEUE_DESC computeQueueDesc =
{
.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE,
.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE,
.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE,
.Priority = D3D12_COMMAND_QUEUE_PRIORITY_HIGH,
.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE
};
queueDesc.Priority = queueDesc.Priority;

comRef_defineLocal(ID3D12CommandQueue, computeQueue);
hr = ID3D12Device3_CreateCommandQueue(
Expand Down

0 comments on commit d5b3222

Please sign in to comment.