• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 23
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy)
#16
This one:
https://github.com/linux-sunxi/sunxi-mal...L/eglext.h

No EGL_SYNC_FENCE_KHR stuff in there.
Reply
#17
A little bit of progress here:
I took the EGL includes from the Amlogic Mali libraries which had all the necessary defines. Some other things needed modifications to get your kodi version to build. Here's the patch against your github tree: http://pastebin.com/8xb52BgX

Kodi starts up alright, but as soon as I start some video playback, it crashes and I get the following on my console:

Code:
kodi.bin: opengl_nv.c:348: glVDPAUMapSurfacesNV: Assertion `nv' failed.

What's wrong?
Reply
#18
(2015-12-30, 14:16)mosterta Wrote: - it needs a special version of libvdpau-sunxi (due to using UMP + support for more video formats)
https://github.com/mosterta/libvdpau-sunxi

Hello. I try to install this version on my A20 device, running Debian jessie, but i am stuck at this point. I can't install this version of libvdpau-sunxi, the error is following, when i try "маке":
Quote:ve.c:30:32: fatal error: valgrind/ammt_reqs.h: No such file or directory
#include <valgrind/ammt_reqs.h>
^
compilation terminated.
Makefile:88: recipe for target 've.o' failed
make: *** [ve.o] Error 1
I don't have ammt_reqs.h file in valgrind directory and i don't know where to take it from. Any clues? Sorry if i ask something stupid, i am new into all this.
Reply
#19
Hi RagnerBG,

the question is not studid, this is something I already forgot about: I modified valgrind to add more features, but which you probably don't need. you can remove the include line + in ve.c the line with
AMMT_SET_REGS_BASE.

BR
Reply
#20
(2016-01-17, 16:27)tom81 Wrote: A little bit of progress here:
I took the EGL includes from the Amlogic Mali libraries which had all the necessary defines. Some other things needed modifications to get your kodi version to build. Here's the patch against your github tree: http://pastebin.com/8xb52BgX

Kodi starts up alright, but as soon as I start some video playback, it crashes and I get the following on my console:

Code:
kodi.bin: opengl_nv.c:348: glVDPAUMapSurfacesNV: Assertion `nv' failed.

What's wrong?

Please disable in Kodi settings VDPAU mixing, but keep VDPAU itself enabled.
Reply
#21
(2016-01-31, 20:46)mosterta Wrote: Hi RagnerBG,

the question is not studid, this is something I already forgot about: I modified valgrind to add more features, but which you probably don't need. you can remove the include line + in ve.c the line with
AMMT_SET_REGS_BASE.

BR

Thank you for your answer. I've already tried to remove "#include <valgrind/ammt_reqs.h>" in ve.c, now i've tried to remove "AMMT_SET_REGS_BASE(ve.regs);" line also. But i end up with the same error:
Quote:opengl_nv.c:29:32: fatal error: EGL/eglplatform_fb.h: No such file or directory
#include <EGL/eglplatform_fb.h>
^
compilation terminated.
Makefile:88: recipe for target 'opengl_nv.o' failed
make: *** [opengl_nv.o] Error 1
At first i thought it is because i have X11 version of mali driver, so i install it for framebuffer, but the file is still missing. So i manually create file eglplatform_fb.h in /usr/include/EGL, with the content from here - sunxi-mali/include/EGL/eglplatform_fb.h and i make some progress, but end up with another missing file error:
Quote:opengl_nv.c:30:32: fatal error: EGL/fbdev_window.h: No such file or directory
#include <EGL/fbdev_window.h>
^
compilation terminated.
Makefile:88: recipe for target 'opengl_nv.o' failed
I tried the same scenario and manually create the file in /usr/include/EGL, with the content from here - fbdev_window.h @ 3bf3af7b, but still something is not right because i end up with another error:
Quote:opengl_nv.c: In function ‘createTexture2D’:
opengl_nv.c:329:6: error: ‘fbdev_pixmap’ has no member named ‘format’
pm->format = 0;
^
opengl_nv.c: In function ‘vdp_device_opengles_nv_open’:
opengl_nv.c:75:1: warning: control reaches end of non-void function [-Wreturn-ty pe]
}
^
opengl_nv.c: In function ‘glVDPAURegisterOutputSurfaceNV’:
opengl_nv.c:204:1: warning: control reaches end of non-void function [-Wreturn-t ype]
}
^
opengl_nv.c: In function ‘glVDPAUIsSurfaceNV’:
opengl_nv.c:208:1: warning: control reaches end of non-void function [-Wreturn-t ype]
}
^
Makefile:88: recipe for target 'opengl_nv.o' failed
for which i don't have an idea. I will appreciate if you give me some more clues Smile .
Reply
#22
(2016-01-31, 22:22)RagnerBG Wrote:
(2016-01-31, 20:46)mosterta Wrote: Hi RagnerBG,

