Jump to content

H2+/H3/H5/A64 Disp2 U-Boot video driver


jernej

Recommended Posts

I managed to write H3 HDMI driver for mainline U-Boot. Source can be found here:

https://github.com/jernejsk/u-boot

 

You should also add CONFIG_VIDEO=y to defconfig for your board.

 

It should work nicely for standard resolutions (720p, 1080p). Other resolutions might work, but some additional work needs to be done. Currently, this can be used for working with U-Boot (instead of serial console) or splash screen.

Link to comment
Share on other sites

Had to do this also to force video driver compilation:

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 68443c9..b10f3a1 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -431,7 +431,7 @@ config AXP_GPIO
 
 config VIDEO
 	bool "Enable graphical uboot console on HDMI, LCD or VGA"
-	depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I
+	depends on !MACH_SUN8I_A83T && !MACH_SUN9I && !MACH_SUN50I
 	default y
 	---help---
 	Say Y here to add support for using a cfb console on the HDMI, LCD

and as a result I'm getting white screen with little noise of different colored pixels.

 

I squashed your patches to one and compiled u-boot 2016.09.01 (Armbian default)

HDMI connected: Setting up a 1920x1080 hdmi console (overscan 0x0)
dotclock: 148500kHz = 148500kHz: (3MHz * 99) / 2
hdmi enabled
In:    serial
Out:   vga
Err:   vga
Net:   phy interface7
eth0: ethernet@1c30000
Hit any key to stop autoboot:  0
Link to comment
Share on other sites

Thanks for testing! Probably framebuffer memory is reserved in wrong part of the RAM, shouldn't be hard to fix. I guess that latest U-Boot RC version has changes in Kconfig. Code in repo works as it is.

Link to comment
Share on other sites

Probably the same issue (or something close) affects r3p0 mali driver on H3. IMO you can ask @ssvb, he should know what needs to be changed.

 

I guess that latest U-Boot RC version has changes in Kconfig. Code in repo works as it is.

Don't know. This piece is still in Kconfig in 2016.11-rc3 and IMO this condition should be removed.

Link to comment
Share on other sites

Probably the same issue (or something close) affects r3p0 mali driver on H3. IMO you can ask @ssvb, he should know what needs to be changed.

 

Well, it could be that the issue is the same. I fixed my U-Boot driver. It seems that we shouldn't adjust addresses at all. Hm... I should test that also with One or Lite, but currently I don't have such board at hand. Do you?

Link to comment
Share on other sites

Works for me

U-Boot 2016.09.01-armbian (Nov 11 2016 - 15:23:04 +0300) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi Plus 2E
I2C:   ready
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0, SUNXI SD/MMC: 1
MMC: no card present
*** Warning - MMC init failed, using default environment

HDMI connected: Setting up a 1280x1024 hdmi console (overscan 0x0)
dotclock: 108000kHz = 108000kHz: (24MHz * 9) / 1 / 2
HDMI PHY divider: 2
pixel_clk: 108000000
pixel_repeat: false
x_res: 1280
y_res: 1024
hor_back_porch: 248
hor_front_porch: 48
hor_sync_time: 112
ver_back_porch: 38
ver_front_porch: 1
ver_sync_time: 3
hor_sync_polarity: true
ver_sync_polarity: true
b_interlace: false
hdmi enabled
In:    serial
Out:   vga
Err:   vga
Net:   phy interface7
eth0: ethernet@1c30000
Hit any key to stop autoboot:  0

