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);
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);
EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_NV12,
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
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 ?.