mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Use a dedicated mutex to protect the blocked queues.
This commit is contained in:
parent
df36026633
commit
8e087b0f17
Notes:
Alexandre Julliard
2023-02-13 22:20:19 +01:00
Approved-by: Conor McCarthy (@cmccarthy) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/87
@ -645,7 +645,7 @@ static HRESULT d3d12_device_add_blocked_command_queues(struct d3d12_device *devi
|
||||
if (count == 0)
|
||||
return S_OK;
|
||||
|
||||
vkd3d_mutex_lock(&device->mutex);
|
||||
vkd3d_mutex_lock(&device->blocked_queues_mutex);
|
||||
|
||||
if ((i = ARRAY_SIZE(device->blocked_queues) - device->blocked_queue_count) < count)
|
||||
{
|
||||
@ -657,7 +657,7 @@ static HRESULT d3d12_device_add_blocked_command_queues(struct d3d12_device *devi
|
||||
for (i = 0; i < count; ++i)
|
||||
device->blocked_queues[device->blocked_queue_count++] = command_queues[i];
|
||||
|
||||
vkd3d_mutex_unlock(&device->mutex);
|
||||
vkd3d_mutex_unlock(&device->blocked_queues_mutex);
|
||||
return hr;
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ static HRESULT d3d12_device_flush_blocked_queues_once(struct d3d12_device *devic
|
||||
|
||||
*flushed_any = false;
|
||||
|
||||
vkd3d_mutex_lock(&device->mutex);
|
||||
vkd3d_mutex_lock(&device->blocked_queues_mutex);
|
||||
|
||||
/* Flush any ops unblocked by a new pending value. These cannot be flushed
|
||||
* with the device locked, so move the queue pointers to a local array. */
|
||||
@ -676,7 +676,7 @@ static HRESULT d3d12_device_flush_blocked_queues_once(struct d3d12_device *devic
|
||||
memcpy(blocked_queues, device->blocked_queues, blocked_queue_count * sizeof(blocked_queues[0]));
|
||||
device->blocked_queue_count = 0;
|
||||
|
||||
vkd3d_mutex_unlock(&device->mutex);
|
||||
vkd3d_mutex_unlock(&device->blocked_queues_mutex);
|
||||
|
||||
i = 0;
|
||||
while (i < blocked_queue_count)
|
||||
|
@ -2462,6 +2462,8 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface)
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||
|
||||
vkd3d_mutex_destroy(&device->blocked_queues_mutex);
|
||||
|
||||
vkd3d_private_store_destroy(&device->private_store);
|
||||
|
||||
vkd3d_cleanup_format_info(device);
|
||||
@ -4119,6 +4121,7 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
vkd3d_time_domains_init(device);
|
||||
|
||||
device->blocked_queue_count = 0;
|
||||
vkd3d_mutex_init(&device->blocked_queues_mutex);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(device->desc_mutex); ++i)
|
||||
vkd3d_mutex_init(&device->desc_mutex[i]);
|
||||
|
@ -1512,6 +1512,7 @@ struct d3d12_device
|
||||
unsigned int queue_family_count;
|
||||
VkTimeDomainEXT vk_host_time_domain;
|
||||
|
||||
struct vkd3d_mutex blocked_queues_mutex;
|
||||
struct d3d12_command_queue *blocked_queues[VKD3D_MAX_DEVICE_BLOCKED_QUEUES];
|
||||
unsigned int blocked_queue_count;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user