From 037b21647b06957682ff8a0a1b24dcbc49e1c357 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Dec 2022 17:39:23 +0100 Subject: backend/drm: store pending FB in state Instead of having a pending_fb field on the struct wlr_drm_plane, move it to struct wlr_drm_connector_state. That way, there's no risk having a stale pending FB around: the state doesn't survive across tests and commits. The cursor is a special case because it's disconnected from the atomic state: the wlr_backend_impl.set_cursor hook sets the cursor for the next commit. Move the field to wlr_drm_connector.cursor_pending_fb. --- include/backend/drm/drm.h | 4 +--- include/backend/drm/renderer.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'include/backend') diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 365f1ad2..fa18225c 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -22,8 +22,6 @@ struct wlr_drm_plane { /* Only initialized on multi-GPU setups */ struct wlr_drm_surface mgpu_surf; - /* Buffer to be submitted to the kernel on the next page-flip */ - struct wlr_drm_fb *pending_fb; /* Buffer submitted to the kernel, will be presented on next vblank */ struct wlr_drm_fb *queued_fb; /* Buffer currently displayed on screen */ @@ -99,6 +97,7 @@ struct wlr_drm_connector_state { bool modeset; bool active; drmModeModeInfo mode; + struct wlr_drm_fb *primary_fb; }; struct wlr_drm_connector { @@ -153,7 +152,6 @@ size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc); void drm_lease_destroy(struct wlr_drm_lease *lease); -struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane); struct wlr_drm_fb *get_next_cursor_fb(struct wlr_drm_connector *conn); #define wlr_drm_conn_log(conn, verb, fmt, ...) \ diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h index 77ed4127..5851d228 100644 --- a/include/backend/drm/renderer.h +++ b/include/backend/drm/renderer.h @@ -45,6 +45,7 @@ void drm_fb_destroy(struct wlr_drm_fb *fb); void drm_fb_clear(struct wlr_drm_fb **fb); void drm_fb_move(struct wlr_drm_fb **new, struct wlr_drm_fb **old); +struct wlr_drm_fb *drm_fb_lock(struct wlr_drm_fb *fb); struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf, struct wlr_buffer *buffer); -- cgit v1.2.3