[vlc-commits] vout: direct3d11: clean the wait until all the commands are processed
Steve Lhomme
git at videolan.org
Wed Aug 5 09:27:12 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Aug 5 09:25:31 2020 +0200| [972733ed991e7219d9c5615c633d35d1c40cb55b] | committer: Steve Lhomme
vout: direct3d11: clean the wait until all the commands are processed
We need to begin the commands we are monitoring. We need to unlock the device
context while we wait until it's finished with our commands. The decoder may
have a chance to send some decoding commands and we may wait longer when
locking back the device context.
We don't need to lock the device context in PreparePicture, it's already locked.
Use a ID3D11Asynchronous pointer directly. We don't need to know the underlying
type, except when creating it.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=972733ed991e7219d9c5615c633d35d1c40cb55b
---
modules/video_output/win32/direct3d11.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 47eecf9582..faa154ee04 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -100,7 +100,7 @@ struct vout_display_sys_t
d3d11_shaders_t shaders;
d3d_quad_t picQuad;
- ID3D11Query *prepareWait;
+ ID3D11Asynchronous *prepareWait;
picture_sys_d3d11_t stagingSys;
plane_t stagingPlanes[PICTURE_PLANE_MAX];
@@ -521,7 +521,10 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
{
vout_display_sys_t *sys = vd->sys;
- d3d11_device_lock( sys->d3d_dev );
+ if (sys->prepareWait)
+ {
+ ID3D11DeviceContext_Begin(sys->d3d_dev->d3dcontext, sys->prepareWait);
+ }
if (sys->picQuad.textureFormat->formatTexture == DXGI_FORMAT_UNKNOWN)
{
@@ -664,15 +667,17 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
if (sys->prepareWait)
{
int maxWait = 10;
- ID3D11DeviceContext_End(sys->d3d_dev->d3dcontext, (ID3D11Asynchronous*)sys->prepareWait);
+ ID3D11DeviceContext_End(sys->d3d_dev->d3dcontext, sys->prepareWait);
while (S_FALSE == ID3D11DeviceContext_GetData(sys->d3d_dev->d3dcontext,
- (ID3D11Asynchronous*)sys->prepareWait, NULL, 0, 0)
+ sys->prepareWait, NULL, 0, 0)
&& --maxWait)
+ {
+ d3d11_device_unlock( sys->d3d_dev );
SleepEx(2, TRUE);
+ d3d11_device_lock( sys->d3d_dev );
+ }
}
-
- d3d11_device_unlock( sys->d3d_dev );
}
static void Prepare(vout_display_t *vd, picture_t *picture,
@@ -1142,7 +1147,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
D3D11_QUERY_DESC query = { 0 };
query.Query = D3D11_QUERY_EVENT;
- hr = ID3D11Device_CreateQuery(sys->d3d_dev->d3ddevice, &query, &sys->prepareWait);
+ hr = ID3D11Device_CreateQuery(sys->d3d_dev->d3ddevice, &query, (ID3D11Query**)&sys->prepareWait);
ID3D11BlendState *pSpuBlendState;
D3D11_BLEND_DESC spuBlendDesc = { 0 };
More information about the vlc-commits
mailing list