[mythtv] Some thoughts about myth & ARM video decode aspects

Piotr Oniszczuk piotr.oniszczuk at gmail.com
Tue Oct 30 17:49:12 UTC 2018


Guys,

Encouraged by recent mainline kernel/mesa support for rpi (fully working myth with OpenGL UI+playback; but no hw accell) I started to think about myth can support all those small factor ARM boxes able to play 4k at 60p and costing fraction when compared to x86 solutions.

There is huge variety of SoC vendors but unfortunatelly lack of standard approach for hw accell video decode (when compared to x86 world).

Generally: majority of SoC have separate 3D engine and separate hw video decode block - so I think future MythTV planing (if any) should carefully select what software architecture to chose…

Let see rpi as example:
It has now pretty good 3D support (mainline kernel/mesa allows to play SD content with OpenGL playback profile no problem on rpi3). 
But hw accell video decode on mainline upstream is not possible (yet).
Really frustrating.  
AFAIK only choice is still bcrm blobs licensed for rpi and offering api which are not compatible with khronos OpenGL (so Qt needs to be custom built; supported myth painter is only qt).
There are plans to address this i.e. by https://anholt.github.io/twivc4/2018/05/30/twiv/ 
but so far I didn’t see much progress :-(

Recent things like i.e. 10-bit H.265 up to 4K 60fps capable player for 66$: 
https://www.cnx-software.com/2018/10/19/beelink-gt1-mini-s905x2-tv-box-voice-air-mouse/

or 47$
https://www.cnx-software.com/2018/09/25/x96-max-amlogic-s905x2-tv-box/
(just examples) 

directed me to a bit research how myth can do video decode on such boxes.
 
Option1 is recent nice work on myth Android app.
(I’m wonder Your opinion guys - how such boxes are supported by current master - especially for 4k content)

Option2 is mythfrontend app running under kind of standard linux os (not Android).

Looking where ARM ecosytem goes today regarding hw based video decode - it looks like V4L2 is definite future
(IMHO good overview: https://events.static.linuxfound.org/images/stories/pdf/lceu2012_debski.pdf)

Key SoCs seems to be already actively going towards v4l2:

AmLogic: 
http://linux-meson.com/doku.php
https://github.com/Elyotna/linux

AllWinner:  
https://linux-sunxi.org/Sunxi-cedrus
https://github.com/bootlin/linux-cedrus/tree/cedrus/4.19/requests-api-v18

Others:
http://linux-sunxi.org/V4L2_mem2mem_Others

If You look how v4l2 m2m works, there are 2 aspects:
- input toward v4l2 decoder
- output from v4l2 decoder
 
For v4l2 input I see 2 major options:

1: proxy between myth already implemented myth video api and v4l2
example vaapi-to-v4l2 requestor: https://github.com/bootlin/libva-v4l2-request
 
2: myth feeding video bitstream directly to ffmpeg 

For v4l2 output I see options like this:

A: proxy between myth already implemented api and v4l2
(I understand vaapi-to-v4l2 requestor can realise both: input towards v4l2 and output from v4l2)   

B: ffmpeg with v4l2 m2m hw_accell; decoded video output mixed with OpenGL UI via myth renderer (is it possible today?)

C: v4l2 m2m; decoded video output mixed with OpenGL UI via mesa api by GLES textures 

D: v4l2 m2m; decoded video output mixed with OpenGL UI via DRM prime

(BTW: there is very interesting youtube video about C & D: https://www.youtube.com/watch?v=pF6i19oscqg)

So quite interesting seems to be architecture is 1A (and low hanging fruit) .
But probably most prospective is: 2D
2C is also effective - but require GLES with EGL_image_dma_buf_export and probably not every SoC has this (in mesa nor vendor blobs)

Comparing 1A with 2D[C]:
1A:
+ is practically already implemented on myth side (i mean vaapi; v4l2 is kernel thing so this is outside of myth)
- probably expensive mem copy operations (assuming there is no zero-copy things like dam_bufs)

2D[C]:
- requires implementation
+ can offer really max. hardware exploitation (hw video decode; DMA for zero-copy mem operations; etc). But for really high processing/bitrate videos (4k at 60p) this will be probably only choice

I’m wonder what smart ppl out there are thinking about all above? 

PS: I’m really tempted to buy i.e:

https://botland.com.pl/android-box-smart-tv/10033-android-71-smart-tv-box-tx3-mini-quadcore-2gb-ram-16gb-rom.html?search_query=S905x&results=5

and start to play with 1A - but strongly afraid that even if it will play OK - CPU load due mem copy will be show stopper…
 

  


       
   


More information about the mythtv-dev mailing list