d3d11device: Add gst_d3d11_device_thread_add_full method

I would be used to invoke GPU task with specified priority.
This commit is contained in:
Seungha Yang 2019-12-04 23:20:39 +09:00 committed by GStreamer Merge Bot
parent 7cab47ddda
commit d2b85683de
2 changed files with 30 additions and 2 deletions

View file

@ -652,6 +652,28 @@ gst_d3d11_device_message_callback (MessageData * msg)
void void
gst_d3d11_device_thread_add (GstD3D11Device * device, gst_d3d11_device_thread_add (GstD3D11Device * device,
GstD3D11DeviceThreadFunc func, gpointer data) GstD3D11DeviceThreadFunc func, gpointer data)
{
gst_d3d11_device_thread_add_full (device,
G_PRIORITY_DEFAULT, func, data, NULL);
}
/**
* gst_d3d11_device_thread_add_full:
* @device: a #GstD3D11Device
* @priority: the priority at which to run @func
* @func: (scope call): a #GstD3D11DeviceThreadFunc
* @data: (closure): user data to call @func with
* @notify: (nullable): a function to call when @data is no longer in use, or %NULL.
*
* Execute @func in the D3DDevice thread of @device with @data with specified
* @priority
*
* MT-safe
*/
void
gst_d3d11_device_thread_add_full (GstD3D11Device * device,
gint priority, GstD3D11DeviceThreadFunc func, gpointer data,
GDestroyNotify notify)
{ {
GstD3D11DevicePrivate *priv; GstD3D11DevicePrivate *priv;
MessageData msg = { 0, }; MessageData msg = { 0, };
@ -671,8 +693,8 @@ gst_d3d11_device_thread_add (GstD3D11Device * device,
msg.data = data; msg.data = data;
msg.fired = FALSE; msg.fired = FALSE;
g_main_context_invoke (priv->main_context, g_main_context_invoke_full (priv->main_context, priority,
(GSourceFunc) gst_d3d11_device_message_callback, &msg); (GSourceFunc) gst_d3d11_device_message_callback, &msg, notify);
g_mutex_lock (&priv->lock); g_mutex_lock (&priv->lock);
while (!msg.fired) while (!msg.fired)

View file

@ -97,6 +97,12 @@ void gst_d3d11_device_thread_add (GstD3D11Device * devi
GstD3D11DeviceThreadFunc func, GstD3D11DeviceThreadFunc func,
gpointer data); gpointer data);
void gst_d3d11_device_thread_add_full (GstD3D11Device * device,
gint priority,
GstD3D11DeviceThreadFunc func,
gpointer data,
GDestroyNotify notify);
ID3D11Texture2D * gst_d3d11_device_create_texture (GstD3D11Device * device, ID3D11Texture2D * gst_d3d11_device_create_texture (GstD3D11Device * device,
const D3D11_TEXTURE2D_DESC * desc, const D3D11_TEXTURE2D_DESC * desc,
const D3D11_SUBRESOURCE_DATA *inital_data); const D3D11_SUBRESOURCE_DATA *inital_data);