TVout for Orange PI Zero and other H2/H3 boards, Mainline Kernel, WORKING 看全部

Cross posted from Armbian forums, in case people don't read it over there:

I have managed to forward port icenowys code for TVE on the H2+/H3 to mainline armbian.  It seems to work totally fine, with a few caveats.
First: Sample images of it in action ->
Second: the patch itself ->
Third: a prebuilt image for Orange Pi Zero: ->

just put the patch into userpatches for the sunxi-next kernel, and build.  it should apply cleanly. Its for H2+/H3.  I have only tried it on a orange pi zero, but it should work on all H2+/H3 boards.
You then need to edit /boot/armbianEnv.txt
add tve to overlays to enable it.  the driver will only run and enable tv out when the tv out devices are specifically enabled, so i created an overlay which does this.  If you want to turn TV out off, just remove tve from the overlays line.
My armbianEnv.txt overlays looks like this:
  1. overlays=usbhost2 usbhost3 tve
If you want copious amounts of DRM debug info in your logs, add this as well:
  1. extraargs=drm.debug=0xF
Its not needed, unless you really want the debug info.

1. The default mode is PAL, with 720x576 resolution.  Thats outside of normal PAL displayable area, and so the screen overscans.
I dont know how to correct this, although its mostly just annoying with terminals.
I also don't know how to change the video mode to NTSC.

2. The standard font is a bit thin for composite video, and causes slight strobing and color impurity.  Its because PAL needs pixels to be a certain MINIMUM width or color information can not be properly encoded.
A way to resolve this is use :
  1. # apt-get install fbterm
  2. ...
  3. $ fbterm -s 20
This will run a terminal which is easy to change the font, and pick a bigger one.  its much easier to read.  Look at the help for fbterm to work out everything it can do.

3. I used the program "fim" to display the test images.  there are others for doing stuff on the terminal.
4. I haven't tried X.  I am not interested in running an X terminal on a TV, but it should probably work fine.

Other than that it all seems good.  I originally tested my hardware with the legacy kernel, and the image quality from this patch seems superior to what the legacy kernel produces. (legacy was noisy)

The only other thing you need to know is Orange Pi Zero is missing filter circuity from its Composite Output, the most important thing you need to do is put a 50 ohm resistor between the signal and GND.  i soldered one inside my RCA connector, it fits fine and isn't too difficult.  IF you don't do this the image will bloom and look like total crap, so you have been warned.

Its easy enough to build your own image, just follow the guides on how to rebuild armbian.

I also need to mention, all props go to Icenowy Zheng who wrote the original driver.  I just tweaked the device tree stuff and got it in a state where it can apply cleanly to the armbian mainline kernel and build system.
Original code is here:

One question,  With this I can see the ubuntu desktop?
Edited by strontium at 2018-2-28 10:38

Note: I am using Debian Stretch, not Ubuntu.  However, my patch is just for the kernel, so you can apply it and build an Ubuntu image if you like, it will work similarly.

The answer is YES.

Install a desktop using
  1. sudo tasksel

after its all finished properly, reboot.  You will then get this:

if you want to change video mode, you can do it with xrandr like this:
  1. DISPLAY=:0 xrandr --output Composite-1 --mode NTSC
  2. DISPLAY=:0 xrandr --output Composite-1 --mode PAL
You only need the "DISPLAY=:0" if you are doing the mode setting from a ssh terminal.

Supposedly xrandr can scale the desktop and move it around (which could help with the overcan problem) but i couldn't get it to work in the 5 minutes I allocated to testing it.
Thanks for the patch.
It works with NTSC, I just tried it, the resolution is 720x640 in this mode, with a 640x430 displayed window.

For the overscan however, it is not possible to usexrandr to solve the issue to my knowledge. Normally a xrandr --mode 640x430 --panning 720x640 but this mode is not available...

If you find how to enable NTSC at boot, I would be interested !
if anyone is interested, for NTSC at startup, add this to the kernel parameters:
  1. video=Composite-1:720x480
Although it doesn't seem to be possible to fix the overscan issue with xrandr, a possible workaround is to scale the image and declare a panning inside of it so that it is at least 720x{576,480}
For NTSC, I have something like 680x460 with 31x28margins (although my tv is probably not a reference), giving:
  1. xrandr --output Composite-1 --mode NTSC --scale 1.1x1.04 --panning 720x480+34+29
I can't seem to get fbset working to fix the overscan for the console, however.