===== HARDWARE =====
STM32MP157 Arm®-based dual Cortex®-A7 32 bits + Cortex®-M4 32 bits MPU in TFBGA361 package
* https://www.st.com/en/microcontrollers-microprocessors/stm32mp157c.html# 800 MHz
* 4" TFT 480×800 pixels with LED backlight, MIPI DSISM interface, and capacitive touch panel
* https://www.st.com/resource/en/data_brief/stm32mp157c-dk2.pdf
* https://fccid.io/EEC/RU0000042104# STM32MP157C-DK2
* https://fccid.io/VPYLB1DX#
===== FEEDBACK WELCOME =====
Here are work in progress notes, hints are welcome
Follow up to date work in progress:
* https://purl.org/rzr/pinball#
Reach me at :
* https://mastodon.social/@rzr/104344278444742428
* https://twitter.com/RzrFreeFr/status/1273329211076415495
===== DEBIAN INSTALL =====
I am using debian as main os and can explain steps
==== TODO ====
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)
* https://tracker.debian.org/pkg/linux#
==== TFTP ====
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
==== U-Boot ====
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}
==== EXTLINUX ====
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<
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
* https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
==== iSCSI ====
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:
* linux-image-5.6.0-2-armmp-lpae
* [!!] Configuring open-iscsi / Upgrade... / Yes
=== Reboot ===
* https://wiki.debian.org/SAN/iSCSI
TODO
=== RootFs ===
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
===== SD =====
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
==== UBOOT ====
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}
* https://christian-gmeiner.info/2019-12-19-stm32/
* https://gist.github.com/austriancoder/4b6ea334925e3069d8e8a168034eb097
==== CUSTOM KERNEL ====
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
* https://tracker.debian.org/pkg/linux#
* https://salsa.debian.org/kernel-team/linux
* https://github.com/RobertCNelson/armv7-lpae-multiplatform/commits/v5.7.x
* https://www.kernel.org/# v5.7.2
* https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?h=next-20200613
* https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git/
* https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git/commit/?h=stm32-next&id=a352e2b337b827403b01df2a88059e873cc8c171
* https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git/log/?h=stm32-next
* https://github.com/torvalds/linux/commit/f56f1579a094573104ffb0e81b623528d992b73c# gc400
* https://github.com/RobertCNelson/armv7-lpae-multiplatform/blob/v5.7.x/patches/soc/stm32_dtbs/0001-Add-stm32-DTBS-v5.6.x.patch
==== DMESG ====
[ 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
===== X11 / XORG =====
(==) 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
* https://tracker.debian.org/pkg/xorg-server#
* https://bugzilla.redhat.com/show_bug.cgi?id=1387793
* https://codesearch.debian.net/search?q=armada&literal=1
* https://wiki.debian.org/InstallingDebianOn/Wandboard
* https://gitlab.freedesktop.org/xorg/xserver/-/commits/master?&search=etnaviv
==== X11 DRIVER ====
Etnaviv X.Org driver is Xf86-video-armada (2D) with DRI2
* http://git.yoctoproject.org/cgit/cgit.cgi/meta-freescale/tree/recipes-graphics/xorg-driver
* https://gitlab.com/jcgit/xf86-video-imx-vivante
* http://www.linuxfromscratch.org/blfs/view/7.4/x/x7driver.html
==== GPU ====
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"
* https://raw.githubusercontent.com/etnaviv/galcore_headers/master/include_stm32_v6.2.4.p3.174315/gc_feature_database.h# gc7000nano_0x4652
* https://github.com/etnaviv/etna_viv/commit/516304922a7c2583a6dd9b6299972cfcfbc14d68
apt remove libetnaviv-headers-1.0
/usr/include/libetnaviv/src/etnaviv/common.xml.h
* https://wiki.st.com/stm32mpu/wiki/Category:GPU
* https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2868
* https://www.cnx-software.com/tag/etnaviv/
* https://www.st.com/content/ccc/resource/technical/document/programming_manual/group0/8b/12/ae/c9/21/c5/41/50/DM00596687/files/DM00596687.pdf/jcr:content/translations/en.DM00596687.pdf
* https://www.st.com/content/ccc/resource/technical/document/user_manual/group1/eb/45/d9/2c/bc/6d/42/fd/DM00596663/files/DM00596663.pdf/jcr:content/translations/en.DM00596663.pdf
* https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-online-training/stm32mp1-online-training.html
===== VIVANTE =====
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
* https://www.st.com/en/microcontrollers-microprocessors/stm32mp157c.html
* https://www.st.com/resource/en/datasheet/stm32mp157c.pdf# OpenGL 2.1
* https://en.wikipedia.org/wiki/Vivante_Corporation
* http://www.vivantecorp.com/index.php/en/technology/3d.html
* https://github.com/etnaviv/vivante_kernel_drivers
* https://github.com/Freescale/kernel-module-imx-gpu-viv
* https://raw.githack.com/etnaviv/etna_viv/master/doc/gpus_comparison.html#
* https://www.phoronix.com/scan.php?page=news_item&px=Etnaviv-Vivante-XDC2015
* https://www.x.org/wiki/Events/XDC2015/Program/Stach_etnaviv.pdf 2015
* https://www.cnx-software.com/tag/vivante
* https://schd.ws/hosted_files/elciotna18/7d/2018_elc_na.pdf
* http://www.vivantecorp.com/index.php/en/media-article/news/277-20140403-vivante-gc7000-delivers-desktop-graphics-to-mobile.html#
* https://community.st.com/s/question/0D53W000009gH7RSAU/does-dk2-include-npu-galcoreko#
==== GC NANO ====
ls gcnano-userland-multi-6.2.4.p4-20190626/usr/include/# EGL gbm.h GLES GLES2 KHR VG
* https://github.com/STMicroelectronics/gcnano-binaries
* https://github.com/STMicroelectronics/meta-st-stm32mp/blob/thud/recipes-graphics/gcnano-userland/gcnano-userland-binary.inc
==== DEBIAN ====
* https://build.opensuse.org/package/show/home:rzrfreefr/libetnaviv-headers
* https://build.opensuse.org/package/show/home:rzrfreefr/xf86-video-armada
* https://build.opensuse.org/package/show/home:rzrfreefr/libdrm-armada
* https://build.opensuse.org/package/show/home:rzrfreefr/linux
==== DT ====
* https://wiki.st.com/stm32mpu/wiki/GPU_device_tree_configuration# dts
* https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/stm32mp157c-dk2.dts
* https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/stm32mp157.dtsi
* https://github.com/STMicroelectronics/linux/blob/v4.19-stm32mp/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
* https://github.com/STMicroelectronics/linux/blob/v4.19-stm32mp/arch/arm/boot/dts/stm32mp157c.dtsi
* https://github.com/torvalds/linux/commits/master/arch/arm/boot/dts/stm32mp157c-dk2.dts
* https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git/log/arch/arm/boot/dts/stm32mp157c-dk2.dts?h=stm32-next
* https://github.com/RobertCNelson/stm32-DeviceTrees/commit/1fbcd2d328bb6e4dfa5061059851c84e981963f7
* https://github.com/RobertCNelson/armv7-lpae-multiplatform/blob/v5.7.x/patches/git/STM32DTBS
==== KERNEL DRM ====
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"
* https://cgit.freedesktop.org/drm/drm-misc/log/
* https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/stm/drv.c#n233 "stm32-display"
===== 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",
* https://novena.jookia.org/pool/main/libe/libetnaviv-headers/# 2020
* http://repo.novena.io/repo/pool/main/libe/libetnaviv/# 2015
* https://codesearch.debian.net/search?q=etnaviv
* https://github.com/etnaviv/libetnaviv/issues/1
* https://github.com/etnaviv/etna_viv
* https://github.com/laanwj/etna_viv/wiki
* https://github.com/austriancoder/etna_viv
* https://github.com/novena-next/docs# libetnaviv-headers
* https://github.com/novena-next/etna_viv/blob/novena-debian/debian/libetnaviv-headers.install
* https://github.com/novena-next/xf86-video-armada/blob/master/debian/rules#L6
* https://cgit.freedesktop.org/mesa/mesa/tree/src/etnaviv?h=20.1
* https://cgit.freedesktop.org/mesa/drm/tree/etnaviv?h=libdrm-2.4.102
* https://archive.fosdem.org/2016/schedule/event/etnaviv/#attachments/slides/1206/export/events/attachments/etnaviv/slides/1206/FOSDEM2016_Etnaviv.pdf
* https://github.com/sarnold/meta-small-arm-extra/blob/morty/recipes-graphics/etnaviv/etnaviv-headers_0.0.1.bb
* https://lwn.net/Articles/659391/# 2015
==== ETNAVIV KERNEL ====
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
author: Russell King
author: Christian Gmeiner
parm: job_hang_limit:int
parm: hw_job_limit:int
parm: dump_core:bool
* https://github.com/torvalds/linux/commits/master/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
* https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/etnaviv/etnaviv_drv.c#L522 20151214
* https://patchwork.kernel.org/patch/7768181/#
* https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/gpu/vivante%2Cgc.yaml
* https://lwn.net/Articles/639270/
=== DRM etnaviv1 ===
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
* https://tracker.debian.org/pkg/libdrm# libdrm-etnaviv1
* https://cgit.freedesktop.org/mesa/drm/tree/tests?h=libdrm-2.4.102
==== MESA3D / ETNAVIV ====
2 parts : DRI and Gallium driver
* https://cgit.freedesktop.org/mesa/mesa/log/?qt=grep&q=Etnaviv#
* https://cgit.freedesktop.org/mesa/mesa/log/?qt=grep&q=GC400#
* https://docs.mesa3d.org/relnotes/20.1.0.html#
* https://tracker.debian.org/pkg/mesa# [2020-05-22] Accepted mesa 20.1.0~rc4-1
* https://cgit.freedesktop.org/mesa/mesa/commit/?id=c9e8b49b885242d84ba031dacef5aa4a5ac1e5b6# 2017
=== ETNAVIV/ DRI ===
* https://cgit.freedesktop.org/mesa/mesa/tree/src/etnaviv
* https://cgit.freedesktop.org/mesa/mesa/tree/src/etnaviv/drm-shim/README.md
* https://cgit.freedesktop.org/mesa/mesa/tree/src/etnaviv/drm-shim/etnaviv_noop.c?id=bd5cf70d3db711c31a2f2fca4eb05e20c185e38c#n44# GC400
* https://cgit.freedesktop.org/mesa/mesa/commit/?id=d3fa18a1fa2b36e90c52e0f5809900dadf80d83f# etnaviv: drm-shim: add GC400
=== ETNAVIV/ Gallium ===
stm_dri.so is gallium driver for GC400
* https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/etnaviv#
* https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1582# (stm_dri.so)
* https://cgit.freedesktop.org/mesa/mesa/commit/src/gallium?id=4f75ea57c21bdd4100bb8a17d4823eb32f2864# gallium: add stm DRM entry point
==== ETNAVIV debian ====
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'
=== armada ===
TODO read:
* http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/tree/FAQ?h=unstable-devel&id=52e29ae4defe9ee0cae738f9a49539d1766c38fe
=== LIB DRM ===
Userspace interface to kernel DRM services,
etnaviv support has been upstreamed into Mesa:
* https://cgit.freedesktop.org/mesa/drm/log/etnaviv
* https://cgit.freedesktop.org/mesa/drm/tree/etnaviv/libdrm_etnaviv.pc.in
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
* https://tracker.debian.org/pkg/libdrm
* https://salsa.debian.org/xorg-team/lib/libdrm/-/blob/debian-unstable/debian/control
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
=== LIB DRM ARMADA ===
libdrm_armada provides the DDX
* https://en.wikipedia.org/wiki/Device_Dependent_X
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
* http://git.arm.linux.org.uk/cgit/libdrm-armada.git/tree/debian/changelog# (2018)
* https://pkgs.org/search/?q=armada# FedorA
* https://src.fedoraproject.org/rpms/libdrm-armada/blob/master/f/libdrm-armada.spec
* https://novena.jookia.org/pool/main/libd/libdrm-armada/
* https://bugzilla.redhat.com/show_bug.cgi?id=1703381
* https://github.com/d4ddi0/meta-etnaviv/blob/master/recipes-graphics/drm/libdrm-armada_git.bb
* https://github.com/maximeh/buildroot/blob/master/package/libdrm/libdrm.mk
* https://patchwork.ozlabs.org/project/buildroot/patch/20180202145526.20133-2-Evgeniy.Didin@synopsys.com/# libdrm-armada
* https://github.com/sarnold/libdrm-armada
=== XORG ARMADA ===
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
* https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c#L26
* https://cgit.freedesktop.org/mesa/mesa/commit/?id=d3fa18a1fa2b36e90c52e0f5809900dadf80d83f
* https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3195
* https://github.com/xobs/xserver-xorg-video-armada/issues/1#
* https://github.com/VCTLabs/xf86-video-armada/commits/devel# 2018
* https://github.com/clinew/xserver-xorg-video-armada/tree/xorg-1.20.3# 2018
* https://pkgs.org/search/?q=xorg-x11-drv-armada# FedorA 30
* https://archlinuxarm.org/packages/armv7h/xf86-video-armada# Arch
* https://github.com/twoerner/meta-etnaviv/blob/master/recipes-graphics/xorg-driver/xf86-video-armada_git.bb
* https://archlinuxarm.org/forum/viewtopic.php?f=5&t=11287
* https://github.com/xobs/xserver-xorg-video-armada/blob/novena-r2/src/armada_module.c#L35 88AP16x 88AP510
=== Xorg DRM ===
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
* https://github.com/etnaviv/libetnaviv/blob/master/src/viv.h
* http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/tree/README
* http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/tree/README?h=unstable-devel
* http://repos.rcn-ee.com/debian/pool/main/x/xf86-video-armada/?C=M;O=A
* https://github.com/etnaviv/galcore_headers/tree/master/include_arnova
* https://codesearch.debian.net/search?q=viv_open
* http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/commit/?h=unstable-devel&id=34357ebc0bee3554bb63e96819d2559606d1bec8
* https://community.nxp.com/thread/443216#
* https://github.com/etnaviv/galcore_headers/tree/master/include_stm32_v6.2.4.p3.174315
===== MESA3D =====
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
* https://www.mesa3d.org/
* https://tracker.debian.org/pkg/mesa
* https://docs.mesa3d.org/envvars.html
* https://cgit.freedesktop.org/mesa/mesa/log/?qt=grep&q=STM32#
===== Etnaviv MESA driver =====
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
* https://gitlab.freedesktop.org/mesa/mesa/-/tree/master/src/gallium/drivers/etnaviv
* https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3195# (GC400)
* https://cgit.freedesktop.org/mesa/mesa/tree/src/etnaviv/drm-shim/README.md
* https://www.pengutronix.de/en/blog/2017-09-28-etnaviv.html
* https://gitlab.freedesktop.org/marex/mesa/-/branches
==== GLAMOR ====
GLAMOR to accelerate 2D graphical over Mesa
xserver-xorg-core: /usr/lib/xorg/modules/libglamoregl.so
cat<
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/987# Glamor
* https://cgit.freedesktop.org/xorg/xserver/tree/glamor/glamor.c#n745 etnaviv
* https://cgit.freedesktop.org/xorg/driver/glamor/tree/src/glamor.c#n311 legacy
* https://marc.info/?l=freedesktop-xorg-devel&m=152000841901464&w=2
* https://lists.freedesktop.org/archives/etnaviv/2017-November/001238.html# 2.1
===== WAYLAND ======
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
* https://wayland.freedesktop.org/faq.html
==== SDL2 WAYLAND ====
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
* https://github.com/Neverball/neverball
* https://salsa.debian.org/games-team/chromium-bsu
* https://www.khronos.org/registry/OpenGL/specs/gl/glspec13.pdf
===== SDL2 =====
Debian ship SDL2 with some backends
apt-cache rdepends libsdl2-2.0
# SDL_VIDEODRIVER available: x11 wayland dummy
export SDL_AUDIODRIVER=dummy
===== KMS =====
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
* https://wiki.st.com/stm32mpu/wiki/DRM_KMS_overview
===== EGL =====
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
===== KMS / EGL =====
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
* https://tracker.debian.org/pkg/kmscube
* https://cgit.freedesktop.org/mesa/kmscube/tree/README.md
* https://mntre.com/media/tech_notes_md/2018-11-19-using-modesetting-with-etnaviv.html# (GC3000)
* https://forum.armbian.com/topic/5709-cubox-i4pro-and-x11-gpu-support/
* https://packages.qa.debian.org/libg/libglvnd.html
===== GALLIUM =====
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 /<>/build/src/gallium/targets/dri/libgallium_dri.so to /<>/debian/tmp/usr/lib/arm-linux-gnueabihf/dri/armada-drm_dri.so
* https://buildd.debian.org/status/fetch.php?pkg=mesa&arch=armhf&ver=20.1.1-1&stamp=1591875381&raw=0
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
* https://phoronix.com/scan.php?page=news_item&px=OpenGL-2.1-Etnaviv
* https://cgit.freedesktop.org/mesa/mesa/commit/?id=0a23841a98dacad1fbc81f34479ce194e86fc99a
* https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/etnaviv/README
===== OPENGL =====
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
* https://docs.mesa3d.org/envvars.html
* https://www.khronos.org/opengl/wiki/History_of_OpenGL#OpenGL_1.3_.282001.29
* https://khronos.org/registry/OpenGL/specs/gl/glspec13.pdf
* https://feedback.wildfiregames.com/report/opengl/device/Gallium%200.4%20on%20llvmpipe%20(LLVM%203.4,%20128%20bits)
===== SDL =====
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
* https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlenvvars.html
* https://stackoverflow.com/questions/57672568/sdl2-on-raspberry-pi-without-x/57684805#57684805
* https://hg.libsdl.org/SDL/rev/9cd9e14912279fb342ec9c83a4a5cd1e7b1890ee
* https://build.opensuse.org/package/live_build_log/home:rzrfreefr:snapshot/libsdl2/Debian_10/armv7l
* https://hg.libsdl.org/SDL/file/default/configure#l19798
* http://www.linuxfromscratch.org/blfs/view/svn/multimedia/sdl.html
===== SDL2 KMSDRM =====
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 < ~/.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
* https://wiki.libsdl.org/FAQUsingSDL
* https://github.com/ptitSeb/gl4es/issues/85
* https://stackoverflow.com/questions/57672568/sdl2-on-raspberry-pi-without-x#
===== GL4ES =====
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
===== GL4ES X11 =====
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
* https://build.opensuse.org/package/show/home:rzrfreefr/gl4es
* https://forum.armbian.com/topic/8352-tutorial-opengl-apps-on-opengl-es-gl4es/
* https://github.com/ptitSeb/gl4es/issues/85
==== GL4ES WAYLAND ===
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)
===== SDL2+GL4ES FB =====
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
===== SDL KMS =====
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!
* https://dev.to/noah11012/using-sdl2-opening-a-window-79c
===== GBM =====
GBM is intended to be used as a native platform for EGL
* https://en.wikipedia.org/wiki/Mesa_(computer_graphics)#
* https://www.x.org/wiki/Events/XDC2014/XDC2014RitgerEGLNonMesa/
===== GLES =====
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
* https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglInitialize.xhtml
* https://github.com/ptitSeb/gl4es/issues/170
* https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglChooseConfig.xhtml
* https://community.st.com/s/question/0D53W000003xPIU/direct-use-of-sdl-with-kms-drm
===== TODO =====
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*+
* https://tracker.debian.org/pkg/xorg-server# /usr/bin/Xwayland
===== SDL2 tests =====
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
===== SDL GLES2 =====
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
==== SDL gl2 =====
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
===== PINBALL =====
==== PINBALL X11 =====
# 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
==== PINBALL X11 SDL2 =====
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
==== PINBALL WAYLAND =====
Needs SDL2 port
cat < 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
* https://perf.wiki.kernel.org/index.php/Tutorial
==== PINBALL on KMS ====
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
===== PINBALL GLES =====
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
* https://en.wikibooks.org/wiki/OpenGL_Programming/OpenGL_ES_Overview
* https://community.khronos.org/t/list-of-opengl-functions-per-version/68860
* https://www.khronos.org/registry/OpenGL/index_gl.php#specfiles
* https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glBegin.xml
* https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glBindTexture.xml#
* https://stackoverflow.com/questions/6408202/how-do-i-replace-glbegin-and-related-functions-in-opengl-es-2-0#
===== OS =====
* http://ubuntu.unitedcolo.de/archlinux-arm/armv7h/alarm/
===== Community =====
* https://www.kosagi.com/forums/search.php?action=show_user_posts&user_id=633# Jookia Thx
* https://xobs.io/author/sean/# Sean "xobs" Cross
* https://nullr0ute.com/tag/gpus/# FedorA
==== Jessie ====
* https://www.kosagi.com/w/index.php?title=Updating_novena_repo_key
# 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
==== debian:10+ Buster ===
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
===== STM32MP157AAC =====
* https://wiki.dh-electronics.com/index.php/Avenger96
* STM32MP157AAC: 2x ARM® Cortex-A7 up to 650 MHz + 1x ARM® Cortex-M4 up to 209 MHz
* GPU 1x 3D GPU Vivante® @ 533 MHz - OpenGL® ES 2.0
* https://www.dropbox.com/s/u8nihe1xd6ysk3v/SCH_588-200-HS00008-public_R07_2019-08-01.pdf?dl=0
* https://github.com/dh-electronics/manifest-av96/blob/thud/default.xml
* https://mastodon.social/@rzr/104387325455327941
docker run -ti ubuntu:18.04 $SHELL
===== MISC =====
* https://www.xypron.de/projects/u-boot/iscsi.html
* https://gitlab.denx.de/u-boot/u-boot/-/blob/master/doc/uefi/iscsi.rst
* https://fosdem.org/2020/schedule/event/firmware_duwu/
* https://wiki.debian.org/DebianInstaller/Arm/OtherPlatforms
* https://git.busybox.net/buildroot/tree/board/stmicroelectronics/stm32mp157c-dk2
* https://git.busybox.net/buildroot/tree/configs/stm32mp157c_dk2_defconfig# 5.3.7
* https://www.slideshare.net/ennael/kernel-recipes-2017-an-introduction-to-the-linux-drm-subsystem-maxime-ripard
* https://git.linaro.org/arm/xorg/driver/xf86-video-armsoc.git/tree/README
* https://github.com/koansoftware/koan-stm32mp-bsp-repo/tree/thud# Yocto
* https://github.com/koansoftware/koan-stm32mp-bsp-base
* https://docplayer.net/160810411-Challenges-of-using-containers-to-run-graphical-embedded-systems-diego-rondini.html
* https://elinux.org/images/6/6c/ELC_2019_-_Graphical_Containers_on_Embedded_Presentation.pdf
* https://github.com/Freescale/kernel-module-imx-gpu-viv
* https://www.kynetics.com/news
* http://dri.sourceforge.net/doc/DRIintro.html
* http://dri.sourceforge.net/doc/vendor_relationships_paper.html
* https://www.collabora.com/news-and-blog/blog/2021/03/03/asymmetric-multi-processing-with-linux-and-zephyr-on-stm32mp1/
* https://blog.st.com/stm32cube-ecosystem/#
* https://www.st.com/content/ccc/resource/technical/document/user_manual/group0/10/0d/a5/a2/7e/b9/4c/ca/DM00321394/files/DM00321394.pdf/jcr:content/translations/en.DM00321394.pdf DisplaY FRD397B2509V2
===== RELATED =====
@TaG: SbC