summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2022-02-04 10:42:19 +0000
committerMarge Bot <emma+marge@anholt.net>2022-02-07 09:57:41 +0000
commit3da8300562efeeeeea6c80bce98c830b0da28622 (patch)
tree886a2272726679995986deec52ed8223147a7ac0 /src/egl
parentfa4390f7bf6c2bff7ee6799b67accdf2e2db475c (diff)
egl/wayland: Reset buffer age when destroying buffers
A buffer age of 0 means that the buffer is uninitialised or has unknown content. We rely on the buffer age initially being 0 through zalloc when the surface is first created; when they are first used for a swap, we set their age to 1, and then we increment the age of every buffer in the chain with a non-zero age when we swap. Now that we can release buffers, both through dmabuf-feedback as well as detecting when we're using a deeper swapchain than the compositor needs, make sure to reset their age as they are released. Without doing this, the age will stay as it was before it was released and be incremented, returning the wrong age to the user the first time a previously-released buffer slot has been reused. Signed-off-by: Daniel Stone <daniels@collabora.com> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5977 Fixes: 22d796feb828 ("egl/wayland: break double/tripple buffering feedback loops") Fixes: b5848b2dac14 ("egl/wayland: use surface dma-buf feedback to allocate surface buffers") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14873>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 93dac2fd09d..5ff83cce08a 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -256,6 +256,7 @@ wl_buffer_release(void *data, struct wl_buffer *buffer)
wl_buffer_destroy(buffer);
dri2_surf->color_buffers[i].wl_release = false;
dri2_surf->color_buffers[i].wl_buffer = NULL;
+ dri2_surf->color_buffers[i].age = 0;
}
dri2_surf->color_buffers[i].locked = false;
@@ -863,6 +864,7 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->color_buffers[i].dri_image = NULL;
dri2_surf->color_buffers[i].linear_copy = NULL;
dri2_surf->color_buffers[i].data = NULL;
+ dri2_surf->color_buffers[i].age = 0;
}
if (dri2_dpy->dri2)
@@ -1145,6 +1147,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].dri_image = NULL;
dri2_surf->color_buffers[i].linear_copy = NULL;
+ dri2_surf->color_buffers[i].age = 0;
}
}
@@ -2342,6 +2345,7 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->color_buffers[i].data_size);
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].data = NULL;
+ dri2_surf->color_buffers[i].age = 0;
}
}