I am using EGLImage in combination with Android GraphicBuffers to remove the need to copy to/from GPU memory. The problem is it seems only one format is supported (RGBA8888). I would like to confirm this, either by quering the driver or if you have the answer here.
1. Is there a way to get this information from the driver?
2. Is there a list of supported GraphicBuffer formats?
Hi emilwesterngren,
thank you for your post. Certainly more than one format you have pointed out should be supported. However it is quite difficult to tell which formats are supported in your gralloc implementaion as it depends on specific vendor integration. Would you be able to share more details what device you are trying this on?
Maybe you could try to select your desired format first and then tell us what is going wrong and we may be able to help you.
HTH,
Sylwester
Hi, thanks for answering. So it seems the only way to find this out is by trial and error? I can get back with the specific errors on the platforms I use.
In general, I am trying to render YUV buffers from the camera in OpenGL ES without using glTexImage2D/glReadPixels for texture loading. One problem is OpenGL ES has very limited support for YUV formats. I know there exists an extension on some drivers (EGL external image) where you can sample YUV, but that includes automatic conversion to RGBA which I don't want, and I don't think it can be used to render TO a buffer (i.e. automatic conversion back to YUV from RGBA). Please correct me if I'm wrong though.
I've been thinking of switching to OpenCL instead, since I've heard the support is better for this format. What would you suggest is the best solution for Mali GPU regarding this problem?
Best regards,
Emil Westergren
Hi Emil,
You can create an EGLImageKHR then import it in OpenCL using clCreateFromEGLImageKHR
CL uses the type of the EGLImage to find out how much data it needs to sample from the cl_image but never performs any type conversion. (Data will be interpolated only if you enable it in the image sampler).
Therefore I would recommend using a CL_RGBA image (Not all CL or EGL image formats are supported by the extension) for your YUV data, this way you get 32bit of raw data for each image read in your kernel
Hope this helps,
Anthony
There is also an ARM extension which allows you to import dma_buf allocations as a buffer. (This way there is no type associated to the buffer you can simply use vload/vstore on the buffer).
This requires a Mali driver which is r7p0 or above and you need to obviously be able to provide a dma_buf allocation.
Is that something which would work for you you think ?
the GL_EXT_YUV_target, that allows GLES shaders to directly sample the YUV values, will come soon with the end devices. No specific dates nor devices yet though.
That might be possible yes. I will look into it, thank you.
Hi Sylwester,
That's exactly what I'm looking for. Do you have more information about this extension other than https://www.khronos.org/registry/gles/extensions/EXT/EXT_YUV_target.txt ? Can't wait to get my hands on it.
Do you know how this kind of texture loading will be supported in Vulkan?
"Is there a list of supported Pixel formats? or way to get this information from driver for android?"
I see a list here, https://developer.android.com/reference/android/graphics/PixelFormat.html, but don't know if there are any device specific modifications to this list.
-Deepali