[vlc-commits] direct3d11: log the time waited for the render to finish in verbose mode

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


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed May 19 08:37:55 2021 +0200| [be33a34535e838fce01a86cd44f7b0eb637b4f7b] | committer: Steve Lhomme

direct3d11: log the time waited for the render to finish in verbose mode

(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>

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

 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 );



More information about the vlc-commits mailing list