1. 28 1月, 2015 1 次提交
  2. 27 1月, 2015 4 次提交
    • 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: 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
    • D
      drm: Add standardized boolean props · 960cd9d4
      Daniel Vetter 提交于
      Not a new type exposed to userspace, just a standard way to create
      them since between range, bitmask and enum there's 3 different ways to
      pull out a boolean prop.
      
      Also add the kerneldoc for the recently added new prop types, which
      Rob forgot all about.
      
      v2: Fixup kerneldoc, spotted by Rob.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      960cd9d4
    • M
      drm: Add rotation value to plane state · 1da30627
      Matt Roper 提交于
      The rotation property is shared by multiple drivers, so it makes sense
      to store the rotation value (for atomic-converted drivers) in the common
      plane state so that core code can eventually access it as well.
      
      Cc: dri-devel@lists.freedesktop.org
      Suggested-by: NDaniel Vetter <daniel@ffwll.ch>
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1da30627
  3. 22 1月, 2015 1 次提交
    • D
      drm/probe-helper: don't lose hotplug event · 162b6a57
      Daniel Vetter 提交于
      There's a race window (small for hpd, 10s large for polled outputs)
      where userspace could sneak in with an unrelated connnector probe
      ioctl call and eat the hotplug event (since neither the hpd nor the
      poll code see a state change).
      
      To avoid this, check whether the connector state changes in all other
      ->detect calls (in the current helper code that's only probe_single)
      and if that's the case, fire off a hotplug event. Note that we can't
      directly call the hotplug event handler, since that expects that no
      locks are held (due to reentrancy with the fb code to update the kms
      console).
      
      Also, this requires that drivers using the probe_single helper
      function set up the poll work. All current drivers do that already,
      and with the reworked hpd handling there'll be no downside to
      unconditionally setting up the poll work any more.
      
      v2: Review from Rob Clark
      - Don't bail out of the output poll work immediately if it's disabled
        to make sure we deliver the delayed hoptplug events. Instead just
        jump to the tail.
      - Don't scheduel the work when it's not set up. Would be a driver bug
        since using probe helpers for anything dynamic without them
        initialized makes them all noops.
      
      Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
      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@ffwll.ch>
      162b6a57
  4. 21 1月, 2015 1 次提交
  5. 05 1月, 2015 3 次提交
    • R
      drm: Atomic modeset ioctl · d34f20d6
      Rob Clark 提交于
      The atomic modeset ioctl can be used to push any number of new values
      for object properties. The driver can then check the full device
      configuration as single unit, and try to apply the changes atomically.
      
      The ioctl simply takes a list of object IDs and property IDs and their
      values.
      
      Originally based on a patch from Ville Syrjälä, although it has mutated
      (mutilated?) enough since then that you probably shouldn't blame it on
      him ;-)
      
      The atomic support is hidden behind the DRM_CLIENT_CAP_ATOMIC cap (to
      protect legacy userspace) and drm.atomic module param (for now).
      
      v2: Check for file_priv->atomic to make sure we only allow userspace
      in-the-know to use atomic.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d34f20d6
    • R
      drm/atomic: atomic plane properties · 6b4959f4
      Rob Clark 提交于
      Expose the core plane state as properties, so they can be updated via
      atomic ioctl.
      
      v2: atomic property flag
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6b4959f4
    • R
      drm: add atomic properties · 88a48e29
      Rob Clark 提交于
      Once a driver is using atomic helpers for modeset, the next step is to
      switch over to atomic properties.  To do this, make sure that any
      modeset objects have their ->atomic_{get,set}_property() vfuncs suitably
      populated if they have custom properties (you did already remember to
      plug in atomic-helper func for the legacy ->set_property() vfuncs,
      right?), and then set DRIVER_ATOMIC bit in driver_features flag.
      
      A new cap is introduced, DRM_CLIENT_CAP_ATOMIC, for the purposes of
      shielding legacy userspace from atomic properties.  Mostly for the
      benefit of legacy DDX drivers that do silly things like getting/setting
      each property at startup (since some of the new atomic properties will
      be able to trigger modeset).
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [danvet: Squash in fixup patch to check for DRM_MODE_PROP_ATOMIC
      instaed of the CAP define when filtering properties. Reported by
      Tvrtko Uruslin, acked by Rob.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      88a48e29
  6. 19 12月, 2014 2 次提交
  7. 18 12月, 2014 5 次提交
  8. 09 12月, 2014 3 次提交
  9. 06 12月, 2014 1 次提交
  10. 27 11月, 2014 2 次提交
    • R
      drm/atomic: add plane iterator macros · dd275956
      Rob Clark 提交于
      Add helper macros to iterate the current, or incoming set of planes
      attached to a crtc.  These helpers are only available for drivers
      converted to use atomic-helpers.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [danvet: Squash in fixup from Rob to move the planemask iterator to
      drm_crtc.h and document it. That one is needed by the atomic ioctl so
      can't be in a helper library.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      dd275956
    • 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
  11. 20 11月, 2014 2 次提交
    • D
      drm: s/enum_blob_list/enum_list/ in drm_property · 3758b341
      Daniel Vetter 提交于
      I guess for hysterical raisins this was meant to be the way to read
      blob properties. But that's done with the two-stage approach which
      uses separate blob kms object and the special-purpose get_blob ioctl.
      
      Shipping userspace seems to have never relied on this, and the kernel
      also never put any blob thing onto that property. And nowadays it
      would blow up, e.g. in drm_property_destroy. Also it makes no sense to
      return values in an ioctl that only returns metadata about everything.
      
      So let's ditch all the internal code for the blob list, rename the
      list to be unambiguous and sprinkle comments all over the place to
      explain this peculiar piece of api.
      
      v2: Squash in fixup from Rob to remove now unused variables.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      3758b341
    • D
      drm/atomic: Don't overrun the connector array when hotplugging · f52b69f1
      Daniel Vetter 提交于
      Yet another fallout from not considering DP MST hotplug. With the
      previous patches we have stable indices, but it might still happen
      that a connector gets added between when we allocate the array and
      when we actually add a connector. Especially when we back off due to
      ww mutex contention or similar issues.
      
      So store the sizes of the arrays in struct drm_atomic_state and double
      check them. We don't really care about races except that we want to
      use a consistent value, so ACCESS_ONCE is all we need. And if we
      indeed notice that we'd overrun the array then just give up and
      restart the entire ioctl.
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      f52b69f1
  12. 15 11月, 2014 1 次提交
  13. 13 11月, 2014 3 次提交
  14. 12 11月, 2014 1 次提交
    • 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
  15. 07 11月, 2014 2 次提交
    • 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 crtc/connector updates using crtc/plane helper interfaces · 623369e5
      Daniel Vetter 提交于
      So this is finally the integration of the crtc and plane helper
      interfaces into the atomic helper functions.
      
      In the check function we now have a few steps:
      
      - First we update the output routing and figure out which crtcs need a
        full mode set. Suitable encoders are selected using ->best_encoder,
        with the same semantics as the crtc helpers of implicitly disabling
        all connectors currently using the encoder.
      
      - Then we pull all other connectors into the state update which feed
        from a crtc which changes. This must be done do catch mode changes
        and similar updates - atomic updates are differences on top of the
        current state.
      
      - Then we call all the various ->mode_fixup to compute the adjusted
        mode. Note that here we have a slight semantic difference compared
        to the crtc helpers: We have not yet updated the encoder->crtc link
        when calling the encoder's ->mode_fixup function. But that's a
        requirement when converting to atomic since we want to prepare the
        entire state completely contained with the over drm_atomic_state
        structure. So this must be carefully checked when converting drivers
        over to atomic helpers.
      
      - Finally we do call the atomic_check functions on planes and crtcs.
      
      The commit function is also quite a beast:
      
      - The only step that can fail is done first, namely pinning the
        framebuffers. After that we cross the point of no return, an async
        commit would push all that into the worker thread.
      
      - The disabling of encoders and connectors is a bit tricky, since
        depending upon the final state we need to select different crtc
        helper functions.
      
      - Software tracking is a bit clarified compared to the crtc helpers:
        We commit the software state before starting to touch the hardware,
        like crtc helpers. But since we just swap them we still have the old
        state (i.e. the current hw state) around, which is really handy to
        write simple disable functions. So no more
        drm_crtc_helper_disable_all_unused_functions kind of fun because
        we're leaving unused crtcs/encoders behind. Everything gets shut
        down in-order now, which is one of the key differences of the i915
        helpers compared to crtc helpers and a really nice additional
        guarantee.
      
      - Like with the plane helpers the atomic commit function waits for one
        vblank to pass before calling the framebuffer cleanup function.
      
      Compared to Rob's helper approach there's a bunch of upsides:
      
      - All the interfaces which can fail are called in the ->check hook
        (i.e. ->best_match and the various ->mode_fixup hooks). This means
        that drivers can just reuse those functions and don't need to move
        everything into ->atomic_check callbacks. If drivers have no need
        for additional constraint checking beyong their existing crtc
        helper callbacks they don't need to do anything.
      
      - The actual commit operation is properly stage: First we prepare
        framebuffers, which can potentially still fail (due to memory
        exhausting). This is important for the async case, where this must
        be done synchronously to correctly return errors.
      
      - The output configuration changes (done with crtc helper functions)
        and the plane update (using atomic plane helpers) are correctly
        interleaved: First we shut down any crtcs that need changing, then
        we update planes and finally we enable everything again. Hardware
        without GO bits must be more careful with ordering, which this
        sequence enables.
      
      - Also for hardware with shared output resources (like display PLLs)
        we first must shut down the old configuration before we can enable
        the new one. Otherwise we can hit an impossible intermediate state
        where there's not enough PLLs (which is the point behind atomic
        updates).
      
      v2:
      - Ensure that users of ->check update crtc_state->enable correctly.
      - Update the legacy state in crtc/plane structures. Eventually we want
        to remove that, but for now the drm core still expects this (especially
        the plane->fb pointer).
      
      v3: A few changes for better async handling:
      
      - Reorder the software side state commit so that it happens all before
        we touch the hardware. This way async support becomes very easy
        since we can punt all the actual hw touching to a worker thread. And
        as long as we synchronize with that thread (flushing or cancelling,
        depending upon what the driver can handle) before we commit the next
        software state there's no need for any locking in the worker thread
        at all. Which greatly simplifies things.
      
        And as long as we synchronize with all relevant threads we can have
        a lot of them (e.g. per-crtc for per-crtc updates) running in
        parallel.
      
      - Expose pre/post plane commit steps separately. We need to expose the
        actual hw commit step anyway for drivers to be able to implement
        asynchronous commit workers. But if we expose pre/post and plane
        commit steps individually we allow drivers to selectively use atomic
        helpers.
      
      - I've forgotten to call encoder/bridge ->mode_set functions, fix
        this.
      
      v4: Add debug output and fix a mixup between current and new state
      that resulted in crtcs not getting updated correctly. And in an
      Oops ...
      
      v5:
      - Be kind to driver writers in the vblank wait functions.. if thing
        aren't working yet, and vblank irq will never come, then let's not
        block forever.. especially under console-lock.
      - Correctly clear connector_state->best_encoder when disabling.
        Spotted while trying to understand a report from Rob Clark.
      - Only steal encoder if it actually changed, otherwise hilarity ensues
        if we steal from the current connector and so set the ->crtc pointer
        unexpectedly to NULL. Reported by Rob Clark.
      - Bail out in disable_outputs if an output currently doesn't have a
        best_encoder - this means it's already disabled.
      
      v6: Fixupe kerneldoc as reported by Paulo. And also fix up kerneldoc
      in drm_crtc.h.
      
      v7: Take ownership of the atomic state and clean it up with
      drm_atomic_state_free().
      
      v8 Various improvements all over:
      - Polish code comments and kerneldoc.
      - Improve debug output to make sure all failure cases are logged.
      - Treat enabled crtc with no connectors as invalid input from userspace.
      - Don't ignore the return value from mode_fixup().
      
      v9:
      - Improve debug output for crtc_state->mode_changed.
      
      v10:
      - Fixup the vblank waiting code to properly balance the vblank_get/put
        calls.
      - Better comments when checking/computing crtc->mode_changed
      
      v11: Fixup the encoder stealing logic: We can't look at encoder->crtc
      since that's not in the atomic state structures and might be updated
      asynchronously in and async commit. Instead we need to inspect all the
      connector states and check whether the encoder is currently in used
      and if so, on which crtc.
      
      v12: Review from Sean:
      - A few spelling fixes.
      - Flatten control flow indent by converting if blocks to early
        continue/return in 2 places.
      - Capture connectors_for_crtc return value in int num_connectors
        instead of bool has_connectors and do an explicit int->bool
        conversion with !!. I think the helper is more useful for drivers if
        it returns the number of connectors (e.g. to detect cloning
        configurations), so decided to keep that return value.
      
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Paulo Zanoni <przanoni@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      623369e5
  16. 06 11月, 2014 4 次提交
    • D
      drm/crtc-helper: Transitional functions using atomic plane helpers · 2f324b42
      Daniel Vetter 提交于
      These two functions allow drivers to reuse their atomic plane helpers
      functions for the primary plane to implement the interfaces required
      by the crtc helpers for the legacy ->set_config callback.
      
      This is purely transitional and won't be used once the driver is fully
      converted. But it allows partial conversions to the atomic plane
      helpers which are functional.
      
      v2:
      - Use ->atomic_duplicate_state if available.
      - Don't forget to run crtc_funcs->atomic_check.
      
      v3: Shift source coordinates correctly for 16.16 fixed point.
      
      v4: Don't forget to call ->atomic_destroy_state if available.
      
      v5: Fixup kerneldoc.
      
      v6: Reuse the plane_commit function from the transitional plane
      helpers to avoid too much duplication.
      
      v7:
      - Remove some stale comment.
      - Correctly handle the lack of plane->state object, necessary for
        transitional use.
      
      v8: Fixup an embarrassing h/vdisplay mixup.
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f324b42
    • D
      drm: Add atomic/plane helpers · c2fcd274
      Daniel Vetter 提交于
      This is the first cut of atomic helper code. As-is it's only useful to
      implement a pure atomic interface for plane updates.
      
      Later patches will integrate this with the crtc helpers so that full
      atomic updates are possible. We also need a pile of helpers to aid
      drivers in transitioning from the legacy world to the shiny new atomic
      age. Finally we need helpers to implement legacy ioctls on top of the
      atomic interface.
      
      The design of the overall helpers<->driver interaction is fairly
      simple, but has an unfortunate large interface:
      
      - We have ->atomic_check callbacks for crtcs and planes. The idea is
        that connectors don't need any checking, and if they do they can
        adjust the relevant crtc driver-private state. So no connector hooks
        should be needed. Also the crtc helpers integration will do the
        ->best_encoder checks, so no need for that.
      
      - Framebuffer pinning needs to be done before we can commit to the hw
        state. This is especially important for async updates where we must
        pin all buffers before returning to userspace, so that really only
        hw failures can happen in the asynchronous worker.
      
        Hence we add ->prepare_fb and ->cleanup_fb hooks for this resources
        management.
      
      - The actual atomic plane commit can't fail (except hw woes), so has
        void return type. It has three stages:
        1. Prepare all affected crtcs with crtc->atomic_begin. Drivers can
           use this to unset the GO bit or similar latches to prevent plane
           updates.
        2. Update plane state by looping over all changed planes and calling
           plane->atomic_update. Presuming the hardware is sane and has GO
           bits drivers can simply bash the state into the hardware in this
           function. Other drivers might use this to precompute hw state for
           the final step.
        3. Finally latch the update for the next vblank with
           crtc->atomic_flush. Note that this function doesn't need to wait
           for the vblank to happen even for the synchronous case.
      
      v2: Clear drm_<obj>_state->state to NULL when swapping in state.
      
      v3: Add TODO that we don't short-circuit plane updates for now. Likely
      no one will care.
      
      v4: Squash in a bit of polish that somehow landed in the wrong (later)
      patche.
      
      v5: Integrate atomic functions into the drm docbook and fixup the
      kerneldoc.
      
      v6: Fixup fixup patch squashing fumble.
      
      v7: Don't touch the legacy plane state plane->fb and plane->crtc. This
      is only used by the legacy ioctl code in the drm core, and that code
      already takes care of updating the pointers in all relevant cases.
      This is in stark contrast to connector->encoder->crtc links on the
      modeset side, which we still need to set since the core doesn't touch
      them.
      
      Also some more kerneldoc polish.
      
      v8: Drop outdated comment.
      
      v9: Handle the state->state pointer correctly: Only clearing the
      ->state pointer when assigning the state to the kms object isn't good
      enough. We also need to re-link the swapped out state into the
      drm_atomic_state structure.
      
      v10: Shuffle the misplaced docbook template hunk around that Sean spotted.
      
      Cc: Sean Paul <seanpaul@chromium.org>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c2fcd274
    • D
      drm: Global atomic state handling · cc4ceb48
      Daniel Vetter 提交于
      Some differences compared to Rob's patches again:
      - Dropped the committed and checked booleans. Checking will be
        internally enforced by always calling ->atomic_check before
        ->atomic_commit. And async handling needs to be solved differently
        because the current scheme completely side-steps ww mutex deadlock
        avoidance (and so either reinvents a new deadlock avoidance wheel or
        like the current code just deadlocks).
      
      - State for connectors needed to be added, since now they have a
        full-blown drm_connector_state (so that drivers have something to
        attach their own stuff to).
      
      - Refcounting is gone. I plane to solve async updates differently,
        since the lock-passing scheme doesn't cut it (since it abuses ww
        mutexes). Essentially what we need for async is a simple ownership
        transfer from the caller to the driver. That doesn't need full-blown
        refcounting.
      
      - The acquire ctx is a pointer. Real atomic callers should have that
        on their stack, legacy entry points need to put the right one
        (obtained by drm_modeset_legacy_acuire_ctx) in there.
      
      - I've dropped all hooks except check/commit. All the begin/end
        handling is done by core functions and is the same.
      
      - commit/check are just thin wrappers that ensure that ->check is
        always called.
      
      - To help out with locking in the legacy implementations I've added a
        helper to just grab all locks in the backoff case.
      
      v2: Add notices that check/commit can fail with EDEADLK.
      
      v3:
      - More consistent naming for state_alloc.
      - Add state_clear which is needed for backoff and retry.
      
      v4: Planes/connectors can switch between crtcs, and we need to be
      careful that we grab the state (and locks) for both the old and new
      crtc. Improve the interface functions to ensure this.
      
      v5: Add functions to grab affected connectors for a crtc and to recompute
      the crtc->enable state. This is useful for both helper and atomic ioctl
      code when e.g. removing a connector.
      
      v6: Squash in fixup from Fengguang to use ERR_CAST.
      
      v7: Add debug output.
      
      v8: Make checkpatch happy about kcalloc argument ordering.
      
      v9: Improve kerneldoc in drm_crtc.h
      
      v10:
      - Fix another kcalloc argument misorder I've missed.
      - More polish for kerneldoc.
      
      v11: Clarify the ownership rules for the state object. The new rule is
      that a successful drm_atomic_commit (whether synchronous or asnyc)
      always inherits the state and is responsible for the clean-up. That
      way async and sync ->commit functions are more similar.
      
      v12: A few bugfixes:
      - Assign state->state pointers correctly when grabbing state objects -
        we need to link them up with the global state.
      - Handle a NULL crtc in set_crtc_for_plane to simplify code flow a bit
        for the callers of this function.
      
      v13: Review from Sean:
      - kerneldoc spelling fixes
      - Don't overallocate states->planes.
      - Handle NULL crtc in set_crtc_for_connector.
      
      v14: Sprinkle __must_check over all functions which do wait/wound
      locking to make sure callers don't forget this. Since I have ;-)
      
      v15: Be more explicit in the kerneldoc when functions can return
      -EDEADLK what to do. And that every other -errno is fatal.
      
      v16: Indent with tabs instead of space, spotted by Ander.
      
      v17: Review from Thierry, small kerneldoc and other naming polish.
      
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Ander Conselvan de Oliveira <conselvan2@gmail.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cc4ceb48
    • D
      drm: Add atomic driver interface definitions for objects · 144ecb97
      Daniel Vetter 提交于
      Heavily based upon Rob Clark's atomic series.
      - Dropped the connector state from the crtc state, instead opting for a
        full-blown connector state. The only thing it has is the desired
        crtc, but drivers which have connector properties have now a
        data-structure to subclass.
      
      - Rename create_state to duplicate_state. Especially for legacy ioctls
        we want updates on top of existing state, so we need a way to get at
        the current state. We need to be careful to clear the backpointers
        to the global state correctly though.
      
      - Drop property values. Drivers with properties simply need to
        subclass the datastructures and track the decoded values in there. I
        also think that common properties (like rotation) should be decoded
        and stored in the core structures.
      
      - Create a new set of ->atomic_set_prop functions, for smoother
        transitions from legacy to atomic operations.
      
      - Pass the ->atomic_set_prop ioctl the right structure to avoid
        chasing pointers in drivers.
      
      - Drop temporary boolean state for now until we resurrect them with
        the helper functions.
      
      - Drop invert_dimensions. For now we don't need any checking since
        that's done by the higher-level legacy ioctls. But even then we
        should also add rotation/flip tracking to the core drm_crtc_state,
        not just whether the dimensions are inverted.
      
      - Track crtc state with an enable/disable. That's equivalent to
        mode_valid, but a bit clearer that it means the entire crtc.
      
      The global interface will follow in subsequent patches.
      
      v2: We need to allow drivers to somehow set up the initial state and
      clear it on resume. So add a plane->reset callback for that. Helpers
      will be provided with default behaviour for all these.
      
      v3: Split out the plane->reset into a separate patch.
      
      v4: Improve kerneldoc in drm_crtc.h
      
      v5: Remove unused inline functions for handling state objects, those
      callbacks are now mandatory for full atomic support.
      
      v6: Fix commit message nit Sean noticed.
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      144ecb97
  17. 05 11月, 2014 3 次提交
  18. 10 9月, 2014 1 次提交