summaryrefslogtreecommitdiff
path: root/vulkan/libvulkan/driver.cpp
AgeCommit message (Collapse)Author
2025-04-02Downgrade ICD's view of VkApplicationInfo::apiVersion for 1.3 ICD Chris Forbes
Certain 1.3 ICDs in the wild seem to misbehave on seeing VkApplicationInfo::apiVersion = 1.4. Bug: b/403118763 Flag: NONE bugfix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a9972152370858f05df2b79daf90fd2930ff6001) Merged-In: Ic6ec11ecca68add499db864af4a6e96ef8076aa4 Change-Id: Ic6ec11ecca68add499db864af4a6e96ef8076aa4
2025-03-13libvulkan: refactor for _FORTIFY_SOURCE=3 support. Elliott Hughes
You can't use malloc_usable_size() when built with _FORTIFY_SOURCE=3, so pull out the allocator into a file that can be built _FORTIFY_SOURCE=2 while still getting the benefits for the rest of the code. Bug: http://b/291762537 Change-Id: Ic3a71bd8eadeb2da167edc0ba28becba2f95f82e
2024-11-25Add support for vulkan api level 1.4 in loader Chris Forbes
Bug: b/370568136 Flag: com.android.graphics.libvulkan.flags.vulkan_1_4_instance_api Change-Id: Ibf168e24f5be16cdf87b683322d291336b11244f
2024-08-15Implement the VK_KHR_swapchain_mutable_format device extension in the vulkan ↵ Tom Murphy
loader Add an implementation for the VK_KHR_swapchain_mutable_format extension. Test: Stepped through changes in debugger Test: Ran sample app with VVL which used the extension Test: Ran dEQP-VK.image.swapchain_mutable.android.* dEQP tests Flag: com.android.graphics.libvulkan.flags.swapchain_mutable_format_ext Bug: 341978292 Change-Id: Ib0e5b9f750cd5a94ab65419542898db207716fcc
2024-08-06Merge changes I1e6c3c80,I4310618c into main am: 5a2065886b Chris Forbes
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3205054 Change-Id: Ib75609eb56bba49998afab66b73bfbd076812429 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-01Fix updatable driver loading issue with Vulkan. Rob VanReenen
When unloading Vulkan driver, check if close() function is non-NULL before calling it. Bug: 349287141 Change-Id: I1e6c3c80e57dceecd41888541044807e1dab45af
2024-05-15Filter hook entry points by ICD entry point presence Jörg Wagner
For device proc hooks which intercept core functions check whether there exists an exposed core function from the ICD, and skip exposure if none is found. This avoids having to replicate exposure filtering based on requested Vulkan API versions inside the Loader - rely on the ICD to handle it correctly. Bug: 309752984 Change-Id: Ibeb13dae8eccaa859072ee5233013d99d5b26ef0
2024-05-07Add engine name to GpuStatsAppInfo Tom Murphy
The engine name from VkApplicationInfo is useful for collection metrics on Vulkan usage. Add it to the collected metrics in GpuStatsAppInfo. Bug: 330118952 Test: adb shell dumpsys gpu Test: atest GpuStatsTest Change-Id: If4096b8a96ed77ddb1d2fd9f48c2b8825b3d0280
2024-01-09Vulkan: Don't close HAL inside of an assert Ian Elliott
Bug: 282237072 Test: Compile with asserts disabled Change-Id: Ideed507af4f6422db32f85c5ef70d8c62d21d5c9
2023-11-16Merge "Load vulkan driver from an apex when ro.vulkan.apex is set" into main ↵ Jooyung Han
am: a4f2d92c23 am: 1a18312ba9 am: 3093fae8e8 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2818498 Change-Id: I61f92db0772295c0355e3ece91d8964b356aa1ae Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-16Merge "Load vulkan driver from an apex when ro.vulkan.apex is set" into main ↵ Jooyung Han
am: a4f2d92c23 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2818498 Change-Id: I84f10f2dcbdbdbac513e6c387cb9160dc96a4eca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15Load vulkan driver from an apex when ro.vulkan.apex is set Jooyung Han
When ro.vulkan.apex is set, loader tries to load driver from the apex. This enables vulkan driver to be packaged in APEX. Bug: 205618237 Bug: 306294280 Test: cvd start -gpu_mode=guest_swiftshader # load vulkan.pastel from apex. Change-Id: I63feb6d55fb9918b95d3cff0d9ffa0d004e94645
2023-11-13Merge "Vulkan: log dlerror on error" into main am: 67d71c0552 am: 02ba47d307 ↵ Jooyung Han
am: 84e6863205 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2825857 Change-Id: I341887a0ee410693bf7f6e0d02b2a5b8e91a14b8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13Merge "Vulkan: log dlerror on error" into main am: 67d71c0552 Jooyung Han
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2825857 Change-Id: Id94e4d8297d5fb778b2b537ce90988dabbd77fc8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13Vulkan: log dlerror on error Jooyung Han
Previously, it prints dlerror even when it succeeds, which leads to a misleading log entry. Bug: n/a Test: cvd start -gpu_mode=guest_swiftshader Change-Id: I6eaf9df6b3fc5c848c999847d712391e6d8b1633
2023-10-04Deprecate GetSwapchainGrallocUsageANDROID from the platform Trevor David Black
Bug: 259437988 Change-Id: I9ae19978c7ea5f73292343fb187395ed5dbde270
2023-08-25Merge Android U (ab/10368041) Xin Li
Bug: 291102124 Merged-In: I9b175092d433fc6d7b22b437a09d76d3d2e0ce14 Change-Id: If8a2897a99b111ba107f33c19537d40bcbdc802e
2023-08-14Merge "Vulkan: Avoid buffer overflow by ignoring duplicate extensions" into ↵ Treehugger Robot
udc-qpr-dev
2023-08-11Vulkan: Avoid buffer overflow by ignoring duplicate extensions Ian Elliott
For any instance extension that a Vulkan driver supports, if a VkInstance is created with that extension listed multiple times, the 2nd-nth times should be ignored. That avoids overwriting an array in CreateInfoWrapper::FilterExtension(). Test: Manual testing with logcat Bug: 288929054 Change-Id: I096a6752e0f4abef868efdb6f8b4bcbd0c0c79cd Merged-In: I096a6752e0f4abef868efdb6f8b4bcbd0c0c79cd
2023-08-10Vulkan: Avoid buffer overflow by ignoring duplicate extensions Ian Elliott
For any instance extension that a Vulkan driver supports, if a VkInstance is created with that extension listed multiple times, the 2nd-nth times should be ignored. That avoids overwriting an array in CreateInfoWrapper::FilterExtension(). Test: Manual testing with logcat Bug: 288929054 Change-Id: I096a6752e0f4abef868efdb6f8b4bcbd0c0c79cd
2023-08-03Add swapchainImageUsage to VkGrallocUsageInfo2 Trevor David Black
Bug: 288286529 Test: Build Change-Id: I8091d9c4db11394b85ceb1d266f97d35a00cc246
2022-12-28Revert "Revert "Reland: "libvulkan: Implement EXT_swapchain_maintenance1"""" Chris Forbes
This reverts commit 334a4105c8d52848c48c4c843a33522423010c4c. Reason for revert: all failures tracked to original CL, not the reland. No issues seen now in manual hwasan tests. Change-Id: Icd2f12f18b5f1a77237703983e11bced16cb8865
2022-12-22Revert "Reland: "libvulkan: Implement EXT_swapchain_maintenance1""" Ian Elliott
This reverts commit 2dcb4f0064d3d6a01105d2c8a12368c347d85227. Reason for revert: Appears to cause HWASAN failures. See b/263442454, b/263446408, b/263444233, and b/263445588. Change-Id: I6de0027ae2db803445a66de575dda97826b8eb6a
2022-12-22Reland: "libvulkan: Implement EXT_swapchain_maintenance1"" Chris Forbes
This reverts commit ac40c1e284453e10a7c2b6f2c6090fc4be322398 and incorporates a fix for the memory corruption that caused us to revert it initially. Bug: b/255376900 Change-Id: I3d8ab1977ea705bebdb8cd2c69d39f06ab5c4158
2022-12-21Revert "libvulkan: Implement EXT_swapchain_maintenance1" Ian Elliott
This reverts commit 08c7bb1fdb33d6ad34ba1b2de3ac0579750456fe. Reason for revert: Possibly the cause of b/263412882 (will revert and see if that clears up the problem) Change-Id: If217e36c67fcea8b5270dbf20b0c13c42d1da09a
2022-12-21libvulkan: Implement EXT_swapchain_maintenance1 Chris Forbes
The loader now implements EXT_swapchain_maintenance1 and EXT_surface_maintenance1, which fix assorted issues with the original swapchain extension. Our implementation of EXT_swapchain_maintenance1 is conditional on the underlying driver having support for importing sync fds as external fences (which requires Vulkan 1.1 + support for VK_KHR_external_fence_fd). Bug: b/255376900 Change-Id: I72ce770a7296e4e97cccf13bad420aa5a1001a6a
2022-12-13Merge "Adding new Vulkan metrics to GPU Stats" Serdar Kocdemir
2022-12-12Adding new Vulkan metrics to GPU Stats Serdar Kocdemir
Following fields are added into GpuStatsAppInfo for tracking: bool createdGlesContext = false; bool createdVulkanDevice = false; bool createdVulkanSwapchain = false; uint32_t vulkanApiVersion = 0; uint64_t vulkanDeviceFeaturesEnabled = 0; std::vector<int32_t> vulkanInstanceExtensions = {}; std::vector<int32_t> vulkanDeviceExtensions = {}; Extensions are tracked as 32-bit hashes. setTargetStatsArray GPU service function added to provide an array of stat values, used for reporting list of extensions. Bug: b/244286661 Test: adb shell dumpsys gpu Test: atest GpuStatsTest Change-Id: I4ae4e3b687cd6274a9b4127a336dd0f91f5f9e39
2022-12-01Vulkan loader changes to address previous comments in image_compression_control Trevor David Black
Bug: 218365766 Test: Build Change-Id: I214981958eb02e22b0322c679241b50012006fb9
2022-11-16Vulkan loader changes to support VK_EXT_image_compression_control Trevor David Black
Bug: 218365766 Test: Build Change-Id: I91cddbee0daac27d838e6201ba63c51a5158412c
2022-03-16swapchain: Implement VK_KHR_surface_protected_capabilities Ian Elliott
This version tries to address some subtle differences between upstream and downstream branches. Bug: 221490496 Test: Test with ANGLE EGLConfig-generation code Change-Id: I750f052e3560e76b2035ed3c92a3ec38745b9ef4
2022-03-16swapchain: Implement VK_GOOGLE_surfaceless_query Ian Elliott
This extension allows ANGLE to call Vulkan WSI queries before it has a VkSurfaceKHR. This version tries to address some subtle differences between upstream and downstream branches. Bug: 203826952 Test: Test with ANGLE EGLConfig-generation code Change-Id: I7eb013efbaa5dd19ebed045583616238cea57023
2022-03-15Revert "swapchain: Implement VK_GOOGLE_surfaceless_query" Ian Elliott
In order to help the automerger get this everywhere, am reverting it here, and then will land it in AOSP master (which will automerge here again). This reverts commit 8e0f12163f90a1a511625ba1f290de95777beb86. Test: Manual inspection Bug: 203826952 Change-Id: I227993c87b1601b8dc0d1cf4bb008d5af9abc930
2022-03-14Revert "swapchain: Implement VK_KHR_surface_protected_capabilities" Ian Elliott
In order to help the automerger get this everywhere, am reverting it here, and then will land it in AOSP master (which will automerge here again). This reverts commit a9e06fd447e8ebf22b2dd025d6ee1aa3f93b2bc1. Test: Manual Inspection Bug: 221490496 Change-Id: I21dcc2ab87d34b2366d32d06b910c88400c5f70d
2022-03-01swapchain: Implement VK_KHR_surface_protected_capabilities Ian Elliott
Bug: 221490496 Test: Test with ANGLE EGLConfig-generation code Change-Id: Id01e677175a2cf98f4d893e21f3c654375772153
2022-03-01swapchain: Implement VK_GOOGLE_surfaceless_query Ian Elliott
This extension allows ANGLE to call Vulkan WSI queries before it has a VkSurfaceKHR. Bug: 203826952 Test: Test with ANGLE EGLConfig-generation code Change-Id: I7e53a8a28157023658baac0778033159bdd2285e
2022-01-24Change Vulkan API to 1.3 Trevor David Black
The commit changes the platform code to support Vulkan 1.3. Bug: 191881132 Test: build Change-Id: I75ed8a0737ef20ff95e4a27ce39cc855d8a1deeb
2022-01-24Vulkan: update the loader for vulkan-headers v1.3.197 Trevor David Black
Bug: 191881132 Test: build Change-Id: Ie9e13d64a438d895f92e826e693477d508200054
2022-01-24Deprecate old VK_* defines Trevor David Black
Bug: 191881132 Test: build Change-Id: If7ff23e465b54258c9e2445981cbc11cbe14e174
2022-01-24Change Vulkan API to 1.2 Ian Elliott
The commit changes the platform code to support Vulkan 1.2. Bug: 191881132 Test: build Change-Id: I6e71a84b85874a71031734004b8e44ee0ea7446f
2021-07-22Inline GetPhysicalDeviceProperties2 into QueryPresentationProperties Chris Forbes
In general, we implement the 1.1 instance / physical device API as preferring to call the native 1.1 function if available; otherwise falling back to calling the equivalent GPDP2 function. If the underlying driver supports *neither* then any caller of that function has already invoked UB by calling it and so falling over is acceptable. Unfortunately, the loader itself does call vkGetPhysicalDeviceProperties2 in one case, regardless of what the driver may support, in order to determine whether the platform's swapchain implementation should expose some features. On a 1.0 driver without the GPDP2 extension, this caused trouble. As a slight further wrinkle, vkGetPhysicalDeviceProperties2 "cannot fail", making propagating a failure back up through the loader annoying. As a workaround, inline the calls to GetPhysicalDeviceProperties2 and GetPhysicalDeviceProperties2KHR into QueryPresentationProperties, where we can handle our one special case of both function pointers being missing but behavior being defined. Bug: b/192130684 Change-Id: Iff2bae98b7931bed80fafd895cf57061becabd8d
2020-11-13Vulkan/OpenGL: log dlerror for loading updatable gfx driver Yiwei Zhang
Test: build Change-Id: Ifcb57266f5d93767ba911f70695e0bbbeace98e6
2020-10-23Merge changes from topic "vulkan-header-1.2.158" am: 373e4fd03e am: ↵ Treehugger Robot
64f80d1b45 am: b932d1c701 am: fa5109f4cd Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1465688 Change-Id: Ib518ffa5be638239f8d3655c8e3e6194e93cce9b
2020-10-22Vulkan: update the loader for vulkan-headers v1.2.158 Yiwei Zhang
1. Fixed a false assumption on max api version in gen script 2. Updated thae gens via ./vulkan/scripts/code_generator.py 3. Added the new entry points to null_driver. 4. Updated the llndk symbol map Bug: 171402955 Test: build Change-Id: Ifa0b9dce7f4138ca0c72c1c17ca3af8eed538abf
2020-10-14Vulkan: load built-in driver into default namespace as a fallback Yiwei Zhang
There isn't sphal in vendor config because the default has the same access there. This change allows vendor processes to load Vulkan driver into the default namespace. Bug: 170258171 Test: Vulkan driver can be loaded into vendor processes Change-Id: If58493e6954e4e8d2309aaca392fcdffea9c6b9a
2020-08-29Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709) Xin Li
Bug: 166295507 Merged-In: I70ea776b8589ac3a7982c710c5c8b2941d86e55b Change-Id: Ic1d535e9d2d6f80d95215240dbdb024995b045f8
2020-08-17Merge "vulkan: avoid waiting for service.sf.present_timestamp creation" am: ↵ Treehugger Robot
2ea51b8478 am: 6f61f6578a am: d711a75dca am: 38bb97f622 am: 17d1f93562 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1401796 Change-Id: I29bea1b5bc183347433767393e38d50750a88cc0
2020-08-17Merge "vulkan: avoid waiting for service.sf.present_timestamp creation" am: ↵ Treehugger Robot
2ea51b8478 am: 6f61f6578a Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1401796 Change-Id: I70e95fd72b12b7fb45b7ea4c317f61321b8e6540
2020-08-15vulkan: avoid waiting for service.sf.present_timestamp creation Yiwei Zhang
This change is to help unblock: 1. ANGLE used as built-in gl driver 2. Vulkan used as RenderEngine backend Moving the property creation before RenderEngine init can potentially cause a boot time regression. Those creating gpu contexts before boot finished are not relying on EGL_ANDROID_get_frame_timestamps or VK_GOOGLE_display_timing. Bug: 164717293 Test: manual Change-Id: Iff34e0a5c4101c3961a078e0d34a2a7fb0391857
2020-08-13libvulkan: avoid allocation if final extension count is zero Yiwei Zhang
This change also makes sure ExtensionFilter is properly initialized. Bug: 161810298 Test: dEQP-VK.api.object_management.max_concurrent#instance Change-Id: I2e3526b38fc5eeddf0e96d18dfd6f218bbb80201