mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 19:06:33 +00:00
d3d11memory: Protect against concurrent access from GPU and CPU to staging texture
Staging texture does not allow GPU access while it's CPU mapped. But because we cannot block concurrent READ access by GstMemory design, additional staging texture is still required. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2375>
This commit is contained in:
parent
e0a9a73adf
commit
47ff41bcd2
1 changed files with 2 additions and 8 deletions
|
@ -342,7 +342,7 @@ gst_d3d11_memory_upload (GstD3D11Memory * dmem)
|
|||
GstD3D11MemoryPrivate *priv = dmem->priv;
|
||||
ID3D11DeviceContext *device_context;
|
||||
|
||||
if (!priv->staging || priv->staging == priv->texture ||
|
||||
if (!priv->staging ||
|
||||
!GST_MEMORY_FLAG_IS_SET (dmem, GST_D3D11_MEMORY_TRANSFER_NEED_UPLOAD))
|
||||
return;
|
||||
|
||||
|
@ -358,7 +358,7 @@ gst_d3d11_memory_download (GstD3D11Memory * dmem)
|
|||
GstD3D11MemoryPrivate *priv = dmem->priv;
|
||||
ID3D11DeviceContext *device_context;
|
||||
|
||||
if (!priv->staging || priv->staging == priv->texture ||
|
||||
if (!priv->staging ||
|
||||
!GST_MEMORY_FLAG_IS_SET (dmem, GST_D3D11_MEMORY_TRANSFER_NEED_DOWNLOAD))
|
||||
return;
|
||||
|
||||
|
@ -1433,12 +1433,6 @@ gst_d3d11_allocator_alloc_wrapped (GstD3D11Allocator * self,
|
|||
mem->priv->native_type = GST_D3D11_MEMORY_NATIVE_TYPE_TEXTURE_2D;
|
||||
mem->device = (GstD3D11Device *) gst_object_ref (device);
|
||||
|
||||
/* This is staging texture as well */
|
||||
if (desc->Usage == D3D11_USAGE_STAGING) {
|
||||
mem->priv->staging = texture;
|
||||
texture->AddRef ();
|
||||
}
|
||||
|
||||
return GST_MEMORY_CAST (mem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue