backend/drm: Destroy page flips on backend destroy

When we destroy the backend, page flips will no longer be invoked meaning
those won't clean up the page flips for us.
This commit is contained in:
Alexander Orzechowski 2023-11-17 14:34:32 -05:00
parent 3aed24b8d4
commit b06d58fa8b
3 changed files with 9 additions and 3 deletions

View file

@ -39,6 +39,11 @@ static void backend_destroy(struct wlr_backend *backend) {
destroy_drm_connector(conn); destroy_drm_connector(conn);
} }
struct wlr_drm_page_flip *page_flip, *page_flip_tmp;
wl_list_for_each_safe(page_flip, page_flip_tmp, &drm->page_flips, link) {
drm_page_flip_destroy(page_flip);
}
wlr_backend_finish(backend); wlr_backend_finish(backend);
wl_list_remove(&drm->display_destroy.link); wl_list_remove(&drm->display_destroy.link);

View file

@ -420,7 +420,7 @@ static void drm_connector_set_pending_page_flip(struct wlr_drm_connector *conn,
conn->pending_page_flip = page_flip; conn->pending_page_flip = page_flip;
} }
static void page_flip_destroy(struct wlr_drm_page_flip *page_flip) { void drm_page_flip_destroy(struct wlr_drm_page_flip *page_flip) {
if (!page_flip) { if (!page_flip) {
return; return;
} }
@ -476,7 +476,7 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn,
drm_fb_clear(&layer->pending_fb); drm_fb_clear(&layer->pending_fb);
} }
page_flip_destroy(page_flip); drm_page_flip_destroy(page_flip);
} }
return ok; return ok;
} }
@ -1696,7 +1696,7 @@ static void handle_page_flip(int fd, unsigned seq,
if (conn != NULL) { if (conn != NULL) {
conn->pending_page_flip = NULL; conn->pending_page_flip = NULL;
} }
page_flip_destroy(page_flip); drm_page_flip_destroy(page_flip);
if (conn == NULL) { if (conn == NULL) {
return; return;

View file

@ -193,6 +193,7 @@ bool drm_connector_supports_vrr(struct wlr_drm_connector *conn);
size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm, size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc); struct wlr_drm_crtc *crtc);
void drm_lease_destroy(struct wlr_drm_lease *lease); void drm_lease_destroy(struct wlr_drm_lease *lease);
void drm_page_flip_destroy(struct wlr_drm_page_flip *page_flip);
struct wlr_drm_fb *get_next_cursor_fb(struct wlr_drm_connector *conn); struct wlr_drm_fb *get_next_cursor_fb(struct wlr_drm_connector *conn);
struct wlr_drm_layer *get_drm_layer(struct wlr_drm_backend *drm, struct wlr_drm_layer *get_drm_layer(struct wlr_drm_backend *drm,