[vlc-devel] [PATCH] direct3d11: call SetMultithreadProtected() as soon as the device is created
Steve Lhomme
robux4 at videolabs.io
Tue May 2 13:51:44 CEST 2017
Fixes #18261
---
modules/codec/avcodec/d3d11va.c | 14 +++++++-------
modules/video_output/win32/direct3d11.c | 15 +++++++--------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 1f96940e4a..dafd3d9180 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -582,6 +582,13 @@ static int D3dCreateDevice(vlc_va_t *va)
msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
+ ID3D10Multithread *pMultithread;
+ hr = ID3D11Device_QueryInterface( d3ddev, &IID_ID3D10Multithread, (void **)&pMultithread);
+ if (SUCCEEDED(hr)) {
+ ID3D10Multithread_SetMultithreadProtected(pMultithread, TRUE);
+ ID3D10Multithread_Release(pMultithread);
+ }
+
dx_sys->d3ddev = (IUnknown*) d3ddev;
va->sys->d3dctx = d3dctx;
@@ -961,13 +968,6 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, const video_forma
directx_sys_t *dx_sys = &va->sys->dx_sys;
HRESULT hr;
- ID3D10Multithread *pMultithread;
- hr = ID3D11Device_QueryInterface( (ID3D11Device*) dx_sys->d3ddev, &IID_ID3D10Multithread, (void **)&pMultithread);
- if (SUCCEEDED(hr)) {
- ID3D10Multithread_SetMultithreadProtected(pMultithread, TRUE);
- ID3D10Multithread_Release(pMultithread);
- }
-
#if VLC_WINSTORE_APP
/* On the Xbox 1/S, any decoding of H264 with one dimension over 2304
* crashes totally the device */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 8b24ad4870..ff318e4fbc 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -745,14 +745,6 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
pool_cfg.lock = Direct3D11MapPoolTexture;
//pool_cfg.unlock = Direct3D11UnmapPoolTexture;
}
- } else {
- HRESULT hr;
- ID3D10Multithread *pMultithread;
- hr = ID3D11Device_QueryInterface( sys->d3ddevice, &IID_ID3D10Multithread, (void **)&pMultithread);
- if (SUCCEEDED(hr)) {
- ID3D10Multithread_SetMultithreadProtected(pMultithread, TRUE);
- ID3D10Multithread_Release(pMultithread);
- }
}
pictures = calloc(pool_size, sizeof(*pictures));
@@ -1564,6 +1556,13 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
return VLC_EGENERIC;
}
+ ID3D10Multithread *pMultithread;
+ hr = ID3D11Device_QueryInterface( sys->d3ddevice, &IID_ID3D10Multithread, (void **)&pMultithread);
+ if (SUCCEEDED(hr)) {
+ ID3D10Multithread_SetMultithreadProtected(pMultithread, TRUE);
+ ID3D10Multithread_Release(pMultithread);
+ }
+
IDXGIAdapter *dxgiadapter = D3D11DeviceAdapter(sys->d3ddevice);
if (FAILED(hr)) {
msg_Err(vd, "Could not get the DXGI Adapter");
--
2.12.1
More information about the vlc-devel
mailing list