diff options
author | Simon Ser <contact@emersion.fr> | 2024-02-14 13:49:49 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-02-14 17:13:25 +0100 |
commit | 76ed82c10139c9154efde0abae01c43516a8dca9 (patch) | |
tree | 580493843ec8918b8f97914fc9ff8602c68ed516 | |
parent | 97a6a58a9581452291641424d28dc0310e176afd (diff) |
backend/drm: add drm_page_flip_create()
-rw-r--r-- | backend/drm/drm.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index fc514229..005bff11 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -443,6 +443,16 @@ void drm_page_flip_destroy(struct wlr_drm_page_flip *page_flip) { free(page_flip); } +static struct wlr_drm_page_flip *drm_page_flip_create(struct wlr_drm_connector *conn) { + struct wlr_drm_page_flip *page_flip = calloc(1, sizeof(*page_flip)); + if (page_flip == NULL) { + return NULL; + } + page_flip->conn = conn; + wl_list_insert(&conn->backend->page_flips, &page_flip->link); + return page_flip; +} + static bool drm_crtc_commit(struct wlr_drm_connector *conn, const struct wlr_drm_connector_state *state, uint32_t flags, bool test_only) { @@ -451,12 +461,10 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn, struct wlr_drm_page_flip *page_flip = NULL; if (flags & DRM_MODE_PAGE_FLIP_EVENT) { - page_flip = calloc(1, sizeof(*page_flip)); + page_flip = drm_page_flip_create(conn); if (page_flip == NULL) { return false; } - page_flip->conn = conn; - wl_list_insert(&conn->backend->page_flips, &page_flip->link); } struct wlr_drm_backend *drm = conn->backend; |