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.
This commit is contained in:
Simon Ser 2022-12-06 17:39:23 +01:00
parent ae61cd6bfb
commit 037b21647b
6 changed files with 70 additions and 51 deletions

View file

@ -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, ...) \

View file

@ -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);