mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:50:52 +00:00
wined3d: Lock wined3d mutex in wined3d_get_adapter_identifier().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9042fbe1e4
commit
6dddb88ebe
4 changed files with 14 additions and 22 deletions
|
@ -132,9 +132,7 @@ static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter,
|
|||
adapter_id.device_name = NULL; /* d3d9 only */
|
||||
adapter_id.device_name_size = 0; /* d3d9 only */
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(d3d8->wined3d, adapter, flags, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
identifier->DriverVersion = adapter_id.driver_version;
|
||||
identifier->VendorId = adapter_id.vendor_id;
|
||||
|
|
|
@ -137,9 +137,7 @@ static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapte
|
|||
adapter_id.device_name = identifier->DeviceName;
|
||||
adapter_id.device_name_size = sizeof(identifier->DeviceName);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(d3d9->wined3d, adapter, flags, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
identifier->DriverVersion = adapter_id.driver_version;
|
||||
identifier->VendorId = adapter_id.vendor_id;
|
||||
|
@ -544,11 +542,9 @@ static HRESULT WINAPI d3d9_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUI
|
|||
adapter_id.description_size = 0;
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(d3d9->wined3d, adapter, 0, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid));
|
||||
*luid = adapter_id.adapter_luid;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -158,11 +158,7 @@ static HRESULT dxgi_adapter_get_desc(struct dxgi_adapter *adapter, DXGI_ADAPTER_
|
|||
adapter_id.description_size = sizeof(description);
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
||||
return hr;
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128))
|
||||
|
@ -311,11 +307,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryVideoMemoryInfo(IWineDXGIAdap
|
|||
adapter_id.description_size = 0;
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
||||
return hr;
|
||||
|
||||
switch (segment_group)
|
||||
|
|
|
@ -1155,8 +1155,6 @@ HRESULT CDECL wined3d_set_adapter_display_mode(struct wined3d *wined3d,
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
/* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
|
||||
and fields being inserted in the middle, a new structure is used in place */
|
||||
HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
|
||||
UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
|
||||
{
|
||||
|
@ -1166,8 +1164,10 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
|
|||
TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
|
||||
wined3d, adapter_idx, flags, identifier);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
if (adapter_idx >= wined3d->adapter_count)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
goto fail;
|
||||
|
||||
adapter = &wined3d->adapters[adapter_idx];
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
|
|||
identifier->device_name_size, NULL, NULL))
|
||||
{
|
||||
ERR("Failed to convert device name, last error %#x.\n", GetLastError());
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1206,11 +1206,17 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
|
|||
identifier->revision = 0;
|
||||
memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier));
|
||||
identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1;
|
||||
memcpy(&identifier->adapter_luid, &adapter->luid, sizeof(identifier->adapter_luid));
|
||||
identifier->adapter_luid = adapter->luid;
|
||||
identifier->video_memory = min(~(SIZE_T)0, adapter->driver_info.vram_bytes);
|
||||
identifier->shared_system_memory = min(~(SIZE_T)0, adapter->driver_info.sysmem_bytes);
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return WINED3D_OK;
|
||||
|
||||
fail:
|
||||
wined3d_mutex_unlock();
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_get_adapter_raster_status(const struct wined3d *wined3d, UINT adapter_idx,
|
||||
|
|
Loading…
Reference in a new issue