=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Lock wined3d mutex in wined3d_swapchain_present().
Alexandre Julliard
julliard at winehq.org
Mon Dec 3 15:28:54 CST 2018
Module: wine
Branch: master
Commit: 9042fbe1e4838136bd68905df13fb3264af9a64d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9042fbe1e4838136bd68905df13fb3264af9a64d
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Mon Dec 3 14:41:05 2018 +0100
wined3d: Lock wined3d mutex in wined3d_swapchain_present().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d8/swapchain.c | 7 +------
dlls/d3d9/swapchain.c | 7 +------
dlls/dxgi/swapchain.c | 7 +------
dlls/wined3d/swapchain.c | 5 +++++
4 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c
index 6e8b98e..c9abfff 100644
--- a/dlls/d3d8/swapchain.c
+++ b/dlls/d3d8/swapchain.c
@@ -88,7 +88,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
{
struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface);
struct d3d8_device *device = impl_from_IDirect3DDevice8(swapchain->parent_device);
- HRESULT hr;
TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
@@ -99,12 +98,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region);
- wined3d_mutex_lock();
- hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
+ return wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, swapchain->swap_interval, 0);
- wined3d_mutex_unlock();
-
- return hr;
}
static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface,
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c
index 1279663..00ead0f 100644
--- a/dlls/d3d9/swapchain.c
+++ b/dlls/d3d9/swapchain.c
@@ -140,7 +140,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai
{
struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(swapchain->parent_device);
- HRESULT hr;
TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n",
iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
@@ -152,12 +151,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai
if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region);
- wined3d_mutex_lock();
- hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
+ return wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, swapchain->swap_interval, flags);
- wined3d_mutex_unlock();
-
- return hr;
}
static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData(IDirect3DSwapChain9Ex *iface, IDirect3DSurface9 *surface)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 4dfa068..5aa2525 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -602,7 +602,6 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface
UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters)
{
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
- HRESULT hr;
TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n",
iface, sync_interval, flags, present_parameters);
@@ -624,11 +623,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_Present1(IDXGISwapChain1 *iface
if (present_parameters)
FIXME("Ignored present parameters %p.\n", present_parameters);
- wined3d_mutex_lock();
- hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, sync_interval, 0);
- wined3d_mutex_unlock();
-
- return hr;
+ return wined3d_swapchain_present(swapchain->wined3d_swapchain, NULL, NULL, NULL, sync_interval, 0);
}
static BOOL STDMETHODCALLTYPE d3d11_swapchain_IsTemporaryMonoSupported(IDXGISwapChain1 *iface)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 344a186..3a7039d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -164,9 +164,12 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
+ wined3d_mutex_lock();
+
if (!swapchain->back_buffers)
{
WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL.\n");
+ wined3d_mutex_unlock();
return WINED3DERR_INVALIDCALL;
}
@@ -186,6 +189,8 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
wined3d_cs_emit_present(swapchain->device->cs, swapchain, src_rect,
dst_rect, dst_window_override, swap_interval, flags);
+ wined3d_mutex_unlock();
+
return WINED3D_OK;
}
More information about the wine-cvs
mailing list