vulkan: Add/fix various annotations

And fix a memory leak in gst_vulkan_display_wayland_new() in error
cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
This commit is contained in:
Sebastian Dröge 2022-10-17 11:29:02 +03:00
parent b57c07d5a7
commit 2f0e195709
12 changed files with 28 additions and 24 deletions

View File

@ -64,7 +64,7 @@ gst_vulkan_display_android_finalize (GObject * object)
* *
* Create a new #GstVulkanDisplayAndroid. * Create a new #GstVulkanDisplayAndroid.
* *
* Returns: (transfer full): a new #GstVulkanDisplayAndroid or %NULL * Returns: (transfer full): a new #GstVulkanDisplayAndroid
*/ */
GstVulkanDisplayAndroid * GstVulkanDisplayAndroid *
gst_vulkan_display_android_new (void) gst_vulkan_display_android_new (void)

View File

@ -221,7 +221,7 @@ gst_vulkan_display_cocoa_finalize (GObject * object)
* *
* Create a new #GstVulkanDisplayCocoa. * Create a new #GstVulkanDisplayCocoa.
* *
* Returns: (transfer full): a new #GstVulkanDisplayCocoa or %NULL * Returns: (transfer full): a new #GstVulkanDisplayCocoa
*/ */
GstVulkanDisplayCocoa * GstVulkanDisplayCocoa *
gst_vulkan_display_cocoa_new (void) gst_vulkan_display_cocoa_new (void)

View File

