[PATCH 7/7] drm: Fix up the atomic legacy paths so they work
Rob Clark
robdclark at gmail.com
Wed Jul 23 12:38:20 PDT 2014
From: Sean Paul <seanpaul at chromium.org>
BUG=chromium:336809
TEST=Tested on snow & peppy
Change-Id: Icd864ac52da9c973202f3ac4629824ef5eec2ac9
Signed-off-by: Sean Paul <seanpaul at chromium.org>
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
drivers/gpu/drm/drm_atomic.c | 4 ++++
drivers/gpu/drm/drm_crtc.c | 11 ++++++++---
include/drm/drm_crtc.h | 1 +
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index cc12114..5b1201f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -626,6 +626,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->index]);
crtc->base.propvals = &crtc->state->propvals;
@@ -700,6 +701,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);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d5ad7e1..ca7bff9 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -777,7 +777,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, &config->crtc_list);
- config->num_crtc++;
+ crtc->index = config->num_crtc++;
crtc->primary = primary;
crtc->cursor = cursor;
@@ -898,7 +898,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);
@@ -926,7 +926,6 @@ retry:
return -EINVAL;
}
}
-
return 0;
}
@@ -948,6 +947,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;
@@ -1021,6 +1024,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);
@@ -1032,6 +1036,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;
}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 084fce0..7afe392 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -320,6 +320,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;
--
1.9.3
More information about the dri-devel
mailing list