1. 10 3月, 2015 1 次提交
  2. 04 3月, 2015 1 次提交
    • D
      drm/i915: Fix modeset state confusion in the load detect code · 9128b040
      Daniel Vetter 提交于
      This is a tricky story of the new atomic state handling and the legacy
      code fighting over each another. The bug at hand is an underrun of the
      framebuffer reference with subsequent hilarity caused by the load
      detect code. Which is peculiar since the the exact same code works
      fine as the implementation of the legacy setcrtc ioctl.
      
      Let's look at the ingredients:
      
      - Currently our code is a crazy mix of legacy modeset interfaces to
        set the parameters and half-baked atomic state tracking underneath.
        While this transition is going we're using the transitional plane
        helpers to update the atomic side (drm_plane_helper_disable/update
        and friends), i.e. plane->state->fb. Since the state structure owns
        the fb those functions take care of that themselves.
      
        The legacy state (specifically crtc->primary->fb) is still managed
        by the old code (and mostly by the drm core), with the fb reference
        counting done by callers (core drm for the ioctl or the i915 load
        detect code). The relevant commit is
      
        commit ea2c67bb
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Tue Dec 23 10:41:52 2014 -0800
      
            drm/i915: Move to atomic plane helpers (v9)
      
      - drm_plane_helper_disable has special code to handle multiple calls
        in a row - it checks plane->crtc == NULL and bails out. This is to
        match the proper atomic implementation which needs the crtc to get
        at the implied locking context atomic updates always need. See
      
        commit acf24a39
        Author: Daniel Vetter <daniel.vetter@ffwll.ch>
        Date:   Tue Jul 29 15:33:05 2014 +0200
      
            drm/plane-helper: transitional atomic plane helpers
      
      - The universal plane code split out the implicit primary plane from
        the CRTC into it's own full-blown drm_plane object. As part of that
        the setcrtc ioctl (which updated both the crtc mode and primary
        plane) learned to set crtc->primary->crtc on modeset to make sure
        the plane->crtc assignments statate up to date in
      
        commit e13161af
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Tue Apr 1 15:22:38 2014 -0700
      
            drm: Add drm_crtc_init_with_planes() (v2)
      
        Unfortunately we've forgotten to update the load detect code. Which
        wasn't a problem since the load detect modeset is temporary and
        always undone before we drop the locks.
      
      - Finally there is a organically grown history (i.e. don't ask) around
        who sets the legacy plane->fb for the various driver entry points.
        Originally updating that was the drivers duty, but for almost all
        places we've moved that (plus updating the refcounts) into the core.
        Again the exception is the load detect code.
      
      Taking all together the following happens:
      - The load detect code doesn't set crtc->primary->crtc. This is only
        really an issue on crtcs never before used or when userspace
        explicitly disabled the primary plane.
      
      - The plane helper glue code short-circuits because of that and leaves
        a non-NULL fb behind in plane->state->fb and plane->fb. The state
        fb isn't a real problem (it's properly refcounted on its own), it's
        just the canary.
      
      - Load detect code drops the reference for that fb, but doesn't set
        plane->fb = NULL. This is ok since it's still living in that old
        world where drivers had to clear the pointer but the core/callers
        handled the refcounting.
      
      - On the next modeset the drm core notices plane->fb and takes care of
        refcounting it properly by doing another unref. This drops the
        refcount to zero, leaving state->plane now pointing at freed memory.
      
      - intel_plane_duplicate_state still assume it owns a reference to that
        very state->fb and bad things start to happen.
      
      Fix this all by applying the same duct-tape as for the legacy setcrtc
      ioctl code and set crtc->primary->crtc properly.
      
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Paul Bolle <pebolle@tiscali.nl>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Paulo Zanoni <przanoni@gmail.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reported-and-tested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9128b040
  3. 25 2月, 2015 1 次提交
    • R
      drm/i915: Fix frontbuffer false positve. · 62e537f8
      Rodrigo Vivi 提交于
      This return 0 without setting atomic bits on fb == crtc->cursor->fb
      where causing frontbuffer false positives.
      
      According to Daniel:
      
      The original regression seems to have been introduced in the original
      check/commit split:
      
      commit 757f9a3e
      Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
      Date:   Wed Sep 24 14:20:24 2014 -0300
      
          drm/i915: move check of intel_crtc_cursor_set_obj() out
      
      Which already cause other trouble, resulting in the check getting moved in
      
      commit e391ea88
      Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
      Date:   Wed Sep 24 14:20:25 2014 -0300
      
          drm/i915: Fix not checking cursor and object sizes
      
      The frontbuffer tracking itself only was broken when we shifted it into
      the check/commit logic with:
      
      commit 32b7eeec
      Author: Matt Roper <matthew.d.roper@intel.com>
      Date:   Wed Dec 24 07:59:06 2014 -0800
      
          drm/i915: Refactor work that can sleep out of commit (v7)
      
      v2: When putting more debug prints I notice the solution was simpler
      than I thought. AMS design is solid, just this return was wrong.
      Sorry for the noise.
      
      v3: Remove the entire chunck that would probably
          be removed by gcc anyway. (by Daniel)
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      62e537f8
  4. 24 2月, 2015 1 次提交
  5. 23 2月, 2015 2 次提交
  6. 31 1月, 2015 1 次提交
  7. 27 1月, 2015 28 次提交
  8. 13 1月, 2015 5 次提交
    • V
      drm/i915: Don't register HDMI connectors for eDP ports on VLV/CHV · d2182a66
      Ville Syrjälä 提交于
      If we determine that a specific port is eDP, don't register the HDMI
      connector/encoder for it. The reason being that we want to disable
      HPD interrupts for eDP ports when the display is off, but the presence
      of the extra HDMI connector would demand the HPD interrupt to remain
      enabled all the time.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d2182a66
    • M
      drm/i915: Drop unused position fields (v2) · 53a366b9
      Matt Roper 提交于
      The userspace-requested plane coordinates are now always available via
      plane->state.base (and the i915-adjusted values are stored in
      plane->state), so we no longer use the coordinate fields in intel_plane
      and can drop them.
      
      Also, note that the error case for pageflip calls update_plane() to
      program the values from plane->state; it's simpler to just call
      intel_plane_restore() which does the same thing.
      
      v2: Replace manual update_plane() with intel_plane_restore() in pageflip
          error handler.
      
      Reviewed-by(v1): Bob Paauwe <bob.j.paauwe@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      53a366b9
    • M
      drm/i915: Move to atomic plane helpers (v9) · ea2c67bb
      Matt Roper 提交于
      Switch plane handling to use the atomic plane helpers.  This means that
      rather than provide our own implementations of .update_plane() and
      .disable_plane(), we expose the lower-level check/prepare/commit/cleanup
      entrypoints and let the DRM core implement update/disable for us using
      those entrypoints.
      
      The other main change that falls out of this patch is that our
      drm_plane's will now always have a valid plane->state that contains the
      relevant plane state (initial state is allocated at plane creation).
      The base drm_plane_state pointed to holds the requested source/dest
      coordinates, and the subclassed intel_plane_state holds the adjusted
      values that our driver actually uses.
      
      v2:
       - Renamed file from intel_atomic.c to intel_atomic_plane.c (Daniel)
       - Fix a copy/paste comment mistake (Bob)
      
      v3:
       - Use prepare/cleanup functions that we've already factored out
       - Use newly refactored pre_commit/commit/post_commit to avoid sleeping
         during vblank evasion
      
      v4:
       - Rebase to latest di-nightly requires adding an 'old_state' parameter
         to atomic_update;
      
      v5:
       - Must have botched a rebase somewhere and lost some work.  Restore
         state 'dirty' flag to let begin/end code know which planes to
         run the pre_commit/post_commit hooks for.  This would have actually
         shown up as broken in the next commit rather than this one.
      
      v6:
       - Squash kerneldoc patch into this one.
       - Previous patches have now already taken care of most of the
         infrastructure that used to be in this patch.  All we're adding here
         now is some thin wrappers.
      
      v7:
       - Check return of intel_plane_duplicate_state() for allocation
         failures.
      
      v8:
       - Drop unused drm_plane_state -> intel_plane_state cast.  (Ander)
       - Squash in actual transition to plane helpers.  Significant
         refactoring earlier in the patchset has made the combined
         prep+transition much easier to swallow than it was in earlier
         iterations. (Ander)
      
      v9:
       - s/track_fbs/disabled_planes/ in the atomic crtc flags.  The only fb's
         we need to update frontbuffer tracking for are those on a plane about
         to be disabled (since the atomic helpers never call prepare_fb() when
         disabling a plane), so the new name more accurately describes what
         we're actually tracking.
      
      Testcase: igt/kms_plane
      Testcase: igt/kms_universal_plane
      Testcase: igt/kms_cursor_crc
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ea2c67bb
    • M
      drm/i915: Clarify sprite plane function names (v4) · 4a3b8769
      Matt Roper 提交于
      A few of the sprite-related function names in i915 are very similar
      (e.g., intel_enable_planes() vs intel_crtc_enable_planes()) and don't
      make it clear whether they only operate on sprite planes, or whether
      they also apply to all universal plane types.  Rename a few functions to
      be more consistent with our function naming for primary/cursor planes or
      to clarify that they apply specifically to sprite planes:
      
       - s/intel_disable_planes/intel_disable_sprite_planes/
       - s/intel_enable_planes/intel_enable_sprite_planes/
      
      Also, drop the sprite-specific intel_destroy_plane() and just use
      the type-agnostic intel_plane_destroy() function.  The extra 'disable'
      call that intel_destroy_plane() did is unnecessary since the plane will
      already be disabled due to framebuffer destruction by the point it gets
      called.
      
      v2: Earlier consolidation patches have reduced the number of functions
          we need to rename here.
      
      v3: Also rename intel_plane_funcs vtable to intel_sprite_plane_funcs
          for consistency with primary/cursor.  (Ander)
      
      v4: Convert comment for intel_plane_destroy() to kerneldoc now that it
          is no longer a static function.  (Ander)
      
      Reviewed-by(v1): Bob Paauwe <bob.j.paauwe@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4a3b8769
    • M
      drm/i915: Move vblank evasion to commit (v4) · c34c9ee4
      Matt Roper 提交于
      Move the vblank evasion up from the low-level, hw-specific
      update_plane() handlers to the general plane commit operation.
      Everything inside commit should now be non-sleeping, so this brings us
      closer to how vblank evasion will behave once we move over to atomic.
      
      v2:
       - Restore lost intel_crtc->active check on vblank evasion
      
      v3:
       - Replace assert_pipe_enabled() in intel_disable_primary_hw_plane()
         with an intel_crtc->active test; it turns out assert_pipe_enabled()
         grabs some mutexes and can sleep, which we can't do with interrupts
         disabled.
      
      v4:
       - Equivalent to v2; v3 change is now squashed into an earlier patch
         of the series.  (Ander).
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c34c9ee4