backend/drm: re-use FBs

Instead of importing buffers to GBM and KMS at each frame, cache them
and re-use them while the wlr_buffer is alive.

This is the same as [1] and [2] but for the DRM backend.

[1]: https://github.com/swaywm/wlroots/pull/2538
[2]: https://github.com/swaywm/wlroots/pull/2539
This commit is contained in:
Simon Ser 2020-12-22 18:42:59 +01:00
parent 91cb0fc443
commit d9bbc416a6
4 changed files with 56 additions and 15 deletions

View file

@ -42,6 +42,11 @@ static void backend_destroy(struct wlr_backend *backend) {
wlr_signal_emit_safe(&backend->events.destroy, backend);
struct wlr_drm_fb *fb, *fb_tmp;
wl_list_for_each_safe(fb, fb_tmp, &drm->fbs, link) {
drm_fb_destroy(fb);
}
wl_list_remove(&drm->display_destroy.link);
wl_list_remove(&drm->session_destroy.link);
wl_list_remove(&drm->session_active.link);
@ -147,6 +152,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
wlr_backend_init(&drm->backend, &backend_impl);
drm->session = session;
wl_list_init(&drm->fbs);
wl_list_init(&drm->outputs);
drm->dev = dev;