1. 05 3月, 2015 1 次提交
  2. 24 2月, 2015 2 次提交
  3. 23 2月, 2015 3 次提交
  4. 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
  5. 05 1月, 2015 1 次提交
  6. 19 12月, 2014 1 次提交
  7. 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
  8. 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
  9. 25 11月, 2014 3 次提交
    • T
      drm/plane: Pass old state to ->atomic_update() · f1c37e1a
      Thierry Reding 提交于
      In most situations it will be useful to have the old state passed to the
      ->atomic_update() callback. For example if a plane is being disabled the
      new state's .crtc field will be NULL, but some drivers may rely on this
      field to program the CRTCs registers.
      
      v2: rename variable to old_plane_state and remove redundant comment as
      suggested by Daniel Vetter, remove an Exynos hunk that doesn't apply to
      drm-next and add a hunk for pending MSM mdp5 changes
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f1c37e1a
    • J
      drm/atomic_helper: Cope with plane->crtc == NULL in disable helper · aa54e2ee
      Jasper St. Pierre 提交于
      The drm core can call the plane disable hook multiple times, which
      means it can get called when plane->crtc is already NULL. That in turn
      means we can't get at the implicit acquire ctx we use in the atomic
      helpers for legacy entries points.
      
      We could try to pass drm_modeset_legacy_acquire_ctx a drm_device
      pointer so that it can cope with a NULL crtc. But that still doesn't
      work since the cursor ioctls (remapped with the universal cursor plane
      support code) only grabs the crtc locks. So the global acquire context
      isn't set eitehr.
      
      The real solution here would be to bite the bullet and wire up
      explicit acquire context parameters to all relevant functions. We need
      to do that anyway (to be able to get rid of some small allocations
      which we can't cope with failing). But that's a lot of work and better
      done once atomic has settled a bit.
      
      So meanwhile just catch this case in the helper and bail out.
      Signed-off-by: NJasper St. Pierre <jstpierre@mecheye.net>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      [danvet: Completely rewrite commit message and comment but keep
      Jasper's logic and author credits since his patch is the only
      short-term solution that works.]
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      aa54e2ee
    • D
      drm/atomic-helper: Skip vblank waits for unchanged fbs · ab58e338
      Daniel Vetter 提交于
      Especially with legacy cursor ioctls existing userspace assumes that
      you can pile up lots of updates in one go. The super-proper way to
      support this would be a special commit mode which overwrites the last
      update. But getting there will be quite a bit of work.
      
      Meanwhile do what pretty much all the drivers have done for the plane
      update functions: Simply skip the vblank wait for the buffer cleanup
      if the buffer is the same. Since the universal cursor plane code will
      not recreate framebuffers needlessly this allows us to not slow down
      legacy pageflip events while someone moves the cursor around.
      
      v2: Drop the async plane update hunk from a previous attempt at this
      issue.
      
      v3: Fix up kerneldoc.
      
      v4: Don't oops so badly. Reported by Jasper.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: "Jasper St. Pierre" <jstpierre@mecheye.net>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NJasper St. Pierre <jstpierre@mecheye.net>
      Tested-by: NJasper St. Pierre <jstpierre@mecheye.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      ab58e338
  10. 22 11月, 2014 2 次提交
  11. 20 11月, 2014 3 次提交
  12. 15 11月, 2014 1 次提交
  13. 12 11月, 2014 2 次提交
    • D
      drm: Per-plane locking · 4d02e2de
      Daniel Vetter 提交于
      Turned out to be much simpler on top of my latest atomic stuff than
      what I've feared. Some details:
      
      - Drop the modeset_lock_all snakeoil in drm_plane_init. Same
        justification as for the equivalent change in drm_crtc_init done in
      
      	commit d0fa1af4
      	Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      	Date:   Mon Sep 8 09:02:49 2014 +0200
      
      	    drm: Drop modeset locking from crtc init function
      
        Without these the drm_modeset_lock_init would fall over the exact
        same way.
      
      - Since the atomic core code wraps the locking switching it to
        per-plane locks was a one-line change.
      
      - For the legacy ioctls add a plane argument to the locking helper so
        that we can grab the right plane lock (cursor or primary). Since the
        universal cursor plane might not be there, or someone really crazy
        might forgoe the primary plane even accept NULL.
      
      - Add some locking WARN_ON to the atomic helpers for good paranoid
        measure and to check that it all works out.
      
      Tested on my exynos atomic hackfest with full lockdep checks and ww
      backoff injection.
      
      v2: I've forgotten about the load-detect code in i915.
      
      v3: Thierry reported that in latest 3.18-rc vmwgfx doesn't compile any
      more due to
      
      commit 21e88620
      Author: Rob Clark <robdclark@gmail.com>
      Date:   Thu Oct 30 13:39:04 2014 -0400
      
          drm/vmwgfx: fix lock breakage
      
      Rebased and fix this up.
      
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      4d02e2de
    • R
      drm: export atomic wait_for_vblanks helper (v2) · 5ee3229c
      Rob Clark 提交于
      v1: original
      v2: danvet's kerneldoc nitpicks
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      5ee3229c
  14. 07 11月, 2014 7 次提交
    • D
      drm/atomic: Refcounting for plane_state->fb · 321ebf04
      Daniel Vetter 提交于
      So my original plan was that the drm core refcounts framebuffers like
      with the legacy ioctls. But that doesn't work for a bunch of reasons:
      
      - State objects might live longer than until the next fb change
        happens for a plane. For example delayed cleanup work only happens
        _after_ the pageflip ioctl has completed. So this definitely doesn't
        work without the plane state holding its own references.
      
      - The other issue is transition from legacy to atomic implementations,
        where the driver works under a mix of both worlds. Which means
        legacy paths might not properly update the ->fb pointer under
        plane->state->fb. Which is a bit a problem when then someone comes
        around and _does_ try to clean it up when it's long gone.
      
      The second issue is just a bit a transition bug, since drivers should
      update plane->state->fb in all the paths that aren't converted yet.
      But a bit more robustness for the transition can't hurt - we pull
      similar tricks with cleaning up the old fb in the transitional helpers
      already.
      
      The pattern for drivers that transition is
      
      	if (plane->state)
      		drm_atomic_set_fb_for_plane(plane->state, plane->fb);
      
      inserted after the fb update has logically completed at the end of
      ->set_config (or ->set_base/mode_set if using the crtc helpers),
      ->page_flip, ->update_plane or any other entry point which updates
      plane->fb.
      
      v2: Update kerneldoc - copypasta fail.
      
      v3: Fix spelling in the commit message (Sean).
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      321ebf04
    • D
      drm: Docbook integration and over sections for all the new helpers · 3150c7d0
      Daniel Vetter 提交于
      In all cases the text requires that new drivers are converted to the
      atomic interfaces.
      
      v2: Add overview for state handling.
      
      v3: Review from Sean: Some spelling fixes and drop the misguided
      hunk to remove rgba8888 from the plane helpers compat list.
      
      Cc: Sean Paul <seanpaul@chromium.org>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3150c7d0
    • D
      drm/atomic-helpers: functions for state duplicate/destroy/reset · d461701c
      Daniel Vetter 提交于
      The atomic users and helpers assume that there is always a obj->state
      structure around. Which means drivers need to somehow create that at
      driver load time. Also it should obviously reset hardware state, so
      needs to be reset upon resume.
      
      Finally the destroy/duplicate_state functions are an awful lot of
      boilerplate if the driver doesn't need anything beyond the default
      state objects.
      
      So add helper functions for all of this.
      
      v2: Somehow the plane/connector versions got lost in the first
      version.
      
      v3: Add kerneldoc.
      
      v4: Make duplicate_state functions a bit more robust, which is useful
      for debugging state tracking issues when transitioning to atomic.
      
      v5: Clear temporary variables in the crtc state when duplicating it,
      like ->mode_changed or ->planes_changed. If we don't do this stale
      values for these might pollute the next atomic modeset.
      
      v6: Also clear crtc_state->event in case the driver didn't (yet) clear
      this out.
      
      v7: Split out wrong squashed commit. Also improve the kerneldoc to
      mention that obj->state can be NULL and when.  Both suggested by
      Daniel Thompson.
      
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d461701c
    • D
      drm/atomic-helper: implement ->page_flip · 8bc0f312
      Daniel Vetter 提交于
      Currently there is no way to implement async flips using atomic, that
      essentially requires us to be able to cancel pending requests
      mid-flight.
      
      To be able to do that (and I guess we want this since vblank synced
      updates which opportunistically cancel still pending updates seem to be
      wanted) we'd need to add a mandatory cancellation mode. Depending upon
      the exact semantics we decide upon that could mean that userspace will
      not get completion events, or will get them all stacked up.
      
      So reject async updates for now. Also async updates usually means not
      vblank synced at all, and I guess for drivers which want to support
      this they should simply add a special pageflip handler (since usually
      you need a special flip cmd to achieve this). That kind of async flip
      is pretty much exclusively just used for games and benchmarks where
      dropping just one frame means you'll get a headshot or something bad
      like that ... And so slight amounts of tearing is acceptable.
      
      v2: Fixup kerneldoc, reported by Paulo.
      
      v3: Use the set_crtc_for_plane function to assign the crtc, since
      otherwise the book-keeping is off.
      
      v4: Update crtc->primary->fb since ->page_flip is the only driver
      callback where the core won't do this itself. We might want to fix
      this inconsistency eventually.
      
      v5: Use set_crtc_for_connector as suggested by Sean.
      
      v6: Daniel Thompson noticed that my error handling is inconsistent
      and that in a few cases I didn't handle fatal errors (i.e. not
      -EDEADLK). Fix this by consolidate the ww mutex backoff handling
      into one check in the fail: block and flatten the error control
      flow everywhere else.
      
      v7: Fix spelling mistake in the commit message (Sean).
      
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Paulo Zanoni <przanoni@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8bc0f312
    • D
      drm/atomic-helpers: document how to implement async commit · e8c833a7
      Daniel Vetter 提交于
      No helper function to do it all yet provided since no driver has
      support for driver core fences yet. Which we'd need to make the
      implementation really generic.
      
      v2: Clarify async howto a bit per the discussion With Rob Clark.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e8c833a7
    • D
      drm/atomic: Integrate fence support · e2330f07
      Daniel Vetter 提交于
      This patch is for enabling async commits. It replaces an earlier
      approach which added an async boolean paramter to the ->prepare_fb
      callbacks. The idea is that prepare_fb picks up the right fence to
      synchronize against, which is then used by the synchronous commit
      helper. For async commits drivers can either register a callback to
      the fence or simply do the synchronous wait in their async work queue.
      
      v2: Remove unused variable.
      
      v3: Only wait for fences after the point of no return in the part
      of the commit function which can be run asynchronously. This is after
      the atomic state has been swapped in, hence now check
      plane->state->fence.
      
      Also add a WARN_ON to make sure we don't try to wait on a fence when
      there's no fb, just as a sanity check.
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      e2330f07
    • D
      drm/atomic-helper: implementatations for legacy interfaces · 042652ed
      Daniel Vetter 提交于
      Well, except page_flip since that requires async commit, which isn't
      there yet.
      
      For the functions which changes planes there's a bit of trickery
      involved to keep the fb refcounting working. But otherwise fairly
      straight-forward atomic updates.
      
      The property setting functions are still a bit incomplete. Once we
      have generic properties (e.g. rotation, but also all the properties
      needed by the atomic ioctl) we need to filter those out and parse them
      in the helper. Preferrably with the same function as used by the real
      atomic ioctl implementation.
      
      v2: Fixup kerneldoc, reported by Paulo.
      
      v3: Add missing EXPORT_SYMBOL.
      
      v4: We need to look at the crtc of the modeset, not some random
      leftover one from a previous loop when udpating the connector->crtc
      routing. Also push some local variables into inner loops to avoid
      these kinds of bugs.
      
      v5: Adjust semantics - drivers now own the atomic state upon
      successfully synchronous commit.
      
      v6: Use the set_crtc_for_plane function to assign the crtc, since
      otherwise the book-keeping is off.
      
      v7:
      - Improve comments.
      - Filter out the crtc of the ->set_config call when recomputing
        crtc_state->enabled: We should compute the same state, but not doing
        so will give us a good chance to catch bugs and inconsistencies -
        the atomic helper's atomic_check function re-validates this again.
      - Fix the set_config implementation logic when disabling the crtc: We
        still need to update the output routing to disable all the
        connectors properly in the state. Caught by the atomic_check
        functions, so at least that part worked ;-) Also add some WARN_ONs
        to ensure ->set_config preconditions all apply.
      
      v8: Fixup an embarrassing h/vdisplay mixup.
      
      v9: Shuffled bad squash to the right patch, spotted by Daniel
      
      v10: Use set_crtc_for_connector as suggested by Sean.
      
      v11: Daniel Thompson noticed that my error handling is inconsistent
      and that in a few cases I didn't handle fatal errors (i.e. not
      -EDEADLK). Fix this by consolidate the ww mutex backoff handling
      into one check in the fail: block and flatten the error control
      flow everywhere else.
      
      v12: Review and discussion with Sean:
      - One spelling fix.
      - Correctly skip the crtc from the set_config set when recomputing
        ->enable state. That should allow us to catch any bugs in higher
        levels in computing that state (which is supplied to the
        ->set_config implementation). I've screwed this up and Sean spotted
        that the current code is pointless.
      
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Paulo Zanoni <przanoni@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      042652ed