• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INSTANCE_H__
22 #define __GST_VULKAN_INSTANCE_H__
23 
24 #include <gst/vulkan/vulkan.h>
25 
26 G_BEGIN_DECLS
27 
28 #define GST_TYPE_VULKAN_INSTANCE         (gst_vulkan_instance_get_type())
29 #define GST_VULKAN_INSTANCE(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstance))
30 #define GST_VULKAN_INSTANCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstanceClass))
31 #define GST_IS_VULKAN_INSTANCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_INSTANCE))
32 #define GST_IS_VULKAN_INSTANCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_INSTANCE))
33 #define GST_VULKAN_INSTANCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstanceClass))
34 GST_VULKAN_API
35 GType gst_vulkan_instance_get_type       (void);
36 
37 /**
38  * GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR:
39  *
40  * Since: 1.18
41  */
42 #define GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR "gst.vulkan.instance"
43 
44 /**
45  * GstVulkanInstance:
46  * @parent: parent #GstObject
47  * @instance: the Vulkan instance handle
48  * @physical_devices: list of vulkan physical device handles
49  * @n_physical_device: number of entries in @physical_devices
50  *
51  * Since: 1.18
52  */
53 struct _GstVulkanInstance
54 {
55   GstObject parent;
56 
57   VkInstance instance; /* hides a pointer */
58   VkPhysicalDevice *physical_devices; /* hides a pointer */
59   guint32 n_physical_devices;
60 
61   /* <private> */
62   gpointer _reserved        [GST_PADDING];
63 };
64 
65 /**
66  * GstVulkanInstanceClass:
67  * @parent_class: parent #GstObjectClass
68  *
69  * Since: 1.18
70  */
71 struct _GstVulkanInstanceClass
72 {
73   GstObjectClass parent_class;
74 
75   /* <private> */
76   gpointer _reserved        [GST_PADDING];
77 };
78 
79 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstVulkanInstance, gst_object_unref)
80 
81 GST_VULKAN_API
82 GstVulkanInstance * gst_vulkan_instance_new                     (void);
83 GST_VULKAN_API
84 gboolean            gst_vulkan_instance_fill_info               (GstVulkanInstance * instance,
85                                                                  GError ** error);
86 GST_VULKAN_API
87 gboolean            gst_vulkan_instance_open                    (GstVulkanInstance * instance,
88                                                                  GError ** error);
89 
90 GST_VULKAN_API
91 gpointer            gst_vulkan_instance_get_proc_address        (GstVulkanInstance * instance,
92                                                                  const gchar * name);
93 
94 GST_VULKAN_API
95 GstVulkanDevice *   gst_vulkan_instance_create_device           (GstVulkanInstance * instance,
96                                                                  GError ** error);
97 
98 GST_VULKAN_API
99 void                gst_context_set_vulkan_instance             (GstContext * context,
100                                                                  GstVulkanInstance * instance);
101 GST_VULKAN_API
102 gboolean            gst_context_get_vulkan_instance             (GstContext * context,
103                                                                  GstVulkanInstance ** instance);
104 GST_VULKAN_API
105 gboolean            gst_vulkan_instance_handle_context_query    (GstElement * element,
106                                                                  GstQuery * query,
107                                                                  GstVulkanInstance * instance);
108 GST_VULKAN_API
109 gboolean            gst_vulkan_instance_run_context_query       (GstElement * element,
110                                                                  GstVulkanInstance ** instance);
111 GST_VULKAN_API
112 gboolean            gst_vulkan_instance_check_version           (GstVulkanInstance * instance,
113                                                                  guint major,
114                                                                  guint minor,
115                                                                  guint patch);
116 GST_VULKAN_API
117 void                gst_vulkan_instance_get_version             (GstVulkanInstance * instance,
118                                                                  guint * major,
119                                                                  guint * minor,
120                                                                  guint * patch);
121 
122 GST_VULKAN_API
123 gboolean            gst_vulkan_instance_get_extension_info      (GstVulkanInstance * instance,
124                                                                  const gchar * name,
125                                                                  guint32 * spec_version);
126 GST_VULKAN_API
127 gboolean            gst_vulkan_instance_enable_extension        (GstVulkanInstance * instance,
128                                                                  const gchar * name);
129 GST_VULKAN_API
130 gboolean            gst_vulkan_instance_disable_extension       (GstVulkanInstance * instance,
131                                                                  const gchar * name);
132 GST_VULKAN_API
133 gboolean            gst_vulkan_instance_is_extension_enabled    (GstVulkanInstance * instance,
134                                                                  const gchar * name);
135 GST_VULKAN_API
136 gboolean            gst_vulkan_instance_get_layer_info          (GstVulkanInstance * instance,
137                                                                  const gchar * name,
138                                                                  gchar ** description,
139                                                                  guint32 * spec_version,
140                                                                  guint32 * implementation_version);
141 GST_VULKAN_API
142 gboolean            gst_vulkan_instance_enable_layer            (GstVulkanInstance * instance,
143                                                                  const gchar * name);
144 GST_VULKAN_API
145 gboolean            gst_vulkan_instance_is_layer_enabled        (GstVulkanInstance * instance,
146                                                                  const gchar * name);
147 
148 G_END_DECLS
149 
150 #endif /* __GST_VULKAN_INSTANCE_H__ */
151