| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef __GST_VULKAN_IMAGE_MEMORY_H__ |
| 22 |
#define __GST_VULKAN_IMAGE_MEMORY_H__ |
| 23 |
|
| 24 |
#include <gst/vulkan/gstvkbarrier.h> |
| 25 |
#include <gst/vulkan/gstvkdevice.h> |
| 26 |
|
| 27 |
#include <gst/video/video.h> |
| 28 |
|
| 29 |
G_BEGIN_DECLS |
| 30 |
|
| 31 |
#define GST_TYPE_VULKAN_IMAGE_MEMORY_ALLOCATOR (gst_vulkan_image_memory_allocator_get_type()) |
| 32 |
GST_VULKAN_API |
| 33 |
GType gst_vulkan_image_memory_allocator_get_type(void); |
| 34 |
|
| 35 |
#define GST_IS_VULKAN_IMAGE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VULKAN_IMAGE_MEMORY_ALLOCATOR)) |
| 36 |
#define GST_IS_VULKAN_IMAGE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VULKAN_IMAGE_MEMORY_ALLOCATOR)) |
| 37 |
#define GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VULKAN_MEMORY_ALLOCATOR, GstVulkanImageMemoryAllocatorClass)) |
| 38 |
#define GST_VULKAN_IMAGE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VULKAN_MEMORY_ALLOCATOR, GstVulkanImageMemoryAllocator)) |
| 39 |
#define GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VULKAN_MEMORY_ALLOCATOR, GstVulkanImageMemoryAllocatorClass)) |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#define GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_CAST(obj) ((GstVulkanImageMemoryAllocator *)(obj)) |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#define GST_VULKAN_IMAGE_MEMORY_ALLOCATOR_NAME "VulkanImage" |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
#define GST_CAPS_FEATURE_MEMORY_VULKAN_IMAGE "memory:VulkanImage" |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
struct _GstVulkanBarrierImageInfo |
| 69 |
{ |
| 70 |
GstVulkanBarrierMemoryInfo parent; |
| 71 |
|
| 72 |
VkImageLayout image_layout; |
| 73 |
|
| 74 |
VkImageSubresourceRange subresource_range; |
| 75 |
}; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
struct _GstVulkanImageMemory |
| 92 |
{ |
| 93 |
GstMemory parent; |
| 94 |
|
| 95 |
GstVulkanDevice * device; |
| 96 |
|
| 97 |
VkImage image; |
| 98 |
GstVulkanMemory *vk_mem; |
| 99 |
|
| 100 |
VkImageCreateInfo create_info; |
| 101 |
VkMemoryRequirements requirements; |
| 102 |
VkImageFormatProperties format_properties; |
| 103 |
VkImageUsageFlags usage; |
| 104 |
|
| 105 |
GstVulkanBarrierImageInfo barrier; |
| 106 |
|
| 107 |
|
| 108 |
GMutex lock; |
| 109 |
gboolean wrapped; |
| 110 |
GDestroyNotify notify; |
| 111 |
gpointer user_data; |
| 112 |
|
| 113 |
GPtrArray *views; |
| 114 |
GPtrArray *outstanding_views; |
| 115 |
|
| 116 |
gpointer _padding[GST_PADDING]; |
| 117 |
}; |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
typedef gboolean (*GstVulkanImageMemoryFindViewFunc) (GstVulkanImageView * view, gpointer user_data); |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
struct _GstVulkanImageMemoryAllocator |
| 138 |
{ |
| 139 |
GstAllocator parent; |
| 140 |
|
| 141 |
|
| 142 |
gpointer _reserved [GST_PADDING]; |
| 143 |
}; |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
struct _GstVulkanImageMemoryAllocatorClass |
| 154 |
{ |
| 155 |
GstAllocatorClass parent_class; |
| 156 |
|
| 157 |
|
| 158 |
gpointer _reserved [GST_PADDING]; |
| 159 |
}; |
| 160 |
|
| 161 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVulkanImageMemoryAllocator, gst_object_unref); |
| 162 |
|
| 163 |
GST_VULKAN_API |
| 164 |
void gst_vulkan_image_memory_init_once (void); |
| 165 |
GST_VULKAN_API |
| 166 |
gboolean gst_is_vulkan_image_memory (GstMemory * mem); |
| 167 |
|
| 168 |
GST_VULKAN_API |
| 169 |
gboolean gst_vulkan_image_memory_init (GstVulkanImageMemory * mem, |
| 170 |
GstAllocator * allocator, |
| 171 |
GstMemory * parent, |
| 172 |
GstVulkanDevice * device, |
| 173 |
VkFormat format, |
| 174 |
VkImageUsageFlags usage, |
| 175 |
VkImageLayout initial_layout, |
| 176 |
GstAllocationParams * params, |
| 177 |
gsize size, |
| 178 |
gpointer user_data, |
| 179 |
GDestroyNotify notify); |
| 180 |
|
| 181 |
GST_VULKAN_API |
| 182 |
GstMemory * gst_vulkan_image_memory_alloc_with_image_info |
| 183 |
(GstVulkanDevice * device, |
| 184 |
VkImageCreateInfo * image_info, |
| 185 |
VkMemoryPropertyFlags mem_prop_flags); |
| 186 |
|
| 187 |
GST_VULKAN_API |
| 188 |
GstMemory * gst_vulkan_image_memory_alloc (GstVulkanDevice * device, |
| 189 |
VkFormat format, |
| 190 |
gsize width, |
| 191 |
gsize height, |
| 192 |
VkImageTiling tiling, |
| 193 |
VkImageUsageFlags usage, |
| 194 |
VkMemoryPropertyFlags mem_prop_flags); |
| 195 |
|
| 196 |
GST_VULKAN_API |
| 197 |
GstMemory * gst_vulkan_image_memory_wrapped (GstVulkanDevice * device, |
| 198 |
VkImage image, |
| 199 |
VkFormat format, |
| 200 |
gsize width, |
| 201 |
gsize height, |
| 202 |
VkImageTiling tiling, |
| 203 |
VkImageUsageFlags usage, |
| 204 |
gpointer user_data, |
| 205 |
GDestroyNotify notify); |
| 206 |
|
| 207 |
GST_VULKAN_API |
| 208 |
guint32 gst_vulkan_image_memory_get_width (GstVulkanImageMemory * image); |
| 209 |
GST_VULKAN_API |
| 210 |
guint32 gst_vulkan_image_memory_get_height (GstVulkanImageMemory * image); |
| 211 |
|
| 212 |
GST_VULKAN_API |
| 213 |
GstVulkanImageView *gst_vulkan_image_memory_find_view (GstVulkanImageMemory * image, |
| 214 |
GstVulkanImageMemoryFindViewFunc find_func, |
| 215 |
gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; |
| 216 |
GST_VULKAN_API |
| 217 |
void gst_vulkan_image_memory_add_view (GstVulkanImageMemory * image, |
| 218 |
GstVulkanImageView * view); |
| 219 |
|
| 220 |
|
| 221 |
G_END_DECLS |
| 222 |
|
| 223 |
#endif |