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 40static inline struct gl_memory_object * 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 50static inline struct gl_memory_object * 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 60static inline struct gl_semaphore_object * 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 70static inline struct gl_semaphore_object * 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 80extern void 81_mesa_init_memory_object_functions(struct dd_function_table *driver); 82 83extern void 84_mesa_initialize_memory_object(struct gl_context *ctx, 85 struct gl_memory_object *obj, 86 GLuint name); 87extern void 88_mesa_delete_memory_object(struct gl_context *ctx, 89 struct gl_memory_object *semObj); 90 91extern void 92_mesa_initialize_semaphore_object(struct gl_context *ctx, 93 struct gl_semaphore_object *obj, 94 GLuint name); 95extern void 96_mesa_delete_semaphore_object(struct gl_context *ctx, 97 struct gl_semaphore_object *semObj); 98 99extern void GLAPIENTRY 100_mesa_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects); 101 102extern GLboolean GLAPIENTRY 103_mesa_IsMemoryObjectEXT(GLuint memoryObject); 104 105extern void GLAPIENTRY 106_mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects); 107 108extern void GLAPIENTRY 109_mesa_MemoryObjectParameterivEXT(GLuint memoryObject, 110 GLenum pname, 111 const GLint *params); 112 113extern void GLAPIENTRY 114_mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject, 115 GLenum pname, 116 GLint *params); 117 118extern 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 127extern 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 137extern 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 147extern 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 158extern 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 167extern 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 177extern 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 187extern 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 198extern void GLAPIENTRY 199_mesa_TexStorageMem1DEXT(GLenum target, 200 GLsizei levels, 201 GLenum internalFormat, 202 GLsizei width, 203 GLuint memory, 204 GLuint64 offset); 205 206extern void GLAPIENTRY 207_mesa_TextureStorageMem1DEXT(GLuint texture, 208 GLsizei levels, 209 GLenum internalFormat, 210 GLsizei width, 211 GLuint memory, 212 GLuint64 offset); 213 214extern void GLAPIENTRY 215_mesa_GenSemaphoresEXT(GLsizei n, GLuint *semaphores); 216 217extern void GLAPIENTRY 218_mesa_DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores); 219 220extern GLboolean GLAPIENTRY 221_mesa_IsSemaphoreEXT(GLuint semaphore); 222 223extern void GLAPIENTRY 224_mesa_SemaphoreParameterui64vEXT(GLuint semaphore, 225 GLenum pname, 226 const GLuint64 *params); 227 228extern void GLAPIENTRY 229_mesa_GetSemaphoreParameterui64vEXT(GLuint semaphore, 230 GLenum pname, 231 GLuint64 *params); 232 233extern 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 241extern 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 249extern void GLAPIENTRY 250_mesa_ImportMemoryFdEXT(GLuint memory, 251 GLuint64 size, 252 GLenum handleType, 253 GLint fd); 254 255extern void GLAPIENTRY 256_mesa_ImportSemaphoreFdEXT(GLuint semaphore, 257 GLenum handleType, 258 GLint fd); 259 260#endif 261