• 1
  • 15
  • 16
  • 17(current)
  • 18
  • 19
  • 23
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy)
Code:
cbkodi ~/kodi_stuff/sunxi-mali # make config
rm -f config.mk
make config.mk
make[1]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
make -f Makefile.config
make[2]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
ABI="armhf" (Detected)
VERSION="r3p0" (Detected)
EGL_TYPE="framebuffer" (Detected)
Makefile.config:87: *** No Mali libs exist for r3p0, armhf, framebuffer. Stop.

Really my Cubieboard 2 is so special? From which repo you download mali-binary drivers? I guess i need them because

Code:
cbkodi ~/kodi_stuff/libvdpau-sunxi # make
DUPA="-L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1"
gcc -shared -Wl,-soname,libvdpau_nv_sunxi.so.1  opengl_nv.o -lrt -lm -lpthread -lUMP -lEGL -lGLESv2 -L /root/kodi_stuff/libvdpau-sunxi libvdpau_sunxi.so.1 -L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1 -o libvdpau_nv_sunxi.so.1
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lEGL
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lGLESv2
Reply
Thanks so much for your continuous support!

Here is a log for H264-MPEG4-AVC encoding https://drive.google.com/open?id=0B1uRD2...FNhMDY0aTQ
Here is a log for MPEG4-DIVX encoding https://drive.google.com/open?id=0B1uRD2...TYwcUM0QlE

I have also tried some online streaming, but I always get the same result. Just a black screen. If I hit the "info"button, I see the navigation overlay for the video (time-bar, controls and preview image)
Reply
(2017-08-06, 21:28)pdrobek Wrote:
Code:
cbkodi ~/kodi_stuff/sunxi-mali # make config
rm -f config.mk
make config.mk
make[1]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
make -f Makefile.config
make[2]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
ABI="armhf" (Detected)
VERSION="r3p0" (Detected)
EGL_TYPE="framebuffer" (Detected)
Makefile.config:87: *** No Mali libs exist for r3p0, armhf, framebuffer. Stop.

Really my Cubieboard 2 is so special? From which repo you download mali-binary drivers? I guess i need them because

Code:
cbkodi ~/kodi_stuff/libvdpau-sunxi # make
DUPA="-L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1"
gcc -shared -Wl,-soname,libvdpau_nv_sunxi.so.1  opengl_nv.o -lrt -lm -lpthread -lUMP -lEGL -lGLESv2 -L /root/kodi_stuff/libvdpau-sunxi libvdpau_sunxi.so.1 -L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1 -o libvdpau_nv_sunxi.so.1
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lEGL
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lGLESv2

your Cubieboard shouldn't be special regarding the OpenGLES library. As far as I can remember, I got the libs from https://github.com/linux-sunxi/sunxi-mali
But I can't remember whether any options are required and if so, which values have to be passed. Where did you got the GLES code? Can it be that you have a newer repository, which does not support r3p0 anymore?
Reply
(2017-08-06, 21:37)mosterta Wrote:
(2017-08-06, 21:28)pdrobek Wrote:
Code:
cbkodi ~/kodi_stuff/sunxi-mali # make config
rm -f config.mk
make config.mk
make[1]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
make -f Makefile.config
make[2]: Wejście do katalogu '/root/kodi_stuff/sunxi-mali'
ABI="armhf" (Detected)
VERSION="r3p0" (Detected)
EGL_TYPE="framebuffer" (Detected)
Makefile.config:87: *** No Mali libs exist for r3p0, armhf, framebuffer. Stop.

Really my Cubieboard 2 is so special? From which repo you download mali-binary drivers? I guess i need them because

Code:
cbkodi ~/kodi_stuff/libvdpau-sunxi # make
DUPA="-L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1"
gcc -shared -Wl,-soname,libvdpau_nv_sunxi.so.1  opengl_nv.o -lrt -lm -lpthread -lUMP -lEGL -lGLESv2 -L /root/kodi_stuff/libvdpau-sunxi libvdpau_sunxi.so.1 -L /root/kodi_stuff/libvdpau-sunxi libcedar_access.so.1 -o libvdpau_nv_sunxi.so.1
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lEGL
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.4/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: cannot find -lGLESv2

your Cubieboard shouldn't be special regarding the OpenGLES library. As far as I can remember, I got the libs from https://github.com/linux-sunxi/sunxi-mali
But I can't remember whether any options are required and if so, which values have to be passed. Where did you got the GLES code? Can it be that you have a newer repository, which does not support r3p0 anymore?

I follow this guide http://linux-sunxi.org/Mali_binary_driver, first try was with X11 enabled, now im try framebuffer version without any X11 libs. I'm so close to break window with my cubie and buy rpi3 :-)

few minutes later i clone once again this repo and it compile successful r3p0 driver version. I guess some stuck on copy-paste from old build system.
Reply
@pdrobek: I can confirm, I have just re-compiled my sunxi-mali (on a cubietruck, though) and get it from https://github.com/linux-sunxi/sunxi-mali
I have just re-pulled it, so it is not a newer version and it worked.
I needed to configure for the "framebuffer" version, not the X11, though, so
make EGL_TYPE=framebuffer config
make
make install
Reply
(2017-08-06, 21:34)matrzh Wrote: Thanks so much for your continuous support!

Here is a log for H264-MPEG4-AVC encoding https://drive.google.com/open?id=0B1uRD2...FNhMDY0aTQ
Here is a log for MPEG4-DIVX encoding https://drive.google.com/open?id=0B1uRD2...TYwcUM0QlE

I have also tried some online streaming, but I always get the same result. Just a black screen. If I hit the "info"button, I see the navigation overlay for the video (time-bar, controls and preview image)

Even if the hardware layer implementation does not use any OpenGLES shaders directly, the shaders are compiled and must be compileable successfully. This is not the case in your installation:
21:22:45.076 T:3032760320 ERROR: 0:21: L0001: Typename expected, found 'pzecision'
0:21: L0001: Expected identifier, found 'highp'
21:22:45.076 T:3032760320 ERROR: GL: Error compiling fragment shader

I can't see which fragment shader is wrong, but please check all your vertex and fragment shader programs. These are named "*_gles_*.glsl" in directory system/shaders. Somehow the word "precision" got replaced by "pzecision".
Reply
It's working! Big Grin
I tried some formats and online streaming, too. The file was corrupted and had some strange characters in it. I may have to replace my sd-card...
Anyway. Now, I just need to disable logging so the videos run smoother.
I also still have some issues with youtube plugins and some TV providers, but I will figure that out.


Thanks again!
Reply
(2017-08-06, 22:48)matrzh Wrote: It's working! Big Grin
I tried some formats and online streaming, too. The file was corrupted and had some strange characters in it. I may have to replace my sd-card...
Anyway. Now, I just need to disable logging so the videos run smoother.
I also still have some issues with youtube plugins and some TV providers, but I will figure that out.


Thanks again!

good to hear that you got it working finally. Big Grin have fun with it.
EDIT: switch on -O2 as well if you disabled it, also for ffmpeg. Additional with disabling logging. This makes a huge performance jump and videos are played much smoother than when only using -O0
Reply
hi @mosterta

Quote:Thanks for the hint regarding libcedarJpeg. This lib works for H3 too, so strange that it does not work on A13. Does the lib crash the kernel? how exactly does the kernel hang? can you still ping the A13? can you specify more exactly what you mean by "hanging"?
regarding the video error: I havent tried it on an A10/A20, but will try the video whether I see the same issue. I have tried several big buck bunny videos and havent seen this error.
And nice that kodi works that easily on the A13. I will commit the code.

libcedarJpeg kills the system completely ( no ping no ssh no serial console output no kernel panic no kernel messages just cold dead!) the whole system just freezes !!
about the big buck bunny video it seems a bug in the original libvdpau-sunxi I've tested it, maybe related to A13 I've reported the issue.
few notes:
-local video files have black thumbnails ( i guess kodi is using ffmpeg to generate a thumbnail from video file) , and because it's vdpau accelerated it can't redirect the output to an image file ( is there a workaround for this ?) I've tried online media info but always corrupts the video database and crash with sigfault everytime I run kodi and I have to delete the video database to avoid segfault on startup.
- the interface is a little bit slow I guess because of the sdcard speed ( I've mounted the ".kodi" dir using ramdisk and I've seen so much Improvement), does disabling debugging improve responsiveness ?
- there's a tearing in the kodi gui especially when something is moving fast, does this happen with A10/A20 ?
-can I build audio visualizations ? I saw it support OPENGLES , will it work with your implementation?
Reply
(2017-08-07, 03:04)xchetah Wrote: hi @mosterta

Quote:Thanks for the hint regarding libcedarJpeg. This lib works for H3 too, so strange that it does not work on A13. Does the lib crash the kernel? how exactly does the kernel hang? can you still ping the A13? can you specify more exactly what you mean by "hanging"?
regarding the video error: I havent tried it on an A10/A20, but will try the video whether I see the same issue. I have tried several big buck bunny videos and havent seen this error.
And nice that kodi works that easily on the A13. I will commit the code.

libcedarJpeg kills the system completely ( no ping no ssh no serial console output no kernel panic no kernel messages just cold dead!) the whole system just freezes !!
about the big buck bunny video it seems a bug in the original libvdpau-sunxi I've tested it, maybe related to A13 I've reported the issue.
few notes:
-local video files have black thumbnails ( i guess kodi is using ffmpeg to generate a thumbnail from video file) , and because it's vdpau accelerated it can't redirect the output to an image file ( is there a workaround for this ?) I've tried online media info but always corrupts the video database and crash with sigfault everytime I run kodi and I have to delete the video database to avoid segfault on startup.
- the interface is a little bit slow I guess because of the sdcard speed ( I've mounted the ".kodi" dir using ramdisk and I've seen so much Improvement), does disabling debugging improve responsiveness ?
- there's a tearing in the kodi gui especially when something is moving fast, does this happen with A10/A20 ?
-can I build audio visualizations ? I saw it support OPENGLES , will it work with your implementation?

- thumbnails are generated using FFMPEG, but this should be done without using VDPAU. I can not work with VDPAU. I have seen some code that ffmpeg without VDPAU is used. But I have to double check that.
- the slow interface is probably due to excessive debug logging into kodi.log. When you disable it, it should be better. When you recompile with -O2, it also makes a huge improvement. But of course that makes debugging much more difficult.
- I can't see any tearing in A10/A20 implementation. Where does your kernel come from? check drivers/video/sunxi/disp/dev_fb.c that VSYNC is enabled
case FBIO_WAITFORVSYNC:
{
ret = Fb_wait_for_vsync(info);
break;
}
- audio visualizations should work. These use OpenGLES on the gui layer. The hardware layer and mixing is only used for video support.
Reply
hi @mosterta

Quote:- thumbnails are generated using FFMPEG, but this should be done without using VDPAU. I can not work with VDPAU. I have seen some code that ffmpeg without VDPAU is used. But I have to double check that.
- the slow interface is probably due to excessive debug logging into kodi.log. When you disable it, it should be better. When you recompile with -O2, it also makes a huge improvement. But of course that makes debugging much more difficult.
- I can't see any tearing in A10/A20 implementation. Where does your kernel come from? check drivers/video/sunxi/disp/dev_fb.c that VSYNC is enabled
case FBIO_WAITFORVSYNC:
{
ret = Fb_wait_for_vsync(info);
break;
}
- audio visualizations should work. These use OpenGLES on the gui layer. The hardware layer and mixing is only used for video support.

for thumbnails , I have this from the log when I regenerate them
Code:
21:42:40.595 T:2684777216   DEBUG: DoWork - trying to extract thumb from video file /home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
21:42:40.604 T:2684777216   DEBUG: Open - probing detected format [mov,mp4,m4a,3gp,3g2,mj2]
21:42:41.432 T:2684777216   DEBUG: Open - avformat_find_stream_info starting
21:42:41.503 T:2923422464   DEBUG: Thread BackgroundLoader 2923422464 terminating
21:42:42.175 T:2684777216   DEBUG: Open - av_find_stream_info finished
21:42:42.183 T:2684777216   DEBUG: ScanForExternalSubtitles: Searching for subtitles...
21:42:42.185 T:2684777216   DEBUG: ScanForExternalSubtitles: END (total time: 3 ms)
21:42:42.186 T:2684777216   DEBUG: FactoryCodec - Video:  - Opening
21:42:42.187 T:2684777216  NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
21:42:42.188 T:2684777216   DEBUG: CDVDVideoCodecFFmpeg - Updated codec: ff-h264
21:42:42.189 T:2684777216   DEBUG: FactoryCodec - Video: ff-h264 - Opened
21:42:42.190 T:2684777216   DEBUG: ExtractThumb - seeking to pos 15000ms (total: 45000ms) in /home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
21:42:42.191 T:2684777216   DEBUG: SeekTime - unknown position after seek
21:42:42.202 T:2684777216  NOTICE: CDVDVideoCodecFFmpeg::GetFormat - Creating VDPAU(1920x1080)
21:42:42.544 T:2684777216   DEBUG: cached image 'special://masterprofile/Thumbnails/d/de877497.jpg' size 720x405
21:42:42.715 T:2684777216   DEBUG: ExtractThumb - measured 2120 ms to extract thumb from file </home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4> in 10 packets.
does this line means it is using vdpau?(NOTICE: CDVDVideoCodecFFmpeg::GetFormat - Creating VDPAU(1920x1080))

