Commit b2432adf authored by Ville Syrjälä's avatar Ville Syrjälä

drm/atomic: Use explicit old/new state in drm_atomic_crtc_check()

Convert drm_atomic_crtc_check() over to using explicit old vs. new
crtc states. Avoids the confusion of "what does crtc->state mean
again?".
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181101184646.14753-2-ville.syrjala@linux.intel.comReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 534903d6
...@@ -310,9 +310,11 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, ...@@ -310,9 +310,11 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
} }
EXPORT_SYMBOL(drm_atomic_get_crtc_state); EXPORT_SYMBOL(drm_atomic_get_crtc_state);
static int drm_atomic_crtc_check(struct drm_crtc *crtc, static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
struct drm_crtc_state *state) const struct drm_crtc_state *new_crtc_state)
{ {
struct drm_crtc *crtc = new_crtc_state->crtc;
/* NOTE: we explicitly don't enforce constraints such as primary /* NOTE: we explicitly don't enforce constraints such as primary
* layer covering entire screen, since that is something we want * layer covering entire screen, since that is something we want
* to allow (on hw that supports it). For hw that does not, it * to allow (on hw that supports it). For hw that does not, it
...@@ -321,7 +323,7 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, ...@@ -321,7 +323,7 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
* TODO: Add generic modeset state checks once we support those. * TODO: Add generic modeset state checks once we support those.
*/ */
if (state->active && !state->enable) { if (new_crtc_state->active && !new_crtc_state->enable) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
...@@ -331,14 +333,14 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, ...@@ -331,14 +333,14 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
* as this is a kernel-internal detail that userspace should never * as this is a kernel-internal detail that userspace should never
* be able to trigger. */ * be able to trigger. */
if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
WARN_ON(state->enable && !state->mode_blob)) { WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
WARN_ON(!state->enable && state->mode_blob)) { WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
...@@ -354,7 +356,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, ...@@ -354,7 +356,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
* and legacy page_flip IOCTL which also reject service on a disabled * and legacy page_flip IOCTL which also reject service on a disabled
* pipe. * pipe.
*/ */
if (state->event && !state->active && !crtc->state->active) { if (new_crtc_state->event &&
!new_crtc_state->active && !old_crtc_state->active) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
...@@ -960,7 +963,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -960,7 +963,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
struct drm_plane *plane; struct drm_plane *plane;
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *old_crtc_state;
struct drm_crtc_state *new_crtc_state;
struct drm_connector *conn; struct drm_connector *conn;
struct drm_connector_state *conn_state; struct drm_connector_state *conn_state;
int i, ret = 0; int i, ret = 0;
...@@ -976,8 +980,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -976,8 +980,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
} }
} }
for_each_new_crtc_in_state(state, crtc, crtc_state, i) { for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
ret = drm_atomic_crtc_check(crtc, crtc_state); ret = drm_atomic_crtc_check(old_crtc_state, new_crtc_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
...@@ -1005,8 +1009,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1005,8 +1009,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
} }
if (!state->allow_modeset) { if (!state->allow_modeset) {
for_each_new_crtc_in_state(state, crtc, crtc_state, i) { for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(crtc_state)) { if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n", DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment