backend/drm: introduce pending and current CRTC state

Previously, we only had the pending state (crtc->pending, crtc->mode and
crtc->active). This causes issues when a commit fails: the pending state
is left as-is, and the next commit may read stale data from it.

This will also cause issues when implementing test-only commits: we need
to rollback the pending CRTC state after a test-only commit.

Introduce separate pending and current CRTC states. Properly update the
current state after a commit.
This commit is contained in:
Simon Ser 2020-05-18 14:27:42 +02:00 committed by Drew DeVault
parent d6cc718472
commit 15d8f1806e
4 changed files with 37 additions and 26 deletions

View file

@ -42,16 +42,16 @@ struct wlr_drm_plane {
union wlr_drm_plane_props props;
};
enum wlr_drm_crtc_field {
WLR_DRM_CRTC_MODE = 1 << 0,
struct wlr_drm_crtc_state {
bool active;
struct wlr_drm_mode *mode;
};
struct wlr_drm_crtc {
uint32_t id;
uint32_t pending; // bitfield of enum wlr_drm_crtc_field
bool active;
drmModeModeInfo mode;
bool pending_modeset;
struct wlr_drm_crtc_state pending, current;
// Atomic modesetting only
uint32_t mode_id;