[vlc-devel] [PATCH 3.0 2/4] direct3d11: don't lock the ID3D11VideoContext when waiting for the query to finish

Steve Lhomme robux4 at ycbcr.xyz
Tue May 25 08:44:18 UTC 2021


This leaves some time for the decoder to do things.

This is how it was before 42011b9fb105b4b5de832fdafd097b86c8154eda.

Fixes #25728

(cherry picked from commit 4cb73cccce3a413263b697b88acafe172978c325) (edited)
edited:
- the display callback is in a different location
- the d3d_dev is not a pointer

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 modules/video_output/win32/direct3d11.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e950987172..519737f0e3 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1027,6 +1027,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev.d3dcontext,
                                                       sys->prepareWait, NULL, 0, 0))
         {
+            d3d11_device_unlock( &sys->d3d_dev );
             mtime_t sleep_duration = (picture->date - mdate()) / 4;
             if (sleep_duration <= 2 * CLOCK_FREQ / 1000)
             {
@@ -1036,6 +1037,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
             }
             // wait a little until the rendering is done
             SleepEx(sleep_duration * 1000 / CLOCK_FREQ, TRUE);
+            d3d11_device_lock( &sys->d3d_dev );
         }
     }
 
@@ -1063,9 +1065,11 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev.d3dcontext,
                                                       sys->prepareWait, NULL, 0, 0))
         {
+            d3d11_device_unlock( &sys->d3d_dev );
             if (start == 0)
                 start = mdate();
             SleepEx(2, TRUE);
+            d3d11_device_lock( &sys->d3d_dev );
         }
         if (start != 0 && sys->log_level >= 4)
             msg_Dbg(vd, "rendering wasn't finished, waited extra %lld ms",
-- 
2.29.2



More information about the vlc-devel mailing list