[vlc-devel] [PATCH 3.0 3/4] direct3d11: log the time waited for the render to finish in verbose mode

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


(cherry picked from commit 2550346b5f609b6c7626281a906bdaa6523ffbb7) (edited)
edited:
- the code unlock is only for D3D11 opaque
- mtime_t instead of vlc_tick_t

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

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 519737f0e3..2867e0200f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1004,9 +1004,14 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         }
     }
 
+    mtime_t render_start;
+    const char *wait_method = NULL;
+    if (sys->log_level >= 4)
+        render_start = mdate();
 #ifdef HAVE_D3D11_4_H
     if (sys->d3dcontext4)
     {
+        wait_method = "fence";
         if (sys->renderFence == UINT64_MAX)
             sys->renderFence;
         else
@@ -1022,6 +1027,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 #endif
     if (sys->prepareWait)
     {
+        wait_method = "query";
         ID3D11DeviceContext_End(sys->d3d_dev.d3dcontext, sys->prepareWait);
 
         while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev.d3dcontext,
@@ -1040,6 +1046,11 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
             d3d11_device_lock( &sys->d3d_dev );
         }
     }
+    if (sys->log_level >= 4 && wait_method != NULL)
+    {
+        msg_Dbg(vd, "waited %" PRId64 " ms for the render %s",
+            (mdate() - render_start) * 1000 / CLOCK_FREQ, wait_method);
+    }
 
     if (is_d3d11_opaque(picture->format.i_chroma))
         d3d11_device_unlock( &sys->d3d_dev );
-- 
2.29.2



More information about the vlc-devel mailing list