首页 > 解决方案 > eglCreateImageKHR is working only with RGBA8888 format. How to send RGB888 data?

问题描述

I implemented an opengl-es application running on mali-400 gpu. I grab the 1280x960 RGB buffer from camera and render on GPU , I use zero copy operation using EGL_EXT_image_dma_buf_import extension.

my problem is that the Besler camera gives frames in RGB888 format. but eglCreateImageKHR is working only if I give RGBA8888 format . If I pass RGB888 to eglCreateImageKHR it gives black screen and also egl image returned is 0.

will I have to convert RGB888 to RGBA8888 before passing? what are the other options. below is my code.

EGLint egl_img_attr[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
    EGL_DMA_BUF_PLANE0_FD_EXT, buffer->dbuf_fd,
    EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
    EGL_DMA_BUF_PLANE0_PITCH_EXT, TEX_WIDTH * 3,
    EGL_WIDTH, TEX_WIDTH,
    EGL_HEIGHT, TEX_HEIGHT,
    EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_RGBA8888 ,
    EGL_NONE, EGL_NONE };

buffer->egl_img = eglCreateImageKHR(egl_dpy, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, egl_img_attr);

标签: opengl-esgpueglmali-400

解决方案


推荐阅读