ChisBread / malior

malior is the game container of arm
GNU General Public License v3.0
112 stars 20 forks source link

moliar-droid not work well #12

Closed DiamondHunters closed 1 year ago

DiamondHunters commented 1 year ago

Env:

armbain(Ubuntu 22.04) rock5b(rk3588)

I installed malior-droid and start it with: malior-droid start

Problem:

my wayland desktop becomes the Android starting logo. I run command cat /sys/devices/platform/fb000000.gpu/devfreq/fb000000.gpu/load and found gpu is working with load. but it will not get into android ui.

in logcat,Many processes crashed because of 03-01 12:28:50.299 339 539 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 539 (NDK MediaCodec_), pid 339 (system_server)

error:

03-01 12:33:17.390 110 149 E hwc-drm-display-composition: CreateAndAssignReleaseFences,line=205 Create ReleaseFence(RFD0-FN4360-TC4361) Fail!: frame = 4360 LayerName=FramebufferSurface

03-01 12:33:05.687 76 887 E HWComposer: getSupportedContentTypes: getSupportedContentTypes failed for display 0: Unsupported (8)

03-01 12:33:09.720 185 201 E rkdisplay-resources: Failed to find primary display

mali info

03-01 12:33:13.280 30922 30922 D libEGL  : loaded /vendor/lib64/egl/libGLES_mali.so
03-01 12:33:14.630 30926 30926 D libEGL  : loaded /vendor/lib/egl/libGLES_mali.so
03-01 12:33:15.792 31350 31371 I mali_so : [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 1292; [Func] : base_context_deal_with_version_affairs_rk_ext;
03-01 12:33:15.792 31350 31371 I mali_so : arm_release_ver of this mali_so is 'g12p0-01eac0', rk_so_ver is '2@0 '.
03-01 12:33:15.792 31350 31371 I mali_so : [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 1308; [Func] : base_context_deal_with_version_affairs_rk_ext;
03-01 12:33:15.792 31350 31371 I mali_so : arm_release_vers are match. to set the full mali_ver 'g12p0-01eac0-x-2@0' as value of 'sys.gmali.version'.

Attempts made

reconfig gpu by ppa following https://github.com/ChisBread/rk3588-gaming-step-by-step/blob/main/gpu-envs.md (glmark2 worked) replace host mali_csffw.bin by the file in docker replace mali_csffw.bin in docker by the file in host md5: 500fb89ce8aa9a1e6e91950a5dfec316 mali_csffw.bin in docker 81ad0f6bfb231fefd460e46ee2f26511 mali_csffw.bin from github Attempts not work.

I tried to analyze the cause of the problem, but the log of the problem is not obvious. I have no idea what in my environment hasn't been properly configured and what else do I need to pay attention to. Thank you for making the image.

Full log

log.txt

ChisBread commented 1 year ago

Does the kernel enable PSI, ASHMEM, and ANDROID_BINDERFS?

ChisBread commented 1 year ago

I guess gpu driver doesn't matter here, just correct mali_csffw.bin and kernel configuration. If your device is different than mine (Orange Pi 5), then our default configuration will be a little different. After I turned on PSI, ASHMEM, and ANDROID_BINDERFS, the redroid image works fine, maybe Rock 5B needs more configuration, such as CGROUP_BPF, etc...

jpacg commented 1 year ago

I also have Rock5b, and it works fine

rock@rock-5b:~$ zcat /proc/config.gz | grep PSI
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep BINDER
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep ASHMEM
CONFIG_ASHMEM=y
rock@rock-5b:~$ zcat /proc/config.gz | grep FUSE
CONFIG_ROCKCHIP_EFUSE=y
CONFIG_FUSE_FS=y
rock@rock-5b:~$ md5sum /lib/firmware/mali_csffw.bin
81ad0f6bfb231fefd460e46ee2f26511  /lib/firmware/mali_csffw.bin
rock@rock-5b:~$
ChisBread commented 1 year ago

I also have Rock5b, and it works fine

rock@rock-5b:~$ zcat /proc/config.gz | grep PSI
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep BINDER
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep ASHMEM
CONFIG_ASHMEM=y
rock@rock-5b:~$ zcat /proc/config.gz | grep FUSE
CONFIG_ROCKCHIP_EFUSE=y
CONFIG_FUSE_FS=y
rock@rock-5b:~$ md5sum /lib/firmware/mali_csffw.bin
81ad0f6bfb231fefd460e46ee2f26511  /lib/firmware/mali_csffw.bin
rock@rock-5b:~$

Thanks for your feedback

DiamondHunters commented 1 year ago

I also add systemd.unified_cgroup_hierarchy=0 to kernel cmdline and redroid/redroid:12.0.0-latest is work

root@rock-5b:/home/dia# zcat /proc/config.gz |grep -E 'PSI|ASHMEM|BINDER|FUSE|CGROUP'
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
CONFIG_CGROUPS=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_SOCK_CGROUP_DATA=y
CONFIG_BLK_CGROUP_RWSTAT=y
# CONFIG_BLK_CGROUP_IOLATENCY is not set
# CONFIG_BLK_CGROUP_IOCOST is not set
# CONFIG_BLK_CGROUP_IOPRIO is not set
CONFIG_MQ_IOSCHED_DEADLINE_CGROUP=y
# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set
CONFIG_NET_CLS_CGROUP=m
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
CONFIG_ASHMEM=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
CONFIG_ANDROID_BINDER_IPC_SELFTEST=y
CONFIG_ROCKCHIP_EFUSE=y
CONFIG_FUSE_FS=m

root@rock-5b:/home/dia# lsmod
Module                  Size  Used by
xt_nat                 16384  1
xt_tcpudp              16384  3
veth                   24576  0
bnep                   24576  2
xt_conntrack           16384  1
nf_conntrack_netlink    40960  0
nfnetlink              16384  2 nf_conntrack_netlink
xt_addrtype            16384  2
iptable_filter         16384  1
br_netfilter           24576  0
iptable_nat            16384  1
xt_MASQUERADE          16384  24
nf_nat                 57344  3 xt_nat,iptable_nat,xt_MASQUERADE
nf_conntrack          135168  5 xt_conntrack,nf_nat,xt_nat,nf_conntrack_netlink,xt_MASQUERADE
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
bridge                184320  1 br_netfilter
stp                    16384  1 bridge
llc                    16384  2 bridge,stp
overlay               110592  1
zstd                   16384  8
binfmt_misc            20480  1
joydev                 20480  0
sch_fq_codel           20480  43
vhost_vsock            20480  0
vmw_vsock_virtio_transport_common    24576  1 vhost_vsock
vsock                  36864  5 vmw_vsock_virtio_transport_common,vhost_vsock
vhost_net              24576  0
tun                    45056  41 vhost_net
vhost                  32768  2 vhost_vsock,vhost_net
vhost_iotlb            16384  1 vhost
tap                    24576  1 vhost_net
vhci_hcd               45056  0
usbip_core             32768  1 vhci_hcd
fuse                  110592  1
ip_tables              24576  2 iptable_filter,iptable_nat
x_tables               28672  7 xt_conntrack,iptable_filter,xt_tcpudp,xt_addrtype,xt_nat,ip_tables,xt_MASQUERADE
ipv6                  421888  117 bridge,br_netfilter
panfrost               57344  0
gpu_sched              28672  1 panfrost
pgdrv                  16384  0

so I think the problem is related to display drive or armbian. And I will check what configuration of orange pie and rock5b ubuntu image is different from armbian

ChisBread commented 1 year ago

Maybe changing the device binding will help

            --entrypoint /init \
            $(ls -v /dev|grep -P 'mali0|video|dri|snd|/shm'|awk '{print "-v /dev/"$1":/dev/"$1}') \
            ${MALIOR_DROID_IMAGE} \
            androidboot.hardware=rk30board
DiamondHunters commented 1 year ago

Thanks for advice,but problem still exist.

I try to make my armbian kernel config bring into correspondence with ubuntu And I think "the problem is causing by kernel differences" has been excluded

I don't know which is the real cause of the problem among the numerous errors reported. But I think that is very suspicious.

[  500.136992] ------------[ cut here ]------------
[  500.137006] WARNING: CPU: 7 PID: 26347 at drivers/gpu/arm/bifrost/csf/mali_kbase_csf.c:1760 kbase_csf_ctx_init+0x84/0x164
[  500.137007] Modules linked in: xt_nat xt_tcpudp veth bnep xt_conntrack nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter br_netfilter iptable_nat xt_MASQUERADE nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bridge stp llc overlay zstd binfmt_misc joydev sch_fq_codel vhost_vsock vmw_vsock_virtio_transport_common vsock vhost_net tun vhost vhost_iotlb tap vhci_hcd usbip_core fuse ip_tables x_tables ipv6 panfrost gpu_sched pgdrv
[  500.137051] CPU: 7 PID: 26347 Comm: RenderThread Tainted: G        W         5.10.110 #5
[  500.137052] Hardware name: Radxa ROCK 5B (DT)
[  500.137055] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
[  500.137058] pc : kbase_csf_ctx_init+0x84/0x164
[  500.137060] lr : kbase_csf_ctx_init+0x58/0x164
[  500.137061] sp : ffffffc01bfabbb0
[  500.137062] x29: ffffffc01bfabbb0 x28: ffffff81d169ad00
[  500.137065] x27: 0000000000000000 x26: 0000000000000000
[  500.137067] x25: 0000000000000000 x24: 0000000000000018
[  500.137070] x23: 0000000000000009 x22: ffffffc01115a480
[  500.137072] x21: ffffff8106fd0118 x20: ffffff8106fd0000
[  500.137075] x19: ffffffc013a05000 x18: 0000000000000000
[  500.137077] x17: 0000000000000000 x16: 0000000000000000
[  500.137080] x15: 0000007125411500 x14: 0000000000000000
[  500.137082] x13: 0000000000000000 x12: 0000000000000000
[  500.137084] x11: ffffff810104fb58 x10: 0000000000000000
[  500.137086] x9 : ffffffc010fd90e8 x8 : ffffff81d5740a00
[  500.137089] x7 : 0000000000000000 x6 : 0000000000001360
[  500.137091] x5 : 0000000000003578 x4 : 0000000000000000
[  500.137093] x3 : 0000000000000000 x2 : ffffff81d169ad00
[  500.137096] x1 : ffffff8106de17b8 x0 : ffffff8143ef7b18
[  500.137099] Call trace:
[  500.137101]  kbase_csf_ctx_init+0x84/0x164
[  500.137104]  kbase_create_context+0x74/0x144
[  500.137108]  kbase_file_create_kctx+0x7c/0x1e0
[  500.137111]  kbase_ioctl+0x3e0/0x2aa8
[  500.137114]  vfs_ioctl+0x34/0x54
[  500.137116]  __arm64_sys_ioctl+0x84/0xb8
[  500.137120]  el0_svc_common.constprop.0+0x13c/0x1ec
[  500.137121]  do_el0_svc+0x90/0x9c
[  500.137125]  el0_svc+0x20/0x30
[  500.137126]  el0_sync_handler+0xbc/0x158
[  500.137128]  el0_sync+0x1a0/0x1c0
[  500.137130]
               PC: 0xffffffc0108d0908:

I tried using androidboot.redroid_gpu_mode=guest to make it working with swiftshader but above problem still appear. So I don't know whether this parameter is not accepted or whether the problem is not due to GPU now.

Next ,I will try to run it on distributions which have been succeeded to run with gpu accelerate then find the difference of environment and log.

Thank you.

DiamondHunters commented 1 year ago

I also have Rock5b, and it works fine

rock@rock-5b:~$ zcat /proc/config.gz | grep PSI
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep BINDER
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep ASHMEM
CONFIG_ASHMEM=y
rock@rock-5b:~$ zcat /proc/config.gz | grep FUSE
CONFIG_ROCKCHIP_EFUSE=y
CONFIG_FUSE_FS=y
rock@rock-5b:~$ md5sum /lib/firmware/mali_csffw.bin
81ad0f6bfb231fefd460e46ee2f26511  /lib/firmware/mali_csffw.bin
rock@rock-5b:~$

I should like to ask :Does the image you use have a desktop environment?

jpacg commented 1 year ago

I also have Rock5b, and it works fine

rock@rock-5b:~$ zcat /proc/config.gz | grep PSI
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep BINDER
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
rock@rock-5b:~$ zcat /proc/config.gz | grep ASHMEM
CONFIG_ASHMEM=y
rock@rock-5b:~$ zcat /proc/config.gz | grep FUSE
CONFIG_ROCKCHIP_EFUSE=y
CONFIG_FUSE_FS=y
rock@rock-5b:~$ md5sum /lib/firmware/mali_csffw.bin
81ad0f6bfb231fefd460e46ee2f26511  /lib/firmware/mali_csffw.bin
rock@rock-5b:~$

I should like to ask :Does the image you use have a desktop environment?

No desktop environment, using the rock5b official ubuntu server

DiamondHunters commented 1 year ago

After redeploying on ubuntu, I found the root cause of the problem. All this is because I set CONFIG_ION=y. It causes hardware acceleration not to work properly. I unset it then everything got back on track. Sorry for taking up your time and thank you for your guidance! Wish all the best wishes for you.

ChisBread commented 1 year ago

Thanks for your feedback! it will help others.