-checking config.status it seems I've already enabled -O2 , maybe because I enabled optimizations (without it ffmpeg doesn't compile).
-my kernel is the official linux-sunxi branch , and it has VSYNC is enabled.
-here's a video demonstrating the problem : https://drive.google.com/file/d/0BzQVVX8...Zwdm8/view
-fbset reports 68Hz , while kodi reports 50Hz could this be the problem?
-do you want me to debug libcedarJpeg so it can support A13?
Reply
(2017-08-07, 20:55)xchetah Wrote: hi @mosterta

Quote:- thumbnails are generated using FFMPEG, but this should be done without using VDPAU. I can not work with VDPAU. I have seen some code that ffmpeg without VDPAU is used. But I have to double check that.
- the slow interface is probably due to excessive debug logging into kodi.log. When you disable it, it should be better. When you recompile with -O2, it also makes a huge improvement. But of course that makes debugging much more difficult.
- I can't see any tearing in A10/A20 implementation. Where does your kernel come from? check drivers/video/sunxi/disp/dev_fb.c that VSYNC is enabled
case FBIO_WAITFORVSYNC:
{
ret = Fb_wait_for_vsync(info);
break;
}
- audio visualizations should work. These use OpenGLES on the gui layer. The hardware layer and mixing is only used for video support.

for thumbnails , I have this from the log when I regenerate them
Code:
21:42:40.595 T:2684777216   DEBUG: DoWork - trying to extract thumb from video file /home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
21:42:40.604 T:2684777216   DEBUG: Open - probing detected format [mov,mp4,m4a,3gp,3g2,mj2]
21:42:41.432 T:2684777216   DEBUG: Open - avformat_find_stream_info starting
21:42:41.503 T:2923422464   DEBUG: Thread BackgroundLoader 2923422464 terminating
21:42:42.175 T:2684777216   DEBUG: Open - av_find_stream_info finished
21:42:42.183 T:2684777216   DEBUG: ScanForExternalSubtitles: Searching for subtitles...
21:42:42.185 T:2684777216   DEBUG: ScanForExternalSubtitles: END (total time: 3 ms)
21:42:42.186 T:2684777216   DEBUG: FactoryCodec - Video:  - Opening
21:42:42.187 T:2684777216  NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
21:42:42.188 T:2684777216   DEBUG: CDVDVideoCodecFFmpeg - Updated codec: ff-h264
21:42:42.189 T:2684777216   DEBUG: FactoryCodec - Video: ff-h264 - Opened
21:42:42.190 T:2684777216   DEBUG: ExtractThumb - seeking to pos 15000ms (total: 45000ms) in /home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4
21:42:42.191 T:2684777216   DEBUG: SeekTime - unknown position after seek
21:42:42.202 T:2684777216  NOTICE: CDVDVideoCodecFFmpeg::GetFormat - Creating VDPAU(1920x1080)
21:42:42.544 T:2684777216   DEBUG: cached image 'special://masterprofile/Thumbnails/d/de877497.jpg' size 720x405
21:42:42.715 T:2684777216   DEBUG: ExtractThumb - measured 2120 ms to extract thumb from file </home/eyad/Desktop/big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4> in 10 packets.
does this line means it is using vdpau?(NOTICE: CDVDVideoCodecFFmpeg::GetFormat - Creating VDPAU(1920x1080))

-checking config.status it seems I've already enabled -O2 , maybe because I enabled optimizations (without it ffmpeg doesn't compile).
-my kernel is the official linux-sunxi branch , and it has VSYNC is enabled.
-here's a video demonstrating the problem : https://drive.google.com/file/d/0BzQVVX8...Zwdm8/view
-fbset reports 68Hz , while kodi reports 50Hz could this be the problem?
-do you want me to debug libcedarJpeg so it can support A13?