the question is not studid, this is something I already forgot about: I modified valgrind to add more features, but which you probably don't need. you can remove the include line + in ve.c the line with
AMMT_SET_REGS_BASE.

BR

Thank you for your answer. I've already tried to remove "#include <valgrind/ammt_reqs.h>" in ve.c, now i've tried to remove "AMMT_SET_REGS_BASE(ve.regs);" line also. But i end up with the same error:
Quote:opengl_nv.c:29:32: fatal error: EGL/eglplatform_fb.h: No such file or directory
#include <EGL/eglplatform_fb.h>
^
compilation terminated.
Makefile:88: recipe for target 'opengl_nv.o' failed
make: *** [opengl_nv.o] Error 1
At first i thought it is because i have X11 version of mali driver, so i install it for framebuffer, but the file is still missing. So i manually create file eglplatform_fb.h in /usr/include/EGL, with the content from here - sunxi-mali/include/EGL/eglplatform_fb.h and i make some progress, but end up with another missing file error:
Quote:opengl_nv.c:30:32: fatal error: EGL/fbdev_window.h: No such file or directory
#include <EGL/fbdev_window.h>
^
compilation terminated.
Makefile:88: recipe for target 'opengl_nv.o' failed
I tried the same scenario and manually create the file in /usr/include/EGL, with the content from here - fbdev_window.h @ 3bf3af7b, but still something is not right because i end up with another error:
Quote:opengl_nv.c: In function ‘createTexture2D’:
opengl_nv.c:329:6: error: ‘fbdev_pixmap’ has no member named ‘format’
pm->format = 0;
^
opengl_nv.c: In function ‘vdp_device_opengles_nv_open’:
opengl_nv.c:75:1: warning: control reaches end of non-void function [-Wreturn-ty pe]
}
^
opengl_nv.c: In function ‘glVDPAURegisterOutputSurfaceNV’:
opengl_nv.c:204:1: warning: control reaches end of non-void function [-Wreturn-t ype]
}
^
opengl_nv.c: In function ‘glVDPAUIsSurfaceNV’:
opengl_nv.c:208:1: warning: control reaches end of non-void function [-Wreturn-t ype]
}
^
Makefile:88: recipe for target 'opengl_nv.o' failed
for which i don't have an idea. I will appreciate if you give me some more clues Smile .

it's a long time ago that I installed the header files, so I am not sure where I get all these from. I thought from linux-sunxi/sunxi-mali but I checked and didn't find the include by myself. But you can get the header files from
https://github.com/codesnake/aml-mali/co...a7848c07f9
The header files in this repo should be comptible with the ones I use.
Reply
#23
(2016-02-01, 00:08)mosterta Wrote: it's a long time ago that I installed the header files, so I am not sure where I get all these from. I thought from linux-sunxi/sunxi-mali but I checked and didn't find the include by myself. But you can get the header files from
https://github.com/codesnake/aml-mali/co...a7848c07f9
The header files in this repo should be comptible with the ones I use.

