1. 26 5月, 2015 2 次提交
  2. 21 5月, 2015 3 次提交
    • A
      drm: bridge: Allow daisy chaining of bridges · 862e686c
      Archit Taneja 提交于
      Allow drm_bridge objects to link to each other in order to form an encoder
      chain. The requirement for creating a chain of bridges comes because the
      MSM drm driver uses up its encoder and bridge objects for blocks within
      the SoC itself. There isn't anything left to use if the SoC display output
      is connected to an external encoder IC. Having an additional bridge
      connected to the existing bridge helps here. In general, it is possible for
      platforms to have  multiple devices between the encoder and the
      connector/panel that require some sort of configuration.
      
      We create drm bridge helper functions corresponding to each op in
      'drm_bridge_funcs'. These helpers call the corresponding
      'drm_bridge_funcs' op for the entire chain of bridges. These helpers are
      used internally by drm_atomic_helper.c and drm_crtc_helper.c.
      
      The drm_bridge_enable/pre_enable helpers execute enable/pre_enable ops of
      the bridge closet to the encoder, and proceed until the last bridge in the
      chain is enabled. The same holds for drm_bridge_mode_set/mode_fixup
      helpers. The drm_bridge_disable/post_disable helpers disable the last
      bridge in the chain first, and proceed until the first bridge in the chain
      is disabled.
      
      drm_bridge_attach() remains the same. As before, the driver calling this
      function should make sure it has set the links correctly. The order in
      which the bridges are connected to each other determines the order in which
      the calls are made. One requirement is that every bridge in the chain
      should point the parent encoder object. This is required since bridge
      drivers expect a valid encoder pointer in drm_bridge. For example, consider
      a chain where an encoder's output is connected to bridge1, and bridge1's
      output is connected to bridge2:
      
      	/* Like before, attach bridge to an encoder */
      	bridge1->encoder = encoder;
      	ret = drm_bridge_attach(dev, bridge1);
      	..
      
      	/*
      	 * set the first bridge's 'next' bridge to bridge2, set its encoder
      	 * as bridge1's encoder
      	 */
      	bridge1->next = bridge2
      	bridge2->encoder = bridge1->encoder;
      	ret = drm_bridge_attach(dev, bridge2);
      
      	...
      	...
      
      This method of bridge chaining isn't intrusive and existing drivers that
      use drm_bridge will behave the same way as before. The bridge helpers also
      cleans up the atomic and crtc helper files a bit.
      Reviewed-by: NJani Nikula <jani.nikula@linux.intel.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      862e686c
    • M
      drm/atomic: add all affected planes in drm_atomic_helper_check_modeset · 57744aa7
      Maarten Lankhorst 提交于
      Drivers may need to recalculate plane state when a modeset occurs,
      not reliably adding them might cause hard to debug bugs.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      57744aa7
    • M
      drm/atomic: add commit_planes_on_crtc helper · de28d021
      Maarten Lankhorst 提交于
      drm_atomic_helper_commit_planes calls all atomic_begin's first,
      then updates all planes, finally calling atomic_flush.
      
      Some drivers may want to things like disabling irq's
      from their atomic_begin, in which case a second call to atomic_begin
      will splat. By using commit_planes_on_crtc on each crtc in the
      atomic state they'll evade that issue.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      [danvet: Extend kerneldoc a bit as discussed with Maarten on irc.]
      [danvet: Squash in fixup to check for crtc_funcs in all places.
      Reported by Dan Carpenter.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      de28d021
  3. 18 5月, 2015 1 次提交
  4. 13 5月, 2015 2 次提交
  5. 08 5月, 2015 1 次提交
  6. 04 5月, 2015 1 次提交
  7. 16 4月, 2015 1 次提交
  8. 12 4月, 2015 1 次提交
  9. 03 4月, 2015 1 次提交
    • T
      drm/atomic: Add helpers for state-subclassing drivers · f5e7840b
      Thierry Reding 提交于
      Drivers that subclass CRTC, plane or connector state need to carefully
      duplicate the code that the atomic helpers have. This is bound to cause
      breakage eventually because it requires auditing all drivers and update
      them when code is added to the helpers.
      
      In order to avoid that, implement new helpers that perform the required
      steps when copying and destroying state. These new helpers are exported
      so that state-subclassing drivers can use them. The default helpers are
      implemented using them as well, providing a single location that needs
      to be changed when adding to base atomic states.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      f5e7840b
  10. 27 3月, 2015 1 次提交
    • D
      drm/atomic-helpers: Properly avoid full modeset dance · 4218a32f
      Daniel Vetter 提交于
      Legacy setCrtc has a nice fastpath for just updating the frontbuffer
      when the output routing doesn't change. Which I of course tried to
      keep working, except that I fumbled the job: The helpers correctly
      compute ->mode_changed, CRTC updates get correctly skipped but
      connector functions are called unconditionally.
      
      Fix this.
      
      v2: For the disable sided connector->state->crtc might be NULL.
      Instead look at the old_connector_state->crtc, but still use the new
      crtc state for that old crtc. Reported by Thierry.
      Reported-and-Tested-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v1)
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v1)
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      4218a32f
  11. 17 3月, 2015 2 次提交
  12. 11 3月, 2015 1 次提交
  13. 10 3月, 2015 1 次提交
  14. 05 3月, 2015 1 次提交
  15. 24 2月, 2015 2 次提交
  16. 23 2月, 2015 3 次提交
  17. 27 1月, 2015 8 次提交
    • T
      drm/atomic: Add ->atomic_check() to encoder helpers · 4cd4df80
      Thierry Reding 提交于
      This callback can be used instead of the legacy ->mode_fixup() and is
      passed the CRTC and connector states. It can thus use these states to
      validate the modeset and cache values in the state to be used during
      the actual modeset.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      4cd4df80
    • T
      drm/plane: Add optional ->atomic_disable() callback · 407b8bd9
      Thierry Reding 提交于
      In order to prevent drivers from having to perform the same checks over
      and over again, add an optional ->atomic_disable callback which the core
      calls under the right circumstances.
      
      v2: pass old state and detect edges to avoid calling ->atomic_disable on
      already disabled planes, remove redundant comment (Daniel Vetter)
      
      v3: rename helper to drm_atomic_plane_disabling() to clarify that it is
      checking for transitions, move helper to drm_atomic_helper.h, clarify
      check for !old_state and its relation to transitional helpers
      
      Here's an extract from some discussion rationalizing the behaviour (for
      a full version, see the reference below):
      
          > > Hm, thinking about this some more this will result in a slight difference
          > > in behaviour, at least when drivers just use the helper ->reset functions
          > > but don't disable everything:
          > > - With transitional helpers we assume we know nothing and call
          > >   ->atomic_disable.
          > > - With atomic old_state->crtc == NULL in the same situation right after
          > >   boot-up, but we asssume the plane is really off and _dont_ call
          > >   ->atomic_disable.
          > >
          > > Should we instead check for (old_state && old_state->crtc) and state that
          > > drivers need to make sure they don't have stuff hanging around?
          >
          > I don't think we can check for old_state because otherwise this will
          > always return false, whereas we really want it to force-disable planes
          > that could be on (lacking any more accurate information). For
          > transitional helpers anyway.
          >
          > For the atomic helpers, old_state will never be NULL, but I'd assume
          > that the driver would reconstruct the current state in ->reset().
      
          By the way, the reason for why old_state can be NULL with transitional
          helpers is the ordering of the steps in the atomic transition. Currently
          the Tegra patches do this (based on your blog post and the Exynos proto-
          type):
      
              1) atomic conversion, phase 1:
                 - implement ->atomic_{check,update,disable}()
                 - use drm_plane_helper_{update,disable}()
      
              2) atomic conversion, phase 2:
                 - call drm_mode_config_reset() from ->load()
                 - implement ->reset()
      
          That's only a partial list of what's done in these steps, but that's the
          only relevant pieces for why old_state is NULL.
      
          What happens is that without ->reset() implemented there won't be any
          initial state, hence plane->state (the old_state here) will be NULL the
          first time atomic state is applied.
      
          We could of course reorder the sequence such that drivers are required
          to hook up ->reset() before they can (or at the same as they) hook up
          the transitional helpers. We could add an appropriate WARN_ON to this
          helper to make that more obvious.
      
          However, that will not solve the problem because it only gets rid of the
          special case. We still don't know whether old_state->crtc == NULL is the
          current state or just the initial default.
      
          So no matter which way we do this, I don't see a way to get away without
          requiring specific semantics from drivers. They would be that:
      
              - drivers recreate the correct state in ->reset() so that
                old_state->crtc != NULL if the plane is really enabled
      
          or
      
              - drivers have to ensure that the real state in fact mirrors the
                initial default as encoded in the state (plane disabled)
      
      References: http://lists.freedesktop.org/archives/dri-devel/2015-January/075578.htmlReviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      407b8bd9
    • T
      drm/plane: Make ->atomic_update() mandatory · 3cad4b68
      Thierry Reding 提交于
      There is no use-case where it would be useful for drivers not to
      implement this function and the transitional plane helpers already
      require drivers to provide an implementation.
      
      v2: add new requirement to kerneldoc
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      3cad4b68
    • D
      drm/atomic-helper: debug output for modesets · 95d6eb3b
      Daniel Vetter 提交于
      With the combination of ->enable and ->active it's a bit complicated
      to follow what exactly is going on sometimes within a full modeset.
      Add debug output to make this all traceable.
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      95d6eb3b
    • D
      drm/atomic-helpers: Saner encoder/crtc callbacks · ee0a89cf
      Daniel Vetter 提交于
      For historical reasons going all the way back to how the Xrandr code
      was implemented the semantics of the callbacks used to enable/disable
      crtcs and encoders are ... interesting.
      
      But with atomic helpers all that complexity has been binned, with only
      a well-defined on/off action left. Unfortunately the names stuck.
      
      Let's fix that by adding enable/disable hooks every, make them the
      preferred variant for atomic and update documentations.
      
      Later on we add debug warnings when drivers have deprecated hooks. But
      while everything is in-flight with lots of drivers converting to
      atomic that's a bit too much - better wait for things to settle a bit
      first.
      
      v2: Fix kerneldoc, reported by Wu Fengguang.
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      ee0a89cf
    • D
      drm/atomic-helpers: Recover full cursor plane behaviour · f02ad907
      Daniel Vetter 提交于
      Cursor plane updates have historically been fully async and mutliple
      updates batched together for the next vsync. And userspace relies upon
      that. Since implementing a full queue of async atomic updates is a bit
      of work lets just recover the cursor specific behaviour with a hint
      flag and some hacks to drop the vblank wait.
      
      v2: Fix kerneldoc, reported by Wu Fengguang.
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      f02ad907
    • D
      drm/atomic-helper: add connector->dpms() implementation · b486e0e6
      Daniel Vetter 提交于
      This builds on top of the crtc->active infrastructure to implement
      legacy DPMS. My choice of semantics is somewhat arbitrary, but the
      entire pipe is enabled as along as one output is still enabled.
      
      Of course it also clamps everything that's not ON to OFF.
      
      v2: Fix spelling in one comment.
      
      v3: Don't do an async commit (Thierry)
      
      v4: Dan Carpenter noticed missing error case handling.
      
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      b486e0e6
    • D
      drm/atomic: Add drm_crtc_state->active · eab3bbef
      Daniel Vetter 提交于
      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: NThierry Reding <treding@nvidia.com>
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      eab3bbef
  18. 05 1月, 2015 1 次提交
  19. 19 12月, 2014 1 次提交
  20. 18 12月, 2014 4 次提交
    • D
      drm/atomic: Introduce state->obj backpointers · 07cc0ef6
      Daniel Vetter 提交于
      Useful since this way we can pass around just the state objects and
      will get ther real object, too.
      
      Specifically this allows us to again simplify the parameters for
      set_crtc_for_plane.
      
      v2: msm already has it's own specific plane_reset hook, don't forget
      that one!
      
      v3: Fixup kerneldoc, reported by 0-day builder.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: Rob Clark <robdclark@gmail.com> (v2)
      Tested-by: Rob Clark <robdclark@gmail.com> (v2)
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      07cc0ef6
    • D
      drm/atomic-helper: Again check modeset *before* plane states · b4274fbe
      Daniel Vetter 提交于
      This essentially reverts
      
      commit 934ce1c2
      Author: Rob Clark <robdclark@gmail.com>
      Date:   Wed Nov 19 16:41:33 2014 -0500
      
          drm/atomic: check mode_changed *after* atomic_check
      
      Depending upon the driver both orders (or maybe even interleaving) is
      required:
      - If ->atomic_check updates ->mode_changed then helper_check_modeset
        must be run afters.
      - If ->atomic_check depends upon accurate adjusted dotclock values for
        e.g. watermarks, then helper_check_modeset must be run first.
      
      The failure mode in the first case is usually a totally angry hw
      because the pixel format switching doesn't happen. The failure mode in
      the later case is usually nothing, since in most cases the old
      adjusted mode from the previous modeset wont be too far off to be a
      problem. So just underruns and perhaps even just suboptimal (from a
      power consumption) watermarks.
      
      Furthermore in the transitional helpers we only call ->atomic_check
      after the new modeset state has been fully set up (and hence
      computed).
      
      Given that asymmetry in expected failure modes I think it's safer to
      go back to the older order. So do that and give msm a special check
      function to compensate.
      
      Also update kerneldoc to explain this a bit.
      
      v2: Actually add the missing hunk Rob spotted.
      
      v3: Move msm_atomic_check into msm_atomic.c, requested by Rob.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Tested-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      b4274fbe
    • D
      drm/atomic-helper: Export both plane and modeset check helpers · d9b13620
      Daniel Vetter 提交于
      The default call sequence for these two parts won't fit for all
      drivers. So export the two pieces and explain with a bit of kerneldoc
      when each should be called.
      
      v2: Squash in fixup from Rob to actually add the newly exported
      functions to headers
      
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      d9b13620
    • R
      drm/atomic: fix potential null ptr on plane enable · 4b08eae5
      Rob Clark 提交于
      When a plane is being enabled, plane->crtc has not been set yet.  Use
      plane->state->crtc.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4b08eae5
  21. 27 11月, 2014 2 次提交
    • R
      drm/atomic: clear plane's CRTC and FB when shutting down · e5b5341c
      Rob Clark 提交于
      Otherwise we'd still end up w/ the plane attached to the CRTC, and
      seemingly active, but without an FB.  Which ends up going *boom*
      in the drivers.
      
      Slightly modified version of Daniel's irc suggestion.
      
      Note that the big problem isn't drivers going *boom* here (since we
      already have the situation of planes being left enabled when the crtc
      goes down). The real issue is that the core assumes the primary plane
      always goes down when calling ->set_config with a NULL mode. Ignoring
      that assumption leads to the legacy state pointers plane->fb/crtc
      getting out of sync with atomic, and that then leads to the subsequent
      *boom* all over the place.
      
      CC: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [danvet: Drop my opinion of what's going sidewides here into the
      commit message as a note.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e5b5341c
    • R
      drm/atomic: track bitmask of planes attached to crtc · 6ddd388a
      Rob Clark 提交于
      Chasing plane->state->crtc of planes that are *not* part of the same
      atomic update is racy, making it incredibly awkward (or impossible) to
      do something simple like iterate over all planes and figure out which
      ones are attached to a crtc.
      
      Solve this by adding a bitmask of currently attached planes in the
      crtc-state.
      
      Note that the transitional helpers do not maintain the plane_mask.  But
      they only support the legacy ioctls, which have sufficient brute-force
      locking around plane updates that they can continue to loop over all
      planes to see what is attached to a crtc the old way.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [danvet:
      - Drop comments about locking in set_crtc_for_plane since they're a
        bit misleading - we already should hold lock for the current crtc.
      - Also WARN_ON if get_state on the old crtc fails since that should
        have been done already.
      - Squash in fixup to check get_plane_state return value, reported by
        Dan Carpenter and acked by Rob Clark.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6ddd388a