aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-22 10:36:21 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 04:02:18 -0500
commiteab3bbeffd152125ae0f90863b8e9bc8eef49423 (patch)
tree544f11ec5b22e8c941b638761aeddf0431117943 /drivers/gpu/drm/drm_atomic.c
parent960cd9d4fef6dd9e235c0e5c0d4ed027f8a48025 (diff)
drm/atomic: Add drm_crtc_state->active
This is the infrastructure for DPMS ported to the atomic world. Fundamental changes compare to legacy DPMS are: - No more per-connector dpms state, instead there's just one per each display pipeline. So if you clone either you have to unclone first if you only want to switch off one screen, or you just switch of everything (like all desktops do). This massively reduces complexity for cloning since now there's no more half-enabled cloned configs to consider. - Only on/off, dpms standby/suspend are as dead as real CRTs. Again reduces complexity a lot. Now especially for backwards compat the really important part for dpms support is that dpms on always succeeds (except for hw death and unplugged cables ofc). Which means everything that could fail (like configuration checking, resources assignments and buffer management) must be done irrespective from ->active. ->active is really only a toggle to change the hardware state. More precisely: - Drivers MUST NOT look at ->active in their ->atomic_check callbacks. Changes to ->active MUST always suceed if nothing else changes. - Drivers using the atomic helpers MUST NOT look at ->active anywhere, period. The helpers will take care of calling the respective enable/modeset/disable hooks as necessary. As before the helpers will carefully keep track of the state and not call any hooks unecessarily, so still no double-disables or enables like with crtc helpers. - ->mode_set hooks are only called when the mode or output configuration changes, not for changes in ->active state. - Drivers which reconstruct the state objects in their ->reset hooks or through some other hw state readout infrastructure must ensure that ->active reflects actual hw state. This just implements the core bits and helper logic, a subsequent patch will implement the helper code to implement legacy dpms with this. v2: Rebase on top of the drm ioctl work: - Move crtc checks to the core check function. - Also check for ->active_changed when deciding whether a modeset might happen (for the ALLOW_MODESET mode). - Expose the ->active state with an atomic prop. v3: Review from Rob - Spelling fix in comment. - Extract needs_modeset helper to consolidate the ->mode_changed || ->active_changed checks. v4: Fixup fumble between crtc->state and crtc_state. Cc: Rob Clark <robdclark@gmail.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Tested-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r--drivers/gpu/drm/drm_atomic.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 1e38dfc8e462..ee68267bb326 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -241,7 +241,13 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
241 struct drm_crtc_state *state, struct drm_property *property, 241 struct drm_crtc_state *state, struct drm_property *property,
242 uint64_t val) 242 uint64_t val)
243{ 243{
244 if (crtc->funcs->atomic_set_property) 244 struct drm_device *dev = crtc->dev;
245 struct drm_mode_config *config = &dev->mode_config;
246
247 /* FIXME: Mode prop is missing, which also controls ->enable. */
248 if (property == config->prop_active) {
249 state->active = val;
250 } else if (crtc->funcs->atomic_set_property)
245 return crtc->funcs->atomic_set_property(crtc, state, property, val); 251 return crtc->funcs->atomic_set_property(crtc, state, property, val);
246 return -EINVAL; 252 return -EINVAL;
247} 253}
@@ -282,6 +288,13 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
282 * 288 *
283 * TODO: Add generic modeset state checks once we support those. 289 * TODO: Add generic modeset state checks once we support those.
284 */ 290 */
291
292 if (state->active && !state->enable) {
293 DRM_DEBUG_KMS("[CRTC:%d] active without enabled\n",
294 crtc->base.id);
295 return -EINVAL;
296 }
297
285 return 0; 298 return 0;
286} 299}
287 300
@@ -976,7 +989,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
976 if (!crtc) 989 if (!crtc)
977 continue; 990 continue;
978 991
979 if (crtc_state->mode_changed) { 992 if (crtc_state->mode_changed ||
993 crtc_state->active_changed) {
980 DRM_DEBUG_KMS("[CRTC:%d] requires full modeset\n", 994 DRM_DEBUG_KMS("[CRTC:%d] requires full modeset\n",
981 crtc->base.id); 995 crtc->base.id);
982 return -EINVAL; 996 return -EINVAL;