[vlc-commits] d3d11: lock the device when creating the Video Processor
Steve Lhomme
git at videolan.org
Thu Aug 13 14:25:02 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Aug 13 14:24:26 2020 +0200| [ff39bd61219da8f39c3f1e9f2cf18efe71444b83] | committer: Steve Lhomme
d3d11: lock the device when creating the Video Processor
It doesn't seem to be thread safe.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff39bd61219da8f39c3f1e9f2cf18efe71444b83
---
modules/hw/d3d11/d3d11_deinterlace.c | 4 ++++
modules/hw/d3d11/d3d11_filters.c | 4 ++++
modules/hw/d3d11/d3d11_surface.c | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 9515100ce7..8478d2a189 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -251,6 +251,8 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
return VLC_ENOMEM;
memset(sys, 0, sizeof (*sys));
+ d3d11_device_lock(sys->d3d_dev);
+
d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
sys->d3d_dev = &dev_sys->d3d_dev;
if (D3D11_CreateProcessor(filter, sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST,
@@ -343,6 +345,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
{
goto error;
}
+ d3d11_device_unlock(sys->d3d_dev);
filter->fmt_out.video = out_fmt;
filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
@@ -353,6 +356,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
return VLC_SUCCESS;
error:
D3D11_ReleaseProcessor(&sys->d3d_proc);
+ d3d11_device_unlock(sys->d3d_dev);
free(sys);
return VLC_EGENERIC;
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index 64325e4508..38477eba2d 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -358,6 +358,8 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
sys->d3d_dev = &dev_sys->d3d_dev;
DXGI_FORMAT format = vtcx_sys->format;
+ d3d11_device_lock(sys->d3d_dev);
+
if (D3D11_CreateProcessor(filter, sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE,
&filter->fmt_out.video, &filter->fmt_out.video, &sys->d3d_proc) != VLC_SUCCESS)
goto error;
@@ -509,6 +511,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
filter->pf_video_filter = Filter;
filter->p_sys = sys;
filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
+ d3d11_device_unlock(sys->d3d_dev);
return VLC_SUCCESS;
error:
@@ -525,6 +528,7 @@ error:
if (sys->out[1].texture)
ID3D11Texture2D_Release(sys->out[1].texture);
D3D11_ReleaseProcessor(&sys->d3d_proc);
+ d3d11_device_unlock(sys->d3d_dev);
free(sys);
return VLC_EGENERIC;
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index a5fc45ccf2..c5623f38e1 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -83,6 +83,8 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
filter_sys_t *sys = p_filter->p_sys;
HRESULT hr;
+ d3d11_device_lock(sys->d3d_dev);
+
if (D3D11_CreateProcessor(p_filter, d3d_dev, D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE,
&p_filter->fmt_in.video, &p_filter->fmt_out.video, &sys->d3d_proc) != VLC_SUCCESS)
goto error;
@@ -123,6 +125,7 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
msg_Err(p_filter, "Failed to create the processor output. (hr=0x%lX)", hr);
else
{
+ d3d11_device_unlock(sys->d3d_dev);
return VLC_SUCCESS;
}
}
@@ -135,6 +138,7 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev,
error:
D3D11_ReleaseProcessor(&sys->d3d_proc);
+ d3d11_device_unlock(sys->d3d_dev);
return VLC_EGENERIC;
}
#endif
More information about the vlc-commits
mailing list