This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to share texture memory between CPU/GPU for firefly's/rk3288 fbdev Mali-T764

I got the hardware video decoder working on my firefly/rk3288. I can blit the yuv/nv21 output frame to rgb frame memory using fireflys dedicated 2d acceleration hardware. All I need right now is a memory pointer, pointing directly to the texture memory, in order to use the decoded video frame in shaders. In android I would create a GraphicBuffer object and give it to eglCreateImageKHR() and use glEGLImageTargetTexture2DOES. Right now I use glTexSubImage2D to copy and I get about 12 fps for 1920x1080 frames, too slow for showing a movie.

What is the best way to do this for firefly linux 3.10 with fbdev mali t760 driver? How can I simply get a pointer sharing CPU/GPU texture memory? And is there maybe some sample code available?


Right now I stuck and waiting for X11 mali drivers that support XCreatePixmap that could hopefully bring me further. My goal is XBMC, mplayer, ... running on linux on firefly.


Any help would really be appreciated! TNX!


Mac


Background, see:

accelerated video / video processor (VPU) running on linux on RK3288 / firefly - FreakTab.com

Parents
  • Hi Anthony,

    Thanks for your answer, very helpful!

    rk3288 video decoder specs state that decoders output format is YCbCr 4:2:0 semi-planar; that is the same as NV21.

    Right now I use other dedicated blitter hardware on the rk3288 for this 2D hw accelerated conversion to GL_RGBA/RGBA888.

    I dont know if eglImage functions for fbdev support NV21 to RGBA conversion internally that are efficient, deducing from your code it seems it does.

    In my blitter conversion code I use RK_FORMAT_YCbCr_420_SP as source formart, and in xbmc's code on android I see that HAL_PIXEL_FORMAT_YCrCb_NV12  and HAL_PIXEL_FORMAT_YCrCb_NV12_10 are stated (the latter probably for dedicated HEVC decoder).

    As destination format I use RK_FORMAT_RGBA_8888.

    Currently my textures have GL_RGBA format.


    (As a background thought: I also assume using an additional framebuffer /dev/fb1 formatted NV21 as overlay with rk3288's hardware composer might possibly work too and speed things up, especially for 4k/60fps.)

    So if possible, could you give me the magics for both formats:

    1) NV21 = YCbCr 4:2:0 semi-planar

    2) RGBA_8888 = GL_RGBA

    In your sample code I also see dma_img struct and especially dma_img.dma_fd(). I am not familiar with this dma-img/buf stuff, so maybe you can tell/show me how to create this struct and how to get the texture memory address pointer? Do you have some sample code or links to this?

Reply
  • Hi Anthony,

    Thanks for your answer, very helpful!

    rk3288 video decoder specs state that decoders output format is YCbCr 4:2:0 semi-planar; that is the same as NV21.

    Right now I use other dedicated blitter hardware on the rk3288 for this 2D hw accelerated conversion to GL_RGBA/RGBA888.

    I dont know if eglImage functions for fbdev support NV21 to RGBA conversion internally that are efficient, deducing from your code it seems it does.

    In my blitter conversion code I use RK_FORMAT_YCbCr_420_SP as source formart, and in xbmc's code on android I see that HAL_PIXEL_FORMAT_YCrCb_NV12  and HAL_PIXEL_FORMAT_YCrCb_NV12_10 are stated (the latter probably for dedicated HEVC decoder).

    As destination format I use RK_FORMAT_RGBA_8888.

    Currently my textures have GL_RGBA format.


    (As a background thought: I also assume using an additional framebuffer /dev/fb1 formatted NV21 as overlay with rk3288's hardware composer might possibly work too and speed things up, especially for 4k/60fps.)

    So if possible, could you give me the magics for both formats:

    1) NV21 = YCbCr 4:2:0 semi-planar

    2) RGBA_8888 = GL_RGBA

    In your sample code I also see dma_img struct and especially dma_img.dma_fd(). I am not familiar with this dma-img/buf stuff, so maybe you can tell/show me how to create this struct and how to get the texture memory address pointer? Do you have some sample code or links to this?

Children