Allwinner H6 HEVC?

  • chewitt,

    Not sure if you know off hand how well does an Allwinner H6 running LE Matrix and HEVC? I know there are issues with Amlogic and HEVC currently but is Allwinner development more stable?

  • hieppo At this time, very well. Recently, two HEVC fixes were merged, which will land in LE 10.0.2. However, HEVC already decodes correctly for me, even without those two fixes.

    What are your requirements? Note that 10-bit HEVC also works, but it's decoded and rendered as 8-bit. I'm working on this, but it will take a while to make whole pipeline 10-bit.

  • hieppo At this time, very well. Recently, two HEVC fixes were merged, which will land in LE 10.0.2. However, HEVC already decodes correctly for me, even without those two fixes.

    What are your requirements? Note that 10-bit HEVC also works, but it's decoded and rendered as 8-bit. I'm working on this, but it will take a while to make whole pipeline 10-bit.

    Thanks for the information. I was looking at a cheap H6 box but was sure if I should add another useless box to my inventory of Android box.

    H264 is perfect for all boxes. My main concern is playing HEVC. I have several S905x 1GB RAM boxes. I tried LE Amlogic but it can't do 4K 10bit files. My S912 box has 4K pixelation issue and can't seek 1080p and lower resolution.

    So as long as I don't play 4K or play 1080p and lower from beginning to end. It is good.

    So compared to Amlogic, how is the Allwinner solution? Does it have the same issue? If not what other playing issue does it have?

  • No, issues are not the same. 4K 10-bit decoding works, but as I said, colours are not 100% correct, because it's rendered as 8-bit. I'm working on this.

    I doubt you'll find any 1 GB RAM H6 box. Lowest specs are 2 GB and that's already enough. Note that most boxes use 100 Mbit ethernet for some reason. Also worth considering is wifi. Most chips are not supported, but at least for 3 most popular modules, drivers are WIP. Last but not least, only 2 distinct H6 boxes are supported by LE - Tanix TX6 and Beelink GS1. Most of cheap boxes on market will be compatible with Tanix TX6 image. However, they will probably have different IR remote keymap, which will make them impossible to wake from sleep via IR and of course, you'll have to set up your own IR keymap for navigating.

  • I got H6 Beelink GS1, using it daily for a last few weeks with 1080p TV, so can give some feedback.

    It’s certainly usable, smooth hardware playback 1080p60 8bit for all three relevant codecs H.264/HEVC/VP9. No problems seeking videos.

    10bit HEVC plays just fine, 10bit VP9 isn’t really working yet (decodes to garbled pixels). Can’t vouch for colors, most likely TV only gets 8bit for now.

    4K60 is probably only realistic with HEVC, both H.264 and VP9 hardware decoders seem to only handle 4K30. Had to increase kernel CMA memory reservation while trying 4K60 10bit HEVC, defaults are too low.

    Now, some some bugs and annoyances:

    Hardware deinterlaced videos tend to stuck after resuming from pause, need to seek to get them going again.

    HDMI output can randomly drop out for a second, both during playback and in menu. Probably some output timings issues, since sometimes (rare though) TV gets confused and refuses to display certain Hz videos, requiring on/off cycle, which never happened outputing from my other STBs.

    H6 still needs algorithmdirtyregions=0 set in Kodi, otherwise any video will stutter.

    HDMI CEC seems to be very stable and usable now. But I had to disable it, because Panfrost GPU drivers ability to sleep is still semi-broken, every second or third attempt to suspend fails, so TV gets woken up by CEC, etc.

    Crust co-processor firmware rocks as well, this box consumes pretty much zero watts in sleep. If Panfrost will let you to suspend it, that is :)

    H6 box can also be configured to support pretty much any IR remote, including wakeup button if you bother to rebuild Crust. I certainly did, reused big comfortable remote from old mediaplayer.

    Theoretically, if display output stack gets some upgrades, H6 can become as capable video player as RPI4: 4K60 with 10bits and HDR should be real.

  • Thanks offbeat for the great feedback. It gives me hope since it seems Allwinner abilities currently ahead of Amlogic. S912 with panfrost should be as good but i go l guess dev is a bit behind.

    Btw any Allwinner boxes had gigabit LAN

  • I have a T95 Max box currently that I'm running with the nightly Tanix TX6 images, and in regards to HEVC all my files up to 4k30 play fine, but most 4k60 files struggle for me at the moment.

  • offbeat if you have video sample which causes out of CMA memory issue, I would appreciate if you can provide it to me. However, this should soon become issue of the past, I'm working for some time now on fixing all IOMMU issues and once fixed, Cedrus will use normal memory allocator instead of CMA. Interestingly, IOMMU is great debugging tool. If there is access outside of designated buffer, it complains. This already allowed me to fix some Cedrus bugs. Anyway, if you want to see current progress (some H264 videos and HW deinterlacing doesn't work), you can check https://github.com/jernejsk/LibreELEC.tv/commits/iommu

    GPU suspend issue is really unfortunate, but no panfrost developer on IRC seems to be particularly interested in fixing that (at least at time of asking some time ago). I looked into this quickly, but it's way over my head, GPU drivers are not my cup of tea.

    HDMI output can randomly drop out for a second, both during playback and in menu. Probably some output timings issues, since sometimes (rare though) TV gets confused and refuses to display certain Hz videos, requiring on/off cycle, which never happened outputing from my other STBs.

    I went over BSP HDMI driver code many times now and I believe everything is as it should be with latest nightly images, except maybe some minor HDMI PHY settings. I haven't experience any HDMI related issue for a long time. I learned the hard way that HDMI signal quality also depends on board design. During development of H616 HDMI driver I didn't have any luck of getting 4k output on OrangePi Zero2 board. It turns out, 4k also doesn't work with BSP kernel image. However, on H616 TV box, everything work as expected.

    H6 still needs algorithmdirtyregions=0 set in Kodi, otherwise any video will stutter.

    I don't experience that, not sure why.

    10bit HEVC plays just fine, 10bit VP9 isn’t really working yet (decodes to garbled pixels). Can’t vouch for colors, most likely TV only gets 8bit for now.

    True on all counts. VP9 driver is pretty new, nobody really worked on 10-bit support. I did a quick check, but nothing stands out. It needs detailed analysis. 10-bit HDMI output is being worked on.

    Note that ffmpeg decoding loop is not optimized for speed, ideally RPi ffmpeg code for HEVC should be reused (it uses same interface as Cedrus) since it was already improved for speed. Also HEVC supports AFBC "compression", which makes memory accesses more efficient and that translates to higher decoding speed. Needless to say, that also needs to be added.

    So, H6 still has a lot of untapped potential. Many issues/missing features are being worked on, but currently I'm busier than expected, so progress is slow. Some issues are not addressed at all, mostly because I don't experience them, so any kind of detailed analysis is impossible.

  • if you have video sample which causes out of CMA memory issue, I would appreciate if you can provide it to me.

    Samples – Google Drive

    Two HEVC 4K@60 samples, one seems to be 8-bit, another is 10-bit. Both captured from NASA UHD TV channel, free-to-air on Hotbird 13E satellite.

    H6 can't play any of these with default CMA settings, partially decodes first frame, green screen rest, kernel log full of cma errors. No more errors after booting with cma=1024M, but playback isn't smooth. Also, for some reason Kodi switches from 60p to 30p output after a second of playback.

    I'm outputing to 1080p60 TV, so there is some downscaling involved as well.


    Anyway, if you want to see current progress (some H264 videos and HW deinterlacing doesn't work), you can check https://github.com/jernejsk/LibreELEC.tv/commits/iommu

    Cherry picked iommu commit, xtest.patch doesn't apply, probably something already in master.

    Edited 2 times, last by offbeat: Merged a post created by offbeat into this post. (February 19, 2022 at 11:39 PM).

  • Quick test of iommu commit:

    1) Kodi starts with a few drm_gem errors, but keeps running

    2) Some HEVC videos give iommu faults, requiring reboot. Uploaded F1.x265.2160p50.ts sample to GDrive at the link above.

    Code
    [  111.890421] sun50i-iommu 30f0000.iommu: Page fault for 0x000000000000e000 (master 1, dir rd)
    [  111.890445] IOMMU: Level 1 page error
    [  113.890831] cedrus 1c0e000.video-codec: frame processing timed out!

    3) VP9 10bit videos are failing with iommu fault as well

  • That's actually a good clue! This means some buffer is too small. With a little extra debug output, it shouldn't be that hard to figure which one. Well, there are some additional registers to set, but hopefully, that's all.

  • can try this patch to make VP9 10-bit work (downscaled to 8-bit)

    Tested this patch on both master(cma=1024M) and iommu branch.

    Looking good, not a single error in logs!
    Works for every 8bit and 10bit VP9 sample I've got, all from Youtube anyway.
    10bit HDR plays with washed out colors, but thats probably expected, H6 HDMI hardware tonemapping most likely isn't implemented yet.

    Also tested bare decoding speed with ffmpeg commandline:

    Code
    ffmpeg -hide_banner -hwaccel drm -hwaccel_output_format drm_prime -i sample.mkv  -f null -

    Typical 4K 8bit VP9 decodes at ~32 FPS, and 4K 10bit HDR is slower at ~24FPS. Probably ffmpeg decode path isn't 100% optimized yet.
    Allwinner datasheet only promises "VP9 Profile 0/2 4K@30fps", so 4K@60 most likely isn't achievable on H6.

    I'd say this VP9 fix patch should go to master, nice job!