egl/android: fix segfault within swap_buffers
authorTapani Pälli <tapani.palli@intel.com>
Thu, 18 May 2017 07:21:59 +0000 (10:21 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Fri, 19 May 2017 10:57:52 +0000 (13:57 +0300)
commitf347bac30f4045a9583f95a5776484b1a2947183
tree77e0b0636e5ba57932393c752799704b44198ff9
parent1f2d0093bf5084f65a923582881dc74153c804a4
egl/android: fix segfault within swap_buffers

Function droid_swap_buffers may get called without dri2_surf->buffer set,
in these cases we don't have a back buffer set either. Patch fixes segfault
seen with 3DMark that uses android.opengl.GLSurfaceView for rendering it's UI.

backtrace:
   #00 pc 00013f88  /system/lib/egl/libGLES_mesa.so (droid_swap_buffers+104)
   #01 pc 000117b2  /system/lib/egl/libGLES_mesa.so (dri2_swap_buffers+50)
   #02 pc 000058b2  /system/lib/egl/libGLES_mesa.so (eglSwapBuffers+386)
   #03 pc 00011329  /system/lib/libEGL.so (eglSwapBuffersWithDamageKHR+553)
   #04 pc 000118e7  /system/lib/libEGL.so (eglSwapBuffers+55)
   #05 pc 000754dc  /system/lib/libandroid_runtime.so

Note, this is v1 as v2 caused dEQP regressions.

Fixes: 2acc69d ("EGL/Android: Add EGL_EXT_buffer_age extension")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
src/egl/drivers/dri2/platform_android.c