eglMakeCurrent返回EGL_BAD_ALLOC

环境:Android、OpenGL ES 3.0
硬件:T-Firefly 3288(RK3288)、昂达 V10 Pro(MTK8173)、小米平板2(Intel Atom Z8500)

现象:创建两个EGLSurface,一个为offscreen的FBO,另一个为SurfaceView,先对第一个EGLSurface调用makeCurrent,不进行任何绘制操作,再对第二个EGLSurface调用makeCurrent,程序崩溃,堆栈如下:
04-18 20:46:19.597 3232-3328/sanbu.mc_400 E/mali_so: encounter the first mali_error : 0x0003 : execution failed (gles_fb_context_flush at hardware/arm/maliT760/driver/product/gles/src/fb/mali_gles_fb_module_api.c:1395)
04-18 20:46:19.597 3232-3328/sanbu.mc_400 E/mali_so: to dump the call_stack of the first error :
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #00 pc 0042fbf4 /system/vendor/lib/egl/rk3288/libGLES_mali.so
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #01 pc 003fbfa4 /system/vendor/lib/egl/rk3288/libGLES_mali.so
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #02 pc 003d5874 /system/vendor/lib/egl/rk3288/libGLES_mali.so (eglMakeCurrent+980)
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #03 pc 0001016f /system/lib/libEGL.so (android::egl_display_t::makeCurrent(android::egl_context_t*, android::egl_context_t*, void*, void*, void*, void*, void*, void*)+96)
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #04 pc 0001286f /system/lib/libEGL.so (eglMakeCurrent+266)
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #05 pc 0006323d /system/lib/libandroid_runtime.so
04-18 20:46:19.676 3232-3328/sanbu.mc_400 D/mali_so: #06 pc 00bf6ef7 /data/dalvik-cache/arm/system@framework@boot.oat
04-18 20:46:19.676 3232-3328/sanbu.mc_400 E/libEGL: eglMakeCurrent:786 error 3003 (EGL_BAD_ALLOC)

这个问题仅在瑞芯微的RK3288平台上存在,另外两家(MTK和Intel)设备运行正常。

根据堆栈打印的信息和在其它设备上测试的结果,初步推断该问题很大程度上与GPU硬件实现或驱动相关。

规避的方式:在切换两个surface的context之间进行一次绘制操作。

不知道这个锅是ARM Mali的还是RK的,不过RK的东西真不咋的。

Leave a Reply

Your email address will not be published. Required fields are marked *