gstreamer/gst-libs/gst/vulkan/gstvktrash.h

166 lines
6.3 KiB
C
Raw Normal View History

/*
* GStreamer
* Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VULKAN_TRASH_H__
#define __GST_VULKAN_TRASH_H__
#include <gst/vulkan/vulkan.h>
G_BEGIN_DECLS
typedef void (*GstVulkanTrashNotify) (GstVulkanDevice * device, gpointer user_data);
struct _GstVulkanTrash
{
2019-07-04 04:03:51 +00:00
GstMiniObject parent;
GstVulkanTrashList *cache;
GstVulkanFence *fence;
GstVulkanTrashNotify notify;
gpointer user_data;
/* <private> */
gpointer _padding[GST_PADDING];
};
2019-07-04 04:03:51 +00:00
#define GST_TYPE_VULKAN_TRASH gst_vulkan_trash_get_type()
GST_VULKAN_API
GType gst_vulkan_trash_get_type (void);
/**
* gst_vulkan_trash_ref: (skip)
* @trash: a #GstVulkanTrash.
*
* Increases the refcount of the given trash object by one.
*
* Returns: (transfer full): @trash
*/
static inline GstVulkanTrash* gst_vulkan_trash_ref(GstVulkanTrash* trash);
static inline GstVulkanTrash *
gst_vulkan_trash_ref (GstVulkanTrash * trash)
{
return (GstVulkanTrash *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (trash));
}
/**
* gst_vulkan_trash_unref: (skip)
* @trash: (transfer full): a #GstVulkanTrash.
*
* Decreases the refcount of the trash object. If the refcount reaches 0, the
* trash will be freed.
*/
static inline void gst_vulkan_trash_unref(GstVulkanTrash* trash);
static inline void
gst_vulkan_trash_unref (GstVulkanTrash * trash)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (trash));
}
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVulkanTrash, gst_vulkan_trash_unref)
#endif
GST_VULKAN_API
GstVulkanTrash * gst_vulkan_trash_new (GstVulkanFence * fence,
GstVulkanTrashNotify notify,
gpointer user_data);
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
void gst_vulkan_trash_mini_object_unref (GstVulkanDevice * device,
gpointer user_data);
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
void gst_vulkan_trash_object_unref (GstVulkanDevice * device,
gpointer user_data);
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
GstVulkanTrash * gst_vulkan_trash_new_free_semaphore (GstVulkanFence * fence,
VkSemaphore semaphore);
static inline GstVulkanTrash *
gst_vulkan_trash_new_object_unref (GstVulkanFence * fence, GstObject * object)
{
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
return gst_vulkan_trash_new (fence,
(GstVulkanTrashNotify) gst_vulkan_trash_object_unref, (gpointer) object);
}
static inline GstVulkanTrash *
gst_vulkan_trash_new_mini_object_unref (GstVulkanFence * fence, GstMiniObject * object)
{
return gst_vulkan_trash_new (fence,
(GstVulkanTrashNotify) gst_vulkan_trash_mini_object_unref, (gpointer) object);
}
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
GType gst_vulkan_trash_list_get_type (void);
#define GST_TYPE_VULKAN_TRASH_LIST gst_vulkan_trash_list_get_type()
2019-07-04 04:03:51 +00:00
#define GST_VULKAN_TRASH_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VULKAN_TRASH_LIST,GstVulkanTrashList))
#define GST_VULKAN_TRASH_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VULKAN_TRASH_LIST,GstVulkanTrashListClass))
#define GST_VULKAN_TRASH_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VULKAN_TRASH_LIST,GstVulkanTrashListClass))
#define GST_IS_VULKAN_TRASH_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VULKAN_TRASH_LIST))
#define GST_IS_VULKAN_TRASH_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VULKAN_TRASH_LIST))
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVulkanTrashList, gst_object_unref)
#endif
struct _GstVulkanTrashList
{
GstVulkanHandlePool parent;
2019-07-04 04:03:51 +00:00
};
typedef void (*GstVulkanTrashListGC) (GstVulkanTrashList * trash_list);
typedef gboolean (*GstVulkanTrashListAdd) (GstVulkanTrashList * trash_list, GstVulkanTrash * trash);
typedef gboolean (*GstVulkanTrashListWait) (GstVulkanTrashList * trash_list, guint64 timeout);
2019-07-04 04:03:51 +00:00
struct _GstVulkanTrashListClass
{
GstVulkanHandlePoolClass parent_class;
2019-07-04 04:03:51 +00:00
GstVulkanTrashListAdd add_func;
GstVulkanTrashListGC gc_func;
GstVulkanTrashListWait wait_func;
gpointer _padding[GST_PADDING];
};
GST_VULKAN_API
void gst_vulkan_trash_list_gc (GstVulkanTrashList * trash_list);
GST_VULKAN_API
gboolean gst_vulkan_trash_list_wait (GstVulkanTrashList * trash_list,
guint64 timeout);
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
gboolean gst_vulkan_trash_list_add (GstVulkanTrashList * trash_list,
GstVulkanTrash * trash);
GST_VULKAN_API
GstVulkanTrash * gst_vulkan_trash_list_acquire (GstVulkanTrashList * trash_list,
GstVulkanFence * fence,
GstVulkanTrashNotify notify,
gpointer user_data);
2019-07-04 04:03:51 +00:00
GST_VULKAN_API
G_DECLARE_FINAL_TYPE (GstVulkanTrashFenceList, gst_vulkan_trash_fence_list, GST, VULKAN_TRASH_FENCE_LIST, GstVulkanTrashList);
GST_VULKAN_API
GstVulkanTrashList * gst_vulkan_trash_fence_list_new (void);
G_END_DECLS
#endif /* __GST_VULKAN_TRASH_H__ */