Accept Android loaders that wrap vkGetPhysicalDeviceProperties in the bridge

On the Pocket FIT (Android 14, Adreno 750, Qualcomm 0.762.24) every Qualcomm
session failed before Steam: the bridge compares one core query between
Android's libvulkan instance and its own HAL, and Android 14's loader wraps
vkGetPhysicalDeviceProperties, so the check rejected the instance
(VK_ERROR_INCOMPATIBLE_DRIVER) although vkGetPhysicalDeviceFeatures resolved
to the same vulkan.adreno.so entry from both sides.

0012-android-loader-wrapped-queries.patch (for taowen/libhybris bc8cb358 with
wallentx's patches 0001-0011) accepts the instance when any of five core
physical-device queries resolves to the HAL's own entry. The bridge is
rebuilt with it on DroidDeck-Components.
This commit is contained in:
The412Banner committed 2026-10-26 01:01:03 +00:00
1 parent d404de54c4
commit 06dd70c67e
2 files changed
+49

No files matched your search

+4
View File
@@ -2,6 +2,10 @@
The Linux backend uses the installed Qualcomm Vulkan HAL through a pinned libhybris ICD. The Android compositor imports gralloc buffers through `android_wlegl`. Choosing **System Qualcomm driver** in the runtime driver list also selects the system display driver. Restart the app after changing an already loaded display driver.
## Bridge patch for Android 14 loaders
The bridge creates the Vulkan instance through Android's `libvulkan.so` and then checks that this instance dispatches to the same HAL it loaded itself. Upstream compares only `vkGetPhysicalDeviceProperties`. Android 14's loader wraps that query (seen on an AYANEO Pocket FIT, Adreno 750, Qualcomm 0.762.24, SDK 34): it resolved into `libvulkan.so` while `vkGetPhysicalDeviceFeatures` resolved to the same `vulkan.adreno.so` entry from both sides, so every session failed with `Android instance and configured HAL use different dispatch implementations` and `vkCreateInstance` -9. `hybris-patches/0012-android-loader-wrapped-queries.patch` accepts the instance when any of five core physical-device queries resolves to the HAL's own entry; another driver matches none. The bridge is rebuilt with wallentx's builder (`tools/hybris` at `4ed93fb9`, patches 0001-0011) plus this patch on DroidDeck-Components.
## Imported AdrenoTools Qualcomm packages
Import a Qualcomm Android driver with **Change display driver → Import an AdrenoTools zip…**. In **Mix and match → Change runtime driver**, select its **Qualcomm (AdrenoTools, experimental)** entry. Previously imported packages appear without reimporting. This selects the package for Linux applications and the system driver for Android presentation. The runtime change applies to the next session; restart DroidDeck if its display driver was already loaded. Changing only the display selection does not change the Linux runtime driver.
@@ -0,0 +1,45 @@
diff --git a/hybris/vulkan/icd/instance.c b/hybris/vulkan/icd/instance.c
index a3e3020..6717d19 100644
--- a/hybris/vulkan/icd/instance.c
+++ b/hybris/vulkan/icd/instance.c
@@ -70,6 +70,27 @@ static void VKAPI_CALL destroy_instance(VkInstance instance,
free_state(state);
}
+/* Android's loader leaves some core physical-device queries to the driver, so
+ * for its instance they resolve to the HAL's own entries. Which ones it wraps
+ * differs between releases (Android 14 wraps vkGetPhysicalDeviceProperties),
+ * so one identical entry is enough; another driver, or a layer intercepting
+ * all of them, matches none. */
+static int platform_uses_hal(PFN_vkGetInstanceProcAddr platform,
+ PFN_vkGetInstanceProcAddr hal, VkInstance instance)
+{
+ static const char *const queries[] = {
+ "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceFeatures",
+ "vkGetPhysicalDeviceMemoryProperties", "vkGetPhysicalDeviceQueueFamilyProperties",
+ "vkGetPhysicalDeviceFormatProperties",
+ };
+ for (size_t i = 0; i < sizeof(queries) / sizeof(queries[0]); ++i) {
+ PFN_vkVoidFunction entry = hal(instance, queries[i]);
+ if (entry && platform(instance, queries[i]) == entry)
+ return 1;
+ }
+ return 0;
+}
+
VkResult hybris_icd_create_instance(hwvulkan_device_t *hal,
PFN_vkGetInstanceProcAddr platform,
const VkInstanceCreateInfo *info, const VkAllocationCallbacks *allocator,
@@ -113,10 +134,8 @@ VkResult hybris_icd_create_instance(hwvulkan_device_t *hal,
state->resolver = hal->GetInstanceProcAddr;
state->destroy = (PFN_vkDestroyInstance)platform(*instance, "vkDestroyInstance");
/* Never pass a handle from an Android layer or an independently selected
- * updatable driver to our HAL. This core query is an unhooked driver entry
- * in Android's loader and must resolve to the same implementation. */
- if (platform(*instance, "vkGetPhysicalDeviceProperties") !=
- state->resolver(*instance, "vkGetPhysicalDeviceProperties")) {
+ * updatable driver to our HAL. */
+ if (!platform_uses_hal(platform, state->resolver, *instance)) {
fprintf(stderr, "hybris ICD: Android instance and configured HAL use different dispatch implementations\n");
state->destroy(*instance, allocator);
*instance = VK_NULL_HANDLE;