1 /* 2 * GStreamer 3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GST_VULKAN_DEVICE_H__ 22 #define __GST_VULKAN_DEVICE_H__ 23 24 #include <gst/vulkan/gstvkphysicaldevice.h> 25 #include <gst/vulkan/gstvkqueue.h> 26 27 G_BEGIN_DECLS 28 29 #define GST_TYPE_VULKAN_DEVICE (gst_vulkan_device_get_type()) 30 #define GST_VULKAN_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_DEVICE, GstVulkanDevice)) 31 #define GST_VULKAN_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_DEVICE, GstVulkanDeviceClass)) 32 #define GST_IS_VULKAN_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_DEVICE)) 33 #define GST_IS_VULKAN_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_DEVICE)) 34 #define GST_VULKAN_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_DEVICE, GstVulkanDeviceClass)) 35 GST_VULKAN_API 36 GType gst_vulkan_device_get_type (void); 37 38 /** 39 * GST_VULKAN_DEVICE_CONTEXT_TYPE_STR: 40 * 41 * Since: 1.18 42 */ 43 #define GST_VULKAN_DEVICE_CONTEXT_TYPE_STR "gst.vulkan.device" 44 45 /** 46 * GstVulkanDeviceForEachQueueFunc: 47 * 48 * Since: 1.18 49 */ 50 typedef gboolean (*GstVulkanDeviceForEachQueueFunc) (GstVulkanDevice * device, GstVulkanQueue * queue, gpointer user_data); 51 52 /** 53 * GstVulkanDevice: 54 * @parent: the parent #GstObject 55 * @instance: the #GstVulkanInstance this device was allocated with 56 * @physical_device: the #GstVulkanPhysicalDevice this device was allocated with 57 * @device: the vulkan device handle 58 * 59 * Since: 1.18 60 */ 61 struct _GstVulkanDevice 62 { 63 GstObject parent; 64 65 GstVulkanInstance *instance; 66 GstVulkanPhysicalDevice *physical_device; 67 VkDevice device; /* hides a pointer */ 68 69 /* <private> */ 70 gpointer _reserved [GST_PADDING]; 71 }; 72 73 /** 74 * GstVulkanDeviceClass: 75 * @parent_class: the parent #GstObjectClass 76 * 77 * Since: 1.18 78 */ 79 struct _GstVulkanDeviceClass 80 { 81 GstObjectClass parent_class; 82 83 /* <private> */ 84 gpointer _reserved [GST_PADDING]; 85 }; 86 87 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstVulkanDevice, gst_object_unref) 88 89 GST_VULKAN_API 90 GstVulkanDevice * gst_vulkan_device_new (GstVulkanPhysicalDevice * physical_device); 91 GST_VULKAN_API 92 GstVulkanDevice * gst_vulkan_device_new_with_index (GstVulkanInstance * instance, guint device_index); 93 GST_VULKAN_API 94 GstVulkanInstance * gst_vulkan_device_get_instance (GstVulkanDevice * device); 95 GST_VULKAN_API 96 gboolean gst_vulkan_device_open (GstVulkanDevice * device, 97 GError ** error); 98 99 GST_VULKAN_API 100 gboolean gst_vulkan_device_enable_extension (GstVulkanDevice * device, 101 const gchar * name); 102 GST_VULKAN_API 103 gboolean gst_vulkan_device_disable_extension (GstVulkanDevice * device, 104 const gchar * name); 105 GST_VULKAN_API 106 gboolean gst_vulkan_device_is_extension_enabled (GstVulkanDevice * device, 107 const gchar * name); 108 GST_VULKAN_API 109 gboolean gst_vulkan_device_enable_layer (GstVulkanDevice * device, 110 const gchar * name); 111 GST_VULKAN_API 112 gboolean gst_vulkan_device_is_layer_enabled (GstVulkanDevice * device, 113 const gchar * name); 114 115 GST_VULKAN_API 116 gpointer gst_vulkan_device_get_proc_address (GstVulkanDevice * device, 117 const gchar * name); 118 GST_VULKAN_API 119 void gst_vulkan_device_foreach_queue (GstVulkanDevice * device, 120 GstVulkanDeviceForEachQueueFunc func, 121 gpointer user_data); 122 GST_VULKAN_API 123 GstVulkanQueue * gst_vulkan_device_get_queue (GstVulkanDevice * device, 124 guint32 queue_family, 125 guint32 queue_i); 126 GST_VULKAN_API 127 VkPhysicalDevice gst_vulkan_device_get_physical_device (GstVulkanDevice * device); 128 129 GST_VULKAN_API 130 void gst_context_set_vulkan_device (GstContext * context, 131 GstVulkanDevice * device); 132 GST_VULKAN_API 133 gboolean gst_context_get_vulkan_device (GstContext * context, 134 GstVulkanDevice ** device); 135 GST_VULKAN_API 136 gboolean gst_vulkan_device_handle_context_query (GstElement * element, 137 GstQuery * query, 138 GstVulkanDevice * device); 139 GST_VULKAN_API 140 gboolean gst_vulkan_device_run_context_query (GstElement * element, 141 GstVulkanDevice ** device); 142 143 GST_VULKAN_API 144 GstVulkanFence * gst_vulkan_device_create_fence (GstVulkanDevice * device, 145 GError ** error); 146 147 G_END_DECLS 148 149 #endif /* __GST_VULKAN_DEVICE_H__ */ 150