mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 22:30:12 +01:00
egl/wayland: fix glthread crashes
glthread unmarshalling thread cannot run concurrently with code that alloc the back bo or the code that perform the swaps. Ensure this by running dri2_flush_drawable_for_swapbuffers early. Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18223>
This commit is contained in:
parent
eafe72a6cc
commit
58f90fd03f
1 changed files with 11 additions and 3 deletions
|
|
@ -1527,6 +1527,17 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
|
|||
if (dri2_surf->color_buffers[i].age > 0)
|
||||
dri2_surf->color_buffers[i].age++;
|
||||
|
||||
/* Flush (and finish glthread) before:
|
||||
* - update_buffers_if_needed because the unmarshalling thread
|
||||
* may be running currently, and we would concurrently alloc/free
|
||||
* the back bo.
|
||||
* - swapping current/back because flushing may free the buffer and
|
||||
* dri_image and reallocate them using get_back_bo (which causes a
|
||||
* a crash because 'current' becomes NULL).
|
||||
*/
|
||||
dri2_flush_drawable_for_swapbuffers(disp, draw);
|
||||
dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
|
||||
|
||||
/* Make sure we have a back buffer in case we're swapping without ever
|
||||
* rendering. */
|
||||
if (update_buffers_if_needed(dri2_surf) < 0)
|
||||
|
|
@ -1589,9 +1600,6 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
|
|||
dri2_surf->base.Height, 0);
|
||||
}
|
||||
|
||||
dri2_flush_drawable_for_swapbuffers(disp, draw);
|
||||
dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
|
||||
|
||||
wl_surface_commit(dri2_surf->wl_surface_wrapper);
|
||||
|
||||
/* If we're not waiting for a frame callback then we'll at least throttle
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue