![]() |
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) (/showthread.php?tid=254202) |
RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-01-16 This one: https://github.com/linux-sunxi/sunxi-mali/blob/master/include/EGL/eglext.h No EGL_SYNC_FENCE_KHR stuff in there. RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-01-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? RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - RagnerBG - 2016-01-31 (2015-12-30, 14:16)mosterta Wrote: - it needs a special version of libvdpau-sunxi (due to using UMP + support for more video formats) 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 directoryI 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. RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-01-31 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 RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-01-31 (2016-01-17, 16:27)tom81 Wrote: A little bit of progress here: Please disable in Kodi settings VDPAU mixing, but keep VDPAU itself enabled. RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - RagnerBG - 2016-01-31 (2016-01-31, 20:46)mosterta Wrote: Hi RagnerBG, 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 directoryAt 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 directoryI 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’:for which i don't have an idea. I will appreciate if you give me some more clues ![]() RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-02-01 (2016-01-31, 22:22)RagnerBG Wrote:(2016-01-31, 20:46)mosterta Wrote: Hi RagnerBG, 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/commit/0a6e847542e50be7f47a1dd5e43528a7848c07f9 The header files in this repo should be comptible with the ones I use. RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - RagnerBG - 2016-02-01 (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 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:Is this some permission problem, or something else? RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-02-05 (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 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) RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-02-05 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 - 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/gxkexxbck8q5a38/kodi-vdpausunxi-logs.zip?dl=0 Hope this helps a bit. Tom RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-02-07 (2016-02-05, 22:59)tom81 Wrote: Some feedback: 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 RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-02-07 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 RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - mosterta - 2016-02-07 (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. 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 RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - RagnerBG - 2016-02-09 (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) 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-ffmpegI 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:------------------------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' failedI 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. RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-02-10 (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 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/fbqsm3nmsbhqg5f/kodi-16.0rc3-Jarvis-sunxi-vdpau.patch.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 |