@ -424,7 +424,7 @@ gst_vulkan_device_foreach_queue (GstVulkanDevice * device,
* *
* Performs `vkGetDeviceProcAddr()` with @device and @name * Performs `vkGetDeviceProcAddr()` with @device and @name
* *
* Returns: the function pointer for @name or %NULL * Returns: (nullable): the function pointer for @name or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -445,7 +445,7 @@ gst_vulkan_device_get_proc_address (GstVulkanDevice * device,
* gst_vulkan_device_get_instance: * gst_vulkan_device_get_instance:
* @device: a #GstVulkanDevice * @device: a #GstVulkanDevice
* *
* Returns: (transfer full): the #GstVulkanInstance used to create this @device * Returns: (transfer full) (nullable): the #GstVulkanInstance used to create this @device
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -629,7 +629,7 @@ gst_vulkan_device_run_context_query (GstElement * element,
* @device: a #GstVulkanDevice * @device: a #GstVulkanDevice
* @error: a #GError to fill on failure * @error: a #GError to fill on failure
* *
* Returns: a new #GstVulkanFence or %NULL * Returns: (transfer full) (nullable): a new #GstVulkanFence or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */

View File

@ -206,7 +206,7 @@ gst_vulkan_display_finalize (GObject * object)
* @instance: a #GstVulkanInstance * @instance: a #GstVulkanInstance
* @type: the #GstVulkanDisplayType to create * @type: the #GstVulkanDisplayType to create
* *
* Returns: (transfer full): a new #GstVulkanDisplay or %NULL if e.g. @type is * Returns: (transfer full) (nullable): a new #GstVulkanDisplay or %NULL if e.g. @type is
* unsupported * unsupported
* *
* Since: 1.18 * Since: 1.18
@ -326,7 +326,7 @@ gst_vulkan_display_get_handle_type (GstVulkanDisplay * display)
* gst_vulkan_display_create_window: * gst_vulkan_display_create_window:
* @display: a #GstVulkanDisplay * @display: a #GstVulkanDisplay
* *
* Returns: (transfer full): a new #GstVulkanWindow for @display or %NULL. * Returns: (transfer full) (nullable): a new #GstVulkanWindow for @display or %NULL.
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -400,7 +400,7 @@ window_weak_list_to_strong (GstVulkanDisplay * display)
* first argument to @compare_func is the #GstVulkanWindow being checked and the * first argument to @compare_func is the #GstVulkanWindow being checked and the
* second argument is @data. * second argument is @data.
* *
* Returns: (transfer full): The first #GstVulkanWindow that causes a match * Returns: (transfer full) (nullable): The first #GstVulkanWindow that causes a match
* from @compare_func * from @compare_func
* *
* Since: 1.18 * Since: 1.18
@ -633,7 +633,7 @@ gst_vulkan_display_choose_type (GstVulkanInstance * instance)
* gst_vulkan_display_type_to_extension_string: * gst_vulkan_display_type_to_extension_string:
* @type: a #GstVulkanDisplayType * @type: a #GstVulkanDisplayType
* *
* Returns: the Vulkan extension string required for creating a VkSurfaceKHR * Returns: (nullable): the Vulkan extension string required for creating a VkSurfaceKHR
* using a window system handle or %NULL * using a window system handle or %NULL
* *
* Since: 1.18 * Since: 1.18

View File

@ -87,7 +87,7 @@ gst_vulkan_fence_free (GstVulkanFence * fence)
/** /**
* gst_vulkan_fence_new: * gst_vulkan_fence_new:
* @device: the parent #GstVulkanDevice * @device: the parent #GstVulkanDevice
* @error: a #GError for the failure condition * @error: (optional): a #GError for the failure condition
* *
* Returns: whether a new #GstVulkanFence or %NULL on error * Returns: whether a new #GstVulkanFence or %NULL on error
* *

View File

@ -419,7 +419,7 @@ FIXME: implement:
* gst_vulkan_format_get_info: * gst_vulkan_format_get_info:
* @format: a valid `VkFormat` * @format: a valid `VkFormat`
* *
* Returns: the #GstVulkanFormatInfo for @format or %NULL * Returns: (nullable): the #GstVulkanFormatInfo for @format or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */

View File

@ -1071,7 +1071,7 @@ error:
* *
* Performs `vkGetInstanceProcAddr()` with @instance and @name * Performs `vkGetInstanceProcAddr()` with @instance and @name
* *
* Returns: the function pointer for @name or %NULL * Returns: (nullable): the function pointer for @name or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -1095,6 +1095,7 @@ gst_vulkan_instance_get_proc_address (GstVulkanInstance * instance,
/** /**
* gst_vulkan_instance_create_device: * gst_vulkan_instance_create_device:
* @instance: a #GstVulkanInstance * @instance: a #GstVulkanInstance
* @error: (optional): a #GError
* *
* Returns: (transfer full): a new #GstVulkanDevice * Returns: (transfer full): a new #GstVulkanDevice
* *

View File

@ -97,7 +97,7 @@ gst_vulkan_queue_dispose (GObject * object)
* gst_vulkan_queue_get_device * gst_vulkan_queue_get_device
* @queue: a #GstVulkanQueue * @queue: a #GstVulkanQueue
* *
* Returns: (transfer full): the #GstVulkanDevice for @queue * Returns: (transfer full) (nullable): the #GstVulkanDevice for @queue
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -112,7 +112,7 @@ gst_vulkan_queue_get_device (GstVulkanQueue * queue)
/** /**
* gst_vulkan_queue_create_command_pool: * gst_vulkan_queue_create_command_pool:
* @queue: a #GstVulkanQueue * @queue: a #GstVulkanQueue
* @error: a #GError * @error: (optional): a #GError
* *
* Returns: (transfer full): a new #GstVUlkanCommandPool or %NULL * Returns: (transfer full): a new #GstVUlkanCommandPool or %NULL
* *

View File

@ -489,7 +489,7 @@ gst_vulkan_get_or_create_image_view (GstVulkanImageMemory * image)
* @device: a #GstVulkanDevice * @device: a #GstVulkanDevice
* @code: the SPIR-V shader byte code * @code: the SPIR-V shader byte code
* @size: length of @code. Must be a multiple of 4 * @size: length of @code. Must be a multiple of 4
* @error: a #GError to fill on failure * @error: (optional): a #GError to fill on failure
* *
* Returns: (transfer full): a #GstVulkanHandle for @image matching the * Returns: (transfer full): a #GstVulkanHandle for @image matching the
* original layout and format of @image or %NULL * original layout and format of @image or %NULL

View File

@ -65,7 +65,7 @@ gst_vulkan_display_ios_finalize (GObject * object)
* *
* Create a new #GstVulkanDisplayIos. * Create a new #GstVulkanDisplayIos.
* *
* Returns: (transfer full): a new #GstVulkanDisplayIos or %NULL * Returns: (transfer full): a new #GstVulkanDisplayIos
*/ */
GstVulkanDisplayIos * GstVulkanDisplayIos *
gst_vulkan_display_ios_new (void) gst_vulkan_display_ios_new (void)

View File

@ -105,12 +105,12 @@ gst_vulkan_display_wayland_finalize (GObject * object)
/** /**
* gst_vulkan_display_wayland_new: * gst_vulkan_display_wayland_new:
* @name: (allow-none): a display name * @name: (nullable): a display name
* *
* Create a new #GstVulkanDisplayWayland from the wayland display name. See `wl_display_connect`() * Create a new #GstVulkanDisplayWayland from the wayland display name. See `wl_display_connect`()
* for details on what is a valid name. * for details on what is a valid name.
* *
* Returns: (transfer full): a new #GstVulkanDisplayWayland or %NULL * Returns: (transfer full) (nullable): a new #GstVulkanDisplayWayland or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */
@ -118,17 +118,20 @@ GstVulkanDisplayWayland *
gst_vulkan_display_wayland_new (const gchar * name) gst_vulkan_display_wayland_new (const gchar * name)
{ {
GstVulkanDisplayWayland *ret; GstVulkanDisplayWayland *ret;
struct wl_display *display;
ret = g_object_new (GST_TYPE_VULKAN_DISPLAY_WAYLAND, NULL); display = wl_display_connect (name);
gst_object_ref_sink (ret);
ret->display = wl_display_connect (name);
if (!ret->display) { if (!display) {
GST_ERROR ("Failed to open Wayland display connection with name, \'%s\'", GST_ERROR ("Failed to open Wayland display connection with name, \'%s\'",
name); name);
return NULL; return NULL;
} }
ret = g_object_new (GST_TYPE_VULKAN_DISPLAY_WAYLAND, NULL);
gst_object_ref_sink (ret);
ret->display = display;
/* connecting the listeners after attaching the event source will race with /* connecting the listeners after attaching the event source will race with
* the source and the source may eat an event that we're waiting for and * the source and the source may eat an event that we're waiting for and
* deadlock */ * deadlock */

View File

@ -82,12 +82,12 @@ _get_screen_from_connection (xcb_connection_t * connection, int screen_no)
/** /**
* gst_vulkan_display_xcb_new: * gst_vulkan_display_xcb_new:
* @name: (allow-none): a display name * @name: (nullable): a display name
* *
* Create a new #GstVulkanDisplayXCB from the xcb display name. See XOpenDisplay\() * Create a new #GstVulkanDisplayXCB from the xcb display name. See XOpenDisplay\()
* for details on what is a valid name. * for details on what is a valid name.
* *
* Returns: (transfer full): a new #GstVulkanDisplayXCB or %NULL * Returns: (transfer full) (nullable): a new #GstVulkanDisplayXCB or %NULL
* *
* Since: 1.18 * Since: 1.18
*/ */