diff options
author | Lionel Landwerlin <[email protected]> | 2018-11-06 11:37:50 +0000 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-11-06 15:28:07 +0000 |
commit | b43f955037c77e8fac3811c466d9ae3947586478 (patch) | |
tree | 598ff74ca5b2729c6dc0767a78d84540a86cec25 /src | |
parent | f6131d4ec7a24b9731bb01b6b3bd786ea48ba3bb (diff) |
anv: stub internal android code
This reduces the amount of #ifdef ANDROID we'll have to have inside
the driver. Potentially offering better coverage of the android
extensions.
v2: Move anv_android.h include before anv_entrypoints.h (Tapani)
Fix autotools android build (Lionel)
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/Makefile.sources | 4 | ||||
-rw-r--r-- | src/intel/Makefile.vulkan.am | 2 | ||||
-rw-r--r-- | src/intel/vulkan/anv_android.h | 37 | ||||
-rw-r--r-- | src/intel/vulkan/anv_android_stubs.c | 34 | ||||
-rw-r--r-- | src/intel/vulkan/anv_image.c | 2 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 10 | ||||
-rw-r--r-- | src/intel/vulkan/meson.build | 2 |
7 files changed, 80 insertions, 11 deletions
diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources index d10c4511734..4da887f7ed2 100644 --- a/src/intel/Makefile.sources +++ b/src/intel/Makefile.sources @@ -220,6 +220,7 @@ ISL_GENERATED_FILES = \ VULKAN_FILES := \ vulkan/anv_allocator.c \ + vulkan/anv_android.h \ vulkan/anv_batch_chain.c \ vulkan/anv_blorp.c \ vulkan/anv_cmd_buffer.c \ @@ -246,6 +247,9 @@ VULKAN_FILES := \ vulkan/anv_wsi.c \ vulkan/vk_format_info.h +VULKAN_NON_ANDROID_FILES := \ + vulkan/anv_android_stubs.c + VULKAN_ANDROID_FILES := \ vulkan/anv_android.c diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 49108bbf946..ccf7a9f4690 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -171,6 +171,8 @@ VULKAN_CPPFLAGS += \ VULKAN_CFLAGS += $(ANDROID_CFLAGS) VULKAN_LIB_DEPS += $(ANDROID_LIBS) VULKAN_SOURCES += $(VULKAN_ANDROID_FILES) +else +VULKAN_SOURCES += $(VULKAN_NON_ANDROID_FILES) endif if HAVE_PLATFORM_X11 diff --git a/src/intel/vulkan/anv_android.h b/src/intel/vulkan/anv_android.h new file mode 100644 index 00000000000..a27c364471b --- /dev/null +++ b/src/intel/vulkan/anv_android.h @@ -0,0 +1,37 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef ANV_ANDROID_H +#define ANV_ANDROID_H + +#include <vulkan/vulkan.h> +#include <vulkan/vulkan_android.h> +#include <vulkan/vk_android_native_buffer.h> + +VkResult anv_image_from_gralloc(VkDevice device_h, + const VkImageCreateInfo *base_info, + const VkNativeBufferANDROID *gralloc_info, + const VkAllocationCallbacks *alloc, + VkImage *pImage); + +#endif /* ANV_ANDROID_H */ diff --git a/src/intel/vulkan/anv_android_stubs.c b/src/intel/vulkan/anv_android_stubs.c new file mode 100644 index 00000000000..a6fe5a5e6b3 --- /dev/null +++ b/src/intel/vulkan/anv_android_stubs.c @@ -0,0 +1,34 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "anv_android.h" + +VkResult +anv_image_from_gralloc(VkDevice device_h, + const VkImageCreateInfo *base_info, + const VkNativeBufferANDROID *gralloc_info, + const VkAllocationCallbacks *alloc, + VkImage *pImage) +{ + return VK_ERROR_EXTENSION_NOT_PRESENT; +} diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index e89ce012be7..fdb13c2938a 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -631,14 +631,12 @@ anv_CreateImage(VkDevice device, const VkAllocationCallbacks *pAllocator, VkImage *pImage) { -#ifdef ANDROID const VkNativeBufferANDROID *gralloc_info = vk_find_struct_const(pCreateInfo->pNext, NATIVE_BUFFER_ANDROID); if (gralloc_info) return anv_image_from_gralloc(device, pCreateInfo, gralloc_info, pAllocator, pImage); -#endif return anv_image_create(device, &(struct anv_image_create_info) { diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index d8a08d9d67f..c791c568234 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -76,8 +76,8 @@ struct gen_l3_config; #include <vulkan/vulkan.h> #include <vulkan/vulkan_intel.h> #include <vulkan/vk_icd.h> -#include <vulkan/vk_android_native_buffer.h> +#include "anv_android.h" #include "anv_entrypoints.h" #include "anv_extensions.h" #include "isl/isl.h" @@ -3096,14 +3096,6 @@ VkResult anv_image_create(VkDevice _device, const VkAllocationCallbacks* alloc, VkImage *pImage); -#ifdef ANDROID -VkResult anv_image_from_gralloc(VkDevice device_h, - const VkImageCreateInfo *base_info, - const VkNativeBufferANDROID *gralloc_info, - const VkAllocationCallbacks *alloc, - VkImage *pImage); -#endif - const struct anv_surface * anv_image_get_surface_for_aspect_mask(const struct anv_image *image, VkImageAspectFlags aspect_mask); diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build index b08b84fe2f0..b9834867407 100644 --- a/src/intel/vulkan/meson.build +++ b/src/intel/vulkan/meson.build @@ -111,6 +111,8 @@ endforeach libanv_files = files( 'anv_allocator.c', + 'anv_android_stubs.c', + 'anv_android.h', 'anv_batch_chain.c', 'anv_blorp.c', 'anv_cmd_buffer.c', |