1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2017 Red Hat.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Dave Airlie <airlied@gmail.com>
25 * Andres Rodriguez <andresx7@gmail.com>
26 */
27
28 /**
29 * \file externalobjects.h
30 *
31 * Declarations of functions related to the API interop extensions.
32 */
33
34 #ifndef EXTERNALOBJECTS_H
35 #define EXTERNALOBJECTS_H
36
37 #include "glheader.h"
38 #include "hash.h"
39
40 static inline struct gl_memory_object *
_mesa_lookup_memory_object(struct gl_context * ctx,GLuint memory)41 _mesa_lookup_memory_object(struct gl_context *ctx, GLuint memory)
42 {
43 if (!memory)
44 return NULL;
45
46 return (struct gl_memory_object *)
47 _mesa_HashLookup(ctx->Shared->MemoryObjects, memory);
48 }
49
50 static inline struct gl_memory_object *
_mesa_lookup_memory_object_locked(struct gl_context * ctx,GLuint memory)51 _mesa_lookup_memory_object_locked(struct gl_context *ctx, GLuint memory)
52 {
53 if (!memory)
54 return NULL;
55
56 return (struct gl_memory_object *)
57 _mesa_HashLookupLocked(ctx->Shared->MemoryObjects, memory);
58 }
59
60 static inline struct gl_semaphore_object *
_mesa_lookup_semaphore_object(struct gl_context * ctx,GLuint semaphore)61 _mesa_lookup_semaphore_object(struct gl_context *ctx, GLuint semaphore)
62 {
63 if (!semaphore)
64 return NULL;
65
66 return (struct gl_semaphore_object *)
67 _mesa_HashLookup(ctx->Shared->SemaphoreObjects, semaphore);
68 }
69
70 static inline struct gl_semaphore_object *
_mesa_lookup_semaphore_object_locked(struct gl_context * ctx,GLuint semaphore)71 _mesa_lookup_semaphore_object_locked(struct gl_context *ctx, GLuint semaphore)
72 {
73 if (!semaphore)
74 return NULL;
75
76 return (struct gl_semaphore_object *)
77 _mesa_HashLookupLocked(ctx->Shared->SemaphoreObjects, semaphore);
78 }
79
80 extern void
81 _mesa_init_memory_object_functions(struct dd_function_table *driver);
82
83 extern void
84 _mesa_initialize_memory_object(struct gl_context *ctx,
85 struct gl_memory_object *obj,
86 GLuint name);
87 extern void
88 _mesa_delete_memory_object(struct gl_context *ctx,
89 struct gl_memory_object *semObj);
90
91 extern void
92 _mesa_initialize_semaphore_object(struct gl_context *ctx,
93 struct gl_semaphore_object *obj,
94 GLuint name);
95 extern void
96 _mesa_delete_semaphore_object(struct gl_context *ctx,
97 struct gl_semaphore_object *semObj);
98
99 extern void GLAPIENTRY
100 _mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects);
101
102 extern GLboolean GLAPIENTRY
103 _mesa_IsMemoryObjectEXT(GLuint memoryObject);
104
105 extern void GLAPIENTRY
106 _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects);
107
108 extern void GLAPIENTRY
109 _mesa_MemoryObjectParameterivEXT(GLuint memoryObject,
110 GLenum pname,
111 const GLint *params);
112
113 extern void GLAPIENTRY
114 _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject,
115 GLenum pname,
116 GLint *params);
117
118 extern void GLAPIENTRY
119 _mesa_TexStorageMem2DEXT(GLenum target,
120 GLsizei levels,
121 GLenum internalFormat,
122 GLsizei width,
123 GLsizei height,
124 GLuint memory,
125 GLuint64 offset);
126
127 extern void GLAPIENTRY
128 _mesa_TexStorageMem2DMultisampleEXT(GLenum target,
129 GLsizei samples,
130 GLenum internalFormat,
131 GLsizei width,
132 GLsizei height,
133 GLboolean fixedSampleLocations,
134 GLuint memory,
135 GLuint64 offset);
136
137 extern void GLAPIENTRY
138 _mesa_TexStorageMem3DEXT(GLenum target,
139 GLsizei levels,
140 GLenum internalFormat,
141 GLsizei width,
142 GLsizei height,
143 GLsizei depth,
144 GLuint memory,
145 GLuint64 offset);
146
147 extern void GLAPIENTRY
148 _mesa_TexStorageMem3DMultisampleEXT(GLenum target,
149 GLsizei samples,
150 GLenum internalFormat,
151 GLsizei width,
152 GLsizei height,
153 GLsizei depth,
154 GLboolean fixedSampleLocations,
155 GLuint memory,
156 GLuint64 offset);
157
158 extern void GLAPIENTRY
159 _mesa_TextureStorageMem2DEXT(GLuint texture,
160 GLsizei levels,
161 GLenum internalFormat,
162 GLsizei width,
163 GLsizei height,
164 GLuint memory,
165 GLuint64 offset);
166
167 extern void GLAPIENTRY
168 _mesa_TextureStorageMem2DMultisampleEXT(GLuint texture,
169 GLsizei samples,
170 GLenum internalFormat,
171 GLsizei width,
172 GLsizei height,
173 GLboolean fixedSampleLocations,
174 GLuint memory,
175 GLuint64 offset);
176
177 extern void GLAPIENTRY
178 _mesa_TextureStorageMem3DEXT(GLuint texture,
179 GLsizei levels,
180 GLenum internalFormat,
181 GLsizei width,
182 GLsizei height,
183 GLsizei depth,
184 GLuint memory,
185 GLuint64 offset);
186
187 extern void GLAPIENTRY
188 _mesa_TextureStorageMem3DMultisampleEXT(GLuint texture,
189 GLsizei samples,
190 GLenum internalFormat,
191 GLsizei width,
192 GLsizei height,
193 GLsizei depth,
194 GLboolean fixedSampleLocations,
195 GLuint memory,
196 GLuint64 offset);
197
198 extern void GLAPIENTRY
199 _mesa_TexStorageMem1DEXT(GLenum target,
200 GLsizei levels,
201 GLenum internalFormat,
202 GLsizei width,
203 GLuint memory,
204 GLuint64 offset);
205
206 extern void GLAPIENTRY
207 _mesa_TextureStorageMem1DEXT(GLuint texture,
208 GLsizei levels,
209 GLenum internalFormat,
210 GLsizei width,
211 GLuint memory,
212 GLuint64 offset);
213
214 extern void GLAPIENTRY
215 _mesa_GenSemaphoresEXT(GLsizei n, GLuint *semaphores);
216
217 extern void GLAPIENTRY
218 _mesa_DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores);
219
220 extern GLboolean GLAPIENTRY
221 _mesa_IsSemaphoreEXT(GLuint semaphore);
222
223 extern void GLAPIENTRY
224 _mesa_SemaphoreParameterui64vEXT(GLuint semaphore,
225 GLenum pname,
226 const GLuint64 *params);
227
228 extern void GLAPIENTRY
229 _mesa_GetSemaphoreParameterui64vEXT(GLuint semaphore,
230 GLenum pname,
231 GLuint64 *params);
232
233 extern void GLAPIENTRY
234 _mesa_WaitSemaphoreEXT(GLuint semaphore,
235 GLuint numBufferBarriers,
236 const GLuint *buffers,
237 GLuint numTextureBarriers,
238 const GLuint *textures,
239 const GLenum *srcLayouts);
240
241 extern void GLAPIENTRY
242 _mesa_SignalSemaphoreEXT(GLuint semaphore,
243 GLuint numBufferBarriers,
244 const GLuint *buffers,
245 GLuint numTextureBarriers,
246 const GLuint *textures,
247 const GLenum *dstLayouts);
248
249 extern void GLAPIENTRY
250 _mesa_ImportMemoryFdEXT(GLuint memory,
251 GLuint64 size,
252 GLenum handleType,
253 GLint fd);
254
255 extern void GLAPIENTRY
256 _mesa_ImportSemaphoreFdEXT(GLuint semaphore,
257 GLenum handleType,
258 GLint fd);
259
260 #endif
261