mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 20:00:10 +01:00
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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
This commit is contained in:
parent
f6131d4ec7
commit
b43f955037
7 changed files with 80 additions and 11 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
37
src/intel/vulkan/anv_android.h
Normal file
37
src/intel/vulkan/anv_android.h
Normal file
|
|
@ -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 */
|
||||
34
src/intel/vulkan/anv_android_stubs.c
Normal file
34
src/intel/vulkan/anv_android_stubs.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue