[vlc-commits] direct3d11: don't lock the ID3D11VideoContext when waiting for the query to finish

Steve Lhomme git at videolan.org
Wed May 26 05:59:16 UTC 2021


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed May 19 11:18:00 2021 +0200| [3bc537162eae628afcc09c3cbdba4f4b7fd45be6] | committer: Steve Lhomme

direct3d11: don't lock the ID3D11VideoContext when waiting for the query to finish

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>

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

 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",



More information about the vlc-commits mailing list