Hi all,
We're trying to use EGLImages on an Adreno 225 GPU (Qualcomm 8960 SoC) and the stack crashes right in the middle of eglCreateImageKHR with a SIGSEGV.
Here is the code we're using. This code runs fine on Adreno 320, Mali, PowerVR and Tegra GPUs.
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); int minor, major; eglInitialize(display, &major, &minor); eglBindAPI(EGL_OPENGL_ES_API); GLint configAttribs[] = { EGL_ALPHA_SIZE, 8, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, EGL_NONE }; int n; EGLConfig config; eglChooseConfig(display, configAttribs, &config, 1, &n); EGLContext context; GLint eglContextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE }; context = eglCreateContext(display, config, EGL_NO_CONTEXT, eglContextAttribs); GLint pbufferAttribs[] = { EGL_WIDTH, 540, EGL_HEIGHT, 888, EGL_NONE }; EGLSurface pbuffer; pbuffer = eglCreatePbufferSurface(display, config, pbufferAttribs); eglMakeCurrent(display, pbuffer, pbuffer, context); GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 540, 888, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); EGLImageKHR imageKHR; EGLint khrAttribList[] = { EGL_IMAGE_PRESERVED_KHR, EGL_FALSE, EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_NONE }; imageKHR = eglCreateImageKHR(display, context, EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer)tex, khrAttribList);
And we get the following stack trace:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'userdebug/test-keys'
pid: 6566, tid: 6566, name: m.android.gljni >>> com.android.gljni <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
r0 50fa96d8 r1 00000001 r2 50e1d2d0 r3 00000000
r4 00000000 r5 50e1d2d0 r6 000030b1 r7 4bedf328
r8 00003038 r9 00000000 sl 00000000 fp 00003121
ip 4d2f7a91 sp be91a410 lr 4d2f7a9f pc 00000000 cpsr 20000010
d0 0000000000000001 d1 0000000400000000
d2 0000000000000001 d3 000003780000021c
d4 0000040000000001 d5 0000022000000400
d6 001dc000001dc000 d7 0000000000000000
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 00000000000006a0 d17 0000000000000001
d18 0000000000000000 d19 0000000000000000
d20 0000000d4bf09f08 d21 51173d334bf0a024
d22 0000000600000000 d23 00000000000003c0
d24 3f656ac020000000 d25 8000000000000000
d26 3fe5555555555555 d27 0000000000000000
d28 0000000000000005 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 80000010
backtrace:
#00 pc 00000000 <unknown>
#01 pc 00023a9d /system/lib/egl/libGLESv1_CM_adreno200.so (oglSetBlobFunc+36)
#02 pc 00011db0 /system/lib/egl/libEGL_adreno200.so (qeglDrvAPI_eglCreateImageKHR+2008)
#03 pc 00005c1c /system/lib/egl/libEGL_adreno200.so (eglCreateImageKHR+28)
#04 pc 0000c785 /system/lib/libEGL.so (eglCreateImageKHR+72)
#05 pc 00001d55 /data/data/com.android.gljni/lib/libgljni.so (Java_com_android_gljni_GLJNILib_changeBackground+380)
#06 pc 0001f470 /system/lib/libdvm.so (dvmPlatformInvoke+112)
#07 pc 0004ec4f /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
#08 pc 00050d6b /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+174)
#09 pc 00028920 /system/lib/libdvm.so
#10 pc 0002d488 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#11 pc 00061983 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
#12 pc 00068f11 /system/lib/libdvm.so
#13 pc 00028920 /system/lib/libdvm.so
#14 pc 0002d488 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#15 pc 000616bd /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
#16 pc 0004b167 /system/lib/libdvm.so
#17 pc 000489dd /system/lib/libandroid_runtime.so
#18 pc 000494bf /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
#19 pc 00000dcf /system/bin/app_process
stack:
be91a3d0 00000002
be91a3d4 000030b1
be91a3d8 400fcf30
be91a3dc 4bf74034 /system/lib/egl/libEGL_adreno200.so
be91a3e0 51656068
be91a3e4 00000004
be91a3e8 00000000
be91a3ec 4bf74034 /system/lib/egl/libEGL_adreno200.so
be91a3f0 50e1d2d0
be91a3f4 000030b1
be91a3f8 00000001
be91a3fc 50e1d2d0
be91a400 000030b1
be91a404 4bf5d568 /system/lib/egl/libEGL_adreno200.so
be91a408 df0027ad
be91a40c 00000000
#00 be91a410 be91a620 [stack]
........ ........
#01 be91a410 be91a620 [stack]
be91a414 4bf65db4 /system/lib/egl/libEGL_adreno200.so (qeglDrvAPI_eglCreateImageKHR+2012)
#02 be91a418 00000000
be91a41c 0000000d
be91a420 be91a448 [stack]
be91a424 be91a448 [stack]
be91a428 00000010
be91a42c be91a440 [stack]
be91a430 00000000
be91a434 be91a448 [stack]
be91a438 51181cad /system/lib/egl/libGLESv2_adreno200.so (leia_sethwstate_scissor)
be91a43c 000030b1
be91a440 4bf74034 /system/lib/egl/libEGL_adreno200.so
be91a444 516560a0
be91a448 00000002
be91a44c 00000001
be91a450 00000000
be91a454 00000001
Are we missing something in image or texture creation ? Is there the known issue ?
Thanks for your help,
Best regards.
Damien.
Hi Damien..
At first look, the code for calling eglCreatImageKHR seems correct...
1) Try using NULL instead of the khrAttribList (you're using default values, so this should be ok)
2) Try using eglGetCurrentContext(), instead of context
3) Can you confirm glGetError returns GL_NO_ERROR before the call to eglCreateImageKHR?
thanks
Hello mhfeldma,
I tryied your 3 suggestions and the behavior is stricly the same. I got the same stack trace the three times ;)
Do you have any other suggestion ?
Thanks,
Damien
We're curious which Android versions you are running on (for all devices where this is working and not). This information should be printed out in the logcat (search for Adreno or eglInitialize). Also let us know what is listed in about phone.
We appreciate the legwork - it's essential to helping to figure out exactly which version/branch the feature is not working on.
thanks
The phone only phone where we have the problem is a Motorola Razr M, here are some device information:
Model: DROID RAZR M
System version: 98.14.63.XT907.Verizon.en.US
Build number: smq_vzw-userdebug 4.1.2.9.8.1Q-63 35 test-keys
Android version: 4.1.2
Kernel version: 30.31-eng-g06eb01c
Dump of /proc/cpuinfo:
Processor : ARMv7 Processor rev 0 (v7l)
processor : 0
BogoMIPS : 13.53
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x1
CPU part : 0x04d
CPU revision : 0
Hardware : msm8960dt
Revision : 81a0
Serial : 000000020050c596
The Android version is JellyBean, and we're not facing the issue on the other phones. We tried:
And none of them are failing creating the image.
Here are some traces from graphic stack initialization:
gralloc : using (fd=14)
gralloc : id = msmfb40_90701
gralloc : xres = 540 px
gralloc : yres = 960 px
gralloc : xres_virtual = 540 px
gralloc : yres_virtual = 1922 px
gralloc : bpp = 32
gralloc : r = 24:8
gralloc : g = 16:8
gralloc : b = 8:8
gralloc : width = 54 mm (254.000000 dpi)
gralloc : height = 95 mm (256.673676 dpi)
gralloc : refresh rate = 60.00 Hz
[...]
SurfaceFlinger: EGL informations:
SurfaceFlinger: # of configs : 36
SurfaceFlinger: vendor : Android
SurfaceFlinger: version : 1.4 Android META-EGL
SurfaceFlinger: extensions: EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_ANDROID_image_native_buffer
SurfaceFlinger: Client API: OpenGL_ES
SurfaceFlinger: EGLSurface: 8-8-8-8, config=0x4
SurfaceFlinger: OpenGL informations:
SurfaceFlinger: vendor : Qualcomm
SurfaceFlinger: renderer : Adreno (TM) 225
SurfaceFlinger: version : OpenGL ES-CM 1.1 [email protected] AU@ (CL@2726865)
SurfaceFlinger: extensions: GL_EXT_debug_marker GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_APPLE_texture_2D_limited_npot GL_ARB_vertex_buffer_object GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_draw_texture GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_framebuffer_object GL_OES_matrix_palette GL_OES_packed_depth_stencil GL_OES_point_size_array GL_OES_point_sprite GL_OES_read_format GL_OES_rgb8_rgba8 GL_OES_stencil_wrap GL_OES_texture_cube_map GL_OES_texture_env_crossbar GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_texture_mirrored_repeat GL_QCOM_binning_control GL_QCOM_extended_get GL_QCOM_tiled_rendering GL_AMD_compressed_3DC_texture
SurfaceFlinger: GL_MAX_TEXTURE_SIZE = 4096
SurfaceFlinger: GL_MAX_VIEWPORT_DIMS = 4096 x 4096
Thanks.
Hi,
on GS3 using Adreno 225 i do have the same issue.
It seems to me that the EGL_GL_TEXTURE_2D_KHR parameter is not working well on such GPU (compare to other Adreno or even other GPU like MALI PowerVR or NVIDIA.
I'm surprise as the extensions list seems to say it should be supported.
May be we are missing an init or texture passed as parameter is bad (for info on my side i tried multiple formats, multiple size, en even try to generate mimap in case we need the texture to be complete) all the tries drive me to same crash inside eglCreateImageKHR.
Dissassembling the libraries, it seems that the function oglSetBlobFunc access an array to get a function pointer, but that array seems not to be initialized.
Any help would be welcomed as without that it is impossible to share textures between two processes or even between two contexts GLES1.x and GLES 2.0. May be Qualcomm advise another way to share texture than usage of eglImageKHR ?
Thanks in advance for your help.
Best Regards,
Seb
Hi,
continuing investigation its seems working with a GLES 2.0 context. Is it known issue that GLES 1.1 is not working ?
But i would need eglCreateImageKHR working with GLES 1.1. Any Workaround is welcomed.
Br
Seb