d3d12memory: Add get_external_fence() method

Required for caller to wait external fence without map() method

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6749>
This commit is contained in:
Seungha Yang 2024-04-27 17:28:47 +09:00 committed by GStreamer Marge Bot
parent 00924d4820
commit ebb64dfd0d
2 changed files with 35 additions and 0 deletions

View file

@ -994,6 +994,36 @@ gst_d3d12_memory_set_external_fence (GstD3D12Memory * mem, ID3D12Fence * fence,
gst_d3d12_memory_set_external_fence_unlocked (mem, fence, fence_val);
}
/**
* gst_d3d12_memory_get_external_fence:
* @mem: a #GstD3D12Memory
* @fence: (out) (transfer full) (nullable): a ID3D12Fence
* @fence_val: (out): fence value
*
* Gets configured external fence and fence value
*
* Returns: %TRUE if external fence was configured in @mem
*
* Since: 1.26
*/
gboolean
gst_d3d12_memory_get_external_fence (GstD3D12Memory * mem, ID3D12Fence ** fence,
guint64 * fence_val)
{
auto priv = mem->priv;
std::lock_guard < std::mutex > lk (priv->lock);
if (priv->external_fence) {
*fence = priv->external_fence.Get ();
(*fence)->AddRef ();
*fence_val = priv->external_fence_val;
return TRUE;
}
return FALSE;
}
/**
* gst_d3d12_memory_get_d3d11_texture:
* @mem: a #GstD3D12Memory

View file

@ -222,6 +222,11 @@ void gst_d3d12_memory_set_external_fence (GstD3D12Memory * mem,
ID3D12Fence * fence,
guint64 fence_val);
GST_D3D12_API
gboolean gst_d3d12_memory_get_external_fence (GstD3D12Memory * mem,
ID3D12Fence ** fence,
guint64 * fence_val);
GST_D3D12_API
ID3D11Texture2D * gst_d3d12_memory_get_d3d11_texture (GstD3D12Memory * mem,
ID3D11Device * device11);