From c9b5e2a7c1c0c5b1dda3b291d41caa98cf551df5 Mon Sep 17 00:00:00 2001 From: Jan Sikorski Date: Fri, 15 Oct 2021 14:26:26 +0200 Subject: [PATCH] d3d9: Don't grab wined3d lock for wined3d_resource_map/unmap(). Signed-off-by: Jan Sikorski Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/buffer.c | 8 -------- dlls/d3d9/surface.c | 2 -- dlls/d3d9/volume.c | 4 ---- 3 files changed, 14 deletions(-) diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index 07bdfa9320e..901557c288f 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -199,11 +199,9 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, UINT wined3d_box_set(&wined3d_box, offset, 0, offset + size, 1, 0, 1); - wined3d_mutex_lock(); wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_map(wined3d_resource, 0, &wined3d_map_desc, &wined3d_box, wined3dmapflags_from_d3dmapflags(flags, buffer->usage)); - wined3d_mutex_unlock(); *data = wined3d_map_desc.data; return hr; @@ -215,9 +213,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface) TRACE("iface %p.\n", iface); - wined3d_mutex_lock(); wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0); - wined3d_mutex_unlock(); return D3D_OK; } @@ -535,11 +531,9 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, wined3d_box_set(&wined3d_box, offset, 0, offset + size, 1, 0, 1); - wined3d_mutex_lock(); wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); hr = wined3d_resource_map(wined3d_resource, 0, &wined3d_map_desc, &wined3d_box, wined3dmapflags_from_d3dmapflags(flags, buffer->usage)); - wined3d_mutex_unlock(); *data = wined3d_map_desc.data; return hr; @@ -551,9 +545,7 @@ static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface) TRACE("iface %p.\n", iface); - wined3d_mutex_lock(); wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0); - wined3d_mutex_unlock(); return D3D_OK; } diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index d4738d2ca9f..2ff5134781e 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -246,10 +246,8 @@ static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface, if (rect) wined3d_box_set(&box, rect->left, rect->top, rect->right, rect->bottom, 0, 1); - wined3d_mutex_lock(); hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx, &map_desc, rect ? &box : NULL, wined3dmapflags_from_d3dmapflags(flags, 0)); - wined3d_mutex_unlock(); if (SUCCEEDED(hr)) { diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index 39caa8fb08e..e8091aec7a5 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -144,12 +144,10 @@ static HRESULT WINAPI d3d9_volume_LockBox(IDirect3DVolume9 *iface, TRACE("iface %p, locked_box %p, box %p, flags %#x.\n", iface, locked_box, box, flags); - wined3d_mutex_lock(); if (FAILED(hr = wined3d_resource_map(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx, &map_desc, (const struct wined3d_box *)box, wined3dmapflags_from_d3dmapflags(flags, 0)))) map_desc.data = NULL; - wined3d_mutex_unlock(); locked_box->RowPitch = map_desc.row_pitch; locked_box->SlicePitch = map_desc.slice_pitch; @@ -167,9 +165,7 @@ static HRESULT WINAPI d3d9_volume_UnlockBox(IDirect3DVolume9 *iface) TRACE("iface %p.\n", iface); - wined3d_mutex_lock(); hr = wined3d_resource_unmap(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx); - wined3d_mutex_unlock(); if (hr == WINEDDERR_NOTLOCKED) return D3DERR_INVALIDCALL;