Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

machybris for developers: exposing rockchip video and graphical hw acceleration in linux apps

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    machybris for developers: exposing rockchip video and graphical hw acceleration in linux apps

    MACHYBRIS
    machybris is a packaged libhybris solution for rockchip devices (RK3288, RK3188, RK312X) that exposes the following android libs that can be used to develop your linux apps:
    - graphical HW acceleration (EGL, GLES libs)
    - rockchips video HW acceleration (vpu, rkon2 libs)
    - androids media service (media lib)
    - makes, for instance, kodi / spmc run in linux (just install mackodi)

    NEW RELEASE
    Finally a new release of machybris (v0.1.1)! It can now also use androids native surfaceflinger as window composer allowing for a smooth vsync at 60 fps. machybris already ran on RK3288 devices, now I also added support for RK3188 and RK312X devices (disclaimer: I only tested this on my good old mk809iii and my FirePrime (sponsored by firefly): so would be interested if this runs on other devices too!)

    EXAMPLE SOURCE CODE
    And with this release see also some example application code to show how you can use machybris for your application development. See: https://github.com/mac-l1/machybris_examples.git. Here you can find the code for the demos that I put on youtube like the h264 movie player and h264 screen recorder. I also put a simple hevc/h265 movie player in there.
    Hope this helps to unleash and show the power of rockchip hardware acceleration in linux applications for all of us!

    Have fun!

    And if you like it: please get me a faster computer by giving a small donation; it will benefit my impatience during compilation, my nails and future releases; any help is welcome!

    Donate..

    Cheers -- mac-l1

    ---

    HOW TO INSTALL

    1) First try my install_machybris.sh script; run this from a terminal/shell started on your rockchip device
    Code:
    sudo apt-get install curl
    curl -O http://mac-l1.com/install_machybris.sh; bash install_machybris.sh
    sudo reboot
    2) Test if this works out-of-the box by running:
    Code:
    test_hwc
    You should see a turning swirl.

    IF NOT) then you probably need to DISABLE FBCON yourself manually. You need to make sure that the framebuffer console (the fbcon kernel module) is not started automatically in kernel. That can be done by:
    a) Either use a kernel that does NOT have the fbcon module builtin, can be done by building kernel with CONFIG_FRAMEBUFFER_CONSOLE=n in kernel configuration file
    b) Or simply put "fbcon=vc:64-63" in the parameter file of your image, just after "CMDLINE:". See the following example:
    "CMDLINE:fbcon=vc:64-63 vmalloc=516M console=ttyFIQ0 console=tty0 init=/sbin/init root=/dev/mmcblk0p2 rootfstype=ext4 bla bla"
    This can be done on an already linux-installed device using rkflashtool for linux to read/write parameter file http://radxa.com/Rock/flash_the_imag....28Advanced.29) or AndroidTool for Windows (read: advanced tab->export image,start=0,count=2, change the parameter file, write: flash it again using download image tab); or use a pre-configured image file.

    HOW TO INSTALL MACHYBRIS EXAMPLES
    See: https://github.com/mac-l1/machybris_examples.git.
    Code:
    sudo apt-get install curl git
    curl -O http://mac-l1.com/install_machybris.sh; bash install_machybris.sh
    sudo reboot
    # after reboot
    git clone https://github.com/mac-l1/machybris_examples.git
    cd machybris_examples
    ./make_all.sh
    Last edited by MAC_L1; 13 November 2015, 12:20.
    Support my work to make you a better multimedia experience...
    And Donate...

    #2
    reserved
    Support my work to make you a better multimedia experience...
    And Donate...

    Comment


      #3
      Hello MAC_L1, I really appreciate your continued work in this area.

      Comment


        #4
        Thanks MAC_L1.

        Whats the preferred kernel version / distro for this?

        Will Linux 4.2 work (I have it booting on Firefly-RK3288), specifically from this branch: https://github.com/mmind/linux-rockc...omewhat-stable ?

        Comment


          #5
          Originally posted by encore2097 View Post
          Thanks MAC_L1.

          Whats the preferred kernel version / distro for this?

          Will Linux 4.2 work (I have it booting on Firefly-RK3288), specifically from this branch: https://github.com/mmind/linux-rockc...omewhat-stable ?
          Do you have the 4.2 kernel running with latest Lubuntu Linux image from Firefly or another Linux image?
          Does it run smoothly and better or is it not very noticeable compared to a 3.10 kernel?

          Comment


            #6
            Originally posted by encore2097 View Post
            Thanks MAC_L1.

            Whats the preferred kernel version / distro for this?

            Will Linux 4.2 work (I have it booting on Firefly-RK3288), specifically from this branch: https://github.com/mmind/linux-rockc...omewhat-stable ?

            Preferred kernels are the ones i tested it for: ubuntu 14.04, 14.10, 15.04 and debian 8, probably also on later versions; there seems to be no difference...

            Linux 4.2 is very interesting. I will check this one soon:
            http://bbs.t-firefly.com/forum.php?m...extra=page%3D1
            I did a try before also getting this kernel working with the veyron mali driver from mmind, but seems pqy did it!
            My hope is that: egl/gles support now works for xf86-arm-soc for X11:


            Then I hope to get rk_ffmpeg runnning: https://github.com/opensourcechipspa...mpeg_linux.git
            Would be a start to get native linux support for VPU - however now hevc doesnt seems to be supported...

            Another way would be to port chromos rk3288 vpu support, as kernel API is higher:
            https://chromium.googlesource.com/ch...orm/rk3288-vpu
            That really does VPU the right way using v4l2 memory sharing.

            Otherwise need to check/port libhybris to 4.2, wouldnt expect too much issues. Will do that myself too.
            Last edited by MAC_L1; 07 November 2015, 08:52.
            Support my work to make you a better multimedia experience...
            And Donate...

            Comment


              #7
              Originally posted by mo123 View Post

              Do you have the 4.2 kernel running with latest Lubuntu Linux image from Firefly or another Linux image?
              Does it run smoothly and better or is it not very noticeable compared to a 3.10 kernel?

              I have Debian 8 and Gentoo booting from mainline u-boot on Firefly. This eliminates the need for parameter files and speeds up boot time. It makes the boot up process much simplier in my mind and provides the ability to have multiple partitons for multi-boot and/or reliability.

              When I benchmarked 4.2, performance was slightly less but CPU was capped at 1.6Ghz vs 1.8 Ghz in 3.10. This could explain the difference, could indicate other issues.


              Originally posted by MAC_L1 View Post


              Preferred kernels are the ones i tested it for: ubuntu 14.04, 14.10, 15.04 and debian 8, probably also on later versions; there seems to be no difference...

              Linux 4.2 is very interesting. I will check this one soon:
              http://bbs.t-firefly.com/forum.php?m...extra=page%3D1
              I did a try before also getting this kernel working with the veyron mali driver from mmind, but seems pqy did it!
              My hope is that: egl/gles support now works for xf86-arm-soc for X11:


              Then I hope to get rk_ffmpeg runnning: https://github.com/opensourcechipspa...mpeg_linux.git
              Would be a start to get native linux support for VPU - however now hevc doesnt seems to be supported...

              Another way would be to port chromos rk3288 vpu support, as kernel API is higher:
              https://chromium.googlesource.com/ch...orm/rk3288-vpu
              That really does VPU the right way using v4l2 memory sharing.

              Otherwise need to check/port libhybris to 4.2, wouldnt expect too much issues. Will do that myself too.
              I'm still unsure on the proper approach/stack to use. Ideally I would like a powerful, capable, inexpensive platform thats fully open source, from the HW to SW. A platform thats light, fast, easy to develop on that delivers buttery smooth (60 fps) graphics and video. I know Firefly is not fully OSHW, yet its a powerful platform which has a community and willing support for the manufacturer, and the RK3288 platform is developed on with ChromeOS (Google) and you can devices are just getting cheaper.

              Getting 60 fps, smooth graphics through HWC on Linux was a great idea, however I still notice tearing with the hwc_test program at 1080p. The H265 big buck bunny video played flawlessly at 1080p and was decoded at ~125 fps.

              What are the benefits of switching to X11? When I've tested 1080p video with X11 there is serious amounts of tearing when videos play.
              Does xf86-arm-soc expose an X11 api while writing directly to the framebuffer? That might work if the the driver takes care of VSYNC to ensure smoothness and I can understand why you would want to reimplement it to bypass the libhybris approach and get a cleaner solution, but is it possible (no h265 decoding source)?

              I'm also checking out the Freon/Ozone graphics stack in ChromeOS, its goals are: light, fast, display manager and it already works for RK3288 (Veyron) devices. I spoke to the ChromeOS folks and alot of the v4l2 patches are not upstream yet so it would require significant work to get it running.

              There seems to be quite a few options and a discussion on the approach would be helpful to know where to focus effort so we can get to a solution that also helps most folks.

              Comment


                #8
                Originally posted by encore2097 View Post
                I'm still unsure on the proper approach/stack to use. Ideally I would like a powerful, capable, inexpensive platform thats fully open source, from the HW to SW. A platform thats light, fast, easy to develop on that delivers buttery smooth (60 fps) graphics and video. I know Firefly is not fully OSHW, yet its a powerful platform which has a community and willing support for the manufacturer, and the RK3288 platform is developed on with ChromeOS (Google) and you can devices are just getting cheaper.

                Getting 60 fps, smooth graphics through HWC on Linux was a great idea, however I still notice tearing with the hwc_test program at 1080p. The H265 big buck bunny video played flawlessly at 1080p and was decoded at ~125 fps.
                hwc test program is copied as-is from libhybris github; however i have made a hwc test variant that had tripple buffering (latter is needed when other HW devices are still postprocessing after eglSwapBuffers()) that eliminates tearing. besides that i have made a hwc test variant that handles the vsync signal allowing to wait for it - like androids surfaceflinger does; will publish later.

                What are the benefits of switching to X11? When I've tested 1080p video with X11 there is serious amounts of tearing when videos play.
                Does xf86-arm-soc expose an X11 api while writing directly to the framebuffer? That might work if the the driver takes care of VSYNC to ensure smoothness and I can understand why you would want to reimplement it to bypass the libhybris approach and get a cleaner solution, but is it possible (no h265 decoding source)?

                I'm also checking out the Freon/Ozone graphics stack in ChromeOS, its goals are: light, fast, display manager and it already works for RK3288 (Veyron) devices. I spoke to the ChromeOS folks and alot of the v4l2 patches are not upstream yet so it would require significant work to get it running.

                There seems to be quite a few options and a discussion on the approach would be helpful to know where to focus effort so we can get to a solution that also helps most folks.
                See my post on firefly forum: http://bbs.t-firefly.com/forum.php?m...extra=#pid3501. Basically it is quite doable. Just hope that there is someone with the skills and time to put some effort on it. Would for sure be my hero! I would be happy to help him or her. If I would have the time or get paid for it, I would do it myself.
                Support my work to make you a better multimedia experience...
                And Donate...

                Comment


                  #9
                  Originally posted by MAC_L1 View Post
                  hwc test program is copied as-is from libhybris github; however i have made a hwc test variant that had tripple buffering (latter is needed when other HW devices are still postprocessing after eglSwapBuffers()) that eliminates tearing. besides that i have made a hwc test variant that handles the vsync signal allowing to wait for it - like androids surfaceflinger does; will publish later.


                  See my post on firefly forum: http://bbs.t-firefly.com/forum.php?m...extra=#pid3501. Basically it is quite doable. Just hope that there is someone with the skills and time to put some effort on it. Would for sure be my hero! I would be happy to help him or her. If I would have the time or get paid for it, I would do it myself.

                  Glad to hear X11 is doable -- If the goal is getting a fully accelerate Linux desktop, X11 makes sense. For building a single full screen application, using hwc or Freon/Ozone seems easier and more performant than fiddling with X11.

                  Comment


                    #10
                    Hi,

                    sorry to bump an old thread but I tried to install your package on a RK3188 dev boards (based on the Radxa Rock Pro). When I run the script, I come across the following error:

                    device /dev/mmcblk0 doesnt exist; cant fbconify
                    device /dev/mmcblk1 doesnt exist; cant fbconify
                    device /dev/block/mtd/by-name/parameter doesnt exist; cant fbconify
                    % Total % Received % Xferd Average Speed Time Time Time Current
                    Dload Upload Total Spent Left Speed
                    100 243 100 243 0 0 479 0 --:--:-- --:--:-- --:--:-- 481
                    dpkg-deb: error: `machybris-NOT_DETECTED-0.1.2_armhf.deb' is not a debian format archive
                    dpkg: error processing archive machybris-NOT_DETECTED-0.1.2_armhf.deb (--install):
                    subprocess dpkg-deb --control returned error exit status 2
                    Errors were encountered while processing:
                    machybris-NOT_DETECTED-0.1.2_armhf.deb

                    I understand that the script can't detect my RK type and everything so it can't find the right package. Is there a way to get this to work? I'll be really interrested in your libraries!

                    FYI: I have a NAND flash and not an eMMC, so that's why /dev/mmcblk* doesn't exists. My storage is accessed by "/dev/block/mtd/by-name/linuxroot"

                    Thanks for everything!

                    Comment


                      #11
                      Edit: Wrong info.
                      Last edited by Gormar; 24 September 2016, 21:55.
                      RK3288 2GB/16GB OC 1.9GHz at 1.2V RAM [email protected] Wasser's 3.0.11 firmware
                      Out: monitor FullHD 16:9, 3.5" jack headphones; In: remote control, USB HUB: keyboard + mouse + pendrive
                      bricked: VOYO V1 mini 8G/64GB Windows 10

                      Comment


                        #12
                        Originally posted by joe540 View Post
                        Hi,

                        sorry to bump an old thread but I tried to install your package on a RK3188 dev boards (based on the Radxa Rock Pro). When I run the script, I come across the following error:

                        device /dev/mmcblk0 doesnt exist; cant fbconify
                        device /dev/mmcblk1 doesnt exist; cant fbconify
                        device /dev/block/mtd/by-name/parameter doesnt exist; cant fbconify
                        % Total % Received % Xferd Average Speed Time Time Time Current
                        Dload Upload Total Spent Left Speed
                        100 243 100 243 0 0 479 0 --:--:-- --:--:-- --:--:-- 481
                        dpkg-deb: error: `machybris-NOT_DETECTED-0.1.2_armhf.deb' is not a debian format archive
                        dpkg: error processing archive machybris-NOT_DETECTED-0.1.2_armhf.deb (--install):
                        subprocess dpkg-deb --control returned error exit status 2
                        Errors were encountered while processing:
                        machybris-NOT_DETECTED-0.1.2_armhf.deb

                        I understand that the script can't detect my RK type and everything so it can't find the right package. Is there a way to get this to work? I'll be really interrested in your libraries!

                        FYI: I have a NAND flash and not an eMMC, so that's why /dev/mmcblk* doesn't exists. My storage is accessed by "/dev/block/mtd/by-name/linuxroot"

                        Thanks for everything!
                        I fixed the install script: it should now install machybris for rk3188. it works for my old mk809iii rk3188 device...
                        about the "device doesnt exist"-messages, the script tries to look for the flashed parameter file/image on its local drives and if found change it so that fbcon (framebuffer console) is disabled
                        hope this works for you too, as my machybris code is based on the radxa android sources
                        cheers -- mac-l1
                        Support my work to make you a better multimedia experience...
                        And Donate...

                        Comment


                          #13
                          Hi mac-l1,

                          I managed to install it a few days ago by editing the script to force the RK3188 package (even if it can't detect it with /proc/cpuinfo or so) and I added the "fbcon=vc:64-63" line to the kernel boot command (instead of editing the fbconify script), and the installation was successfull, but then, after I reboot, X server is unable to start (screen not found) and my LVDS screen output is buggued (it seems to be zoomed (missing information at the bottom and the right) and red-ish TTY console text instead of white.)

                          I don't know if it come's from the OpenGL/GLES drivers... I disabled the android's kernel module (mali and ump) to see, but no luck. Tried to load my own-built mali and ump modules, still no luck. Tried to rename your boot script also (that loads the android filesystem and everything, so it won't be run at boot) still the same.

                          When I boot, i can go up to 5~6 seconds (on dmsg) without any issue, then something is loaded and the screen's driver become buggy (as described before, red-ish instead of white and bad resolution)

                          I use a 1024x600 LVDS screen on a Raxda Rock Pro based custom dev board. I tried with a fresh ubuntu 14.04 rootfs (with a 3.0.36+ raxda kernel) but I had no luck in using your work yet!

                          If you faced that kind of problems and know where it come from, It'll be really usefull for me! If you need any log (x.org.log, dmsg, or anything) feel free to ask!

                          Thanks for your time and your work,
                          Jonathan

                          Comment


                            #14
                            Originally posted by joe540 View Post
                            Hi mac-l1,

                            I managed to install it a few days ago by editing the script to force the RK3188 package (even if it can't detect it with /proc/cpuinfo or so) and I added the "fbcon=vc:64-63" line to the kernel boot command (instead of editing the fbconify script), and the installation was successfull, but then, after I reboot, X server is unable to start (screen not found) and the my LVDS screen output is buggued (it seems to be zoomed (missing information at the bottom and the right) and red-ish TTY console text instead of white.)

                            I don't know if it come's from the OpenGL/GLES drivers. I disabled the android's kernel module (mali and ump) to see, but no luck. Tried to load my own-built mali and ump modules, still no luck.

                            When I boot, i can go up to 5~6 seconds (on dmsg) without any issue, then something is loaded and the screen's driver become buggy (as described before, red-ish instead of white and bad resolution)

                            I use a 1024x600 LVDS screen on a Raxda Rock Pro based custom dev board. I tried with a fresh ubuntu 14.04 rootfs (with a 3.0.36+ raxda kernel) but I had no luck in using your work yet!

                            If you faced that kind of problems and know where it come from, It'll be really usefull for me! If you need any log (x.org.log, dmsg, or anything) feel free to ask!

                            Thanks for your time and your work,
                            Jonathan
                            Hi Jonathan,

                            i havent heard of these kind of problems before. but i guess the screen issues have to do with the special resolution of your lvds or overwriting of screen settings by machybris. I believe i use the fbset command to set the depth to 32 bits and some other stuff during startup, and I also overwrite xorg.conf to screendepth of 24, so maybe X11 cant find your resolution mode. all these settings were needed to prepare for switching to androids surfaceflinger and egl/gles stuff.

                            what do you want to accomplish with machybris? if you dont need androids egl/gles but only want to use machybris for vpu stuff like decoding video frames then you could use the vpu subset of all functionality packed in machybris, and strip all other stuff.

                            cheers --
                            mac-l1​​​​​​​
                            Support my work to make you a better multimedia experience...
                            And Donate...

                            Comment


                              #15
                              I found your work for the VPU stuff at first, but I'm still trying to get OpenGL ES to work (I had the sunxi OpenGL ES stuff working while testing, but es2gears is still unable to run it and I'm unable to take advantage of it at the end), so If i had more luck with your package, I'll be really happy, but for now the most important thing for me is to be able to decode videos with the VPU

                              I'll have a look at the GPU stuff and I'll try to remove it and to get my screen and X11 server back, and I'll give some feedback on monday!

                              Thanks again,
                              Jonathan

                              Comment

                              Working...
                              X