diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2018-10-23 06:00:02 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2018-10-23 06:00:02 +0000 |
commit | 18d6381c51e253e4c41c62619f80d9ce745b95c8 (patch) | |
tree | a6f0a6ad4273a34925bbc2a08d717f5acc2763eb /lib/mesa/include | |
parent | aea331c3cb69ef2756ffceb05da8ace5e6287314 (diff) |
Import Mesa 17.3.9
Diffstat (limited to 'lib/mesa/include')
-rw-r--r-- | lib/mesa/include/GL/mesa_glinterop.h | 4 | ||||
-rw-r--r-- | lib/mesa/include/vulkan/vk_android_native_buffer.h | 96 |
2 files changed, 100 insertions, 0 deletions
diff --git a/lib/mesa/include/GL/mesa_glinterop.h b/lib/mesa/include/GL/mesa_glinterop.h index 173476a98..45fda93ca 100644 --- a/lib/mesa/include/GL/mesa_glinterop.h +++ b/lib/mesa/include/GL/mesa_glinterop.h @@ -58,12 +58,16 @@ extern "C" { #endif /* Forward declarations to avoid inclusion of GL/glx.h */ +#ifndef GLX_H struct _XDisplay; struct __GLXcontextRec; +#endif /* Forward declarations to avoid inclusion of EGL/egl.h */ +#ifndef __egl_h_ typedef void *EGLDisplay; typedef void *EGLContext; +#endif /** Returned error codes. */ enum { diff --git a/lib/mesa/include/vulkan/vk_android_native_buffer.h b/lib/mesa/include/vulkan/vk_android_native_buffer.h new file mode 100644 index 000000000..a658b4924 --- /dev/null +++ b/lib/mesa/include/vulkan/vk_android_native_buffer.h @@ -0,0 +1,96 @@ +/* + * Copyright 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __VK_ANDROID_NATIVE_BUFFER_H__ +#define __VK_ANDROID_NATIVE_BUFFER_H__ + +/* MESA: A hack to avoid #ifdefs in driver code. */ +#ifdef ANDROID +#include <system/window.h> +#include <vulkan/vulkan.h> +#else +typedef void *buffer_handle_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define VK_ANDROID_native_buffer 1 + +#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER 11 +#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 5 +#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer" + +#define VK_ANDROID_NATIVE_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id))) +#define VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 0) + +typedef struct { + VkStructureType sType; // must be VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID + const void* pNext; + + // Buffer handle and stride returned from gralloc alloc() + buffer_handle_t handle; + int stride; + + // Gralloc format and usage requested when the buffer was allocated. + int format; + int usage; +} VkNativeBufferANDROID; + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageANDROID)(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + int* grallocUsage +); +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID( + VkDevice device, + VkImage image, + int nativeFenceFd, + VkSemaphore semaphore, + VkFence fence +); +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int* pNativeFenceFd +); +// -- DEPRECATED -- +VKAPI_ATTR VkResult VKAPI_CALL vkImportNativeFenceANDROID( + VkDevice device, + VkSemaphore semaphore, + int nativeFenceFd +); +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalNativeFenceANDROID( + VkQueue queue, + int* pNativeFenceFd +); +// ---------------- +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __VK_ANDROID_NATIVE_BUFFER_H__ |