背景
自从原神 4.3版本在2023年12月20日左右升级之后,对于amd gpu并没有专门的支持,amd gpu 运行时会崩溃在libgallium库(mesa提出的全新的3D引擎框架)中。
解决过程
查看waydroid上的issue,可以看到有很多大神尝试了不同的原神版本,都会崩溃。编辑[BUG] Genshin Impact 4.3.0 crashed · Issue #1206 · waydroid/waydroid
以上代码包含了pc值,这就可以通过addr2line命令查看进入到aosp源代码的out/target/product/fde_arm64/symbols/vendor/lib64/dri目录下,可以看到有一个libgallimu_dri.so。使用addrline命令查看pc指针000000000099e844
对应的源代码。可以看到代码在src/mesa/main/texobj.c 的620行。
openfde/out/target/product/fde_arm64/symbols/vendor/lib64/dri$ addr2line 000000000099e844 -e libgallium_dri.so
openfde/external/mesa/src/mesa/main/texobj.c:620
#打开该文件看到:
609 /**
610 * Reference (or unreference) a texture object.
611 * If '*ptr', decrement *ptr's refcount (and delete if it becomes zero).
612 * If 'tex' is non-null, increment its refcount.
613 * This is normally only called from the _mesa_reference_texobj() macro
614 * when there's a real pointer change.
615 */
616 void
617 _mesa_reference_texobj_(struct gl_texture_object **ptr,
618 struct gl_texture_object *tex)
619 {
620 assert(ptr);
621
622 if (*ptr) {
623 /* Unreference the old texture */
624 struct gl_texture_object *oldTex = *ptr;
625
626 assert(valid_texture_object(oldTex));
627 (void) valid_texture_object; /* silence warning in release builds */
628
629 assert(oldTex->RefCount > 0);
630
631 if (p_atomic_dec_zero(&oldTex->RefCount)) {
看倒620行是assert(ptr)。这是一个断言,说明ptr是不合法的指针。针对这个crash找不到更多线索。想着打开mesa的调试开关试试能不能找到其他有用的信息,打开调试开关,重新编译mesa,运行发现崩溃的地方变了,崩溃在external/mes