[Mesa-dev] [PATCH] android: fix segfault within swap_buffers

Tapani Pälli tapani.palli at intel.com
Wed Mar 8 06:08:55 UTC 2017


On 03/07/2017 07:33 PM, Emil Velikov wrote:
> On 6 March 2017 at 12:27, Tapani Pälli <tapani.palli at intel.com> wrote:
>> 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
>>
>> Fixes: 2acc69d ("EGL/Android: Add EGL_EXT_buffer_age extension")
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/egl/drivers/dri2/platform_android.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
>> index 14e13b8..d2769b8 100644
>> --- a/src/egl/drivers/dri2/platform_android.c
>> +++ b/src/egl/drivers/dri2/platform_android.c
>> @@ -634,7 +634,9 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
>>         if (dri2_surf->color_buffers[i].age > 0)
>>            dri2_surf->color_buffers[i].age++;
>>      }
>> -   dri2_surf->back->age = 1;
>> +
>> +   if (dri2_surf->back)
>> +      dri2_surf->back->age = 1;
>>
> It seems like we're papering over the problem:
>
> Both wayland and drm call get_back_bo() prior to touching
> dri2_surf->back. Why we don't want to do the same here ?
> Seems like my "we want to unify the implementations [or bad things
> might happen]" kicked in earlier than expected :-\

Yep that seems the case. I'll test just doing the same thing. Not sure 
if we really need to fetch that back bo here though (?)

// Tapani



More information about the mesa-dev mailing list