[vlc-commits] [Git][videolan/vlc][master] 4 commits: direct3d11: call var_InheritInteger("verbose") less often

Steve Lhomme gitlab at videolan.org
Thu May 20 13:35:28 UTC 2021



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f166bc2a by Steve Lhomme at 2021-05-20T11:45:00+00:00
direct3d11: call var_InheritInteger("verbose") less often

- - - - -
4cb73ccc by Steve Lhomme at 2021-05-20T11:45:00+00:00
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

- - - - -
88c75388 by Steve Lhomme at 2021-05-20T11:45:00+00:00
contrib: wine: make sure we have a usable d3d11_4.h

- - - - -
2550346b by Steve Lhomme at 2021-05-20T11:45:00+00:00
direct3d11: log the time waited for the render to finish in verbose mode

- - - - -


2 changed files:

- contrib/src/wine-headers/rules.mak
- modules/video_output/win32/direct3d11.c


Changes:

=====================================
contrib/src/wine-headers/rules.mak
=====================================
@@ -10,7 +10,7 @@ endif
 WINE_EXTRA_HEADERS = dxva.h
 WINE_IDL_HEADERS = \
 	d3d11.idl \
-	d3d11_1.idl d3d11_2.idl d3d11_3.idl \
+	d3d11_1.idl d3d11_2.idl d3d11_3.idl d3d11_4.idl \
 	dxgicommon.idl dxgitype.idl dxgiformat.idl \
 	dxgidebug.idl \
 	dxgi.idl dxgi1_2.idl dxgi1_3.idl dxgi1_4.idl dxgi1_5.idl dxgi1_6.idl \


=====================================
modules/video_output/win32/direct3d11.c
=====================================
@@ -93,6 +93,8 @@ struct vout_display_sys_t
     vout_display_sys_win32_t sys;       /* only use if sys.event is not NULL */
     display_win32_area_t     area;
 
+    int                      log_level;
+
     /* Sensors */
     void *p_sensors;
 
@@ -625,9 +627,14 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
         }
     }
 
+    vlc_tick_t render_start;
+    const char *wait_method = NULL;
+    if (sys->log_level >= 4)
+        render_start = vlc_tick_now();
 #ifdef HAVE_D3D11_4_H
     if (sys->d3dcontext4)
     {
+        wait_method = "fence";
         if (sys->renderFence == UINT64_MAX)
             sys->renderFence = 0;
         else
@@ -643,11 +650,13 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
 #endif
     if (sys->prepareWait)
     {
+        wait_method = "query";
         ID3D11DeviceContext_End(sys->d3d_dev->d3dcontext, sys->prepareWait);
 
         while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev->d3dcontext,
                                                       sys->prepareWait, NULL, 0, 0))
         {
+            d3d11_device_unlock( sys->d3d_dev );
             vlc_tick_t sleep_duration = (date - vlc_tick_now()) / 4;
             if (sleep_duration <= VLC_TICK_FROM_MS(2))
             {
@@ -657,8 +666,13 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
             }
             // wait a little until the rendering is done
             SleepEx(MS_FROM_VLC_TICK(sleep_duration), TRUE);
+            d3d11_device_lock( sys->d3d_dev );
         }
     }
+    if (sys->log_level >= 4 && wait_method != NULL)
+    {
+        msg_Dbg(vd, "waited %" PRId64 " ms for the render %s", MS_FROM_VLC_TICK(vlc_tick_now() - render_start), wait_method);
+    }
 }
 
 static void Prepare(vout_display_t *vd, picture_t *picture,
@@ -722,13 +736,15 @@ static void Display(vout_display_t *vd, picture_t *picture)
         while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev->d3dcontext,
                                                       sys->prepareWait, NULL, 0, 0))
         {
+            d3d11_device_unlock( sys->d3d_dev );
             if (start == 0)
                 start = vlc_tick_now();
             // keep waiting until all rendering (plus extra) is known to be finished
             // to let the vout thread things are not as smooth as it may think
             SleepEx(2, TRUE);
+            d3d11_device_lock( sys->d3d_dev );
         }
-        if (start != 0 && var_InheritInteger(vd, "verbose") >= 4)
+        if (start != 0 && sys->log_level >= 4)
             msg_Dbg(vd, "rendering wasn't finished, waited extra %lld ms", MS_FROM_VLC_TICK(vlc_tick_now() - start));
     }
 
@@ -833,6 +849,8 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
     video_format_Clean(fmtp);
     *fmtp = fmt;
 
+    sys->log_level = var_InheritInteger(vd, "verbose");
+
     return VLC_SUCCESS;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f235d8ff4282705936729298d4cf25aee595a82a...2550346b5f609b6c7626281a906bdaa6523ffbb7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f235d8ff4282705936729298d4cf25aee595a82a...2550346b5f609b6c7626281a906bdaa6523ffbb7
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list