From 40ab1da1b4a1dac7de590fc9d9fc9b2ac7b39784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 21 Feb 2024 10:40:33 +0100 Subject: [PATCH] egl/wayland: Flush after blitting to linear copy We need to flush after blitting to the linear copy, or the Wayland compositor may not see the correct linear buffer contents. v2: * Keep blitImage call in the same place (Daniel Stone) * Add second flush for the blit to linear copy Fixes: 58f90fd03f4a ("egl/wayland: fix glthread crashes") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9816 Part-of: (cherry picked from commit 7a6836611e39cf00c32b6e189ca7eb2f370d68fe) --- .pick_status.json | 2 +- src/egl/drivers/dri2/platform_wayland.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index f02293c1db9..b1a1cb46675 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1114,7 +1114,7 @@ "description": "egl/wayland: Flush after blitting to linear copy", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "58f90fd03f4aaf2ee19010e9cbd9cee2deda9711", "notes": null diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index ec33aeebbab..4105c2bfe4d 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1643,6 +1643,12 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, dri2_surf->current->dri_image, 0, 0, dri2_surf->base.Width, dri2_surf->base.Height, 0, 0, dri2_surf->base.Width, dri2_surf->base.Height, 0); + + if (dri2_dpy->flush) { + __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(draw); + + dri2_dpy->flush->flush(dri_drawable); + } } wl_surface_commit(dri2_surf->wl_surface_wrapper);