bylaws / libadrenotools Goto Github PK
View Code? Open in Web Editor NEWA library for applying rootless Adreno GPU driver modifications/replacements
License: BSD 2-Clause "Simplified" License
A library for applying rootless Adreno GPU driver modifications/replacements
License: BSD 2-Clause "Simplified" License
Can you teach please how can I update my driver using adrenotools ?
GPU 650 adreno..
Hi,
Getting this issue of call looping between these two functions.
backtrace:
hook_impl: hook_android_dlopen_ext: filename: libhook_impl.so
/base.apk!libhook_impl.so (offset 0x3d9000) (hook_android_dlopen_ext+168)
/base.apk!libmain_hook.so (offset 0x3e0000) (android_dlopen_ext+36)
/base.apk!libhook_impl.so (offset 0x3d9000) (hook_android_dlopen_ext+168)
/base.apk!libmain_hook.so (offset 0x3e0000) (android_dlopen_ext+36)
/base.apk!libhook_impl.so (offset 0x3d9000) (hook_android_dlopen_ext+168)
/base.apk!libmain_hook.so (offset 0x3e0000) (android_dlopen_ext+36)
/base.apk!libhook_impl.so (offset 0x3d9000) (hook_android_dlopen_ext+168)
Hi,
this project is exciting(!) for finally allowing updating Qualcomm drivers on some devices..
thinking about this project I have this 3 questions/requests:
1)Can share if there is some flag/env variable to Adreno Vulkan driver to enable additional (perhaps experimental?) extensions as seems for example some Qualcomm driver 512.615 roms expose lot of new exts more on Adreno 650 than even on Adreno 730 using same 512.615 driver:
http://vulkan.gpuinfo.org/compare.php?compare=compare&id%5B14524%5D=on&id%5B14505%5D=on#extensions
2)Qualcomm Vulkan drivers DB with download links?
I know how to extract Vulkan driver from OTAs and factory images but lazy to download large files (2-4GB) to just extract vulkan Adreno driver.. and seem every one must do the same lenghty way.. do you know of some easier way to acquire it? if not would be nice if somebody maintained a site/DB with these drivers (only Qualcomm Vulkan driver ".so" file) updated regularly..
I know it's not the scope of this work, but wanted to ask anyway..
3)Finally it would be great also an equivalent libmalitools project, reason is now with Pixel 6 devices having Mali GPUs, seems we are getting frequently updated Mali drivers, Google is shipping newer Mali drivers on Android 13 developer previews, for example for Pixel 6:
Android 12 : Mali r32p1
Android 13 dp1 : Mali r34p0
Android 13 dp2 : Mali r35p0
Mali r35 already have 9 new VK extensions (see http://vulkan.gpuinfo.org/compare.php?compare=compare&id%5B14514%5D=on&id%5B13271%5D=on#extensions ) and
and conformanceVersion 1.2.7.2 is vs 1.2.6.0 on r32p1 so new bug fixes..
on website says newest is r36 (https://developer.arm.com/tools-and-software/graphics-and-gaming/mali-drivers/valhall-kernel) and seems plausible DP3 to ship with these drivers..
It would be nice for example to use this updated Mali drivers on Samsung Sxx devices which use Mali GPUs on Europe at least..
All this is to motivate to try doing a libmalitools project..
can you at least answer if you expect to be much work or most work can be shared by libadrenotools (like hooking functionality) and should not be much work left to enable..
Thanks.
Hi and first all many thanks for this amazing library! I'm trying to integrate it into my project but have been facing issues getting it to build. More specifically I'm facing this error:
Opening the particular folder during the build, noticed the library was being built but immediately deleted for some reason. I'll also link to the integration commit in case there was a mistake on my part https://github.com/GPUCode/citra/commit/aed0baf1c71781b0ed11bca15a77dd92696a9aa9
Hey, I'm just wondering how to install adreno tools and how to update them?
Do I have to do it on a PC or can I do it on android
Hello, I don't know if I'm doing it wrong or incorrect but when I install the module it sends an error saying "ERROR: Cannot unpack file". providing screenshots below
I'm really wondering if there's something I did wrong and hopefully i get an answer right away because I really wanna use this library. Thank you so much in advance.
Hello, this is my first time writing an issue so please bear with me. I am currently using qtimappershim on the snapdragon 845 (XZ2) with blobs from @690. Everything works fine, surprisingly, except for one problem. For some reason whenever I try to run an app that uses vulkan, the graphic glitches to the point where it's unusable.
I tested almost all drivers but none works on android 9 note: my cell phone is impossible to make custom rom.if you can make a driver that works on android 9 please let me know or if you already have it send the name or write in response
I'm playing with AdrenoTools but I can't get it to work on a Xiaomi POCO F2 Pro (Adreno 640) running stock ROM Android 12.
I know that it is supposed to work fine on my phone because PPSSPP manages to load the driver fine, reports a different driver string when using the alterante driver and even displays graphical glitches when using this other driver.
I can't figure out what kotlin settings, linker flags or whatever else I'm doing wrong compared to PPSSPP.
I prepared an extremely simple repro test here.
It's a very simple sample that uses GameActivity as backbone (perhaps that's the problem??? I'm also having the same issue using NativeActivity).
No matter what I do I get:
NO VK DEVICES!
adrenotools_open_libvulkan
returns a valid ptr but then vkEnumeratePhysicalDevices
returns VK_SUCCESS with numDevices = 0.
The full log:
---------------------------- PROCESS STARTED (24589) for package com.example.adrenotoolstest2 ----------------------------
2024-03-22 20:49:56.652 24589-24589 Compatibil...geReporter com.example.adrenotoolstest2 D Compat change id reported: 171979766; UID 10546; state: ENABLED
2024-03-22 20:49:56.670 24589-24589 nativeloader com.example.adrenotoolstest2 D Configuring clns-4 for other apk /data/app/~~BHNx5TR2rgoz9pbGpidccg==/com.example.adrenotoolstest2-N_zkCmM2qiQ3wAUzEz-uPQ==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~BHNx5TR2rgoz9pbGpidccg==/com.example.adrenotoolstest2-N_zkCmM2qiQ3wAUzEz-uPQ==/lib/arm64:/data/app/~~BHNx5TR2rgoz9pbGpidccg==/com.example.adrenotoolstest2-N_zkCmM2qiQ3wAUzEz-uPQ==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.example.adrenotoolstest2
2024-03-22 20:49:56.680 24589-24589 GraphicsEnvironment com.example.adrenotoolstest2 V ANGLE Developer option for 'com.example.adrenotoolstest2' set to: 'default'
2024-03-22 20:49:56.680 24589-24589 GraphicsEnvironment com.example.adrenotoolstest2 V Updatable production driver is not supported on the device.
2024-03-22 20:49:56.682 24589-24589 ForceDarkHelperStubImpl com.example.adrenotoolstest2 I initialize for com.example.adrenotoolstest2 , ForceDarkOrigin
2024-03-22 20:49:56.683 24589-24589 OpenGLRenderer com.example.adrenotoolstest2 D JNI_OnLoad success
2024-03-22 20:49:56.684 24589-24589 MiuiForceDarkConfig com.example.adrenotoolstest2 I setConfig density:2.750000, mainRule:0, secondaryRule:0, tertiaryRule:0
2024-03-22 20:49:56.687 24589-24589 NetworkSecurityConfig com.example.adrenotoolstest2 D No Network Security Config specified, using platform default
2024-03-22 20:49:56.688 24589-24589 NetworkSecurityConfig com.example.adrenotoolstest2 D No Network Security Config specified, using platform default
2024-03-22 20:49:56.698 3128-3576 ActivityManagerWrapper com.mi.android.globallauncher E getRecentTasks: taskId=1855 userId=0 baseIntent=Intent { act=android.intent.action.MAIN flag=268435456 cmp=ComponentInfo{com.example.adrenotoolstest2/com.example.adrenotoolstest2.MainActivity} }
2024-03-22 20:49:56.704 24589-24589 AppCompatDelegate com.example.adrenotoolstest2 D Checking for metadata for AppLocalesMetadataHolderService : Service not found
2024-03-22 20:49:56.710 24589-24589 ViewScrollStubImpl com.example.adrenotoolstest2 D the value of ScrollFrictionRes is: 0.015
2024-03-22 20:49:56.715 24589-24589 IS_CTS_MODE com.example.adrenotoolstest2 D false
2024-03-22 20:49:56.715 24589-24589 MULTI_WIND...CH_ENABLED com.example.adrenotoolstest2 D false
2024-03-22 20:49:56.716 24589-24589 IS_CTS_MODE com.example.adrenotoolstest2 D false
2024-03-22 20:49:56.716 24589-24589 MULTI_WIND...CH_ENABLED com.example.adrenotoolstest2 D false
2024-03-22 20:49:56.718 24589-24589 DecorView[] com.example.adrenotoolstest2 D getWindowModeFromSystem windowmode is 1
2024-03-22 20:49:56.732 24589-24589 drenotoolstest com.example.adrenotoolstest2 W Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2024-03-22 20:49:56.732 24589-24589 drenotoolstest com.example.adrenotoolstest2 W Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2024-03-22 20:49:56.739 24589-24589 GameActivity com.example.adrenotoolstest2 I Looking for library libadrenotoolstest2.so
2024-03-22 20:49:56.739 24589-24589 GameActivity com.example.adrenotoolstest2 I Found library libadrenotoolstest2.so. Loading...
2024-03-22 20:49:56.741 24589-24589 GameActivity com.example.adrenotoolstest2 D GameActivity_register
2024-03-22 20:49:56.741 24589-24589 GameActivity com.example.adrenotoolstest2 V Registering com/google/androidgamesdk/GameActivity's 21 native methods...
2024-03-22 20:49:56.741 24589-24589 threaded_app com.example.adrenotoolstest2 V Creating: 0xb40000709caaf300
2024-03-22 20:49:56.741 24589-24589 threaded_app com.example.adrenotoolstest2 V Callbacks set: 0xb40000709caaf350
2024-03-22 20:49:56.741 24589-24589 threaded_app com.example.adrenotoolstest2 V Launching android_app_entry in a thread
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V android_app_entry called
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V android_app = 0xb40000709cb1f600
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V config = 0xb4000070a6409080
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V activity = 0xb40000709caaf300
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V assetmanager = 0xb40000709caadf00
2024-03-22 20:49:56.741 24589-24616 threaded_app com.example.adrenotoolstest2 V Config: mcc=0 mnc=0 lang=es cnt=US orien=1 touch=3 dens=440 keys=1 nav=1 keysHid=3 navHid=0 sdk=31 size=2 long=2 modetype=1 modenight=1
2024-03-22 20:49:56.744 24589-24616 DriverReplacer com.example.adrenotoolstest2 I DRIVER REPLACEMENT LOADED
2024-03-22 20:49:56.744 24589-24616 hook_impl com.example.adrenotoolstest2 I hook_android_load_sphal_library: filename: vulkan.adreno.so
2024-03-22 20:49:56.744 24589-24616 hook_impl com.example.adrenotoolstest2 I hook_android_dlopen_ext: filename: vulkan.adreno.so
2024-03-22 20:49:56.745 24589-24616 hook_impl com.example.adrenotoolstest2 I hook_android_load_sphal_library: filename: vulkan.kona.so
2024-03-22 20:49:56.745 24589-24616 hook_impl com.example.adrenotoolstest2 I hook_android_dlopen_ext: filename: vulkan.kona.so
2024-03-22 20:49:56.746 24589-24616 vulkan com.example.adrenotoolstest2 D searching for layers in '/data/app/~~BHNx5TR2rgoz9pbGpidccg==/com.example.adrenotoolstest2-N_zkCmM2qiQ3wAUzEz-uPQ==/lib/arm64'
2024-03-22 20:49:56.747 24589-24616 vulkan com.example.adrenotoolstest2 D searching for layers in '/data/app/~~BHNx5TR2rgoz9pbGpidccg==/com.example.adrenotoolstest2-N_zkCmM2qiQ3wAUzEz-uPQ==/base.apk!/lib/arm64-v8a'
2024-03-22 20:49:56.747 24589-24616 DriverReplacer com.example.adrenotoolstest2 E NO VK DEVICES!
2024-03-22 20:49:56.752 24589-24589 GameActivity com.example.adrenotoolstest2 V onStart_native
2024-03-22 20:49:56.752 24589-24589 threaded_app com.example.adrenotoolstest2 V Start: 0xb40000709caaf300
2024-03-22 20:49:56.752 24589-24616 threaded_app com.example.adrenotoolstest2 V activityState=10
2024-03-22 20:49:56.754 24589-24589 threaded_app com.example.adrenotoolstest2 V Resume: 0xb40000709caaf300
2024-03-22 20:49:56.754 24589-24616 threaded_app com.example.adrenotoolstest2 V activityState=11
2024-03-22 20:49:56.774 24589-24589 threaded_app com.example.adrenotoolstest2 V WindowInsetsChanged: 0xb40000709caaf300
2024-03-22 20:49:56.782 24589-24613 AdrenoGLES-0 com.example.adrenotoolstest2 I QUALCOMM build : db3d445dbc, Ia06b22fa1a
Build Date : 10/04/21
OpenGL ES Shader Compiler Version: EV031.32.02.16
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
2024-03-22 20:49:56.782 24589-24613 AdrenoGLES-0 com.example.adrenotoolstest2 I Build Config : S P 10.0.7 AArch64
2024-03-22 20:49:56.782 24589-24613 AdrenoGLES-0 com.example.adrenotoolstest2 I Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so
2024-03-22 20:49:56.785 24589-24613 AdrenoGLES-0 com.example.adrenotoolstest2 I PFP: 0x016dd093, ME: 0x00000000
2024-03-22 20:49:56.787 24589-24589 SurfaceView com.example.adrenotoolstest2 D UPDATE null, mIsCastMode = false
2024-03-22 20:49:56.789 24589-24589 GameActivity com.example.adrenotoolstest2 V onSurfaceCreated_native
2024-03-22 20:49:56.789 24589-24589 threaded_app com.example.adrenotoolstest2 V NativeWindowCreated: 0xb40000709caaf300 -- 0xb40000704006c010
2024-03-22 20:49:56.789 24589-24589 threaded_app com.example.adrenotoolstest2 V android_app_set_window called
2024-03-22 20:49:56.789 24589-24616 threaded_app com.example.adrenotoolstest2 V APP_CMD_INIT_WINDOW
2024-03-22 20:49:56.789 24589-24589 threaded_app com.example.adrenotoolstest2 V NativeWindowResized: 0xb40000709caaf300 -- 0xb40000704006c010 ( 1080 x 2246 )
2024-03-22 20:49:56.789 24589-24589 threaded_app com.example.adrenotoolstest2 V NativeWindowRedrawNeeded: 0xb40000709caaf300 -- 0xb40000704006c010
2024-03-22 20:49:56.795 24589-24613 hw-ProcessState com.example.adrenotoolstest2 D Binder ioctl to enable oneway spam detection failed: Invalid argument
2024-03-22 20:49:56.807 24589-24613 LB com.example.adrenotoolstest2 E fail to open file: No such file or directory
2024-03-22 20:49:56.818 24589-24589 SurfaceView com.example.adrenotoolstest2 D UPDATE Surface(name=SurfaceView[com.example.adrenotoolstest2/com.example.adrenotoolstest2.MainActivity])/@0x618d2d4, mIsProjectionMode = false
2024-03-22 20:49:56.818 24589-24589 SurfaceControl com.example.adrenotoolstest2 D nativeSetScreenProjection ===> setScreenProjection
2024-03-22 20:49:56.818 24589-24589 SurfaceControl com.example.adrenotoolstest2 D nativeSetScreenProjection ===> setScreenProjection
2024-03-22 20:49:56.819 24589-24589 SurfaceControl com.example.adrenotoolstest2 D nativeSetScreenProjection ===> setScreenProjection
2024-03-22 20:49:56.823 24589-24589 threaded_app com.example.adrenotoolstest2 V WindowFocusChanged: 0xb40000709caaf300 -- 1
2024-03-22 20:49:56.824 24589-24589 DecorView[] com.example.adrenotoolstest2 D onWindowFocusChanged hasWindowFocus true
2024-03-22 20:49:56.836 24589-24589 DecorView[] com.example.adrenotoolstest2 D getWindowModeFromSystem windowmode is 1
2024-03-22 20:49:56.836 24589-24589 DecorView[] com.example.adrenotoolstest2 D updateDecorCaptionStatus displayWindowDecor is false
2024-03-22 20:49:56.847 24589-24589 threaded_app com.example.adrenotoolstest2 V WindowInsetsChanged: 0xb40000709caaf300
2024-03-22 20:49:56.848 24589-24589 threaded_app com.example.adrenotoolstest2 V NativeWindowResized: 0xb40000709caaf300 -- 0xb40000704006c010 ( 1080 x 2400 )
2024-03-22 20:49:56.848 24589-24589 threaded_app com.example.adrenotoolstest2 V NativeWindowRedrawNeeded: 0xb40000709caaf300 -- 0xb40000704006c010
Debugging further, the first time the hook activates (when I call vkCreateInstance
) it ends up inside hook_android_dlopen_ext
:
[libhook_impl.so] hook_android_dlopen_ext(const char *, int, const android_dlextinfo *) hook_impl.cpp:39
[libhook_impl.so] hook_android_load_sphal_library(const char *, int) hook_impl.cpp:153
[libmain_hook.so] android_load_sphal_library main_hook.c:8
<unknown> 0x00000070b85a302c
<unknown> 0x00000070b85a03e4
<unknown> 0x00000070b8597cf0
<unknown> 0x00000070b8597068
[libadrenotoolstest2.so] replaceDriver(const char *) main.cpp:58
[libadrenotoolstest2.so] android_main(android_app *) main.cpp:115
[libadrenotoolstest2.so] android_app_entry(void *) android_native_app_glue.c:235
[libc.so] __pthread_start(void *) 0x0000007146114b18
[libc.so] __start_thread 0x00000071460b1360
It reaches the following:
auto hookImpl{linkernsbypass_namespace_dlopen("libhook_impl.so", RTLD_NOW, driverNs)};
if (!hookImpl)
return nullptr;
But hookImpl is nullptr.
After that it gets called again (exact same callstack) and also ends up with hookImpl = nullptr, after that it gives up.
When this happens I noticed logcat prints:
hook_android_load_sphal_library: filename: vulkan.adreno.so
hook_android_dlopen_ext: filename: vulkan.adreno.so
hook_android_load_sphal_library: filename: vulkan.kona.so
hook_android_dlopen_ext: filename: vulkan.kona.so
This is a stark difference with PPSSPP which is successful and prints:
hook_android_load_sphal_library: filename: vulkan.adreno.so
hook_android_dlopen_ext: filename: vulkan.adreno.so
hook_android_dlopen_ext: applied libfile_redirect_hook
hook_android_dlopen_ext: loading custom driver: /data/user/0/org.ppsspp.ppsspp/files/drivers/Mesa Turnip Adreno Driver 22.3.1-r2/libvulkan_freedreno.so
I suspect perhaps the Vulkan driver gets loaded too soon; since I AFAIK the injection must happen before loading Vulkan.
But I tried modifying game-activity/native_app_glue/android_native_app_glue.c
(which comes with the SDK) so that the injection is the first thing I do in Thread-1:
JNIEXPORT
void GameActivity_onCreate(GameActivity* activity, void* savedState,
size_t savedStateSize) {
replaceDriver("/storage/emulated/0/Download/Turnip/Turnip-v22.3.1-R2/"); // <--- MODIFIED
LOGV("Creating: %p", activity);
activity->callbacks->onDestroy = onDestroy;
// .. rest of the the code
}
However the result is the same.
I would appreciate some guidance on what am I missing or what am I doing wrong.
Thanks!
Matias
Where can i download this to my android with adreno 610?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.