mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
vkinstance: add gst_vulkan_instance_create_device_with_index
This method will allow to create a device with its device_index preparing the support of multiple device. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7843>
This commit is contained in:
parent
46f4dbe57b
commit
9a771b6909
3 changed files with 67 additions and 21 deletions
|
@ -4150,6 +4150,23 @@ If a specific version is requested, the @patch level is ignored.</doc>
|
|||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="create_device_with_index" c:identifier="gst_vulkan_instance_create_device_with_index" version="1.26" throws="1">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.h"/>
|
||||
<return-value transfer-ownership="full">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">a new #GstVulkanDevice</doc>
|
||||
<type name="VulkanDevice" c:type="GstVulkanDevice*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="instance" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">a #GstVulkanInstance</doc>
|
||||
<type name="VulkanInstance" c:type="GstVulkanInstance*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="device_index" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">the device index to create the new #GstVulkanDevice from</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="disable_extension" c:identifier="gst_vulkan_instance_disable_extension" version="1.18">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">Disable an Vulkan extension by @name. Disabling an extension will only have
|
||||
an effect before the call to gst_vulkan_instance_open().</doc>
|
||||
|
@ -4404,13 +4421,19 @@ version with this function.</doc>
|
|||
<type name="gpointer" c:type="gpointer"/>
|
||||
</array>
|
||||
</field>
|
||||
<glib:signal name="create-device" when="last" version="1.18">
|
||||
<glib:signal name="create-device" when="last" version="1.26">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">Overrides the #GstVulkanDevice creation mechanism.
|
||||
It can be called from any thread.</doc>
|
||||
<return-value transfer-ownership="full">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">the newly created #GstVulkanDevice.</doc>
|
||||
<type name="VulkanDevice"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="device_index" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkinstance.c">the index of the device</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</glib:signal>
|
||||
</class>
|
||||
<record name="VulkanInstanceClass" c:type="GstVulkanInstanceClass" glib:is-gtype-struct-for="VulkanInstance" version="1.18">
|
||||
|
|
|
@ -253,18 +253,20 @@ gst_vulkan_instance_class_init (GstVulkanInstanceClass * klass)
|
|||
|
||||
/**
|
||||
* GstVulkanInstance::create-device:
|
||||
* @object: the #GstVulkanDisplay
|
||||
* @device: the #GstVulkanDevice
|
||||
* @device_index: the index of the device
|
||||
*
|
||||
* Overrides the #GstVulkanDevice creation mechanism.
|
||||
* It can be called from any thread.
|
||||
*
|
||||
* Returns: (transfer full): the newly created #GstVulkanDevice.
|
||||
*
|
||||
* Since: 1.18
|
||||
* Since: 1.26
|
||||
*/
|
||||
gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE] =
|
||||
g_signal_new ("create-device", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, GST_TYPE_VULKAN_DEVICE, 0);
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, GST_TYPE_VULKAN_DEVICE, 1,
|
||||
G_TYPE_UINT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1102,6 +1104,39 @@ gst_vulkan_instance_get_proc_address (GstVulkanInstance * instance,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_instance_create_device_with_index:
|
||||
* @instance: a #GstVulkanInstance
|
||||
* @device_index: the device index to create the new #GstVulkanDevice from
|
||||
* @error: (out) (optional): a #GError
|
||||
*
|
||||
* Returns: (transfer full): a new #GstVulkanDevice
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstVulkanDevice *
|
||||
gst_vulkan_instance_create_device_with_index (GstVulkanInstance * instance,
|
||||
guint device_index, GError ** error)
|
||||
{
|
||||
GstVulkanDevice *device;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_INSTANCE (instance), NULL);
|
||||
|
||||
g_signal_emit (instance, gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE], 0,
|
||||
device_index, &device);
|
||||
|
||||
if (!device) {
|
||||
device = gst_vulkan_device_new_with_index (instance, device_index);
|
||||
}
|
||||
|
||||
if (!gst_vulkan_device_open (device, error)) {
|
||||
gst_object_unref (device);
|
||||
device = NULL;
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_instance_create_device:
|
||||
* @instance: a #GstVulkanInstance
|
||||
|
@ -1115,23 +1150,7 @@ GstVulkanDevice *
|
|||
gst_vulkan_instance_create_device (GstVulkanInstance * instance,
|
||||
GError ** error)
|
||||
{
|
||||
GstVulkanDevice *device;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_INSTANCE (instance), NULL);
|
||||
|
||||
g_signal_emit (instance, gst_vulkan_instance_signals[SIGNAL_CREATE_DEVICE], 0,
|
||||
&device);
|
||||
|
||||
if (!device) {
|
||||
device = gst_vulkan_device_new_with_index (instance, 0);
|
||||
}
|
||||
|
||||
if (!gst_vulkan_device_open (device, error)) {
|
||||
gst_object_unref (device);
|
||||
device = NULL;
|
||||
}
|
||||
|
||||
return device;
|
||||
return gst_vulkan_instance_create_device_with_index (instance, 0, error);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,10 @@ gpointer gst_vulkan_instance_get_proc_address (GstVulkanInstan
|
|||
GST_VULKAN_API
|
||||
GstVulkanDevice * gst_vulkan_instance_create_device (GstVulkanInstance * instance,
|
||||
GError ** error);
|
||||
GST_VULKAN_API
|
||||
GstVulkanDevice * gst_vulkan_instance_create_device_with_index(GstVulkanInstance * instance,
|
||||
guint device_index,
|
||||
GError ** error);
|
||||
|
||||
GST_VULKAN_API
|
||||
void gst_context_set_vulkan_instance (GstContext * context,
|
||||
|
|
Loading…
Reference in a new issue