mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-03 09:01:40 -05:00
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:
parent
d6cc718472
commit
15d8f1806e
4 changed files with 37 additions and 26 deletions
|
|
@ -15,7 +15,7 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
|||
struct wlr_drm_plane *cursor = crtc->cursor;
|
||||
|
||||
uint32_t fb_id = 0;
|
||||
if (crtc->active) {
|
||||
if (crtc->pending.active) {
|
||||
struct wlr_drm_fb *fb = plane_get_next_fb(crtc->primary);
|
||||
struct gbm_bo *bo = drm_fb_acquire(fb, drm, &crtc->primary->mgpu_surf);
|
||||
if (!bo) {
|
||||
|
|
@ -28,18 +28,20 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
|||
}
|
||||
}
|
||||
|
||||
if (crtc->pending & WLR_DRM_CRTC_MODE) {
|
||||
if (crtc->pending_modeset) {
|
||||
uint32_t *conns = NULL;
|
||||
size_t conns_len = 0;
|
||||
drmModeModeInfo *mode = NULL;
|
||||
if (crtc->active) {
|
||||
if (crtc->pending.mode != NULL) {
|
||||
conns = &conn->id;
|
||||
conns_len = 1;
|
||||
mode = &crtc->mode;
|
||||
mode = &crtc->pending.mode->drm_mode;
|
||||
}
|
||||
|
||||
uint32_t dpms = crtc->pending.active ?
|
||||
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
|
||||
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
|
||||
crtc->active ? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF) != 0) {
|
||||
dpms) != 0) {
|
||||
wlr_log_errno(WLR_ERROR, "%s: failed to set DPMS property",
|
||||
conn->output.name);
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue