[vlc-commits] direct3d11: make sure there's no pending operation after leaving Prepare()

Steve Lhomme git at videolan.org
Thu Apr 13 14:58:45 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Apr 10 16:04:36 2017 +0200| [3d541867effaea1f8f65cb7dd19f780e79157bac] | committer: Jean-Baptiste Kempf

direct3d11: make sure there's no pending operation after leaving Prepare()

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d541867effaea1f8f65cb7dd19f780e79157bac
---

 modules/video_output/win32/direct3d11.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 81cb9d51db..dc690bfaa7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1198,15 +1198,13 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 {
     vout_display_sys_t *sys = vd->sys;
 
+#if defined(HAVE_ID3D11VIDEODECODER)
+    if( sys->context_lock != INVALID_HANDLE_VALUE )
+        WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
+#endif
     if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader) {
         picture_sys_t *p_sys = picture->p_sys;
         D3D11_TEXTURE2D_DESC texDesc;
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if( sys->context_lock != INVALID_HANDLE_VALUE )
-        {
-            WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
-        }
-#endif
         if (!is_d3d11_opaque(picture->format.i_chroma))
             Direct3D11UnmapPoolTexture(picture);
         ID3D11Texture2D_GetDesc(sys->stagingSys.texture[0], &texDesc);
@@ -1222,23 +1220,6 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
                                                   0, 0, 0, 0,
                                                   p_sys->resource[KNOWN_DXGI_INDEX],
                                                   p_sys->slice_index, &box);
-        ID3D11DeviceContext_Flush(sys->d3dcontext);
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if ( sys->context_lock != INVALID_HANDLE_VALUE)
-            ReleaseMutex( sys->context_lock );
-#endif
-    } else {
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if( sys->context_lock != INVALID_HANDLE_VALUE )
-        {
-            WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
-        }
-#endif
-        ID3D11DeviceContext_Flush(sys->d3dcontext);
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if ( sys->context_lock != INVALID_HANDLE_VALUE)
-            ReleaseMutex( sys->context_lock );
-#endif
     }
 
     if (subpicture) {
@@ -1249,6 +1230,12 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         sys->d3dregion_count = subpicture_region_count;
         sys->d3dregions      = subpicture_regions;
     }
+
+    ID3D11DeviceContext_Flush(sys->d3dcontext);
+#if defined(HAVE_ID3D11VIDEODECODER)
+    if ( sys->context_lock != INVALID_HANDLE_VALUE)
+        ReleaseMutex( sys->context_lock );
+#endif
 }
 
 static void DisplayD3DPicture(vout_display_sys_t *sys, d3d_quad_t *quad, ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW])



More information about the vlc-commits mailing list