Path: blob/21.2-virgl/include/android_stub/hardware/hwvulkan.h
7202 views
/*1* Copyright 2015 The Android Open Source Project2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*/1516#ifndef ANDROID_HWVULKAN_H17#define ANDROID_HWVULKAN_H1819#include <hardware/hardware.h>20#include <vulkan/vulkan.h>2122__BEGIN_DECLS2324#define HWVULKAN_HARDWARE_MODULE_ID "vulkan"2526#define HWVULKAN_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)27#define HWVULKAN_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION_2(0, 1, 0)2829#define HWVULKAN_DEVICE_0 "vk0"3031typedef struct hwvulkan_module_t {32struct hw_module_t common;33} hwvulkan_module_t;3435/* Dispatchable Vulkan object handles must be pointers, which must point to36* instances of hwvulkan_dispatch_t (potentially followed by additional37* implementation-defined data). On return from the creation function, the38* 'magic' field must contain HWVULKAN_DISPATCH_MAGIC; the loader will overwrite39* the 'vtbl' field.40*41* NOTE: The magic value and the layout of hwvulkan_dispatch_t match the LunarG42* loader used on platforms, to avoid pointless annoying differences for43* multi-platform drivers. Don't change them without a good reason. If there is44* an opportunity to change it, using a magic value that doesn't leave the45* upper 32-bits zero on 64-bit platforms would be nice.46*/47#define HWVULKAN_DISPATCH_MAGIC 0x01CDC0DE48typedef union {49uintptr_t magic;50const void* vtbl;51} hwvulkan_dispatch_t;5253/* A hwvulkan_device_t corresponds to an ICD on other systems. Currently there54* can only be one on a system (HWVULKAN_DEVICE_0). It is opened once per55* process when the Vulkan API is first used; the hw_device_t::close() function56* is never called. Any non-trivial resource allocation should be done when57* the VkInstance is created rather than when the hwvulkan_device_t is opened.58*/59typedef struct hwvulkan_device_t {60struct hw_device_t common;6162PFN_vkEnumerateInstanceExtensionProperties63EnumerateInstanceExtensionProperties;64PFN_vkCreateInstance CreateInstance;65PFN_vkGetInstanceProcAddr GetInstanceProcAddr;66} hwvulkan_device_t;6768__END_DECLS6970#endif // ANDROID_HWVULKAN_H717273