EGLContext issue in P9.0.0_1.0.0-ga for i.MX 8M Quad

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EGLContext issue in P9.0.0_1.0.0-ga for i.MX 8M Quad

2,135 Views
igrik
Contributor I

Dear community,

I am working on Android 9 for a custom board based on the imx8mq design (HDMI connection). U-boot and kernel seem to load fine. I also get the Android to boot up and load proprietary Vivante libraries. Unfortunately, as soon as the surfaceflinger tries to create a EGLContext, the process crashes with EGL_BAD_ALLOC. Did I miss some kind of additional configuration in Android/Linux kernel?

Kernel version

4.9.51

Kernel cmdline

init=/init video=mxcfb0:dev=hdmi,1920x1080M@60 androidboot.hardware=freescale androidboot.fbTileSupport=enable androidboot.gui_resolution=1080p cma=736M androidboot.primary_display=imx-drm firmware_class.path=/vendor/firmware buildvariant=userdebug [...]

Logcat error

01-01 00:00:11.441 2664 2664 D libEGL : loaded /vendor/lib64/egl/libEGL_VIVANTE.so
01-01 00:00:11.729 2664 2664 D libEGL : loaded /vendor/lib64/egl/libGLESv1_CM_VIVANTE.so
01-01 00:00:11.807 2664 2664 D libEGL : loaded /vendor/lib64/egl/libGLESv2_VIVANTE.so
01-01 00:00:11.850 2664 2664 D v_gal : HAL user version 6.2.4 build 163672
01-01 00:00:11.850 2664 2664 D v_gal : HAL kernel version 1.1.771948129 build 0
[...]
01-01 00:00:11.876 2664 2664 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
01-01 00:00:11.876 2664 2664 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
01-01 00:00:11.877 2664 2664 I SurfaceFlinger: ===> got EGL display: 0x1
01-01 00:00:11.877 2664 2664 I SurfaceFlinger: ===> looking for EGL config
01-01 00:00:11.877 2664 2664 W SurfaceFlinger: no suitable EGLConfig found, trying a simpler query
01-01 00:00:11.877 2664 2664 D v_gal : HAL user version 6.2.4 build 163672
01-01 00:00:11.877 2664 2664 D v_gal : HAL kernel version 1.1.-241628520 build 65535
[...]
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: EGL information:
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: vendor : Android
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: version : 1.4 Android META-EGL
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: extensions: EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_ANDROID_get_native_client_buffer EGL_ANDROID_front_buffer_auto_refresh EGL_ANDROID_get_frame_timestamps EGL_EXT_surface_SMPTE2086_metadata EGL_EXT_surface_CTA861_3_metadata EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_lock_surface EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_create_context EGL_KHR_surfaceless_context EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_recordable EGL_KHR_partial_update EGL_EXT_buffer_age
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: Client API: OpenGL_ES
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: EGLSurface: 8-8-8-8, config=0xb
01-01 00:00:11.898 2664 2664 D v_gal : HAL user version 6.2.4 build 163672
01-01 00:00:11.898 2664 2664 D v_gal : HAL kernel version 1.1.8 build 0
01-01 00:00:11.898 2664 2664 I SurfaceFlinger: ===> client version is 2
01-01 00:00:11.900 2664 2664 I SurfaceFlinger: ===> creating EGL context
01-01 00:00:11.900 2664 2664 D libEGL : ===> creating new context from EGL context
01-01 00:00:11.900 2664 2664 D v_gal : HAL user version 6.2.4 build 163672
01-01 00:00:11.900 2664 2664 D v_gal : HAL kernel version 1.1.-40 build 4294967168
[...]
01-01 00:00:11.902 2664 2664 D libEGL : ===> creating new context returned EGL_BAD_ALLOC (0x3003)
01-01 00:00:11.902 2664 2664 D libEGL : ===> continuing w/o valid context
01-01 00:00:11.902 2664 2664 F SurfaceFlinger: EGLContext creation failed
--------- beginning of crash

Tags (3)
0 Kudos
Reply
5 Replies

1,589 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi igrik,

In Android layer, we have the reference code to alloc aligned memory buffer for GPU, since you are using this, you need implement such align by yourself, from Android, the align code can be found in function alloc().

Regards

0 Kudos
Reply

1,589 Views
igrik
Contributor I

I found some allocation-related definitions in imx8m/evk_8mq/BoardConfig.mk

USE_ION_ALLOCATOR := true
USE_GPU_ALLOCATOR := false

They are only used in vendor/nxp/imx-vpu-cnm, which seems not relevant for imx8mq, as it uses vendor/nxp/imx-vpu-hantro.

I have also checked projects in vendor/nxp-opensource/imx/displaydisplaygralloc_v3 and hwcomposer_v20. Gralloc and hwcomposer are loaded correctly and the display module does provide an alloc function. However, this function isn't called before the crash occurs.

Bio_TICFSL‌, do you have an idea which module is the right one for me to adapt? I didn't find any documentation on this.

0 Kudos
Reply

1,589 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

"Android\hardware\imx\mx6\libgralloc_wrapper\BufferManager.cpp" is from Android, the align code.

0 Kudos
Reply

1,589 Views
igrik
Contributor I

Thanks again,

Unfortunately, there is no such project in the Android 9 source tree for imx8mq. I didn't find any files with this or similar name or a gralloc-related project :smileysad:

Bio_TICFSL‌, any ideas? I will check if I can add this project manually to my source tree.

0 Kudos
Reply

1,589 Views
igrik
Contributor I

Hi Bio_TICFSL‌,

Thank you very much for the fast response!

we have the reference code to alloc aligned memory buffer for GPU

Do you mean, there is already an existing reference implementation somewhere, which has to be extended for custom board designs? Could you please point me to the project or file where this is used / has to be implemented (like kernel, gralloc, native frameworks, etc)? Probably there are many functions called alloc in the Android workspace.

Regards,

igrik

0 Kudos
Reply