mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
egl/wayland: Properly clear stale buffers on resize
The following chain of events results in an incorrectly sized buffer persisting beyond its useful lifetime, and causing visual artifacts. buffer is attached at size A window is resized to size B rendering takes place for size B window is resized back to size A swapbuffers with damage is called In this scenario, update_buffers fails to recognize that the surface it's about to commit is a different size than it has rendered. The attached_width and attached_height are set incorrectly, and periodic flickering is observed. Instead, we set a boolean flag at time of resize and use this at the time we latch the window dimensions as surface dimensions to decide whether to discard stale buffers. Signed-off-by: Derek Foreman <derek.foreman@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13270>
This commit is contained in:
parent
885f9b3b75
commit
28d12716e8
2 changed files with 6 additions and 4 deletions
|
|
@ -302,6 +302,7 @@ struct dri2_egl_surface
|
|||
struct wl_drm *wl_drm_wrapper;
|
||||
struct wl_callback *throttle_callback;
|
||||
int format;
|
||||
bool resized;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRM_PLATFORM
|
||||
|
|
|
|||
|
|
@ -279,6 +279,8 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
|
|||
dri2_surf->base.Height == wl_win->height)
|
||||
return;
|
||||
|
||||
dri2_surf->resized = true;
|
||||
|
||||
/* Update the surface size as soon as native window is resized; from user
|
||||
* pov, this makes the effect that resize is done immediately after native
|
||||
* window resize, without requiring to wait until the first draw.
|
||||
|
|
@ -714,10 +716,9 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
|
|||
dri2_surf->dy = dri2_surf->wl_win->dy;
|
||||
}
|
||||
|
||||
if (dri2_surf->wl_win &&
|
||||
(dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
|
||||
dri2_surf->base.Height != dri2_surf->wl_win->attached_height)) {
|
||||
dri2_wl_release_buffers(dri2_surf);
|
||||
if (dri2_surf->resized) {
|
||||
dri2_wl_release_buffers(dri2_surf);
|
||||
dri2_surf->resized = false;
|
||||
}
|
||||
|
||||
if (get_back_bo(dri2_surf) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue