mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 12:40:09 +01:00
venus: bring up Android support
1. implement hwvulkan_device_t 2. mask Android extension support Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10112>
This commit is contained in:
parent
fc3335a472
commit
82bb90e072
3 changed files with 73 additions and 0 deletions
|
|
@ -75,6 +75,10 @@ if with_platform_x11
|
|||
]
|
||||
endif
|
||||
|
||||
if with_platform_android
|
||||
libvn_files += files('vn_android.c')
|
||||
endif
|
||||
|
||||
libvulkan_virtio = shared_library(
|
||||
'vulkan_virtio',
|
||||
[libvn_files, vn_entrypoints, sha1_h],
|
||||
|
|
|
|||
64
src/virtio/vulkan/vn_android.c
Normal file
64
src/virtio/vulkan/vn_android.c
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "vn_common.h"
|
||||
|
||||
#include <hardware/hwvulkan.h>
|
||||
#include <vulkan/vk_icd.h>
|
||||
|
||||
static int
|
||||
vn_hal_open(const struct hw_module_t *mod,
|
||||
const char *id,
|
||||
struct hw_device_t **dev);
|
||||
|
||||
static void UNUSED
|
||||
static_asserts(void)
|
||||
{
|
||||
STATIC_ASSERT(HWVULKAN_DISPATCH_MAGIC == ICD_LOADER_MAGIC);
|
||||
}
|
||||
|
||||
PUBLIC struct hwvulkan_module_t HAL_MODULE_INFO_SYM = {
|
||||
.common = {
|
||||
.tag = HARDWARE_MODULE_TAG,
|
||||
.module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
|
||||
.hal_api_version = HARDWARE_HAL_API_VERSION,
|
||||
.id = HWVULKAN_HARDWARE_MODULE_ID,
|
||||
.name = "Venus Vulkan HAL",
|
||||
.author = "Google LLC",
|
||||
.methods = &(hw_module_methods_t) {
|
||||
.open = vn_hal_open,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static int
|
||||
vn_hal_close(UNUSED struct hw_device_t *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static hwvulkan_device_t vn_hal_dev = {
|
||||
.common = {
|
||||
.tag = HARDWARE_DEVICE_TAG,
|
||||
.version = HWVULKAN_DEVICE_API_VERSION_0_1,
|
||||
.module = &HAL_MODULE_INFO_SYM.common,
|
||||
.close = vn_hal_close,
|
||||
},
|
||||
.EnumerateInstanceExtensionProperties = vn_EnumerateInstanceExtensionProperties,
|
||||
.CreateInstance = vn_CreateInstance,
|
||||
.GetInstanceProcAddr = vn_GetInstanceProcAddr,
|
||||
};
|
||||
|
||||
static int
|
||||
vn_hal_open(const struct hw_module_t *mod,
|
||||
const char *id,
|
||||
struct hw_device_t **dev)
|
||||
{
|
||||
assert(mod == &HAL_MODULE_INFO_SYM.common);
|
||||
assert(strcmp(id, HWVULKAN_DEVICE_0) == 0);
|
||||
|
||||
*dev = &vn_hal_dev.common;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1525,6 +1525,11 @@ vn_physical_device_init_extensions(struct vn_physical_device *physical_dev)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
if (!vk_android_allowed_device_extensions.extensions[i])
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* does not depend on renderer (e.g., WSI) */
|
||||
if (supported.extensions[i]) {
|
||||
physical_dev->base.base.supported_extensions.extensions[i] = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue