1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright 2019 Google LLC 3bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * based in part on anv and radv which are: 6bf215546Sopenharmony_ci * Copyright © 2015 Intel Corporation 7bf215546Sopenharmony_ci * Copyright © 2016 Red Hat. 8bf215546Sopenharmony_ci * Copyright © 2016 Bas Nieuwenhuizen 9bf215546Sopenharmony_ci */ 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ci#ifndef VN_PHYSICAL_DEVICE_H 12bf215546Sopenharmony_ci#define VN_PHYSICAL_DEVICE_H 13bf215546Sopenharmony_ci 14bf215546Sopenharmony_ci#include "vn_common.h" 15bf215546Sopenharmony_ci 16bf215546Sopenharmony_ci#include "util/sparse_array.h" 17bf215546Sopenharmony_ci 18bf215546Sopenharmony_ci#include "vn_wsi.h" 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_cistruct vn_physical_device_features { 21bf215546Sopenharmony_ci VkPhysicalDeviceFeatures vulkan_1_0; 22bf215546Sopenharmony_ci VkPhysicalDeviceVulkan11Features vulkan_1_1; 23bf215546Sopenharmony_ci VkPhysicalDeviceVulkan12Features vulkan_1_2; 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_ci /* Vulkan 1.3 */ 26bf215546Sopenharmony_ci VkPhysicalDevice4444FormatsFeaturesEXT argb_4444_formats; 27bf215546Sopenharmony_ci VkPhysicalDeviceDynamicRenderingFeatures dynamic_rendering; 28bf215546Sopenharmony_ci VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extended_dynamic_state; 29bf215546Sopenharmony_ci VkPhysicalDeviceExtendedDynamicState2FeaturesEXT extended_dynamic_state_2; 30bf215546Sopenharmony_ci VkPhysicalDeviceImageRobustnessFeatures image_robustness; 31bf215546Sopenharmony_ci VkPhysicalDeviceInlineUniformBlockFeatures inline_uniform_block; 32bf215546Sopenharmony_ci VkPhysicalDeviceMaintenance4Features maintenance4; 33bf215546Sopenharmony_ci VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures 34bf215546Sopenharmony_ci shader_demote_to_helper_invocation; 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci /* EXT */ 37bf215546Sopenharmony_ci VkPhysicalDeviceConditionalRenderingFeaturesEXT conditional_rendering; 38bf215546Sopenharmony_ci VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border_color; 39bf215546Sopenharmony_ci VkPhysicalDeviceDepthClipEnableFeaturesEXT depth_clip_enable; 40bf215546Sopenharmony_ci VkPhysicalDeviceImageViewMinLodFeaturesEXT image_view_min_lod; 41bf215546Sopenharmony_ci VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8; 42bf215546Sopenharmony_ci VkPhysicalDeviceLineRasterizationFeaturesEXT line_rasterization; 43bf215546Sopenharmony_ci VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex; 44bf215546Sopenharmony_ci VkPhysicalDeviceRobustness2FeaturesEXT robustness_2; 45bf215546Sopenharmony_ci VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback; 46bf215546Sopenharmony_ci VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_attribute_divisor; 47bf215546Sopenharmony_ci}; 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_cistruct vn_physical_device_properties { 50bf215546Sopenharmony_ci VkPhysicalDeviceProperties vulkan_1_0; 51bf215546Sopenharmony_ci VkPhysicalDeviceVulkan11Properties vulkan_1_1; 52bf215546Sopenharmony_ci VkPhysicalDeviceVulkan12Properties vulkan_1_2; 53bf215546Sopenharmony_ci 54bf215546Sopenharmony_ci /* Vulkan 1.3 */ 55bf215546Sopenharmony_ci VkPhysicalDeviceInlineUniformBlockProperties inline_uniform_block; 56bf215546Sopenharmony_ci VkPhysicalDeviceMaintenance4Properties maintenance4; 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci /* EXT */ 59bf215546Sopenharmony_ci VkPhysicalDeviceConservativeRasterizationPropertiesEXT 60bf215546Sopenharmony_ci conservative_rasterization; 61bf215546Sopenharmony_ci VkPhysicalDeviceCustomBorderColorPropertiesEXT custom_border_color; 62bf215546Sopenharmony_ci VkPhysicalDeviceLineRasterizationPropertiesEXT line_rasterization; 63bf215546Sopenharmony_ci VkPhysicalDeviceProvokingVertexPropertiesEXT provoking_vertex; 64bf215546Sopenharmony_ci VkPhysicalDeviceRobustness2PropertiesEXT robustness_2; 65bf215546Sopenharmony_ci VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback; 66bf215546Sopenharmony_ci VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT 67bf215546Sopenharmony_ci vertex_attribute_divisor; 68bf215546Sopenharmony_ci}; 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_cistruct vn_format_properties_entry { 71bf215546Sopenharmony_ci atomic_bool valid; 72bf215546Sopenharmony_ci VkFormatProperties properties; 73bf215546Sopenharmony_ci}; 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_cistruct vn_physical_device { 76bf215546Sopenharmony_ci struct vn_physical_device_base base; 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci struct vn_instance *instance; 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci /* Between the driver and the app, properties.properties.apiVersion is what 81bf215546Sopenharmony_ci * we advertise and is capped by VN_MAX_API_VERSION and others. 82bf215546Sopenharmony_ci * 83bf215546Sopenharmony_ci * Between the driver and the renderer, renderer_version is the device 84bf215546Sopenharmony_ci * version we can use internally. 85bf215546Sopenharmony_ci */ 86bf215546Sopenharmony_ci uint32_t renderer_version; 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci /* Between the driver and the app, base.base.supported_extensions is what 89bf215546Sopenharmony_ci * we advertise. 90bf215546Sopenharmony_ci * 91bf215546Sopenharmony_ci * Between the driver and the renderer, renderer_extensions is what we can 92bf215546Sopenharmony_ci * use internally (after enabling). 93bf215546Sopenharmony_ci */ 94bf215546Sopenharmony_ci struct vk_device_extension_table renderer_extensions; 95bf215546Sopenharmony_ci uint32_t *extension_spec_versions; 96bf215546Sopenharmony_ci 97bf215546Sopenharmony_ci struct vn_physical_device_features features; 98bf215546Sopenharmony_ci struct vn_physical_device_properties properties; 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci VkQueueFamilyProperties2 *queue_family_properties; 101bf215546Sopenharmony_ci uint32_t queue_family_count; 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_ci VkPhysicalDeviceMemoryProperties2 memory_properties; 104bf215546Sopenharmony_ci 105bf215546Sopenharmony_ci struct { 106bf215546Sopenharmony_ci VkExternalMemoryHandleTypeFlagBits renderer_handle_type; 107bf215546Sopenharmony_ci VkExternalMemoryHandleTypeFlags supported_handle_types; 108bf215546Sopenharmony_ci } external_memory; 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_ci VkExternalFenceHandleTypeFlags external_fence_handles; 111bf215546Sopenharmony_ci VkExternalSemaphoreHandleTypeFlags external_binary_semaphore_handles; 112bf215546Sopenharmony_ci VkExternalSemaphoreHandleTypeFlags external_timeline_semaphore_handles; 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_ci struct wsi_device wsi_device; 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci simple_mtx_t format_update_mutex; 117bf215546Sopenharmony_ci struct util_sparse_array format_properties; 118bf215546Sopenharmony_ci}; 119bf215546Sopenharmony_ciVK_DEFINE_HANDLE_CASTS(vn_physical_device, 120bf215546Sopenharmony_ci base.base.base, 121bf215546Sopenharmony_ci VkPhysicalDevice, 122bf215546Sopenharmony_ci VK_OBJECT_TYPE_PHYSICAL_DEVICE) 123bf215546Sopenharmony_ci 124bf215546Sopenharmony_civoid 125bf215546Sopenharmony_civn_physical_device_fini(struct vn_physical_device *physical_dev); 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci#endif /* VN_PHYSICAL_DEVICE_H */ 128