[vlc-commits] direct3d11: lock the ID3D11DeviceContext when displaying
Steve Lhomme
git at videolan.org
Fri Feb 7 15:58:57 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 5 10:29:47 2020 +0100| [9da057d6bfb11df5935a86c20889b9fce4a07f40] | committer: Steve Lhomme
direct3d11: lock the ID3D11DeviceContext when displaying
We are using it so we should lock it.
Also lock for all the Prepare part. If there's a lock we should use it. If not
that means we don't need protection.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9da057d6bfb11df5935a86c20889b9fce4a07f40
---
modules/video_output/win32/direct3d11.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 1c7df12e56..479c012065 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -525,6 +525,8 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
{
vout_display_sys_t *sys = vd->sys;
+ d3d11_device_lock( sys->d3d_dev );
+
if (sys->picQuad.textureFormat->formatTexture == DXGI_FORMAT_UNKNOWN)
{
D3D11_MAPPED_SUBRESOURCE mappedResource;
@@ -584,8 +586,6 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
{
picture_sys_d3d11_t *p_sys = ActiveD3D11PictureSys(picture);
- d3d11_device_lock( sys->d3d_dev );
-
if (sys->legacy_shader) {
D3D11_TEXTURE2D_DESC srcDesc,texDesc;
ID3D11Texture2D_GetDesc(p_sys->texture[KNOWN_DXGI_INDEX], &srcDesc);
@@ -676,8 +676,7 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
SleepEx(2, TRUE);
}
- if (is_d3d11_opaque(picture->format.i_chroma) && sys->picQuad.textureFormat->formatTexture != DXGI_FORMAT_UNKNOWN)
- d3d11_device_unlock( sys->d3d_dev );
+ d3d11_device_unlock( sys->d3d_dev );
}
static void Prepare(vout_display_t *vd, picture_t *picture,
@@ -687,6 +686,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
VLC_UNUSED(date);
+ d3d11_device_lock( sys->d3d_dev );
libvlc_video_direct3d_hdr10_metadata_t hdr10;
if (picture->format.mastering.max_luminance)
{
@@ -711,6 +711,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
sys->startEndRenderingCb( sys->outside_opaque, false, NULL );
}
+ d3d11_device_unlock( sys->d3d_dev );
}
static void Display(vout_display_t *vd, picture_t *picture)
More information about the vlc-commits
mailing list