Edit: Works without HDMI cable attached too (I'm reading IRC logs)

U-Boot 2016.09.01-armbian (Nov 11 2016 - 15:23:04 +0300) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi Plus 2E
I2C:   ready
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0, SUNXI SD/MMC: 1
MMC: no card present
*** Warning - MMC init failed, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   phy interface7
eth0: ethernet@1c30000
Hit any key to stop autoboot:  0
Link to comment
Share on other sites

I cleaned up driver a bit and another test would be welcomed.

 

Uh, another reason why this driver can be used is boot selection menu, grub style, albeit more simpler. Dual boot (or more), in simpler terms.

Link to comment
Share on other sites

Quick test on OPi Plus2e and OPi PC. Framebuffer configuration (or something else) looks wrong to me both on 1080p and 1280x1024 - image is present only on bottom half of the screen and small tux logo stays at the center of the screen with both resolutions.

 

This sounds more like "splashpos=m,m" present in u-boot environment along with CONFIG_SPLASH_SCREEN_ALIGN enabled at compile time. Do you have by any chance Armbian splash patch enabled?

Link to comment
Share on other sites

This sounds more like "splashpos=m,m" present in u-boot environment along with CONFIG_SPLASH_SCREEN_ALIGN enabled at compile time. Do you have by any chance Armbian splash patch enabled?

Hm. Yes, Igor enabled splash patch after first version of this HDMI driver was added. So nevermind, it's not a bug but a feature.

+	"splashpos=m,m\0" \
+	"splashimage=66000000\0" \
+	"loadsplash=ext4load  mmc 0 ${splashimage} /boot/boot.bmp || fatload  mmc 0 ${splashimage} boot.bmp; bmp d ${splashimage}\0" \
Link to comment
Share on other sites

Yap, no change for 4k monitors.

U-Boot 2016.11-rc2-armbian (Nov 29 2016 - 11:45:31 +0100) Allwinner Technology


CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi PC Plus
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 1, SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment


HDMI connected: Error need 32400kB for fb, but only 16384kB is reserved
In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Link to comment
Share on other sites

It works now in UHD resolution, its a bit hard to read the tiny text, but doable. Logo is in the center, all fine.  :D

U-Boot SPL 2016.11-rc2-armbian (Nov 30 2016 - 06:11:14)
DRAM: 1024 MiB
Trying to boot from MMC2


U-Boot 2016.11-rc2-armbian (Nov 30 2016 - 06:11:14 +0100) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi PC Plus
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 1, SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

HDMI connected: Setting up a 3840x2160 hdmi console (overscan 0x0)
hdmi enabled
In:    serial
Out:   vga
Err:   vga
Net:   phy interface0
eth0: ethernet@1c30000
Link to comment
Share on other sites

 

It works now in UHD resolution, its a bit hard to read the tiny text, but doable. Logo is in the center, all fine.  :D

 

Excellent. Can you make a picture of it? In the evening I will make a bit more chatty U-Boot so we will hopefully see where the problem lies. After that I can try to fix BSP kernel.

Link to comment
Share on other sites

Excellent. Can you make a picture of it? In the evening I will make a bit more chatty U-Boot so we will hopefully see where the problem lies. After that I can try to fix BSP kernel.

 

 

Picture / font is as it should be. I am just refereeing to the fact that font is small due to high screen resolution and since I am usually using Picture In Picture mode for 2nd source. This way I got 4k screen cca. @12 inch :) where u-boot font becomes super tiny small. I failed to made any usable picture, now I left office. I think the best way would be to limit u-boot screen size to 1080p and leave option to force higher with parameter. Such method can than be directly applied to sun4,5,6,7 ... 

Link to comment
Share on other sites

Picture / font is as it should be. I am just refereeing to the fact that font is small due to high screen resolution and since I am usually using Picture In Picture mode for 2nd source. This way I got 4k screen cca. @12 inch :) where u-boot font becomes super tiny small. I failed to made any usable picture, now I left office. I think the best way would be to limit u-boot screen size to 1080p and leave option to force higher with parameter. Such method can than be directly applied to sun4,5,6,7 ... 

 

Nevermind the picture then. Well, while I certainly agree about 1080p limitation for older SoCs, because this is HW limitation, I disagree for newer ones. At least for mainline U-Boot. This functionality is also used for simplefb driver, where it is desirable to have native resolution. But you can always add your own patch a top of mainline.

Link to comment
Share on other sites

Do you know how simplefb driver will interact with DRM driver if we add this patch (in the first message) on top of current branch which has DRM DE2 driver? Is there any way to make simplefb "preferred" over DRM?

 

Unfortunatelly, I don't have full insight in the DRM driver yet. From what I understand, full DRM drivers are preferred against simplefb, so in the process of DRM driver initialization simplefb driver gets disabled. So the only answer I can give you this time is that you can use U-Boot abbility to patch DT and disable DRM driver.

Link to comment
Share on other sites

The only related problem is how to apply those changes to boards where 4k monitor is attached but are not capable of displaying 4k. H2 (and older AW) will be one of those I think? So far we have only one headless unit ...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines