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

Mali 450 r6p1 & DMABUF

Hello,

I have been trying to use DMABUF With egl on a Mali 450 (on an odroid C2).

I was able to successfully use it with the following setup for a 1920x1080 image :

const EGLint img_attrs[] = {

          EGL_WIDTH, 1920,

          EGL_HEIGHT, 1080,

          EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_RGBA8888,

          EGL_DMA_BUF_PLANE0_FD_EXT, pbuffer->fd_handle,

          EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,

          EGL_DMA_BUF_PLANE0_PITCH_EXT, 1920,

          EGL_NONE

      };

eglCreateImageKHR(eglGetCurrentDisplay(), EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, 0, img_attrs);

Though RGBA format is not optimal when working with 1080p or 4K images, especially in terms of memory bandwidth.

So I wanted to use either DRM_FORMAT_NV12 or DRM_FORMAT_YUV420.

As far as i have seen DRM_FORMAT_NV12 is described as a two planes format in drm_fourcc.h so i tried the following :

const EGLint img_attrs[] = {

          EGL_WIDTH, 1920,

          EGL_HEIGHT, 1080,

          EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_NV12,

          EGL_DMA_BUF_PLANE0_FD_EXT, pbuffer->fd_handle,

          EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,

          EGL_DMA_BUF_PLANE0_PITCH_EXT, 1920,

          EGL_DMA_BUF_PLANE1_FD_EXT, pbuffer->fd_handle,

          EGL_DMA_BUF_PLANE1_OFFSET_EXT, 1920*1080,

          EGL_DMA_BUF_PLANE1_PITCH_EXT, 1920 / 2

          EGL_NONE

      };

eglCreateImageKHR(eglGetCurrentDisplay(), EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, 0, img_attrs);

This will results in EGL_BAD_PARAMETER error code when using eglCreateImageKHR

I have tried many combinations both for the NV12 DRM format and the YUV420, but i have always ended up with an EGL_BAD_PARAM error when using anything else than RGBA.

Could anyone shed some light on the proper way to configure the attributes, both for YUV420 and NV12 please ?.

Parents
  • Thanks for you input !

    I can understand that this is not a native format for the GPU and that it might also have some incidence on the GPU perfomance eventually.

    Although memory considerations systemwise are also a point. 4k frame in RGBA is about 33 Megs where it would be 12 megs on YUV / NV12.

    therefore 4k@30fps is close to 1Gb /s for memory transfer, just to read the source image.

    Also and as most player try to keep a few decoded frames in avance, it makes a lot of reserved memory to keep available.

    I can still figure out what's the best between NV12, YUv420 vs RGBA in the end, but the issue I am currently facing is that I can't get the r6p1 Mali driver to create the EGL Image properly with dmabuf and YUV.

    So the former issue is that trying to create those NV12/YUV420 EGLImage will fail with EGL_BAD_PARAM, whatever i do, So either there is something i'm handling wrong in the code above, or the r6p1 opengl Mali libraries expect something that is not in the specs.

    If someone can point out someting wrong in my experiment above / confirm that YUV420 & NV12 should work, that would be great

Reply
  • Thanks for you input !

    I can understand that this is not a native format for the GPU and that it might also have some incidence on the GPU perfomance eventually.

    Although memory considerations systemwise are also a point. 4k frame in RGBA is about 33 Megs where it would be 12 megs on YUV / NV12.

    therefore 4k@30fps is close to 1Gb /s for memory transfer, just to read the source image.

    Also and as most player try to keep a few decoded frames in avance, it makes a lot of reserved memory to keep available.

    I can still figure out what's the best between NV12, YUv420 vs RGBA in the end, but the issue I am currently facing is that I can't get the r6p1 Mali driver to create the EGL Image properly with dmabuf and YUV.

    So the former issue is that trying to create those NV12/YUV420 EGLImage will fail with EGL_BAD_PARAM, whatever i do, So either there is something i'm handling wrong in the code above, or the r6p1 opengl Mali libraries expect something that is not in the specs.

    If someone can point out someting wrong in my experiment above / confirm that YUV420 & NV12 should work, that would be great

Children