gstreamer/gst-libs/gst/vulkan/gstvkhandlepool.h
Matthew Waters 24d096597b vulkan: implement caching and reuse of a couple of vulkan resources
Includes a new GstVulkanHandlePool base class for pooling different
resources togther.  The descriptor cache object is ported to
GstVulkanHandlePool with the exact same functionality.

A new GstVulkanFenceCache is also implemented for caching fences
which is used internally by GstVulkanDevice for creating or reusing
fences.

The existing GstVulkanTrashFenceList object now caches trash objects.
2019-11-28 23:27:21 +00:00

74 lines
2.9 KiB
C

/*
* GStreamer
* Copyright (C) 2019 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_HANDLE_POOL_H__
#define __GST_VULKAN_HANDLE_POOL_H__
#include <gst/gst.h>
#include <gst/vulkan/vulkan_fwd.h>
#include <gst/vulkan/gstvkapi.h>
G_BEGIN_DECLS
GST_VULKAN_API
GType gst_vulkan_handle_pool_get_type (void);
#define GST_TYPE_VULKAN_HANDLE_POOL (gst_vulkan_handle_pool_get_type())
#define GST_VULKAN_HANDLE_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VULKAN_HANDLE_POOL,GstVulkanHandlePool))
#define GST_VULKAN_HANDLE_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VULKAN_HANDLE_POOL,GstVulkanHandlePoolClass))
#define GST_IS_VULKAN_HANDLE_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VULKAN_HANDLE_POOL))
#define GST_IS_VULKAN_HANDLE_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VULKAN_HANDLE_POOL))
#define GST_VULKAN_HANDLE_POOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_HANDLE_POOL, GstVulkanHandlePoolClass))
#define GST_VULKAN_HANDLE_POOL_CAST(o) ((GstVulkanHandlePool *) o)
struct _GstVulkanHandlePool
{
GstObject parent;
GstVulkanDevice *device;
/* <protected> */
GPtrArray *outstanding;
GPtrArray *available;
/* <private> */
gpointer _padding[GST_PADDING];
};
struct _GstVulkanHandlePoolClass
{
GstObjectClass parent;
gpointer (*alloc) (GstVulkanHandlePool * pool, GError ** error);
gpointer (*acquire) (GstVulkanHandlePool * pool, GError ** error);
void (*release) (GstVulkanHandlePool * pool, gpointer handle);
void (*free) (GstVulkanHandlePool * pool, gpointer handle);
};
GST_VULKAN_API
gpointer gst_vulkan_handle_pool_alloc (GstVulkanHandlePool * pool, GError ** error);
GST_VULKAN_API
gpointer gst_vulkan_handle_pool_acquire (GstVulkanHandlePool * pool, GError ** error);
GST_VULKAN_API
void gst_vulkan_handle_pool_release (GstVulkanHandlePool * pool, gpointer handle);
G_END_DECLS
#endif /* _GST_VULKAN_HANDLE_H_ */