backend/wayland: re-use wl_buffers

Instead of re-importing a buffer each time we submit a new frame, re-use
the wl_buffer objects if possible.
This commit is contained in:
Simon Ser 2020-12-11 18:14:58 +01:00
parent de896caceb
commit defcd9b025
3 changed files with 46 additions and 4 deletions

View file

@ -210,6 +210,11 @@ static void backend_destroy(struct wlr_backend *backend) {
wlr_drm_format_set_finish(&wl->linux_dmabuf_v1_formats);
struct wlr_wl_buffer *buffer, *tmp_buffer;
wl_list_for_each_safe(buffer, tmp_buffer, &wl->buffers, link) {
destroy_wl_buffer(buffer);
}
destroy_wl_seats(wl);
if (wl->zxdg_decoration_manager_v1) {
zxdg_decoration_manager_v1_destroy(wl->zxdg_decoration_manager_v1);
@ -270,6 +275,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
wl_list_init(&wl->devices);
wl_list_init(&wl->outputs);
wl_list_init(&wl->seats);
wl_list_init(&wl->buffers);
wl->remote_display = wl_display_connect(remote);
if (!wl->remote_display) {