Yes, this almost do the trick, thank you. But i had to rename/copy eglplatform.h as eglplatform_fb.h, because i noticed it is the same file, renamed when i install mali driver for framebuffer. After this, the error was about missing vdpau-sunxi in ld or something, so i installed libvdpau-sunxi from here first, then your version finally make and installs without errors. Now i have new libvdpau_sunxi.so and some libvdpau_nv_sunxi.so.1 in /usr/local/lib/vdpau. I also copy vdpau directory in /usr/lib as is mentioned in above link, do ldconfig, reboot etc.
The problem is i can't use this new version for some reason. When i try to open file with mplayer or check with vdpauinfo i have an error:
Quote:Failed to open VDPAU backend libvdpau_sunxi.so: cannot open shared object file:
No such file or directory
Is this some permission problem, or something else?
Reply
#24
(2016-02-01, 21:23)RagnerBG Wrote:
(2016-02-01, 00:08)mosterta Wrote: it's a long time ago that I installed the header files, so I am not sure where I get all these from. I thought from linux-sunxi/sunxi-mali but I checked and didn't find the include by myself. But you can get the header files from
https://github.com/codesnake/aml-mali/co...a7848c07f9
The header files in this repo should be comptible with the ones I use.

Yes, this almost do the trick, thank you. But i had to rename/copy eglplatform.h as eglplatform_fb.h, because i noticed it is the same file, renamed when i install mali driver for framebuffer. After this, the error was about missing vdpau-sunxi in ld or something, so i installed libvdpau-sunxi from here first, then your version finally make and installs without errors. Now i have new libvdpau_sunxi.so and some libvdpau_nv_sunxi.so.1 in /usr/local/lib/vdpau. I also copy vdpau directory in /usr/lib as is mentioned in above link, do ldconfig, reboot etc.
The problem is i can't use this new version for some reason. When i try to open file with mplayer or check with vdpauinfo i have an error:
Quote:Failed to open VDPAU backend libvdpau_sunxi.so: cannot open shared object file:
No such file or directory
Is this some permission problem, or something else?

libvdpau_sunxi.so is loaded by libvdpau. It determines that from the location of its installation and adds the path vdpau (e.g. libvdpau in "/usr/lib" then libvdpau_sunxi.so must be installed in "/usr/lib/vdapu") (all AFAIK, since I dont have the code here)

There is also a hardcoded path for libvdpau_nv_sunxi.so.1 in kodi: This lib is currently expected to be in /usr/lib/vdpau. (AFAIK)
Reply
#25
Some feedback:

I got it working now, disabling the video mixer solved my problem. So I did some tests with a number of video files, mainly h264 1080p and 720p. I also tested XVid and MPEG2 videos.
Results:

- H264 stuff generally works up to 1080p (as expected), but I had to decrease ve_size in sunxi_cedar_mod to 80MB or lower (I had 128MB), otherwise 1080p playback crashes Kodi and
Code:
[ 3567.081631] UMP<1>: Failed to allocate needed CMA memory 401408 bytes
[ 3567.087041] UMP<1>: _ump_ukk_allocate() failed in ump_ioctl_allocate()
[ 3567.092643] UMP<1>: Failed to allocate needed CMA memory 1597440 bytes
[ 3567.098820] UMP<1>: _ump_ukk_allocate() failed in ump_ioctl_allocate()
appeared in my kernel log. sunxi_cedar_mod grabs mem in CMA when loaded, maybe vdpau-sunxi tries to grab another chunk of CMA via UMP and fails? Does vdpau-sunxi use the mem allocated by sunxi_cedar_mod?
- H264 and XVid files played fine, but I noticed some skipping every 20secs or so. The video freezes, about 4 frames are skipped (according to counter), then playback continues.
- MPEG2 videos fail completely, audio plays fine but there's no video at all.
- CPU usage is a bit higher as compared to the old AW blobs, around 30% on both cores (blobs had ~10%). Shouldn't be so important though.

I uploaded some kodi log files for the different codec playback attempts, maybe they help solving the stuttering and MPEG2 issues.
https://www.dropbox.com/s/gxkexxbck8q5a3...s.zip?dl=0

Hope this helps a bit.
Tom
Reply
#26
(2016-02-05, 22:59)tom81 Wrote: Some feedback:

I got it working now, disabling the video mixer solved my problem. So I did some tests with a number of video files, mainly h264 1080p and 720p. I also tested XVid and MPEG2 videos.
Results:

- H264 stuff generally works up to 1080p (as expected), but I had to decrease ve_size in sunxi_cedar_mod to 80MB or lower (I had 128MB), otherwise 1080p playback crashes Kodi and
Code:
[ 3567.081631] UMP<1>: Failed to allocate needed CMA memory 401408 bytes
[ 3567.087041] UMP<1>: _ump_ukk_allocate() failed in ump_ioctl_allocate()
[ 3567.092643] UMP<1>: Failed to allocate needed CMA memory 1597440 bytes
[ 3567.098820] UMP<1>: _ump_ukk_allocate() failed in ump_ioctl_allocate()
appeared in my kernel log. sunxi_cedar_mod grabs mem in CMA when loaded, maybe vdpau-sunxi tries to grab another chunk of CMA via UMP and fails? Does vdpau-sunxi use the mem allocated by sunxi_cedar_mod?
- H264 and XVid files played fine, but I noticed some skipping every 20secs or so. The video freezes, about 4 frames are skipped (according to counter), then playback continues.
- MPEG2 videos fail completely, audio plays fine but there's no video at all.
- CPU usage is a bit higher as compared to the old AW blobs, around 30% on both cores (blobs had ~10%). Shouldn't be so important though.

I uploaded some kodi log files for the different codec playback attempts, maybe they help solving the stuttering and MPEG2 issues.
https://www.dropbox.com/s/gxkexxbck8q5a3...s.zip?dl=0

Hope this helps a bit.
Tom

Tom, thanks for testing the code. Some answers to your observations, some are already addressed.
- regarding ve_size in sunxi_cedar_mod: Currently my patched libvdpau-sunxi does not use any memory provided by sunxi_cedar_mod. So it is save to set the ve_size to 1 MB in the module (for value 0 more changes in sunxi_cedar_mod would be requirede). Of course if you still want to use the original libvdpau-sunxi then 1 MB is not enough.
- regarding the 20 sec skipping: I observed the same behavior for the kodi version compiled with debugging enabled. I haven't digged deeper into the issue, since it vanished when using the non-debug compiled version and did a nice -10 when running kodi. But since the debug version produces a lot of debug information I guess writing the log to the SDcard causes this issue.
- MPEG2 issue: I did see the same isssue: I fixed some code in kodi and the ffmpeg libs. Please use the new code. I also provided my guisettings.xml file in the root dir of kodi. There are some specific configuration options required, mainly the de-interlacing one. If you still have the MPEG2 issue with the newly provided code then check your guisettings.xml against mine.

regards
mosterta
Reply
#27
Thanks for the feedback. I tested your updated code and I can confirm that MPEG2 video playback now works. Without debugging compiled in, the stuttering is also gone.
Some more things I noticed:
- Your latest FFMPEG patch seems to be missing a file, avcodec/vdpau_msmpeg4.c. I re-added it from an earlier revision of the patch.
- Forward/backward skipping in videos is broken for any codec: If I fast-forward the video to some different time, I get some green flashing screen with the last few shown frames repeating in between over and over again. Audio continues to play normally, though.
- XVID/MPEG4 playback seems to be a mixed bag. Some files I have work nicely, others have some sort of block artifacts, tearing, choppy playback or no video at all. Maybe the options the videos were encoded with are important, I'll try to produce some "broken" test videos for debugging.
I also tried to port your code to the latest Kodi version (16rc), but I'm afraid I messed something up: I only get a red screen instead of any hw-accelerated video. Something important has changed between 14.2 and 16 I didn't take care of...

Best,
tom
Reply
#28
(2016-02-07, 21:19)tom81 Wrote: Thanks for the feedback. I tested your updated code and I can confirm that MPEG2 video playback now works. Without debugging compiled in, the stuttering is also gone.
Some more things I noticed:
- Your latest FFMPEG patch seems to be missing a file, avcodec/vdpau_msmpeg4.c. I re-added it from an earlier revision of the patch.
- Forward/backward skipping in videos is broken for any codec: If I fast-forward the video to some different time, I get some green flashing screen with the last few shown frames repeating in between over and over again. Audio continues to play normally, though.
- XVID/MPEG4 playback seems to be a mixed bag. Some files I have work nicely, others have some sort of block artifacts, tearing, choppy playback or no video at all. Maybe the options the videos were encoded with are important, I'll try to produce some "broken" test videos for debugging.
I also tried to port your code to the latest Kodi version (16rc), but I'm afraid I messed something up: I only get a red screen instead of any hw-accelerated video. Something important has changed between 14.2 and 16 I didn't take care of...

Best,
tom

Tom, thanks again for testing it.
and thanks for reminding me for the forward/backward issue. I have seen that by myself but did forget about it already again. I will have a look at it ..
regarding xvid/mpeg4. Do you have an example of the block artifact, etc? I have tested all the files I could find in the internet, and they worked fine. So I would be interested to see non-working examples to improve it. The encoding options are definitely important. The MPEG4 standard is so huge (several hundred pages), I just can't support all options of the standard, but have to restrict to the most important ones/the ones which are really used of it. Also I have to see which ones the cedar HW is supporting.
Cool, you tried already porting it. I tried to intermediate step to 15.2, BUT a/v sync in 15.2 has changed a lot and video display skipped lots of frames. Then I wanted to skip 15.2 and concentrate on the latest 16rc, but I did not even start. Maybe be can do the port to 16rc together.. Btw if you see a red screen when you display a video, this means that all values in the UMP buffers are 0. Then after YUV to RGB conversion within the GLES shader the color get converted to red.
I had a similar problem in CLinuxRendererGLES::Render. Check that
- the textures are uploaded to OpenGLES by a function with name similar to uploadTextures
- for single pass rendering that there is NOT just the bold marked line. RenderSinglePass called with the parameter m_currentField uses the wrong index, hence the wrong (empty) texture is used. Therefor I have added the RenderProgessiveWeave function, which uses a different index (internally)
case RQ_SINGLEPASS:
if (m_format == RENDER_FMT_VDPAU_420 && m_currentField == FIELD_FULL)
RenderProgressiveWeave(index, m_currentField);
else
RenderSinglePass(index, m_currentField);

VerifyGLState();
break;

Regards,
mosterta
Reply
#29
(2016-02-05, 15:24)mosterta Wrote: libvdpau_sunxi.so is loaded by libvdpau. It determines that from the location of its installation and adds the path vdpau (e.g. libvdpau in "/usr/lib" then libvdpau_sunxi.so must be installed in "/usr/lib/vdapu") (all AFAIK, since I dont have the code here)

There is also a hardcoded path for libvdpau_nv_sunxi.so.1 in kodi: This lib is currently expected to be in /usr/lib/vdpau. (AFAIK)