I have checked, there is a if statement that for thumbnail generation plain ffmpeg should be used. But, I have changed the code that "hardware" buffers are used in case plain ffmpeg is used for videos not supported by VDPAU. (to accelerate non-vdpau videos). This functionality may have broken the thumbnail generation. I may not noticed because the thumbnails are all already generated when I test. Sad I have to check more in detail and repair it. Unfortunately there is nothing you can do to disable this functionality.

- I had a look to your video. actually I do not know whether I have the same issue. I could not see which use case you actually trigger, i.e. I do not know how to scroll the icons fast enough to check whether I see the same issue.
- If you have time to debug libcedarjpeg, that would be great. I guess there are two possible issues here: the pointer to the UMP buffer is wrong and the cedar HW overwrites kernel memory or even the interrupt table (check for passing address 0 to the cedar hardware) or the hardware itself stops working when it is triggered.
Reply
ok thanks waiting for updates on the thumbnails problem, could this solve the problem temporarily ? :
changing this
Code:
#ifdef ALLWINNERA10
      // always use ffmpeg for thumb extraction instead of A10 HW
      CDVDCodecOptions dvdOptions;
      pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(*pProcessInfo), hint, dvdOptions);
#else
    pVideoCodec = CDVDFactoryCodec::CreateVideoCodec(hint, *pProcessInfo);
#endif
to this
Code:
//#ifdef ALLWINNERA10
      // always use ffmpeg for thumb extraction instead of A10 HW
//     CDVDCodecOptions dvdOptions;
//     pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(*pProcessInfo), hint, dvdOptions);
//#else
    pVideoCodec = CDVDFactoryCodec::CreateVideoCodec(hint, *pProcessInfo);
//#endif
scrolling was done just by keyboard left/right in "Pictures" browser , I also get this effect when opening kodi settings.
I'll try to debug libcedarjpeg as you mentioned.
note for other users , if they want to keep debugging and also have fast interface use this commands:
Code:
rm -rf .kodi/temp/
ln -s /tmp/ .kodi/temp
Reply
(2017-08-07, 22:54)xchetah Wrote: ok thanks waiting for updates on the thumbnails problem, could this solve the problem temporarily ? :
changing this
Code:
#ifdef ALLWINNERA10
      // always use ffmpeg for thumb extraction instead of A10 HW
      CDVDCodecOptions dvdOptions;
      pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(*pProcessInfo), hint, dvdOptions);
#else
    pVideoCodec = CDVDFactoryCodec::CreateVideoCodec(hint, *pProcessInfo);
#endif
to this
Code:
//#ifdef ALLWINNERA10
      // always use ffmpeg for thumb extraction instead of A10 HW
//     CDVDCodecOptions dvdOptions;
//     pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(*pProcessInfo), hint, dvdOptions);
//#else
    pVideoCodec = CDVDFactoryCodec::CreateVideoCodec(hint, *pProcessInfo);
//#endif
scrolling was done just by keyboard left/right in "Pictures" browser , I also get this effect when opening kodi settings.
I'll try to debug libcedarjpeg as you mentioned.
note for other users , if they want to keep debugging and also have fast interface use this commands:
Code:
rm -rf .kodi/temp/
ln -s /tmp/ .kodi/temp

I have checked in code that should re-enable thumbnail generation. I haven't really tried it, but it should behave the same as before my changes.
Thanks for the hint and looking at libcedarjpeg for the A13.
Reply
@mosterta. Another quick question: Are you using the official youtube plugin and does it work?
While I was still struggling with the videos, I could always navigate within the plugin but the crash occurred as soon as I clicked on a video.
When I looked into the compilation again, starting about 2 weeks ago, the plugin threw error messages which I have just posted here:
https://forum.kodi.tv/showthread.php?tid...0&page=171
When importing the python modules directly in a python console, I do not get any errors

What I may want to add: some googling has shown that these EOFErrors may occur if several instances of python concurrently try to access the same pyc file (in Python 2.7). Not sure how it exactly works, but I could well imagine that this is the case.
Reply
  • 1
  • 15
  • 16
  • 17(current)
  • 18
  • 19
  • 23

Logout Mark Read Team Forum Stats Members Help
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy)2