Created attachment 73945 [details]
Swap buffer when a segv happens.
When using the Wayland platform backend of Mesa, if there's no call to any rendering/drawing function, there will be no back buffer present (it should be NULL). This causes any call to dri2_swap_buffers to segfault, since it accesses dri2_surf->back->age.
The egl semantics is that the back buffer is undefined at this situation, maybe presenting only garbage when the swap buffer is done, but it should not crash.
This segfault behavior was reproduced when using the Wayland backend of EFL, and a test program was written with a window and a canvas, without any objects on it. It would trigger a swap buffer but no call was done to allocate a back buffer.
There's a backtrace attached to this bug that shows where the error happens.
Created attachment 74305 [details] [review]
Make sure we have a back buffer in swap buffers
This should fix the problem.
The patch fix the problem, as expected, thanks!
Is there any chance that it gets backported to the stable release/branch too?
Pushed to master. I added the NOTE in the commit message that will make sure it gets picked to the stable branches. I don't know if there's a 9.0.x release planned but 9.1.0 should be out end of Feb and should include this patch.
Author: Kristian Høgsberg <email@example.com>
Date: Wed Feb 6 15:41:54 2013 -0500
egl-wayland: Make sure we allocate a back buffer even if nothing was rendere
At eglSwapBuffer time, we blindly assume we have a back buffer, but the
back buffer only gets allocated when somebody tries to render something.
NOTE: This is a candidate for the 9.0 and 9.1 branches.
on Jul 01, 2016 at 11:34:49.
(provided by the Example extension).