I copy everything from /usr/local/lib/vdpau into /usr/lib/vdapu, as i wrote. I also execute "export VDPAU_DRIVER=sunxi" and "sh -c "echo "export VDPAU_DRIVER=sunxi" >> /etc/profile", nevertheless i have the line in /etc/profile. I even start everything on fresh image from scratch and still have the same error. When i just copy the original libvdpau_sunxi.so1 over your version, vdpauinfo show correct version 0x1623 and everything work. So i give up on this and try to compile XBMC with this libvdpau-sunxi. Is it possible?
Anyway, i now face new bunch of errors and missing things, as expected. The first - i have the following message during configure:
Quote:configure: WARNING: unrecognized options: --with-ffmpeg
I couldn't find info of correct parameter for ffmpeg. Is it possible and if - how to set using of external ffmpeg? I have it compiled with vdpau support. My config look like this:
Quote:------------------------
XBMC Configuration:
------------------------
Debugging: Yes
Profiling: No
Optimization: No
SWIG Available: Yes
JRE Available: Yes
Doxygen Available: Yes
Crosscomp.: No
target ARCH: arm
target CPU: no
OpenGLES: Yes
ALSA: Yes
DBUS: Yes
VDPAU: Yes
VAAPI: No
CrystalHD: No
VDADecoder: No
VTBDecoder: No
OpenMax: No
Joystick: No
XRandR: No
GOOM: No
RSXS: Yes
ProjectM: Yes
Skin Touched: No
X11: No
Bluray: Yes
TexturePacker:No
MID Support: No
ccache: Yes
ALSA Support: Yes
PulseAudio: No
HAL Support: No
DVDCSS: Yes
Google Test Framework Configured: No
Avahi: Yes
Non-free: Yes
ASAP Codec: No
MySQL: No
Webserver: Yes
libssh support: Yes
libRTMP support: Yes
libsmbclient support: Yes
libnfs client support:Yes
libafpclient support: No
AirPLay support: No
AirTunes support: No
UPnP support: Yes
Optical drive: Yes
libudev support: Yes
libusb support: No
libcec support: Yes
libmp3lame support: Yes
libvorbisenc support: Yes
libcap support: Yes
additional players: No
External FFmpeg: No
PVR add-ons: No
prefix: /usr/local
------------------------
I removed "--enable-debug" but debugging is still there. Should i use "--disable-debug" instead? With most of missing things and errors and managed to fought with, but now i have new error during make:
Quote:Makefile:301: recipe for target 'xbmc/cores/VideoRenderers/VideoRenderer.a' failed
make: *** [xbmc/cores/VideoRenderers/VideoRenderer.a] Error 2
I can't find anything related to this in config.log and i am out of ideas. I guess this not gonna hapend in my system. Anyway - thanks for the help and a good idea.
And one last thing, a little offtopic. Any idea haw can i show subtitles in players using vdpau, mpv for example? I have "export VDPAU_OSD=1" in /etc/profile, mpv show to load subtitles, but nothing on the screen.
Reply
#30
(2016-02-07, 22:47)mosterta Wrote: Cool, you tried already porting it. I tried to intermediate step to 15.2, BUT a/v sync in 15.2 has changed a lot and video display skipped lots of frames. Then I wanted to skip 15.2 and concentrate on the latest 16rc, but I did not even start. Maybe be can do the port to 16rc together.. Btw if you see a red screen when you display a video, this means that all values in the UMP buffers are 0. Then after YUV to RGB conversion within the GLES shader the color get converted to red.
I had a similar problem in CLinuxRendererGLES::Render. Check that
- the textures are uploaded to OpenGLES by a function with name similar to uploadTextures
- for single pass rendering that there is NOT just the bold marked line. RenderSinglePass called with the parameter m_currentField uses the wrong index, hence the wrong (empty) texture is used. Therefor I have added the RenderProgessiveWeave function, which uses a different index (internally)
case RQ_SINGLEPASS:
if (m_format == RENDER_FMT_VDPAU_420 && m_currentField == FIELD_FULL)
RenderProgressiveWeave(index, m_currentField);
else
RenderSinglePass(index, m_currentField);

VerifyGLState();
break;

I have found the problem: RenderUpdate has changed in Jarvis and it was uploading YUV planes with the wrong field index (I think...). I hacked it a bit and kicked out RenderProgessiveWeave again. RenderUpdate now checks directly for RENDER_FMT_VDPAU_420.
Video playback now works for me like in Kodi 14.2.
The patch against 16.0rc3 is here: https://www.dropbox.com/s/fbqsm3nmsbhqg5...ch.gz?dl=0
Concerning MPEG4 playback: XVid files with global motion compensation enabled are broken, but I think this is a hardware limitation: My AmLogic based Kodi box also fails to play those files correctly. A workaround would be to disable hw decoder for any SD (<720p) files, at least the A20 is fast enough for that (and noone uses XVid for HD content anyway?)

Best,
tom
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 23

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