Kodi Community Forum
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)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-29

Libs looks like installed corectly
ldconfid -v returns
Code:
libvdpau.so.1 -> libvdpau.so.1.0.0
        libvdpau_sunxi.so.1 -> libvdpau_sunxi.so.1
        libvdpau_nv_sunxi.so.1 -> libvdpau_nv_sunxi.so.1
        libvdpau_trace.so.1 -> libvdpau_trace.so.1.0.0

I think there is no hardware accelerated Sad
https://goo.gl/photos/DxPYRUgzc4z7zxLF6

I cant find a option to change audio output, there is only one choice that is already selected Sad
https://goo.gl/photos/gRzt4hGQWViR8hec6

dmesg does not look very interesting .. i cant see any vdpau errors.
http://porlock.waw.pl/public/dmesg.txt

What i do wrong Sad

edit:
i was able to catch one error.
https://goo.gl/photos/LPtcD329kBLUzkUq5


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-03-29

Get rid of the remaining valgrind stuff: https://github.com/tnmeyer/libvdpau-sunxi/commit/c8279f615d76b80ce77981ee0091a515cd61028b

Small hint for debugging:
If you login remotely via ssh and start kodi from there, you will see console error messages much more easily.


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-29

I use You method of valgrind removal, and now i get this error

https://goo.gl/photos/BrUtWDjJLMrLDRuo9


Unfortunately when i sun kodi over ssh i do not receive any messages on console and have no display over hdmi.

I do not know what to do next Sad

edit:

https://www.google.pl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=%22cedarv_memset%22


doooh ... no results on google..


Tom help me please

edit2:

root@cubieez:/home/porlock# ldd -r /usr/local/lib/vdpau/libvdpau_sunxi.so.1
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6f43000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6ece000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6eab000)
libUMP.so.3 => /usr/local/lib/libUMP.so.3 (0xb6e96000)
libcedar_access.so => /usr/lib/libcedar_access.so (0xb6e84000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6d94000)
/lib/ld-linux-armhf.so.3 (0xb6f97000)
undefined symbol: cedarv_memset (/usr/local/lib/vdpau/libvdpau_sunxi.so.1)

Tom what is in Your compilation, where this should link to ? anyway why compilation pass when this symbol was undefined ?


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-03-30

cedarv_memset is defined in https://github.com/tnmeyer/libvdpau-sunxi/blob/master/ve.c#L261
Make sure that USE_UMP is defined (should be, it's in the main Makefile) and that you use the correct libcedar_access.so


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-30

ve.c:
Code:
#if USE_UMP

CEDARV_MEMORY cedarv_malloc(int size)
{
  CEDARV_MEMORY mem;
  mem.mem_id = ump_ref_drv_allocate (size, UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR);
  if(mem.mem_id == UMP_INVALID_MEMORY_HANDLE)
  {
    printf("could not allocate ump buffer!\n");
    exit(1);
  }
  return mem;
}

void cedarv_memset(CEDARV_MEMORY dst, unsigned char value, size_t len)
{
  void* mem = ump_mapped_pointer_get(dst.mem_id);
  memset(mem, value, len);
}

i'm not a c programer but mayby it is something about that change that

"opengl_nv.c – replace mem.mem_id with mem" that twisted_tits describe on page

but without that change i get a compilation error.
Code:
opengl_nv.c:336:25: error: request for member ‘mem_id’ in something not a structure or union
    ump_reference_add(mem.mem_id);
                         ^
opengl_nv.c:337:41: error: request for member ‘mem_id’ in something not a structure or union
    pm->data   = (short unsigned int*)mem.mem_id;
                                         ^
Makefile:88: recipe for target 'opengl_nv.o' failed

and in makefile i have:

Code:
USE_UMP = 1

ifeq ($(USE_UMP),1)
LIBS  += -lUMP
CFLAGS += -DUSE_UMP=1
endif

full compilation log:
http://porlock.waw.pl/public/compilation.log

i removed --shared from compilation of libvdpau_nv_sunxi.so.1

Code:
root@cubieez:/opt/libvdpau-sunxi# gcc  -Wl,-soname,libvdpau_nv_sunxi.so.1  opengl_nv.o -lrt -lm -lpthread -lUMP -lEGL -lGLESv2 -L /usr/local/lib/vdpau -lvdpau_sunxi -L /opt/libvdpau-sunxi -lr_access -o libvdpau_nv_sunxi.so.1
/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crt1.o: In function `_start':
(.text+0x28): undefined reference to `main'
/usr/local/lib/vdpau/libvdpau_sunxi.so: undefined reference to `cedarv_memset'
collect2: error: ld returned 1 exit status

Any ideas ?


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - rellla - 2016-03-30

Your Makefile seems to be messed up.

"gcc -MD -MP -MQ ve.o -fpic -I/opt/sunxi-mali/include -I/opt/aml-mali/include -c ve.c -o ve.o"

definitly is not derived from
"$(CC) $(DEP_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c $< -o $@"

Check your $(LIB_CFLAGS) and $(CFLAGS)

Regards
rellla

PS: Also you may get rid of the "printf" warnings if you add a #include <stdio.h> to presentation_queue.c or use the VDPAU_DBG() macro for logging.
The memcpy warning is because of a missing #include <string.h> in your files.

PPS: If you did it like described here: https://twistedlinux.wordpress.com/2016/03/14/build-a10a20-with-hardware-acceleration/ it's clear, because you overwrite the CFLAGS .... At least you have to use CFLAGS+= ..... - if this works.
And why mem_id should have to be changed to mem? I don't know....


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-30

Ok i correct the Make file now i get

gcc -MD -MP -MQ ve.o -fpic -Wall -O0 -g -DUSE_UMP=1 -c ve.c -o ve.o

but no luck, i try on aml-mali EGL headers and on oryginal ones but there is always

Code:
undefined symbol: cedarv_memset (/usr/local/lib/vdpau/libvdpau_sunxi.so.1)

Please find my second compilation log.
http://porlock.waw.pl/public/compilation2.log

I find that line

ve.c: In function ‘cedarv_memset’:
ve.c:270:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(mem, value, len);
^
ve.c:270:3: warning: incompatible implicit declaration of built-in function ‘memset’

But this function is delcared.

Code:
root@cubieez:/opt/libvdpau-sunxi# grep memset ./ve.h
void cedarv_memset(CEDARV_MEMORY dst, unsigned char value, size_t len);

Im not a programer ;( what to do.. Sad((


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - rellla - 2016-03-30

(2016-03-30, 14:03)porlock Wrote: Ok i correct the Make file now i get

gcc -MD -MP -MQ ve.o -fpic -Wall -O0 -g -DUSE_UMP=1 -c ve.c -o ve.o

but no luck, i try on aml-mali EGL headers and on oryginal ones but there is always

Code:
undefined symbol: cedarv_memset (/usr/local/lib/vdpau/libvdpau_sunxi.so.1)

Please find my second compilation log.
http://porlock.waw.pl/public/compilation2.log

I find that line

ve.c: In function ‘cedarv_memset’:
ve.c:270:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(mem, value, len);
^
ve.c:270:3: warning: incompatible implicit declaration of built-in function ‘memset’

But this function is delcared.
It's not. cedarv_memset is. It's just a warning though. To get rid of it, see:
(2016-03-30, 13:11)rellla Wrote: PS: Also you may get rid of the "printf" warnings if you add a #include <stdio.h> to presentation_queue.c or use the VDPAU_DBG() macro for logging.
The memcpy warning is because of a missing #include <string.h> in your files.
The bigger problem is "ve.c:256:3: warning: implicit declaration of function ump_phys_address_get"
This is because you need to checkout mosterta/master branch of https://github.com/mosterta/libump and build that one. This is missing in the first post and in the howto i linked in the last post.

Quote:Im not a programer ;( what to do.. Sad((
Maybe wait for someone else fixing these issues, not try to fix yourself, read, read, read or wait for an enduser solution ....
This try & error thing is not very expedient...

Regards
rellla


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-30

I do not quit so quickly, it take some time but i get forward, and i lost a lot of time for this so it will be real waster if I quit now, so I will try to go on till my knowledge or Your patience ends.

Finally I manage to solve all lib includes and shares, that branch of libump for mosentra/master was just in the spot. Now it seems that everything should work fine but.
Kodi .. crash after I try to launch some movie :-(

Please find a a crashlog, I do not see any oblivious errors :-(

http://porlock.waw.pl/public/kodi_crashlog-20160330_164854.log


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - rellla - 2016-03-30

It crashes here:
Code:
#1  0x00481636 in VDPAU::COutput::GLInit (this=this@entry=0xab7774f8) at VDPAU.cpp:4071

I don't know, what in line 4071 of your vdpau.cpp is, but you can at least find out where it segfaults.
I assume, it has something to do with libvdpau-sunxi...

Go searching for line 4071!

Regards
rellla


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-30

There is this lines

it is a part of xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp

while (glGetError() != GL_NO_ERROR);
#if GL_NV_vdpau_sim_interop
glVDPAUInitNV(reinterpret_cast<void*>(m_config.context->GetDevice()),
reinterpret_cast<void*>(m_config.context->GetProcs().vdp_get_proc_address), m_context);
#else
glVDPAUInitNV(reinterpret_cast<void*>(m_config.context->GetDevice()),
reinterpret_cast<void*>(m_config.context->GetProcs().vdp_get_proc_address));
#endif

Maybe i should recompile Kodi after completing all the libs and headers, it take ages so it must be a well thought decision


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - rellla - 2016-03-30

Don't know, whats wrong exactly. I think the error happens a few lines earlier while getting the processes so that you get a NULL pointer. Maybe while loading the shared library. Btw., have you reenabled the --shared flag?
Regards
rellla


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - porlock - 2016-03-30

Yes i reenabled shared flag


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - rellla - 2016-03-31

Which kodi source/branch do you use? How do ./configure it?
Sadly there is only quite minimal error handling and logging included in this kodi source code part.
Which libvdpau-sunxi branch/commit do you use?
Assuming you use mosterta's libvdpau-sunxi HEAD including https://github.com/mosterta/libvdpau-sunxi/commit/b7096644a979e7141f3bdfa423b222e0e87f470c#diff-12ad59d0dc1e6d820b284c8b5ef6d987R80 you may get into trouble when using https://github.com/tnmeyer/xbmc/blob/Jarvis_vdpau_gles/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp#L4071 because you miss the last parameter. But i don't know, which parameter to append. I think it's &CLog::Log .
Alternatively you can redo https://github.com/mosterta/libvdpau-sunxi/commit/b7096644a979e7141f3bdfa423b222e0e87f470c#diff-12ad59d0dc1e6d820b284c8b5ef6d987R80

Worth a try, instead of doing try & error with recompiling Kodi. In case you recompile Kodi, add some huge amount of logging and "if ( .... == NULL)" checks to find the place where it stops. But i don't know if that is sth, a C-noob can do...

Regards
rellla


RE: hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy) - tom81 - 2016-03-31

I'm starting to wonder why I haven't seen this particular crash yet...
I would just revert the patch for vdpau-sunxi that rellla mentioned. If it still crashes then there is another problem.