diff --git a/.pick_status.json b/.pick_status.json index ba5fe26382b..a6066e95a75 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -124,7 +124,7 @@ "description": "egl/wayland: wait for compositor to release shm buffers", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index eef62594ade..6bcdc9a3e17 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -2454,7 +2454,7 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf) } /* else choose any another free location */ - if (!dri2_surf->back) { + while (!dri2_surf->back) { for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { if (!dri2_surf->color_buffers[i].locked) { dri2_surf->back = &dri2_surf->color_buffers[i]; @@ -2472,11 +2472,15 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf) break; } } - } - if (!dri2_surf->back) { - _eglError(EGL_BAD_ALLOC, "failed to find free buffer"); - return -1; + /* wait for the compositor to release a buffer */ + if (!dri2_surf->back) { + if (wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_surf->wl_queue) == + -1) { + _eglError(EGL_BAD_ALLOC, "waiting for a free buffer failed"); + return -1; + } + } } dri2_surf->back->locked = true;