• Daniel Vetter's avatar
    drm/atomic: Add drm_crtc_state->active · eab3bbef
    Daniel Vetter authored
    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: default avatarThierry Reding <treding@nvidia.com>
    Tested-by: default avatarThierry Reding <treding@nvidia.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
    eab3bbef
drm_crtc.h 54.2 KB