STM32MP157 Arm®-based dual Cortex®-A7 32 bits + Cortex®-M4 32 bits MPU in TFBGA361 package
Here are work in progress notes, hints are welcome
Follow up to date work in progress:
Reach me at :
I am using debian as main os and can explain steps
Current debian's kernel is not supporting eMMC or USB so debian-installer can't be used , the workaround is we use iSCSI (network drive)
Configure TFTP to use debian installer,
ramdisk_addr_r=0xc4400000 mkimage -A arm -O linux -T ramdisk \ -C gzip -n "initrd" \ -a ${ramdisk_addr_r} -e ${ramdisk_addr_r} \ -d initrd.gz uImage.initrd
STM32MP> help dhcp ; setenv serverip 192.168.1.12 tftp ${kernel_addr_r} ${serverip}:vmlinuz tftp ${fdt_addr_r} ${serverip}:${board_name}.dtb tftp ${ramdisk_addr_r} ${serverip}:uImage.initrd bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
sudo apt-get install u-boot-menu sudo /usr/bin/dpkg -i /tmp/linux-*5.8.0*.deb sudo update-initramfs -ck `uname -r` sudo zile /boot/extlinux/extlinux.conf TIMEOUT 10 DEFAULT Linux MENU TITLE Boot menu label Linux 5.6.17-armv7-lpae-x14 sda kernel /boot/vmlinuz-5.6.17-armv7-lpae-x14 append console=ttySTM0,115200 root=/dev/sda ro rootfstype=ext4 rootwait fdtdir /usr/lib/linux-image-5.6.17-armv7-lpae-x14/ devicetree /usr/lib/linux-image-5.6.17-armv7-lpae-x14/stm32mp157c-dk2.dtb label NFS kernel /boot/vmlinuz-5.6.17-armv7-lpae-x14 append console=ttySTM0,115200 ro rootwait root=/dev/nfs rootfstype=nfs ip=dhcp ... fdtdir /boot/dtbs/label NFS kernel /boot/vmlinuz-5.6.17-armv7-lpae-x14 devicetree /boot/dtbs/5.6.17-armv7-lpae-x14/stm32mp157c-dk2.dtb kernel_version=5.6.0-2-armmp sudo mkdir -p "${rootfs_dir}/boot/extlinux" cat<<EOF | sudo tee -a "${rootfs_dir}/boot/extlinux/extlinux.conf" label Linux ${kernel_version} kernel /boot/vmlinuz-${kernel_version} append console=ttySTM0,115200 root=/dev/mmcblk0p4 ro rootfstype=ext4 rootwait fdtdir /usr/lib/linux-image-${kernel_version}/ devicetree /usr/lib/linux-image-${kernel_version}/stm32mp157c-dk2.dtb EOF
Boot over mmc0! switch to partitions #0, OK mmc0 is current device Scanning mmc 0:4... Found /boot/extlinux/extlinux.conf Retrieving file: /boot/extlinux/extlinux.conf 1528 bytes read in 36 ms (41 KiB/s) Boot menu 1: Linux 5.6.0-2-armmp-lpae 2: Linux 5.7.0-rc5-armmp-lpae 3: Linux 5.6.17-armv7-lpae-x14 4: Linux 5.6.17-armv7-lpae-x14 sda 5: NFS Enter choice: 2
TODO: Document how to configure tgt (200MB)
Debian's installer once target disc is configured from shell
~ # cat /proc/version Linux version 5.6.0-2-armmp (debian-kernel@lists.debian.org) (gcc version 9.3.0 (Debian 9.3.0-13)) #1 SMP Debian 5.6.14-2 (2020-06-09) ~ # cat /proc/partitions major minor #blocks name 8 0 10240000 sda
Questions:
cat .../10GB.img/2/511705088/etc/os-release PRETTY_NAME="Debian GNU/Linux bullseye/sid" # lib/modules/5.6.0-2-armmp-lpae/ cat $rootfs_dir/etc/fstab UUID=036d3d8c-98d4-48ec-a18b-dce21dcf0bb5 / ext4 errors=remount-ro 0 1 /swapfile none swap sw 0 0
5.6.0-2-armmp-lpae is not supporting SDcard
5.8.0-rc1-00138-g1198e58e1b0e is supporting it (maybe earlier)
[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.6.0-2-armmp-lpae (debian-kernel@lists.debian.org) (gcc version 9.3.0 (Debian 9.3.0-13)) #1 SMP Debian 5.6.14-1 (2020-05-23) (...) [ 0.000000] OF: fdt: Machine model: STMicroelectronics STM32MP157C-DK2 Discovery Board (...) [ 4.223461] Waiting for root device /dev/mmcblk0p4...
+CONFIG_MMC_ARMMMCI=y
diff -u /srv/tftp/5.6.0-2-armmp/config-5.6.0-2-armmp-lpae /srv/tftp/5.6.17-armv7-lpae-x14/config-5.6.17-armv7-lpae-x14 | grep -v '#' | grep '^+' | grep MMC +CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +CONFIG_MMC_SDHCI_OF_ESDHC=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MMC_OMAP_HS=y +CONFIG_MMC_SPI=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_MMC_SUNXI=y +CONFIG_MMC_CQHCI=y +CONFIG_MMC_SDHCI_OMAP=y +CONFIG_MMC35240=m +CONFIG_PHY_ROCKCHIP_EMMC=y -CONFIG_MMC_ARMMMCI=m +CONFIG_MMC_ARMMMCI=y CONFIG_MMC_STM32_SDMMC=y
STM32MP> help dhcp ; setenv serverip 192.168.1.12 tftp ${kernel_addr_r} ${serverip}:vmlinuz tftp ${fdt_addr_r} ${serverip}:${board_name}.dtb tftp ${ramdisk_addr_r} ${serverip}:uImage.initrd bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} setenv bootargs "root=/dev/mmcblk0p4 ip=dhcp " bootz ${kernel_addr_r} - ${fdt_addr_r}
sudo dhclient ; sudo apt-get install -y \ linux-image-5.7.0-rc5-armmp-lpae \ linux-headers-5.7.0-rc5-armmp-lpae sudo zile /boot/extlinux/extlinux.conf
[ 0.000000] Linux version 5.6.17-armv7-lpae-x14 (rzr@cis) (gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))) #1 SMP PREEMPT Sat Jun 13 08:05:25 CEST 2020 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=70c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: STMicroelectronics STM32MP157C-DK2 Discovery Board [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] efi: Getting EFI parameters from FDT: [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000010000000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node mcuram2@10000000, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000010040000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node vdev0vring0@10040000, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000010041000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node vdev0vring1@10041000, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000010042000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node vdev0buffer@10042000, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000030000000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node mcuram@30000000, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000038000000, size 0 MiB [ 0.000000] OF: reserved mem: initialized node retram@38000000, compatible id shared-dma-pool [ 0.000000] cma: Reserved 64 MiB at 0x00000000dc000000 [ 0.000000] On node 0 totalpages: 114688 [ 0.000000] DMA zone: 1536 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 114688 pages, LIFO batch:31 [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.0 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] psci: Trusted OS migration not required [ 0.000000] psci: SMC Calling Convention v1.0 [ 0.000000] percpu: Embedded 20 pages/cpu s53132 r8192 d20596 u81920 [ 0.000000] pcpu-alloc: s53132 r8192 d20596 u81920 alloc=20*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113152 [ 0.000000] Kernel command line: console=ttySTM0,115200 ro rootwait ip=dhcp root=/dev/mmcblk0p4 [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear) [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] software IO TLB: mapped [mem 0xd0000000-0xd4000000] (64MB) [ 0.000000] Memory: 300464K/458752K available (10240K kernel code, 1662K rwdata, 4208K rodata, 2048K init, 379K bss, 92752K reserved, 65536K cma-reserved, 0K highmem) [ 0.000000] random: get_random_u32 called from __kmem_cache_create+0x2d/0x3a8 with crng_init=0 [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] ftrace: allocating 48395 entries in 95 pages [ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/insn.c:15 __arm_gen_branch+0x7f/0x84
(==) Using system config directory "/usr/share/X11/xorg.conf.d" (EE) Fatal server error: (EE) Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices (EE) (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. (EE) (EE) Server terminated with error (1). Closing log file. Xorg -version #| X.Org X Server 1.20.8 # (2020-03-29) Xorg -configure #| List of video drivers: #| amdgpu #| ati #| nouveau #| radeon #| modesetting #| fbdev #| vesa # TODO rebuild armada Xorg -configure 2>&1 | grep armada armada cp xf86-video-armada/conf/xorg-sample.conf /etc/X11/xorg.conf Xorg -retro DISPLAY=:0 xterm apt-get install x11-xserver-utils x11-apps # TODO twm Xorg -retro -noreset DISPLAY=:0 xsetroot -solid purple export DISPLAY=:0 ; xclock startx # alloc_contig_range: [dc400, dca5f) PFNs busy
Etnaviv X.Org driver is Xf86-video-armada (2D) with DRI2
From reference image:
glmark2-es2-drm #| ======================================================= #| glmark2 2017.07 #| ======================================================= #| OpenGL Information #| GL_VENDOR: Vivante Corporation #| GL_RENDERER: Vivante GC7000Nano #| GL_VERSION: OpenGL ES 2.0 V6.2.4.p3.174315
From wip:
dmesg | grep etna [ 3.353529] etnaviv etnaviv: bound 59000000.gpu (ops 0xc0cd894c) [ 3.358261] etnaviv-gpu 59000000.gpu: model: GC400, revision: 4652 [ 3.364904] etnaviv-gpu 59000000.gpu: Need to move linear window on MC1.0, disabling TS [ 3.373209] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0 /* gc7000nano_0x4652 */ { 0x400, /* ChipID */ 0x4652, /* ChipRevision */ 0x70001, /* ProductID */ linux/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
Vivante “GC7000”
“gc7000nano_0x4652”
apt remove libetnaviv-headers-1.0
/usr/include/libetnaviv/src/etnaviv/common.xml.h
The STM32MP157C/F devices also embed a 3D graphic processing unit (Vivante® - OpenGL® ES 2.0) running at up to 533 MHz, with performances up to 26 Mtriangle/s, 133 Mpixel/s.
galcore.ko is the driver for the Vivante GCNANO GPU
ls gcnano-userland-multi-6.2.4.p4-20190626/usr/include/# EGL gbm.h GLES GLES2 KHR VG
dmesg | egrep -i "drm|etnaviv" (...) [ 3.349884] etnaviv etnaviv: bound 59000000.gpu (ops 0xc0cd894c) [ 3.354618] etnaviv-gpu 59000000.gpu: model: GC400, revision: 4652 [ 3.361254] etnaviv-gpu 59000000.gpu: Need to move linear window on MC1.0, disabling TS (...) [ 3.369556] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0 (...) [ 4.029518] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 4.036018] [drm] Driver supports precise vblank timestamp query. [ 4.044342] [drm] Initialized stm 1.0.0 20170330 for 5a001000.display-controller on minor 1 (...) [ 4.472216] Console: switching to colour frame buffer device 60x50 [ 4.510123] stm32-display 5a001000.display-controller: fb0: stmdrmfb frame buffer device (...) [ 21.103286] systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
udevadm info -a -p /sys/class/drm/card1 #| DRIVERS=="stm32-display" udevadm info -a -p /sys/class/drm/card0 #| DRIVERS=="etnaviv"
ETNAVIV has been upstreamed in Mesa, only headers are useful for armdena
# sudo dpkg --add-architecture armhf sudo apt-get remove libetnaviv # sudo apt-get update ; sudo apt-get install multiarch-support -y # wget http://repo.novena.io/repo/pool/main/libe/libetnaviv/libetnaviv-dev_1.1-r1_armhf.deb # wget http://repo.novena.io/repo/pool/main/libe/libetnaviv/libetnaviv_1.1-r1_armhf.deb # sudo dpkg -i --force=all libetnaviv_*.deb && sudo dpkg -i libetnaviv-dev_*.deb sudo apt-get install devscripts git clone https://github.com/xobs/libetnaviv ; cd libetnaviv fakeroot ./debian/rules binary # sudo apt-get remove libetnaviv rm -rf /usr/include/libetnaviv grep platform ./etna_viv/tools/data/gpus.json "platform": "Rockchip 2918", "platform": "Marvell Armada 510 (88AP510)", "platform": "Marvell 88SV331x", "platform": "Marvell Armada 610", "platform": "Marvell Armada 1500", "platform": "Marvell PXA2128", "platform": "Ingenic JZ4770 MIPS", "platform": "Freescale i.MX 6 Quad", "platform": "Freescale i.MX 6 DualLite", "platform": "Freescale i.MX 6 QuadPlus",
export ARCH=arm ; export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- make multi_v7_defconfig # # make stm32_defconfig # not this one
[ 3.346512] etnaviv etnaviv: bound 59000000.gpu (ops 0xc0cd894c) [ 3.351247] etnaviv-gpu 59000000.gpu: model: GC400, revision: 4652 [ 3.357875] etnaviv-gpu 59000000.gpu: Need to move linear window on MC1.0, disabling TS [ 3.366180] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0 /usr/sbin/modinfo etnaviv name: etnaviv filename: (builtin) alias: platform:etnaviv license: GPL v2 file: drivers/gpu/drm/etnaviv/etnaviv description: etnaviv DRM Driver author: Lucas Stach <l.stach@pengutronix.de> author: Russell King <rmk+kernel@arm.linux.org.uk> author: Christian Gmeiner <christian.gmeiner@gmail.com> parm: job_hang_limit:int parm: hw_job_limit:int parm: dump_core:bool
Userspace interface to kernel DRM services
sudo apt remove libdrm-etnaviv1 sudo apt reinstall -t unstable libdrm-dev libdrm-etnaviv1 # 2.4.101-2 sudo apt reinstall libdrm-tests sudo apt reinstall -t testing linux-libc-dev #| libdrm-dev:armhf: /usr/include/libdrm/etnaviv_drmif.h #| linux-libc-dev:armhf: /usr/include/drm/etnaviv_drm.h # TODO #| [ 4984.847] (II) no primary bus or device found #| [ 4984.847] falling back to /sys/devices/platform/etnaviv/drm/card0 #| (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support dmesg | grep etnaviv #| [ 3.345596] etnaviv etnaviv: bound 59000000.gpu (ops 0xc0cd894c) #| [ 3.350329] etnaviv-gpu 59000000.gpu: model: GC400, revision: 4652 #| [ 3.356962] etnaviv-gpu 59000000.gpu: Need to move linear window on MC1.0, disabling TS #| [ 3.365260] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0 dpkg -S /usr/lib/arm-linux-gnueabihf/libdrm_etnaviv.so.1 #| libdrm-etnaviv1:armhf: /usr/lib/arm-linux-gnueabihf/libdrm_etnaviv.so.1
sudo apt reinstall libdrm-tests /usr/bin/modetest #| trying to open device 'stm'…done modetest -c
2 parts : DRI and Gallium driver
stm_dri.so is gallium driver for GC400
Debian-10's mesa lack stm_dri.so:
dpkg -L kmscube || sudo apt install kmscube sudo kmscube -D /dev/dri/card1 gbm: Last dlopen error: /usr/lib/dri/stm_dri.so: cannot open shared object file: No such file or directory
So we update it from sid:
dpkg -L libgl1-mesa-glx channel=unstable echo "deb http://deb.debian.org/debian $channel main contrib non-free" \ | sudo tee /etc/apt/sources.list.d/$channel.list sudo apt-get update dpkg -L libgl1-mesa-dri | grep stm_dri.so || sudo apt-get install -t $channel libgl1-mesa-dri # libgl1-mesa-dri:armhf: /usr/lib/arm-linux-gnueabihf/dri/stm_dri.so # 20.0.7-1_armhf.deb dpkg -S /usr/lib/arm-linux-gnueabihf/dri/stm_dri.so # libgl1-mesa-dri:armhf strings /usr/lib/arm-linux-gnueabihf/dri/stm_dri.so | grep '_DEBUG'
Userspace interface to kernel DRM services, etnaviv support has been upstreamed into Mesa:
And shipped in debian:
dpkg -L libdrm-dev | grep etnaviv #| /usr/include/libdrm/etnaviv_drmif.h #| /usr/lib/arm-linux-gnueabihf/pkgconfig/libdrm_etnaviv.pc #| /usr/lib/arm-linux-gnueabihf/libdrm_etnaviv.so
But some headers could lack:
sudo apt-get install libetnaviv-headers
dpkg -L libetnaviv-headers #| libetnaviv-headers: /usr/include/libetnaviv/attic/etnaviv/viv.h #| libetnaviv-headers: /usr/include/libetnaviv/src/etnaviv/common.xml.h #| /usr/include/libetnaviv/attic/etnaviv/viv.h #| /usr/include/libetnaviv/attic/etnaviv/etna.h #| /usr/include/libetnaviv/src/etnaviv/common.xml.h
apt-file search common.xml.h # TODO * https://codesearch.debian.net/search?q=common.xml.h * https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/src/gallium/drivers/etnaviv/hw/common.xml.h * https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/etnaviv/hw/common.xml.h
# TODO: look for etnaviv/viv.h # ln -fs /usr/include/libetnaviv/attic/etnaviv/*.h /usr/include/etnaviv/ # TODO # https://codesearch.debian.net/search?q=viv.h&literal=1
libdrm_armada provides the DDX
sudo apt-get remove libdrm-armada2 libdrm-armada-dev # 2.0.3-1 git clone http://git.arm.linux.org.uk/cgit/libdrm-armada.git/ cd libdrm-armada apt-get install -y make fakeroot debhelper fakeroot ./debian/rules binary
apt-cache search armada sudo apt reinstall libdrm-armada2 libdrm-armada-dev sudo apt reinstall xserver-xorg-video-armada-etnadrm xserver-xorg-video-armada xserver-xorg-video-armada-dbg #| xserver-xorg-video-armada: /usr/lib/xorg/modules/drivers/armada_drv.so # wget http://repo.novena.io/repo/pool/main/x/xf86-video-armada/xserver-xorg-video-armada-etnaviv_0.0.1-r13_armhf.deb # dpkg -i xserver-xorg-video-armada-etnaviv_0.0.1-r13_armhf.deb git clone http://git.arm.linux.org.uk/cgit/xf86-video-armada.git apt-get install autoconf xutils-dev xserver-xorg-dev libtool pkg-config mv ./build-aux/config.sub ./build-aux/config.sub.orig mv ./build-aux/config.guess ./build-aux/config.guess.orig fakeroot ./debian/rules binary # # TODO: look for etnaviv/viv.h ln -fs /usr/include/libetnaviv/attic/etnaviv/*.h /usr/include/etnaviv/ # TODO # ln -fs /usr/include/libetnaviv/attic/etnaviv /usr/include/etnaviv # https://codesearch.debian.net/search?q=viv.h&literal=1 git clone https://github.com/novena-next/libdrm-armada ; cd libdrm-armada fakeroot ./debian/rules binary # dpkg -i ../libdrm-armada*.deb # 2.0.4-1_armhf git clone https://github.com/novena-next/xf86-video-armada ; cd xf86-video-armada export DEB_DH_MAKESHLIBS_ARG=--ignore-missing-info # --dpkg-shlibdeps-params=--ignore-missing-info fakeroot ./debian/rules binary sudo dpkg -i ../xserver-xorg-video-armada*.deb Xorg -configure 2>&1 | grep armada # cp -av xf86-video-armada/conf/xorg-sample.conf /etc/X11/xorg.conf # gdb : etnadrm_open_render, etnaviv_accel_init @ viv_open failed # # "etnaviv DRM kernel driver 1.3.0, date 2" # (gdb) p version->date # $13 = 0x5b7c58 "20151214" # b chip_specs # gdb -tui /usr/lib/xorg/Xorg # b viv_open # # ret = viv_open(VIV_HW_2D, &etnaviv->conn); = -1 (gdb) p/x conn->chip $17 = {chip_model = 0x400, chip_revision = 0x4652, chip_features = {0xa0e9e004, 0xe1299fff, 0xbe13b219, 0xce110010, 0x8000001}, stream_count = 0x4, register_max = 0x20, thread_count = 0x40, shader_core_count = 0x1, vertex_cache_size = 0x8, vertex_output_buffer_size = 0x80, pixel_pipes = 0x1, instruction_count = 0x100, num_constants = 0x0, buffer_size = 0x0, varyings_count = 0x0} #define chipFeatures_PIPE_2D 0x00000200 p/x conn->chip->chip_features[ETNA_PIPE_2D] & 0x00000200
grep EE /var/log/Xorg.0.log # [ 145.367] (EE) armada(0): etnaviv: unable to open: Invalid argument # [ 145.367] (WW) armada(0): [drm] Vivante initialization failed, running unaccelerated grep etnaviv_accel_init ../xf86-video-armada/etnaviv/etnaviv_accel.c #| ./etnaviv/etnadrm.c:145:int viv_open(enum viv_hw_type hw_type, struct viv_conn **out) #| /viv.h:int viv_open apt-file update ; apt-file search viv.h #| libetnaviv-headers: /usr/include/libetnaviv/attic/etnaviv/viv.h
dpkg -L libgl1-mesa-dri:armhf # /usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so sudo apt-get install -t $channel libglapi-mesa # 20.1.1-1 : libglx-mesa0 # dpkg -L libglapi-mesa dpkg -L libgl1-mesa-dri dpkg -L libgbm1:armhf apt-cache search libgl sudo apt reinstall mesa-common-dev libopengl-dev libglapi-mesa dpkg -L mesa-common-dev sudo apt upgrade rgrep -i -o "getenv(\".*\")" . | sed -e "s|.*\"\(.*\)\".*|\1|g" | sort | uniq | grep -i DEBUG #| LIBGL_DEBUG #| MESA_DEBUG #| MESA_INFO #| MESA_VERBOSE export LIBGL_DEBUG=verbose export LIBGL_SHOW_FPS=1 export LIBGL_DRI3_DISABLE=true export LIBGL_ALWAYS_SOFTWARE=false export MESA_DEBUG=true
Based on Gallium3D can be used by X via xf86-video-armada
libgl1-mesa-dri:armhf: /usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so
GLAMOR to accelerate 2D graphical over Mesa
xserver-xorg-core: /usr/lib/xorg/modules/libglamoregl.so
cat<<EOF | tee /etc/X11/xorg.conf && X Section "Module" Load "dri2" Load "glamoregl" EndSection Section "ServerFlags" Option "AutoAddGPU" "false" Option "DRI2" "true" EndSection Section "Device" Identifier "etnaviv" Driver "modesetting" Option "kmsdev" "/dev/dri/card1" Option "AccelMethod" "none" # Option "AccelMethod" "glamor" EndSection #Section "Screen" # Identifier "Default Screen" # Device "etnaviv" #EndSection EOF
Etnaviv Supported on debian, so SDL2 games are working too
dpkg -L weston || sudo apt-get install kbd weston export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ mkdir -p ${XDG_RUNTIME_DIR}/tmp /bin/openvt -c 1 /usr/bin/weston-launch -f unset GALLIUM_HUD /usr/bin/es2gears_wayland -info # 100 fps #| EGL_VERSION = 1.4 #| EGL_VENDOR = Mesa Project #| EGL_CLIENT_APIS = OpenGL OpenGL_ES export GALLIUM_HUD=fps,cpu,draw-calls # 100 fps
export SDL_AUDIODRIVER=dummy unset GALLIUM_HUD # OpenGL 1.3 is supported /usr/games/neverball #| GL vendor: etnaviv #| GL renderer: Vivante GC400 rev 4652 #| GL version: 1.3 Mesa 20.1.2 #| etna_link_shader:2647: Semantic 19 value 2 not found in vertex shader outputs cat ~/.neverball/neverballrc #| textures 1 #| reflection 0 #| multisample 0 #| width 480 #| height 800 #| fullscreen 1 top # cpu=20% and 5% for weston ? apt-cache rdepends libsdl2-2.0 | grep -v '^lib' | xargs -n1 apt-cache show apt-cache rdepends libsdl2-2.0 | grep -v '^lib' | xargs -n1 sudo apt-get install -y ls /usr/games/* | while read file ; do ldd $file | grep -q libGL.so 2>&1 && \dpkg -S $file ; done apt-get install chromium-bsu dreamchess trackballs teeworlds # supertux spring s3d redeclipse rbdoom3bfg /usr/games/neverball
Debian ship SDL2 with some backends
apt-cache rdepends libsdl2-2.0 # SDL_VIDEODRIVER available: x11 wayland dummy export SDL_AUDIODRIVER=dummy
modetest -M stm -c || sudo apt install libdrm-tests #| 32 0 disconnected HDMI-A-1 0x0 0 31 #| 34 33 connected DSI-1 52x86 1 33 #| #0 480x800 50.00 480 578 610 708 800 815 825 839 29700 flags: ; type: preferred, driver modetest -M stm -c | grep -i HDMI 32 0 disconnected HDMI-A-1 0x0 0 31
sudo apt reinstall libgl1 dpkg -S /usr/lib/arm-linux-gnueabihf/libGL.so.1 # dpkg -S /usr/bin/eglinfo # mesa-utils-extra
From console
root@stm32mp1:~# /usr/bin/eglinfo EGL client extensions string: EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless GBM platform: EGL API version: 1.4 EGL vendor string: Mesa Project EGL version string: 1.4 EGL client APIs: OpenGL OpenGL_ES EGL extensions string: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display Configurations: bf lv colorbuffer dp st ms vis cav bi renderable supported id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces --------------------------------------------------------------------- 0x01 32 0 8 8 8 8 0 0 0 0 0x34325241-- y y y win 0x02 32 0 8 8 8 8 16 0 0 0 0x34325241-- y y y win 0x03 32 0 8 8 8 8 24 0 0 0 0x34325241-- y y y win 0x04 32 0 8 8 8 8 24 8 0 0 0x34325241-- y y y win 0x05 24 0 8 8 8 0 0 0 0 0 0x34325258-- y y y win 0x06 24 0 8 8 8 0 16 0 0 0 0x34325258-- y y y win 0x07 24 0 8 8 8 0 24 0 0 0 0x34325258-- y y y win 0x08 24 0 8 8 8 0 24 8 0 0 0x34325258-- y y y win 0x09 16 0 5 6 5 0 0 0 0 0 0x36314752-- y y y win 0x0a 16 0 5 6 5 0 16 0 0 0 0x36314752-- y y y win 0x0b 16 0 5 6 5 0 24 0 0 0 0x36314752-- y y y win 0x0c 16 0 5 6 5 0 24 8 0 0 0x36314752-- y y y win Wayland platform: error: XDG_RUNTIME_DIR not set in the environment. error: XDG_RUNTIME_DIR not set in the environment. error: XDG_RUNTIME_DIR not set in the environment. eglinfo: eglInitialize failed X11 platform: eglinfo: eglInitialize failed Device platform: eglinfo: eglInitialize failed
* https://gitlab.freedesktop.org/mesa/demos/-/blob/master/src/egl/opengl/eglinfo.c
EGL context seems to work without X11
ldd /usr/bin/kmscube | grep GL libEGL.so.1 => /usr/lib/arm-linux-gnueabihf/libEGL.so.1 (0xb6df4000) libGLESv2.so.2 => /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 (0xb6dce000) libGLdispatch.so.0 => /usr/lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0xb6777000) sudo kmscube -D /dev/dri/card1 || sudo apt install kmscube Using display 0x21d8358 with EGL version 1.4 =================================== EGL information: version: "1.4" vendor: "Mesa Project" client extensions: "EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless" display extensions: "EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display " =================================== OpenGL ES 2.x information: version: "OpenGL ES 2.0 Mesa 20.1.1" shading language version: "OpenGL ES GLSL ES 1.0.16" vendor: "etnaviv" renderer: "Vivante GC400 rev 4652" extensions: "GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture GL_AMD_performance_monitor GL_OES_packed_depth_stencil GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_NV_pixel_buffer_object GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_separate_shader_objects GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex GL_OES_texture_border_clamp GL_KHR_no_error GL_EXT_disjoint_timer_query GL_KHR_parallel_shader_compile " ===================================
If you dont have latest mesa it will fail:
gbm: failed to open any driver (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri) gbm: Last dlopen error: /usr/lib/dri/stm_dri.so: cannot open shared object file: No such file or directory failed to load driver: stm
sudo apt install mesa-utils-extra ; dpkg -L mesa-utils-extra /usr/bin/es2gears_x11 -info # 50fps /usr/bin/es2gears_wayland -info # 100 fps /usr/bin/es2gears -info # 50 fps
DISPLAY=:0 LIBGL_DEBUG=verbose glxinfo | grep render libGL: screen 0 does not appear to be DRI2 capable libGL: MESA-LOADER: dlopen(/usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so)
DISPLAY=:0 GALLIUM_HUD=draw-calls GALLIUM_DRIVER=llvmpipe glxgears -info
GALLIUM_DRIVER=softpipe DISPLAY=:0 glxgears -info
DISPLAY=:0 GALLIUM_HUD=draw-calls glxgears -info
glxinfo -l
installing /<<PKGBUILDDIR>>/build/src/gallium/targets/dri/libgallium_dri.so to /<<PKGBUILDDIR>>/debian/tmp/usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so
libgl1-mesa-dri:armhf: /usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so md5sum /usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so /usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so
6be527e80840f2744df998cb90574e3d /usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so 6be527e80840f2744df998cb90574e3d /usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so
DISPLAY=:0 glxinfo 2>&1 | less name of display: :0 display: :0 screen: 0 direct rendering: Yes server glx vendor string: SGI server glx version string: 1.4 (...) client glx vendor string: Mesa Project and SGI client glx version string: 1.4 DISPLAY=:0 glxgears 2>&1 | less # 167 frames in 5.0 seconds = 33.384 FPS DISPLAY=:0 MESA_GL_VERSION_OVERRIDE="2.0" glxgears -info GL_RENDERER = llvmpipe (LLVM 10.0.0, 128 bits) GL_VERSION = 2.0 Mesa 20.1.1 GL_VENDOR = VMware, Inc. # This should be "GL_VENDOR = etnaviv" instead
SDL_NOMOUSE=1 DISPLAY=:0 /usr/games/pinball
[ 158s] checking for Vivante VDK API... no [ 158s] checking for Vivante FB API... no sudo apt install libdrm-dev libgbm-dev
ldd /usr/games/pinball | grep GL libGL.so.1 => /usr/lib/arm-linux-gnueabihf/libGL.so.1 (0xb6e59000) libGLU.so.1 => /usr/lib/arm-linux-gnueabihf/libGLU.so.1 (0xb6e09000) libGLdispatch.so.0 => /usr/lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0xb687c000) libGLX.so.0 => /usr/lib/arm-linux-gnueabihf/libGLX.so.0 (0xb6819000) # Using SDL2 from console export SDL_VIDEODRIVER=kmsdrm #| Vendor : etnaviv #| Renderer : Vivante GC400 rev 4652 #| Version : 1.3 Mesa 20.1.2 grep KMS /usr/include/SDL2/SDL_config.h #define SDL_VIDEO_DRIVER_KMSDRM 1 #define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "libdrm.so.2" #define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "libgbm.so.1" cat <<EOF> ~/.emilia/pinball size: 480 800 sound: 0 music: 0 view: 0 bpp: 24 fullscreen: 1 lights: 0 brightness: 0.5 texture_filter: -1 showfps: 1 fire: 0 keyboard: bottomnudge 32 keyboard: launch 13 keyboard: leftflip 1073742049 keyboard: leftnudge 1073742048 keyboard: reset 114 keyboard: rightflip 1073742053 keyboard: rightnudge 1073742052 EOF kill -9 $(pidof pinball) ; /usr/games/pinball #| Vendor : etnaviv export LD_LIBRARY_PATH=/usr/lib/gl4es ldd /usr/games/pinball | grep GL #| libGL.so.1 => /usr/lib/gl4es/libGL.so.1 (0xb6da5000) #| libGLU.so.1 => /usr/lib/arm-linux-gnueabihf/libGLU.so.1 (0xb6d55000) export LD_LIBRARY_PATH=/usr/lib/gl4es export DISPLAY=:0 export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ export LIBGL_ES=2 export LIBGL_FB=3 export LIBGL_FPS=1 export LIBGL_GL=21 export LIBGL_DEFAULTWRAP=2 export LIBGL_FBOFORCETEX=1 export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 kill -9 $(pidof pinball) ; /usr/games/pinball file /usr/lib/arm-linux-gnueabihf/libGL.so.1 mv -v /usr/lib/arm-linux-gnueabihf/libGL.so.1 /usr/lib/arm-linux-gnueabihf/libGL.so.1.$(date +%s).bak ln -fs /usr/lib/gl4es/libGL.so.1 /usr/lib/arm-linux-gnueabihf/libGL.so.1 xinit #| X.Org X Server 1.20.8 #| X Protocol Version 11, Revision 0 #| Build Operating System: Linux 4.19.0-8-armmp-lpae armv7l Debian #| Current Operating System: Linux stm32mp1 5.8.0-rc1-00138-g1198e58e1b0e #1 SMP Fri Jun 19 03:38:59 CEST 2020 armv7l #| Kernel command line: root=/dev/sdb5 # ro quiet #| Build Date: 31 March 2020 10:14:40AM #| xorg-server 2:1.20.8-2 (https://www.debian.org/support) #| Current version of pixman: 0.36.0 #| Before reporting problems, check http://wiki.x.org #| to make sure that you have the latest version. #| Markers: (--) probed, (**) from config file, (==) default setting, #| (++) from command line, (!!) notice, (II) informational, #| (WW) warning, (EE) error, (NI) not implemented, (??) unknown. #| (==) Log file: "/var/log/Xorg.0.log", Time: Tue Jun 30 14:09:49 2020 #| (==) Using config file: "/etc/X11/xorg.conf" #| (==) Using system config directory "/usr/share/X11/xorg.conf.d" LIBGL: Initialising gl4es LIBGL: v1.1.3 built on Jun 19 2020 11:31:56 LIBGL: Using GLES 2.0 backend LIBGL: loaded: libGLESv2.so LIBGL: loaded: libEGL.so LIBGL: Using GLES 2.0 backend LIBGL: Error while gathering supported extension (eglInitialize: EGL_NOT_INITIALIZED), default to none LIBGL: Targeting OpenGL 2.1 LIBGL: WARNING, No Limited or Full NPOT support in hardware, Forcing NPOT have no effect! LIBGL: Not trying to batch small subsequent glDrawXXXX LIBGL: try to use VBO LIBGL: glX Will try to recycle EGL Surface LIBGL: Current folder is:/root (II) modeset(0): Initializing kms color map for depth 24, 8 bpc. eglinfo Wayland platform: eglinfo: eglInitialize failed X11 platform: eglinfo: eglInitialize failed Device platform: eglinfo: eglInitialize failed LIBGL: Shuting down export LD_LIBRARY_PATH=/usr/lib/gl4e export LIBGL_FPS=1 unset SDL_VIDEODRIVER export SDL_VIDEODRIVER=kmsdrm unset SDL_RENDER_DRIVER export SDL_RENDER_DRIVER=software export SDL_RENDER_DRIVER=opengl export SDL_RENDER_DRIVER=opengles2 export LIBGL_FB=4 # GBM unset LIBGL_FB unset LIBGL_DRMCARD export LIBGL_DRMCARD=/dev/dri/card1 export LIBL_FBOUNBIND=1 unset LIBL_FBOUNBIND unset LIBGL_ES export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 file /dev/dri/card0 mv /dev/dri/card0 /dev/dri/card0.orig ln -fs card1 /dev/dri/card0 mv /dev/dri/card0.orig /dev/dri/card0 mv /dev/dri/card1 /dev/dri/card1.orig kill -9 $(pidof pinball) ; /usr/games/pinball kill -9 $(pidof pinball) ; sudo apt-get update ; sudo aptitude install libsdl2-snapshot libsdl2-dev=0.2.0.12+330+gc59ab0c02-333 export SDL_AUDIODRIVER=vivante # TODO
dpkg -L gl4es0 | grep '/usr/lib/gl4es/libGL.so.1' || apt reinstall -y --allow-unauthenticated gl4es0 export LIBGL_GL=13 LIBGL: Targeting OpenGL 1.3
sudo kill -9 $(pidof Xorg) ; sudo xinit glxinfo || apt-get install -y mesa-utils
DISPLAY=:0 LD_LIBRARY_PATH=/usr/lib/gl4es glxinfo #| (...) #| LIBGL: Hardware vendor is VMware, Inc. #| (...) #| libEGL warning: DRI2: failed to authenticate #| (...)
DISPLAY=:0 LD_LIBRARY_PATH=/usr/lib/gl4es glxgears -info # 247 frames in 5.0 seconds = 49.283 FPS
DISPLAY=:0 LD_LIBRARY_PATH=/usr/lib/gl4es LIBGL_BATCH=1000 glxgears # 247 frames in 5.0 seconds = 49.333 FPS
LIBGL_FPS=1 LIBGL_FB=1 LD_LIBRARY_PATH=/usr/lib/gl4es SDL_AUDIODRIVER=dummy DISPLAY=:0 SDL_NOMOUSE=1 /usr/games/pinball
# libegl-dev:armhf: /usr/lib/arm-linux-gnueabihf/libEGL.so
export DISPLAY=:0 export LD_LIBRARY_PATH=/usr/lib/gl4es
export LD_LIBRARY_PATH=/usr/lib/gl4es ldd /usr/bin/eglinfo | grep GL export LIBGL_FPS=1 export LIBGL_NOTEST=1 eglinfo #| LIBGL: Targeting OpenGL 2.1 #| LIBGL: Initialising gl4es #| LIBGL: v1.1.3 built on Jun 19 2020 11:31:56 #| LIBGL: fps counter enabled #| LIBGL: Using GLES 2.0 backend #| #| X11 platform: #| eglinfo: eglInitialize failed #| #| Device platform: #| eglinfo: eglInitialize failed #| #| LIBGL: Shuting down # Now let's try SDL app: export SDL_VIDEODRIVER=wayland export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 export LIBGL_FPS=1 export LIBGL_FB=1 export LD_LIBRARY_PATH=/usr/lib/gl4es unset LIBGL_FB mkdir -p ${XDG_RUNTIME_DIR}/tmp /usr/games/pinball #| Couldn't set video mode: OpenGL not available # I suspect a glx issue sudo apt-get install xwayland "Xwayland" "Failed to initialize glamor" kill -9 $(pidof weston)
export LIBGL_FPS=1 export LIBGL_NOTEST=1 kill -9 $(pidof pinball) ; /usr/games/pinball Fonts are not displayed and it's super slow export LIBGL_GL=11
unset LIBGL_DRMCARD export LIBGL_DRMCARD=/dev/dri/card1 unset SDL_RENDER_DRIVER export SDL_RENDER_DRIVER=opengles2 # or opengl # export SDL_RENDER_DRIVER=opengl # or opengl SDL_Window* window = SDL_CreateWindow ("SDL2", 0, 0, 480, 800, SDL_WINDOW_FULLSCREEN ); ); ./sdl-test Dont use software renderer it will fail SDL_VIDEODRIVER available: x11 wayland KMSDRM dummy SDL_VIDEODRIVER usable : KMSDRM SDL_VIDEODRIVER selected : KMSDRM SDL_RENDER_DRIVER available: opengl opengles2 software SDL_RENDER_DRIVER selected : software [ 2661.572776] etnaviv-gpu 59000000.gpu: MMU fault status 0x00000002 [ 2661.577570] etnaviv-gpu 59000000.gpu: MMU 0 fault addr 0xff8bc00017 01-Jul-20 [ 2662.630775] etnaviv-gpu 59000000.gpu: recover hung GPU!
GBM is intended to be used as a native platform for EGL
unset LIBGL_NOTEST unset SDL_VIDEODRIVER export SDL_VIDEODRIVER=kmsdrm # x11 wayland KMSDRM RPI dummy export SDL_RENDER_DRIVER=opengl # opengl opengles2 opengles software export DISPLAY=:0 unset LIBGL_DRMCARD export LIBGL_DRMCARD=/dev/dri/card1 export LIBGL_FB=4 # GBM export LIBGL_FPS=1 # export LIBGL_FBONOALPHA=1 kill -9 $(pidof pinball) ; /usr/games/pinball --debug #| LIBGL: Using GLES 2.0 backend #| LIBGL: GBM on card /dev/dri/card1 is Available #| LIBGL: GBM Surfaces supported and used #| LIBGL: Error while gathering supported extension (eglChooseConfig: EGL_SUCCESS), default to none dpkg -L libgles2 || # /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.1.0 dpkg -S /usr/lib/arm-linux-gnueabihf/libGLESv2.so # libgles-dev:armhf: /usr/lib/arm-linux-gnueabihf/libGLESv2.so dpkg -L libgles2-mesa || apt-get install libgles2-mesa kill -9 $(pidof pinball) ; LIBGL_NOTEST=1 /usr/games/pinball LIBGL: Initialising gl4es LIBGL: v1.1.4 built on Jul 1 2020 11:38:17 LIBGL: framebuffer output enabled LIBGL: Using GLES 2.0 backend LIBGL: loaded: libGLESv2.so LIBGL: loaded: libEGL.so LIBGL: loaded: libgbm.so LIBGL: loaded: libdrm.so LIBGL: Hardware test disabled, nothing activated... LIBGL: Targeting OpenGL 2.1 LIBGL: Forcing NPOT support by disabling MIPMAP support for NPOT textures LIBGL: Not trying to batch small subsequent glDrawXXXX LIBGL: try to use VBO LIBGL: glXMakeCurrent FBO workaround enabled LIBGL: Current folder is:/root Initing SDL
sudo sync sudo apt-get update -y sudo apt-get install -y base-files gnupg curl sudo unset VERSION_ID cat /etc/os-release && . /etc/os-release [ "" != "${VERSION_ID}" ] || VERSION_ID=10 distro="${ID}_${VERSION_ID}" [ "debian" != "${ID}" ] || distro="${distro}.0" [ "debian_10.0" != "$distro" ] || distro="${ID}_${VERSION_ID}" distro=$(echo "${distro}" | sed 's/.*/\u&/') [ "ubuntu" != "${ID}" ] || distro="x${distro}" url="http://download.opensuse.org/repositories/home:/rzrfreefr/${distro}" file="/etc/apt/sources.list.d/home:rzrfreefr.list" echo "deb [allow-insecure=yes] $url /" | sudo tee "${file}" # curl -s ${url}/Release.key | gpg --with-fingerprint curl ${url}/Release.key | sudo apt-key add -v - curl "$url/Release.key" | sudo apt-key add - sudo apt-get update -y apt-cache search armada | cut -d' ' -f1 \ | xargs sudo apt-get install -y --allow-downgrades --allow-unauthenticated # sudo apt reinstall libetnaviv-headers libdrm-etnaviv1 dpkg -L libetnaviv-headers # libetnaviv-headers: /usr/include/libetnaviv/attic/etnaviv/viv.h dpkg -L libdrm-armada2 # /usr/lib/arm-linux-gnueabihf/libdrm_armada.so.0.2.0 # sudo apt-get install -y arm-trusted-firmware sudo apt-get install apt-file ; sudo apt-file update sudo apt-file search etnaviv sudo apt-get install -y libgl1-mesa-dri linux-libc-dev-armhf-cross sudo apt-get install -y libdrm-tests libdrm-etnaviv1 libgl1-mesa-dri linux-libc-dev-armhf-cross dpkg -L libdrm-tests export DISPLAY=:0 GALLIUM_HUD=help glxinfo GALLIUM_HUD=fps,cpu glxgears # 12fps / cpu=80% glxgears -info 154 frames in 5.0 seconds = 30.725 FPS GALLIUM_HUD=fps,cpu,draw-calls glxgears # strace xinit > strace.log 2>&1 GALLIUM_HUD=fps,cpu,draw-calls /usr/bin/glxgears dmesg | grep drm [ 3.365868] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0 [ 4.026043] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 4.032479] [drm] Driver supports precise vblank timestamp query. [ 4.040793] [drm] Initialized stm 1.0.0 20170330 for 5a001000.display-controller on minor 1 [ 4.506432] stm32-display 5a001000.display-controller: fb0: stmdrmfb frame buffer device [ 18.666518] systemd[1]: Condition check resulted in Load Kernel Module drm being skipped. find /dev/dri/ /dev/dri/ /dev/dri/by-path /dev/dri/by-path/platform-5a001000.display-controller-card /dev/dri/by-path/platform-etnaviv-card /dev/dri/by-path/platform-etnaviv-render /dev/dri/card1 /dev/dri/card0 /dev/dri/renderD128 # https://github.com/grate-driver/libdrm/blob/master/xf86drm.c#L2655 drmCommandWriteRead etnadrm_open_render version=etnaviv @ /dev/dri/card0 [ 94.414750] etnaviv-gpu 59000000.gpu: recover hung GPU! DISPLAY=:0 xrandr Screen 0: minimum 320 x 200, current 480 x 800, maximum 2048 x 2048 HDMI-1 disconnected primary (normal left inverted right x axis y axis) DSI-1 connected 480x800+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 480x800 50.00*+
export LIBGL_NOTEST=1 unset LIBGL_NOTEST unset SDL_VIDEODRIVER export SDL_VIDEODRIVER=kmsdrm # x11 wayland KMSDRM RPI dummy unset SDL_RENDER_DRIVER export SDL_RENDER_DRIVER=opengl # opengl opengles2 opengles software #export SDL_RENDER_DRIVER=opengles2 export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ unset LIBGL_DRMCARD export LIBGL_DRMCARD=/dev/dri/card1 export LIBGL_FB=4 # GBM export LIBGL_FPS=1
cd ~/SDL/test/ make testgles2 && ./testgles2 #| INFO: Vendor : etnaviv #| INFO: Renderer : Vivante GC400 rev 4652 #| INFO: Version : OpenGL ES 2.0 Mesa 20.1.2 #| INFO: 50.07 frames per second ./testgles2 --help # On wayland: GALLIUM_HUD=fps,cpu,draw-calls ./testgles2 # CPU=30%, FPS=100
export LIBGL_FPS=1 unset LIBGL_NOTEST #| export LIBGL_NOTEST=1 set | grep GL cd ~/SDL/test/ && make testgl2 && ./testgl2 # A very simple example of using OpenGL with SDL ./testgl2 --info all #| LIBGL: Hardware vendor is etnaviv #| (...) #| INFO: 49.85 frames per second #| LIBGL: Shuting down #| LIBGL: Hardware vendor is VMware, Inc. #| ... #| drmGetBusid returned 'NULL' #| LIBGL: GBM on card /dev/dri/card1 is Available #| LIBGL: Targeting OpenGL 2.1 #| LIBGL: Forcing NPOT support by disabling MIPMAP support for NPOT textures #| LIBGL: Not trying to batch small subsequent glDrawXXXX #| LIBGL: try to use VBO #| LIBGL: glX Will try to recycle EGL Surface #| LIBGL: Current folder is:/root/SDL/test #| INFO: Screen BPP : 32 #| INFO: Swap Interval : 0 #| INFO: Window Size : 480,800 #| INFO: Draw Size : 480,800 GALLIUM_HUD=fps,cpu,draw-calls ./testgl2 # CPU=30%, FPS=100
# export SDL_NOMOUSE=1 export DISPLAY=:0 export SDL_AUDIODRIVER=dummy SDL1's version about 6fps without texture (texture_filter: -1) or 5fps with Vendor : VMware, Inc. Renderer : llvmpipe (LLVM 10.0.0, 128 bits) Version : 3.1 Mesa 20.1.2 aptitude install pinball-snapshot killall pinball -9 ; /usr/games/pinball || gdb /usr/games/pinball #| Vendor : VMware, Inc. #| Renderer : llvmpipe (LLVM 10.0.0, 128 bits) #| Version : 3.1 Mesa 20.1.2 export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 export DISPLAY=:0 export PINBALL_WINDOW_FULLSCREEN_DESKTOP=1 killall pinball -9 ; /usr/games/pinball || gdb /usr/games/pinball
Unknown remote command: grep Unknown remote command: find Unknown remote command: find
export DISPLAY=:0 ; /usr/games/pinball Vendor : VMware, Inc. Renderer : llvmpipe (LLVM 10.0.0, 128 bits) Version : 3.1 Mesa 20.1.2 Function null 0 Function align 0.0699926 Function beh 0.874908 Function collision 2.72193 Function draw 0 Function glight 0.0311078 Function plight 0 Function pnormal 0 Function render 18.793 Function sound 0 Function signal 0.00777696 Function trans 66.1508 Function swap 11.1522 Function keyboard 0.198312 Function render 0 Function swap out 0 Function tick out 0 Function waiting 0 Unprofiled time 99.9994 % 4294965518 25717
Needs SDL2 port
cat <<EOF | sudo tee /etc/apt/sources.list.d/home:rzrfreefr.list deb [allow-insecure=yes] http://download.opensuse.org/repositories/home:rzrfreefr/Debian_10 / EOF sudo apt-get update sudo apt-cache show pinball-snapshot sudo aptitude install pinball # =0.0.0.0+214+g4a4ec39-217 sudo aptitude install pinball-snapshot # =0.0.0.0+214+g4a4ec39-217 dpkg -L weston || sudo apt-get install kbd weston export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ mkdir -p ${XDG_RUNTIME_DIR}/tmp /bin/openvt -c 1 /usr/bin/weston-launch -f unset DISPLAY kill -9 $(pidof pinball) ; /usr/games/pinball Simple profile output ***************** Function null 0 Function align 0.152718 Function beh 0.999215 Function collision 3.11982 Function draw 0 Function glight 0.0785409 Function plight 0 Function pnormal 0 Function render 11.2444 Function sound 0 Function signal 0.0174535 Function trans 84.0649 Function swap 0.165809 Function keyboard 0.157082 Function render 0 Function swap out 0 Function tick out 0 Function waiting 0 Unprofiled time 99.9995 % unset DISPLAY ; strace /usr/games/pinball > log.txt 2>&1 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3 connect(3, {sa_family=AF_UNIX, sun_path="/run/user/0/wayland-0"}, 24) = 0 access("/run/udev/control", F_OK) = 0 socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT) = 5 lsof -p $(pidof pinball) | grep -v 'lib' COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pinball 643 root cwd DIR 8,21 4096 2129 /root pinball 643 root rtd DIR 8,21 4096 2 / pinball 643 root txt REG 8,21 239216 12454 /usr/games/pinball pinball 643 root mem CHR 226,128 18724 /dev/dri/renderD128 pinball 643 root DEL REG 0,1 22797 /memfd:wayland-cursor pinball 643 root 0u CHR 136,1 0t0 4 /dev/pts/1 pinball 643 root 1w REG 8,21 12532086 72 /root/log.txt pinball 643 root 2w REG 8,21 12532086 72 /root/log.txt pinball 643 root 3u unix 0x6537015a 0t0 22796 type=STREAM pinball 643 root 4u REG 0,1 2093056 22797 /memfd:wayland-cursor (deleted) pinball 643 root 5u netlink 0t0 22800 KOBJECT_UEVENT pinball 643 root 7u CHR 226,1 0t0 20485 /dev/dri/card1 pinball 643 root 8u CHR 226,1 0t0 20485 /dev/dri/card1 pinball 643 root 9u CHR 226,128 0t0 18724 /dev/dri/renderD128 pinball 643 root 10u CHR 226,128 0t0 18724 /dev/dri/renderD128 ls -l /proc/$(pidof pinball)/fd lsof | grep 22800 pinball 643 root 5u netlink 0t0 22800 KOBJECT_UEVENT pinball 643 644 SDLTimer root 5u netlink 0t0 22800 KOBJECT_UEVENT pinball 643 root 3u unix 0x6537015a 0t0 22796 type=STREAM pinball 643 644 SDLTimer root 3u unix 0x6537015a 0t0 22796 type=STREAM root@stm32mp1:~# iotop Could not run iotop as some of the requirements are not met: - Linux >= 2.6.20 with - I/O accounting support (CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING) export XDG_RUNTIME_DIR=/var/run/user/$(id -u)/ export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 unset GALLIUM_HUD #| Vendor : etnaviv #| Renderer : Vivante GC400 rev 4652 #| Version : 1.3 Mesa 20.1.2 export GALLIUM_HUD=fps,cpu,draw-calls # for using etnaviv kill -9 $(pidof pinball) ; /usr/games/pinball #| FPS=0.1 cpu=50 dc=25 export SDL_NOMOUSE=1 export PINBALL_BITPERPIXEL=24 export PINBALL_BITPERPIXEL=16 export PINBALL_BITPERPIXEL=8 unset PINBALL_BITPERPIXEL unset PINBALL_WINDOW_FULLSCREEN_DESKTOP export PINBALL_WINDOW_FULLSCREEN_DESKTOP=1 export LIBGL_DEBUG=verbose export LIBGL_SHOW_FPS=1 export LIBGL_ALWAYS_SOFTWARE=false export MESA_DEBUG=true set | grep LIBGL LIBGL_DEBUG=verbose LIBGL_SHOW_FPS=1 export LIBGL_GL=13 unset GALLIUM_HUD export GALLIUM_HUD=fps,cpu,draw-calls # 100 fps kill -9 $(pidof pinball) ; /usr/games/pinball dpkg -L sysstat | grep bin mpstat -P ALL Linux 5.8.0-rc1-00138-g1198e58e1b0e (stm32mp1) 07/02/20 _armv7l_ (2 CPU) 15:43:07 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 15:43:07 all 18.16 0.00 2.59 8.01 0.00 0.20 0.00 0.00 0.00 71.04 15:43:07 0 16.76 0.00 2.45 8.12 0.00 0.36 0.00 0.00 0.00 72.30 15:43:07 1 19.55 0.00 2.74 7.90 0.00 0.04 0.00 0.00 0.00 69.77 /usr/bin/pidstat | grep pinball 15:42:00 0 3646 1.22 0.01 0.00 0.00 1.23 0 pinball less /proc/interrupts
From console:
dpkg -s libgl1-mesa-dri:armhf | grep Version # Version: 20.1.2-1 # 2020-06-24 export GALLIUM_HUD=fps,cpu,draw-calls # for using etnaviv file /usr/lib/arm-linux-gnueabihf/libGL.so.1 killall pinball -9 ; /usr/games/pinball --help || gdb /usr/games/pinball #| Vendor : etnaviv #| Renderer : Vivante GC400 rev 4652 #| Version : 1.3 Mesa 20.1.2 # FPS=0.05 cpu=50 draw-calls=50 export LIBGL_DEBUG=verbose #| drmOpenDevice: node name is /dev/dri/renderD128 #| drmOpenDevice: open result is 5, (OK) #| drmGetBusid returned 'NULL' export MESA_DEBUG=true #| Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAJOR_VERSION)
export DISPLAY=:0 unset DISPLAY export SDL_AUDIODRIVER=dummy export SDL_NOMOUSE=1 unset LIBGL_DEBUG export LIBGL_DEBUG=verbose unset LIBGL_DRMCARD # export LIBGL_DRMCARD=/dev/dri/card1 # export LIBGL_USEVBO=0 export SDL_VIDEODRIVER=kmsdrm # x11 wayland KMSDRM RPI dummy # export SDL_RENDER_DRIVER=opengles2 # export SDL_RENDER_DRIVER=opengl # opengl opengles2 opengles software export GALLIUM_HUD=fps,cpu,draw-calls # for using etnaviv unset LIBGL_NOTEST # export LIBGL_NOTEST=1 set | grep LIBGL export LIBGL_FB=4 # GBM # export LIBGL_FB=1 # GBM killall pinball -9 ; /usr/games/pinball --help || gdb /usr/games/pinball # CPU=50% FPS=0.7 draw-calls=20 # on wayland file /usr/lib/arm-linux-gnueabihf/libGL.so.1 # symbolic link to /usr/lib/gl4es/libGL.so.1 set | grep GL drmOpenDevice: open result is 9, (OK) drmGetBusid returned 'NULL' 0 joysticks were found. Vendor : ptitSeb Renderer : GL4ES wrapper Version : 2.1 gl4es wrapper 1.1.4 Extensions : GL_EXT_abgr GL_EXT_packed_pixels GL_EXT_compiled_vertex_array GL_EXT_compiled_vertex_arrays GL_ARB_vertex_buffer_object GL_ARB_vertex_array_object GL_ARB_vertex_buffer GL_EXT_vertex_array GL_EXT_secondary_color GL_ARB_multitexture GL_ARB_texture_border_clamp GL_ARB_texture_env_add GL_EXT_texture_env_add GL_ARB_texture_env_combine GL_EXT_texture_env_combine GL_ARB_texture_env_crossbar GL_EXT_texture_env_crossbar GL_ARB_texture_env_dot3 GL_EXT_texture_env_dot3 GL_SGIS_generate_mipmap GL_EXT_draw_range_elements GL_EXT_bgra GL_ARB_texture_compression GL_EXT_texture_compression_s3tc GL_OES_texture_compression_S3TC GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_dxt3 GL_EXT_texture_compression_dxt5 GL_ARB_point_parameters GL_EXT_point_parameters GL_EXT_stencil_wrap GL_SGIS_texture_edge_clamp GL_EXT_texture_edge_clamp GL_EXT_direct_state_access GL_EXT_multi_draw_arrays GL_SUN_multi_draw_arrays GL_ARB_multisample GL_EXT_texture_object GL_EXT_polygon_offset GL_GL4ES_hint GL_ARB_draw_elements_base_vertex GL_EXT_draw_elements_base_vertex GL_ARB_map_buffer_range GL_NV_blend_square GL_ARB_texture_rectangle GL_APPLE_texture_2D_limited_npot GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_subtract GL_ARB_texture_mirrored_repeat GL_ARB_framebuffer_object GL_EXT_framebuffer_object GL_EXT_packed_depth_stencil GL_EXT_framebuffer_blit GL_ARB_draw_buffers GL_ARB_point_sprite GL_ARB_texture_cube_map GL_EXT_texture_cube_map GL_EXT_fog_coord GL_EXT_separate_specular_color GL_EXT_rescale_normal GL_ARB_ES2_compatibility GL_ARB_fragment_shader GL_ARB_vertex_shader GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ATI_texture_env_combine3 GL_ATIX_texture_env_route GL_NV_texture_env_combine4 GL_NV_fog_distance GL_ARB_draw_instanced GL_ARB_instanced_arrays GL_ARB_vertex_program GL_ARB_fragment_program GL_EXT_program_parameters SDL_GL_RED_SIZE: 8 SDL_GL_GREEN_SIZE: 8 SDL_GL_BLUE_SIZE: 8 SDL_GL_DEPTH_SIZE: 16 SDL_GL_DOUBLEBUFFER: 1 export LIBGL_FB=4 # GBM export LIBGL_DRMCARD=/dev/dri/card1 unset LIBGL_DRMCARD export SDL_VIDEODRIVER=kmsdrm # x11 wayland KMSDRM RPI dummy unset LIBGL_NOTEST export LIBGL_FPS=1 export SDL_VIDEODRIVER=kmsdrm # x11 wayland KMSDRM RPI dummy export LIBGL_FB=4 # GBM export LIBGL_DRMCARD=/dev/dri/card1 export LD_LIBRARY_PATH=/usr/lib/gl4es export LIBGL_POTFRAMEBUFFER=0 unset LIBGL_POTFRAMEBUFFER export LIBGL_FORCENPOT=1 unset LIBGL_FORCENPOT
readelf -s /usr/games/pinball | awk '{ print $8 }' | sort | uniq | grep '^gl' glBegin # GL1.3 GL2.1 glBindTexture # GL1.3 ES 2.0 glBlendFunc # GL1.3 glClear glClearColor glClearDepth glColor3f glColor4f glCullFace # GL1.3 glDeleteTextures glDepthFunc glDepthMask glDisable glEnable glEnd glFrontFace glFrustum # GL1.3 glGenTextures glGetString glLoadIdentity glMatrixMode glPolygonOffset glShadeModel # GL1.3 glTexCoord2f glTexEnvf glTexImage2D glTexParameteri glVertex3f glViewport readelf -s /usr/lib/gl4es/libGL.so | awk '{ print $8 }' | sort | uniq | grep '^gl' export LIBGL_VSYNC=1 export LIBGL_SHRINK=1 export LIBGL_BATCH=100 export LIBGL_FASTMATH=1 export LIBL_FBOUNBIND=1 export LIBGL_FLOAT=2
# wget http://repo.novena.io/debian/pool/main/k/kosagi-repo/kosagi-repo_1.2-r1_all.deb # sudo dpkg -i kosagi-repo_1.2-r1_all.deb # echo 'deb http://repo.novena.io/repo main contrib non-free' | sudo tee -a /etc/apt/source.list.d/jookia.lst
apt-cache search armada # xserver-xorg-video-armada-etnadrm - Xorg X server -- Armada DRM Etnaviv-based GPU acceleration
sudo apt-get install xserver-xorg-video-armada-etnadrm # from rzr TODO
url='http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/plain/conf/xorg-sample.conf?h=unstable-devel' curl $url | sudo tee /etc/X11/xorg.conf
docker run -ti ubuntu:18.04 $SHELL