summaryrefslogtreecommitdiff
path: root/vulkan/libvulkan/api.cpp
AgeCommit message (Collapse)Author
2021-02-24Merge "Update checking debug.vulkan.layer.* system props" am: 3fa6396567 am: ↵Treehugger Robot
df476dddf5 am: 69140e9c9c Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1596925 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I2e187e756cf202c91debeea8f9bbad76f5463790
2021-02-22Update checking debug.vulkan.layer.* system propsJason Macnak
... to scan a fixed range of priorities followed by consecutive priorities instead of scanning all system props (property_list()) which causes sepolicy audits when Vulkan is loaded in a process with a restrictive sepolicy. This avoids sepolicy audits in system_server for example when running on Cuttlefish with SwANGLE (ANGLE GL on top of SwiftShader Vulkan). Bug: b/179967574 Test: boot Cuttlefish with SwANGLE and inspect audit logs Change-Id: I63b3f45113fbdd3ab62c22f062150e25b99d7352
2020-08-03Vulkan: unload builtin driver to reload updated driver if neededYiwei Zhang
Android historically preloads GL driver in Zygote to speed up app launch time and avoid the duplicate extra memory for each process loading the graphics driver. In Android 10, we landed GL driver unloading mechanism to ship updatable driver and ANGLE without perf overhead on the rest of the system. To get prepared for the HWUI Vulkan backend being turned on as the default renderer for UI componments, this CL will do the same to the Vulkan driver to preload it in Zygote and unload so to reload updated driver if needed. Bug: 135536511 Test: atest CtsUiRenderingTestCases no regression on VK backend Change-Id: I2909f6ecc4f011b1f3670aacdf817ed3b6e9a487
2020-07-16libvulkan: make vkEnumerateInstanceVersion trigger driver loadingYiwei Zhang
This is a globally dispatched api, and it's the best option to preload the driver in Zygote with minimum overhead. This change also updates some return codes according to the spec. Bug: 135536511 Test: take a trace and verify driver is loaded Change-Id: I6fe425ec568b13577d3d9471aa5f181cff44c61c
2020-03-25[Vulkan] Expose device extensions from implicit layers.Peiyong Lin
Previously the vulkan loader only exposes device extensions from the driver implementation when the layer name is not specified. Per vkEnumerateDeviceExtensionProperties spec the loader must also advertise device extensions from implicitly enabled layers. Bug: b/143293104 Test: atest android.gputools.cts.CtsRootlessGpuDebugHostTest Change-Id: Iaf5786ba7e371a290ecd1764af69b5298371cfdd
2020-03-17[Vulkan] Expose instance extensions from implicit layers.Peiyong Lin
Previously the vulkan loader only exposes instance extensions from the driver implementation. Per vkEnumerateInstanceExtensionProperties spec the loader must also advertise instance extensions from implicitly enabled layers. Bug: b/143293104 Test: vkEnumerateInstanceExtensionProperties returns the instance extensions from implicit layers. Change-Id: I17f4ce370bf5f4bba295165a28836e2b7c03a318
2020-02-18Merge "libvulkan: remove a redundant check debuggable logic" into ↵Automerger Merge Worker
qt-qpr1-dev am: eab94c8f45 am: 4f2cf91f9a Change-Id: Ifb3ca893ba2315167c205897355a49c510dffb58
2020-02-18Merge "libvulkan: remove a redundant check debuggable logic" into ↵Automerger Merge Worker
qt-qpr1-dev am: eab94c8f45 Change-Id: I28a9939b33926ebf285a93047ab21691c5e81576
2020-02-18libvulkan: remove a redundant check debuggable logicYiwei Zhang
There're below cases which we can load the debug layers: (1) Layer search paths added from Settings global Layers enabled from Settings global (2) Layer search paths added from default system debug path Layers enabled from system property (3) Layer search paths are from app class loader's default paths Layers enabled from system property For (1), we have done the debuggable check in Java land GraphicsEnvironment. For (2), we have a separate check debuggable logic for adding the system debug path to the layers search paths. For (3), we should never need to check debuggable. So we should just remove the redundant debuggable check when we add implicit layers, which can unblock (3) immediately as well as maintaining the security logic around debug layers. Bug: 147838267 Bug: 149183377 Test: CtsRootlessGpuDebugHostTest#testSystemPropertyEnableVulkan on userbuild Change-Id: I80d9cf3ff6786ce4d4ec5d8afb8da58ba0842ec9
2020-01-31GraphicsEnv: refactor to unify the debuggable logic am: fe62271bc3Automerger Merge Worker
Change-Id: I2bb295fbf56168beefa5dd26ea21cb85a90a6752
2020-01-29GraphicsEnv: refactor to unify the debuggable logicYiwei Zhang
By default, PR_SET_DUMPABLE is 0 for zygote spawned apps, except in the following circumstances: 1. ro.debuggable=1 (global debuggable enabled, i.e., userdebug or eng builds). 2. android:debuggable="true" in the manifest for an individual application. 3. An app which explicitly calls prctl(PR_SET_DUMPABLE, 1). 4. GraphicsEnv calls prctl(PR_SET_DUMPABLE, 1) in the presence of <meta-data android:name="com.android.graphics.injectLayers.enable" android:value="true"/> in the application manifest. So checking both ro.debuggable=1 and PR_GET_DUMPABLE is redundant. Bug: b/144186877, b/148566223 Test: CtsAngleIntegrationHostTestCases Test: CtsRootlessGpuDebugHostTest Change-Id: I934f64315b67db77ee2c2a9dff50fb23bc0a546a Merged-In: I934f64315b67db77ee2c2a9dff50fb23bc0a546a (cherry picked from commit 6a674c9e105bdc5d736c06a4500dcdac1c6c4006)
2019-11-13Merge "GraphicsEnv: refactor to unify the debuggable logic"TreeHugger Robot
2019-11-08GraphicsEnv: refactor to unify the debuggable logicYiwei Zhang
By default, PR_SET_DUMPABLE is 0 for zygote spawned apps, except in the following circumstances: 1. ro.debuggable=1 (global debuggable enabled, i.e., userdebug or eng builds). 2. android:debuggable="true" in the manifest for an individual application. 3. An app which explicitly calls prctl(PR_SET_DUMPABLE, 1). 4. GraphicsEnv calls prctl(PR_SET_DUMPABLE, 1) in the presence of <meta-data android:name="com.android.graphics.injectLayers.enable" android:value="true"/> in the application manifest. So checking both ro.debuggable=1 and PR_GET_DUMPABLE is redundant. Bug: 144186877 Test: CtsAngleIntegrationHostTestCases Test: CtsRootlessGpuDebugHostTest Change-Id: I934f64315b67db77ee2c2a9dff50fb23bc0a546a
2019-11-07Vulkan: fix a typoYiwei Zhang
Fixes: 140609421 Test: build, flash and boot Change-Id: I7548bf733b32861c8007cee63df954022c111a1d
2019-10-24Vulkan: convert all the TODOs into actual issues to chase againstYiwei Zhang
Bug: 134185757 Test: build Change-Id: Ib9a27ba8b8da53707337d3d48e6da502f38670e5
2019-10-17Vulkan: correctly expose Vulkan entry pointsYiwei Zhang
This change fixes the advertisement of core Vulkan entry points as below: 1. GIPA returns a valid checked_proc for 1.1 core device APIs. 2. GDPA returns NULL for 1.1 core device APIs on a 1.0 physical device. Bug: 134185757 Bug: 142266108 Test: dEQP-VK.memory.binding on 1.1 loader and 1.0 device ICD Test: dEQP-VK.api.info.instance on 1.1 loader and 1.0 instance ICD Change-Id: Ieb814516a4019f1a330178bfeb414e1450895c5c Merged-In: I0a3e06dc04bade4f36a7e68ee2f53979c656ee4e
2019-10-17Vulkan: correctly expose Vulkan entry pointsYiwei Zhang
This change fixes the advertisement of core Vulkan entry points as below: 1. GIPA returns a valid checked_proc for 1.1 core device APIs. 2. GDPA returns NULL for 1.1 core device APIs on a 1.0 physical device. Bug: 134185757 Bug: 142266108 Test: dEQP-VK.memory.binding on 1.1 loader and 1.0 device ICD Test: dEQP-VK.api.info.instance on 1.1 loader and 1.0 instance ICD Change-Id: I0a3e06dc04bade4f36a7e68ee2f53979c656ee4e
2019-08-15libvulkan: ensure layer discovery is triggered only once for a new processYiwei Zhang
After decoupling layer discovery from driver loading, the layer discovery is triggered at each call of vkCreateInstance, vkEnumerateInstanceLayerProperties and vkEnumerateInstanceExtensionProperties. However, it takes non-trivial time to traverse the layer search path for priviledged apps and non-updated system apps. So this change just makes sure the layer discovery logic is triggered only once for a new process. Bug: 139443653 Bug: 135536511 Test: preload Vulkan and atest CtsGpuToolsHostTestCases Change-Id: Ibe502fd4b089acbbff6f4a2485fa61c736a484b5
2019-08-13libvulkan: refactor the layer discovery logicYiwei Zhang
Previously, the layer discovery logic is only executed once along with the driver loading. However, once Vulkan driver is preloaded in Zygote, new layers pushed to the system or shipped with the App's apk won't be discovered at runtime. This change refactors the logic of layer discovery. It doesn't hurt to keep finding new layers available in the layer search path, because the app apk itself won't change at runtime. Even if we push new layers to the system search path, that's only on the debug build of the system. Bug: 135536511 Test: preload Vulkan and atest CtsGpuToolsHostTestCases Change-Id: I915b78dacfd9b637a202f76969d559a31eded686
2019-07-18Check if Vulkan layers have a valid looking GIPAAdam Bodnar
Bug: 137862180 Test: flash, remove vkGetInstanceProcAddr from layer symbols, run Change-Id: I4d4d75585623d2c15c57b4d8ad0243a2fc347fce
2019-02-04Vulkan: add atrace supportYiwei Zhang
Test: build, flash and take traces Change-Id: Idab6d748519c4f5bc6aac3d51efd26cad28c94ec
2017-11-15Rootless GPU DebugCody Northrop
Add the ability to load GPU debug layers from the base directory of debuggable applications. This update concides with changes to framework/base to control the enabling logic in GraphicsEnvironment. This commit changes the Vulkan loader to: * Scan an additional location for debug layers. * Use the provided order of layers from GraphicsEnvironment, overriding system properties. * Use the first instance of a layer found, in the case of duplicates. * Move layers paths and namespace to GraphicsEnv, removing vulkan_loader_data Bug: 63708377 Test: Manual, CTS tests to follow Change-Id: I38dc91bbc26671f5093ee1b12454fc024c0b5892
2017-10-26Vulkan api update to 1.1Daniel Koch
Import Vulkan 1.1 header from khronos master@5b2d66c0e6906388385ed7adfd015d80ec0d846a with the following modifications: - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES 10006300 -> 1000063000 - remove VK_KHR_get_display_properties2 (which is not ratified) - device_group interactions from KHR_surface to KHR_swapchain (per MR 2409) Summary of changes since 1.0.61: * VK_KHR_surface -> v26 (subsumed interactions with VK_KHR_device_group) * VK_KHR_swapchain -> v69 (subsumed interactions with VK_KHR_device_group) * VK_EXT_debug_report -> v9 (no api changes) * VK_KHX_multiview -> VK_KHR_multiview * VK_KHX_device_group -> VK_KHR_device_group * VK_KHX_device_group_creation -> VK_KHR_device_group_creation * VK_KHR_push_descriptor -> v2 * Added VK_KHR_maintenance3 * Added 1.1 core enums, structs, and functions (kept KHR suffixed ones too) Implemented the following in libvulkan: * EnumerateInstanceVersion * GetDeviceGroupPresentCapabilitiesKHR (minimal support for 1 device) * GetDeviceGroupSurfacePresentModesKHR (minimal support for local present modes only) * GetPhysicalDevicePresentRectanglesKHR (assumes whole window) * AcquireNextImage2KHR (minimal thunk to AcquireNextImageKHR) * GetDeviceQueue2 * added support for VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR * support for 1.1 core device_groups functionality (no VK_KHR_device_group_creation) - EnumeratePhysicalDeviceGroups * added trampolines for 1.1 core entry points * disabled apiVersion >= 1.1 check Implemented in nulldrv (but largely untested beyond build/link) * EnumerateInstanceVersion * enough empty thunks for VK 1.1 core functions that it links Test: Build Android Change-Id: I247cd670543867bdf80877156d941cf3bfcf6303
2017-01-12resolve merge conflicts of a2c2d11f9 to masterMark Salyzyn
Test: compile Bug: 26552300 Bug: 31289077 Change-Id: I84d0ffa430df3beca0dcc6ed205ce220d7be1f87
2017-01-11Replace cutils/log.h and rationalize log/log.h and android/log.hMark Salyzyn
- cutils/log.h treat as deprecated and lead by example - android/log.h to be used instead of log/log.h if possible - add system includes that are assumed as side effects - define LOG_TAG first Test: compile Bug: 31289077 Bug: 30465923 Change-Id: I8d99b24c333578c9b5aa9f2a01324bd0bba268dd
2016-12-29vulkan: Correct access after free issueCourtney Goeltzenleuchter
While testing argument validation in the loader, I found that I got SEGFAULTs trying to access the logger class created in LayerChain::CreateDevice. I believe that the logger object was being destroyed at the end of the LayerChain construction statement so that a reference to the logger caused a SEGFAULT. Fix CreateInstance path as well, though the loader doesn't currently call the logger in that path, so no way to verify. Test: run vkCreateDevice_test on Vulkan device. See tests/README.md for details Bug: 33783620 Change-Id: Ib46023e8a8dfa008510c655c5b216aabaaf2ea83
2016-12-22Replace cutils/log.h and rationalize log/log.h and android/log.hMark Salyzyn
- cutils/log.h treat as deprecated and lead by example - android/log.h to be used instead of log/log.h if required - add system includes that are assumed as side effects of log.h - modules that use SLOG should use SLOG for all logging (installd) - define LOG_TAG first - remove logging infrastructure if not used Test: build Bug: 31289077 Change-Id: Iea147a0104c7ab7f12451304131d6500f42141e7
2016-05-27vulkan: fix crash when only non-global layers are enabledChia-I Wu
We fail to set up get_instance_proc_addr_ and get_device_proc_addr_ when there are layers but only non-global ones. Bug: 28990561 Change-Id: I82704f946deb5a76640f9dfb792e6fd118c78aa7
2016-05-06vulkan: use Logger in vulkan::apiChia-I Wu
Use debug report logger for actionable application errors (but not other errors). Bug: 28120066 Change-Id: Ia9a3b568e415555bf42c8a76d1df6279835a710c
2016-04-29vulkan: deprecate device layersChia-I Wu
Allow instance layers to intercept all commands and enumerate device extensions. Ignore application device layers. Enumerate all enabled instance layers in vkEnumerateDeviceLayerProperties. Bug: 27911856 Change-Id: I6e89439ab10835dd1a43732c2333a92201e52550
2016-04-28vulkan: detect errors in VkEnumerate*ExtensionPropertiesChia-I Wu
Return VK_ERROR_LAYER_NOT_PRESENT when the layer is not available. Change-Id: I9d9aafe6e40c2ca49e58bc7c70114d0f11de2f81
2016-04-28vulkan: do not distinguish instance or device LayerRefChia-I Wu
Merge Get*LayerRef into GetLayerRef and remove LayerRef::is_instance_. With the removal, LayerRef::SupportsExtension becomes ambiguous. Replace it with FindLayer*Extension. Remove unused LayerRef::GetName and LayerRef::GetSpecName while at it. There should be no user-visible change. Bug: 27911856 Change-Id: I38340654b52338e9ed46d1c4462a6b254b0cab64
2016-04-28vulkan: make Get*LayerRef take a LayerChia-I Wu
The only user-visible change should be improved error messages. Bug: 27911856 Change-Id: Ie50a9d37f07b590026176642f2c67270225f9280
2016-04-28vulkan: refactor layer extension enumerationChia-I Wu
Replace Get*LayerExtensions by a set of new functions that do not distinguish instance and device layers. There should be no user-visible change. Bug: 27911856 Change-Id: Icd98abf51a936769f8f2f218794043b5e2611c5c
2016-04-28vulkan: refactor layer enumerationChia-I Wu
Replace Enumerate*Layers by a set of new functions that do not distinguish instance and device layers. The new functions are also careful not to pollute the rest of the loader with std containers. There should be no user-visible change. Bug: 27911856 Change-Id: I4790fadc1aa2ea934a4628bce55dd45892f15e0b
2016-04-14vulkan: do not query non-enabled WSI functionsChia-I Wu
Initialize dispatch table entries for non-enabled WSI functions to stubs. We do not want to initialize them to NULL because they may still be invoked through the exported WSI entrypoints. Bug: 25850852 Change-Id: I25b715700990ad7432740f031764d70396024d32
2016-04-14vulkan: pass VK_LAYER_FUNCTION_DATA_CALLBACK to layersChia-I Wu
VK_LAYER_FUNCTION_DATA_CALLBACK effectively allows us to pass driver::SetDataInternal to layers. It will be called on handles of potentially unknown types. Add two internal types VK_DEFINE_HANDLE(InstanceDispatchable) VK_DEFINE_HANDLE(DeviceDispatchable) in driver namespace for type safety. Bug: 28015368 Change-Id: I7389829a7d8c374197cd7046973777b49e436961
2016-04-11vulkan: use CamelCase() for LayerChainChia-I Wu
Change-Id: I2f102fa97e3c976fa411b4e6bdc83dacfa243af7
2016-04-11vulkan: use CamelCase() for OverrideExtensionNamesChia-I Wu
Change-Id: If44c40f87b1e3e2eb69d12543a7f3b3036291c88
2016-04-11vulkan: use CamelCase() for OverrideLayerNamesChia-I Wu
Change-Id: Ic7bc29efc1ae5b734ebfc692c441b9537134ccb2
2016-04-11Merge changes I21f07545,I73c39cbe,I47b1639c,I4a6268d7,I06be9898, ... into ↵Chia-I Wu
nyc-dev * changes: vulkan: remove unused loader.{cpp.h} vulkan: use driver::GetData everywhere vulkan: move all _Bottom functions vulkan: add swapchain.h vulkan: add layers_extensions.h vulkan: rework CreateInstance_Bottom and related ones vulkan: rework EnumerateDeviceExtensionProperties_Bottom vulkan: rework {Create,Destroy}Device_Bottom vulkan: move AllocateCommandBuffers_Bottom vulkan: move GetDeviceQueue_Bottom vulkan: rework DriverDispatchTable vulkan: rework driver::Get*ProcAddr vulkan: add VK_ANDROID_native_buffer to vulkan.api vulkan: move driver::GetDefaultAllocator vulkan: move driver::OpenHAL vulkan: move driver::Debuggable
2016-04-11vulkan: add layers_extensions.hChia-I Wu
Move everything for layers_extensions.cpp out of loader.h to layers_extensions.h, and into vulkan::api namespace. Remove now unused InstanceExtensionFromName and DeviceExtensionFromName. Change-Id: I06be98986f40de35e9dffb5499bc1423e9eb3d48
2016-04-07vulkan: check for unsupported extensionsChia-I Wu
Return VK_ERROR_EXTENSION_NOT_PRESENT when an app attempts to enable an unsupported extension. This fixes a regression introduced by my top rewrite (commit 0c20324: vulkan: rewrite top of loader). Since we do not cache HAL extensions, each vkCreateInstance or vkCreateDevice call is preceded by two extension enumeration calls internally. Change-Id: I5342c1a5c9a5452dd2bc52933a5ee558db174048
2016-03-30vulkan: rewrite top of loaderChia-I Wu
The top is responsible for layer discovery and chaining, and the bottom is like a regular layer that is always enabled and is inserted just before the driver. Make the separation clear by rewriting the top and stripping the layer managment code from loader.cpp. Change-Id: I64e525e27bd4c297bccd94a1eb9b88e28088e85d