Dobrica Pavlinušić's random unstructured stuff
Tegra: Revision 10
{file: Tegra2_TRM_DP04508001v01p.pdf}

I will try to collect useful stuff about Tegra latest upstream source on this page.

^ Nvidia Tegra 2/3 APX/nv3p protocol implementation

* https://github.com/AndroidRoot/wheelie

^ qemu

https://github.com/digetx/tegra2_qemu

^ i2cdetect

.pre
root@ac100:~# i2cdetect -l
i2c-1 i2c 7000c400.i2c I2C adapter
i2c-2 i2c 7000d000.i2c I2C adapter
i2c-0 i2c 7000c000.i2c I2C adapter
root@ac100:~# i2cdetect -y 0
Error: Can't use SMBus Quick Write command on this bus
root@ac100:~# i2cdetect -F 0
Functionalities implemented by /dev/i2c-0:
I2C yes
SMBus Quick Command no
SMBus Send Byte yes
SMBus Receive Byte yes
SMBus Write Byte yes
SMBus Read Byte yes
SMBus Write Word yes
SMBus Read Word yes
SMBus Process Call yes
SMBus Block Write yes
SMBus Block Read no
SMBus Block Process Call no
SMBus PEC yes
I2C Block Write yes
I2C Block Read yes
root@ac100:~# i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 4f
50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
.pre

^ grate-driver tegra2 support for mainline

https://github.com/grate-driver

https://github.com/grate-driver/grate/wiki/Grate-driver

.pre
https://wiki.debian.org/CreatePackageFromPPA

https://code.launchpad.net/~grate-driver/+archive/ubuntu/ppa

sudo apt install devscripts build-essential software-properties-common

sudo add-apt-repository ppa:grate-driver/ppa

# enable only deb-src (suggested beaver doesn't work for me)

root@tegra20:/home/dpavlin# cat /etc/apt/sources.list.d/grate-driver-ubuntu-ppa-disco.list
#deb http://ppa.launchpad.net/grate-driver/ppa/ubuntu beaver main
deb-src http://ppa.launchpad.net/grate-driver/ppa/ubuntu disco main


apt update # make sure that is pass, use apt-key adv --recv-key if needed

# build order is important

apt-get build-dep libdrm
apt source --build libdrm
dpkg -i libdrm*.deb


apt-get build-dep xserver-xorg-video-opentegra

apt source --build xserver-xorg-video-opentegra

# this will fail to instal because of libturbojpg dependency

root@x200:/home/dpavlin/grade-build/xserver-xorg-video-opentegra-201901152016~grate~feac058~ubuntu19.04.1# vi debian/control

Package: xserver-xorg-video-opentegra
Architecture: armhf
Depends: ${shlibs:Depends}, ${misc:Depends}, ${xviddriver:Depends},
libdrm-tegra0, liblz4-1, libturbojpeg0 (>= 1.5.0), libpng16-16,
Provides: ${xviddriver:Provides}
Description: X.Org X server -- Opensource driver for NVIDIA Tegra.
This package provides HW-accelerated opensource driver for NVIDIA
Tegra20+ SoC's from the GRATE project <URL:https://github.com/grate-driver>.


root@x200:/home/dpavlin/grade-build/xserver-xorg-video-opentegra-201901152016~grate~feac058~ubuntu19.04.1# dpkg-buildpackage



root@tegra20:/home/dpavlin# apt-get install x11-xserver-utils

root@tegra20:/etc# git diff
diff --git a/X11/xinit/xserverrc b/X11/xinit/xserverrc
index 94494ec..e6c4aa4 100755
--- a/X11/xinit/xserverrc
+++ b/X11/xinit/xserverrc
@@ -1,3 +1,3 @@
#!/bin/sh

-exec /usr/bin/X -nolisten tcp "$@"
+exec /usr/bin/X -listen tcp "$@"


# let's try it

startx

root@tegra20:/home/dpavlin# export DISPLAY=:0
root@tegra20:/home/dpavlin# xhost +
access control disabled, clients can connect from any host

# on another computer

dpavlin@x200:~$ x2x -to tegra20:0 -south


# and one flip of display later, I have working X11 with remote mouse and keyboard

root@tegra20:/home/dpavlin# xrandr --output LVDS-0 --rotation inverted


# to get mesa to compile beause of dependencies, I needed to update to buster

root@tegra20:/home/dpavlin# apt-get build-dep mesa
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
builddeps:mesa : Depends: debhelper (>= 11) but 10.2.5 is to be installed
Depends: quilt (>= 0.63-8.2~) but it is not going to be installed
Depends: x11proto-dev but it is not installable
Depends: libxcb-dri3-dev (>= 1.13) but it is not going to be installed
Depends: libxcb-present-dev (>= 1.13) but it is not going to be installed
Depends: llvm-7-dev (>= 1:7~) but it is not installable
Depends: libwayland-dev (>= 1.15.0) but 1.12.0-1 is to be installed
Depends: libwayland-egl-backend-dev (>= 1.15.0) but it is not installable
Depends: libclang-7-dev (>= 1:7~) but it is not installable
Depends: libclc-dev (>= 0.2.0+git20180917-1~) but it is not going to be installed
Depends: wayland-protocols (>= 1.9) but it is not going to be installed
Depends: libglvnd-core-dev but it is not installable
E: Unable to correct problems, you have held broken packages.


# after buster upgrade and rebuild of everything

(with dpkg-buildpackage)

root@tegra20:/home/dpavlin/grade-build# apt source --build mesa

dpkg -i *.deb

~50 fps with 25% cpu usage in glxgears


root@tegra20:/home/dpavlin/grade-build# apt-get build-dep libvdpau-tegra
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
builddeps:libvdpau-tegra : Depends: libdri2-dev but it is not installable
E: Unable to correct problems, you have held broken packages.


# sigh

root@tegra20:/home/dpavlin/grade-build# apt source --build libvdpau-tegra
...
dpkg-checkbuilddeps: error: Unmet build dependencies: libxv-dev libdri2-dev


root@tegra20:/home/dpavlin/grade-build# apt --fix-broken install
root@tegra20:/home/dpavlin/grade-build# apt-get install libxv-dev

root@tegra20:/home/dpavlin/grade-build/libvdpau-tegra-201901220047~grate~8efb41c~ubuntu18.10.1# vi debian/control

remove libdri2-dev and libdri2

root@tegra20:/home/dpavlin/grade-build/libvdpau-tegra-201901220047~grate~8efb41c~ubuntu18.10.1# dpkg-buildpackage

dpkg -i ../libvdpau-tegra*.deb


.pre

^ partition table support

https://lkml.org/lkml/2020/2/24/1358