• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #include "anv_private.h"
26 
27 #include "vk_util.h"
28 
29 /* Convert the VK_USE_PLATFORM_* defines to booleans */
30 #ifdef VK_USE_PLATFORM_ANDROID_KHR
31 #   undef VK_USE_PLATFORM_ANDROID_KHR
32 #   define VK_USE_PLATFORM_ANDROID_KHR true
33 #else
34 #   define VK_USE_PLATFORM_ANDROID_KHR false
35 #endif
36 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
37 #   undef VK_USE_PLATFORM_WAYLAND_KHR
38 #   define VK_USE_PLATFORM_WAYLAND_KHR true
39 #else
40 #   define VK_USE_PLATFORM_WAYLAND_KHR false
41 #endif
42 #ifdef VK_USE_PLATFORM_XCB_KHR
43 #   undef VK_USE_PLATFORM_XCB_KHR
44 #   define VK_USE_PLATFORM_XCB_KHR true
45 #else
46 #   define VK_USE_PLATFORM_XCB_KHR false
47 #endif
48 #ifdef VK_USE_PLATFORM_XLIB_KHR
49 #   undef VK_USE_PLATFORM_XLIB_KHR
50 #   define VK_USE_PLATFORM_XLIB_KHR true
51 #else
52 #   define VK_USE_PLATFORM_XLIB_KHR false
53 #endif
54 
55 /* And ANDROID too */
56 #ifdef ANDROID
57 #   undef ANDROID
58 #   define ANDROID true
59 #else
60 #   define ANDROID false
61 #endif
62 
63 #define ANV_HAS_SURFACE (VK_USE_PLATFORM_WAYLAND_KHR ||                          VK_USE_PLATFORM_XCB_KHR ||                          VK_USE_PLATFORM_XLIB_KHR)
64 
65 const VkExtensionProperties anv_instance_extensions[ANV_INSTANCE_EXTENSION_COUNT] = {
66    {"VK_KHR_external_fence_capabilities", 1},
67    {"VK_KHR_external_memory_capabilities", 1},
68    {"VK_KHR_external_semaphore_capabilities", 1},
69    {"VK_KHR_get_physical_device_properties2", 1},
70    {"VK_KHR_get_surface_capabilities2", 1},
71    {"VK_KHR_surface", 25},
72    {"VK_KHR_wayland_surface", 6},
73    {"VK_KHR_xcb_surface", 6},
74    {"VK_KHR_xlib_surface", 6},
75    {"VK_EXT_debug_report", 8},
76 };
77 
78 const struct anv_instance_extension_table anv_instance_extensions_supported = {
79    .KHR_external_fence_capabilities = true,
80    .KHR_external_memory_capabilities = true,
81    .KHR_external_semaphore_capabilities = true,
82    .KHR_get_physical_device_properties2 = true,
83    .KHR_get_surface_capabilities2 = ANV_HAS_SURFACE,
84    .KHR_surface = ANV_HAS_SURFACE,
85    .KHR_wayland_surface = VK_USE_PLATFORM_WAYLAND_KHR,
86    .KHR_xcb_surface = VK_USE_PLATFORM_XCB_KHR,
87    .KHR_xlib_surface = VK_USE_PLATFORM_XLIB_KHR,
88    .EXT_debug_report = true,
89 };
90 
91 uint32_t
anv_physical_device_api_version(struct anv_physical_device * dev)92 anv_physical_device_api_version(struct anv_physical_device *dev)
93 {
94     return VK_MAKE_VERSION(1, 0, 57);
95 }
96 
97 const VkExtensionProperties anv_device_extensions[ANV_DEVICE_EXTENSION_COUNT] = {
98    {"VK_ANDROID_native_buffer", 5},
99    {"VK_KHR_16bit_storage", 1},
100    {"VK_KHR_bind_memory2", 1},
101    {"VK_KHR_dedicated_allocation", 1},
102    {"VK_KHR_descriptor_update_template", 1},
103    {"VK_KHR_external_fence", 1},
104    {"VK_KHR_external_fence_fd", 1},
105    {"VK_KHR_external_memory", 1},
106    {"VK_KHR_external_memory_fd", 1},
107    {"VK_KHR_external_semaphore", 1},
108    {"VK_KHR_external_semaphore_fd", 1},
109    {"VK_KHR_get_memory_requirements2", 1},
110    {"VK_KHR_image_format_list", 1},
111    {"VK_KHR_incremental_present", 1},
112    {"VK_KHR_maintenance1", 1},
113    {"VK_KHR_maintenance2", 1},
114    {"VK_KHR_push_descriptor", 1},
115    {"VK_KHR_relaxed_block_layout", 1},
116    {"VK_KHR_sampler_mirror_clamp_to_edge", 1},
117    {"VK_KHR_sampler_ycbcr_conversion", 1},
118    {"VK_KHR_shader_draw_parameters", 1},
119    {"VK_KHR_storage_buffer_storage_class", 1},
120    {"VK_KHR_swapchain", 68},
121    {"VK_KHR_variable_pointers", 1},
122    {"VK_KHX_multiview", 1},
123    {"VK_EXT_external_memory_dma_buf", 1},
124 };
125 
126 void
anv_physical_device_get_supported_extensions(const struct anv_physical_device * device,struct anv_device_extension_table * extensions)127 anv_physical_device_get_supported_extensions(const struct anv_physical_device *device,
128                                              struct anv_device_extension_table *extensions)
129 {
130    *extensions = (struct anv_device_extension_table) {
131       .ANDROID_native_buffer = ANDROID,
132       .KHR_16bit_storage = false,
133       .KHR_bind_memory2 = true,
134       .KHR_dedicated_allocation = true,
135       .KHR_descriptor_update_template = true,
136       .KHR_external_fence = device->has_syncobj_wait,
137       .KHR_external_fence_fd = device->has_syncobj_wait,
138       .KHR_external_memory = true,
139       .KHR_external_memory_fd = true,
140       .KHR_external_semaphore = true,
141       .KHR_external_semaphore_fd = true,
142       .KHR_get_memory_requirements2 = true,
143       .KHR_image_format_list = true,
144       .KHR_incremental_present = true,
145       .KHR_maintenance1 = true,
146       .KHR_maintenance2 = true,
147       .KHR_push_descriptor = true,
148       .KHR_relaxed_block_layout = true,
149       .KHR_sampler_mirror_clamp_to_edge = true,
150       .KHR_sampler_ycbcr_conversion = true,
151       .KHR_shader_draw_parameters = true,
152       .KHR_storage_buffer_storage_class = true,
153       .KHR_swapchain = ANV_HAS_SURFACE,
154       .KHR_variable_pointers = true,
155       .KHX_multiview = false,
156       .EXT_external_memory_dma_buf = true,
157    };
158 }
159