@@ -613,6 +613,7 @@ swap_crtc_state(struct drm_crtc *crtc, struct drm_atomic_state *a)
/* clear transient state (only valid during atomic update): */
cstate->set_config = false;
cstate->connectors_change = false;
+ cstate->commit_state = false;
swap(crtc->state, a->cstates[crtc->id]);
crtc->base.propvals = &crtc->state->propvals;
@@ -687,6 +688,9 @@ commit_crtc_state(struct drm_crtc *crtc,
drm_atomic_get_plane_state(crtc->primary, cstate->state);
int ret = -EINVAL;
+ if (!cstate->commit_state)
+ return 0;
+
if (cstate->set_config)
return set_config(crtc, cstate);
@@ -792,7 +792,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
crtc->base.propvals = &crtc->state->propvals;
list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
- dev->mode_config.num_crtc++;
+ crtc->id = dev->mode_config.num_crtc++;
crtc->primary = primary;
if (primary)
@@ -910,7 +910,7 @@ static int check_connectors(struct drm_crtc *crtc,
if (ocrtc == crtc)
continue;
- ostate = drm_atomic_get_crtc_state(crtc, state);
+ ostate = drm_atomic_get_crtc_state(ocrtc, state);
if (IS_ERR(ostate))
return PTR_ERR(ostate);
@@ -939,7 +939,6 @@ retry:
return -EINVAL;
}
}
-
return 0;
}
@@ -961,6 +960,10 @@ int drm_crtc_check_state(struct drm_crtc *crtc,
if (!(fb && state->mode_valid))
return 0;
+ /* We're not committing this state, ignore */
+ if (!state->commit_state)
+ return 0;
+
hdisplay = state->mode.hdisplay;
vdisplay = state->mode.vdisplay;
@@ -1034,6 +1037,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc,
/* grab primary plane state now, to ensure locks are held, etc. */
drm_atomic_get_plane_state(crtc->primary, state->state);
+ state->commit_state = true;
drm_object_property_set_value(&crtc->base,
&state->propvals, property, value, blob_data);
@@ -1045,6 +1049,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc,
/* check size: */
if (value < sizeof(struct drm_mode_modeinfo))
return -EINVAL;
+
state->mode = *(struct drm_mode_modeinfo *)blob_data;
state->mode_valid = true;
}
@@ -1538,6 +1543,7 @@ int drm_plane_set_property(struct drm_plane *plane,
} else if (property == config->prop_crtc_id) {
struct drm_mode_object *obj = drm_property_get_obj(property, value);
struct drm_crtc *crtc = obj ? obj_to_crtc(obj) : NULL;
+
/* take the lock of the incoming crtc as well, moving
* plane between crtcs is synchronized on both incoming
* and outgoing crtc.
@@ -317,6 +317,7 @@ struct drm_crtc_state {
/* transient state, only valid during atomic operation: */
bool set_config : 1;
bool connectors_change : 1;
+ bool commit_state : 1;
uint8_t num_connector_ids;
uint32_t *connector_ids;