1. 18 3月, 2015 5 次提交
    • V
      drm/i915: Reduce CHV DPLL min vco frequency to 4.8 GHz · 17fe1021
      Ville Syrjälä 提交于
      The current minimum vco frequency leaves us with a gap in our supported
      frequencies at 233-243 MHz. Your typical 2560x1440@60 display wants a
      pixel clock of 241.5 MHz, which is just withing that gap. Reduce the
      allowed vco min frequency to 4.8GHz to reduce the gap to 233-240 MHz,
      and thus allow such displays to work.
      
      4.8 GHz is actually the documented (at least in some docs) limit of the
      PLL, and we just picked 4.86 GHz originally because that was the lowest
      value produced by the PLL spreadsheet, which obviously didn't consider
      2560x1440 displays.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NVijay Purushothaman <vijay.a.purushothaman@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      17fe1021
    • D
      Revert "drm/i915: Switch planes from transitional helpers to full atomic helpers" · ff42e093
      Daniel Vetter 提交于
      This reverts commit 3f678c96.
      
      We've been a bit too optimistic with this one here :(
      
      The trouble is that internally we're still using these plane
      update/disable hooks. Which was totally ok pre-atomic since the drm
      core did all the book-keeping updating and these just mostly updated
      hw state. But with atomic there's lots more going on, and it causes
      heaps of trouble with the load detect code.
      
      This one specifically cause a deadlock since both the load detect code
      and the nested plane atomic helper functions tried to grab the same
      locks. It only blows up because of the evil tricks though we play with
      the implicit ww acquire context.
      
      Applying this revert unearths the NULL deref on already freed
      framebuffer objects reported as a regression in 4.0 by various people.
      
      Fixing this will be fairly invasive, hence revert even for the
      4.1-next queue.
      
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul Bolle <pebolle@tiscali.nl>
      Acked-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      ff42e093
    • D
      drm/i915: Make for_each_sprite() take dev_priv as argument · 3bdcfc0c
      Damien Lespiau 提交于
      Implicit usage of local variables in macros isn't exactly the greatest
      thing in the world, especially when that variable is the drm device and
      we want to move towards a broader use of the i915 device structure.
      
      Let's make for_each_sprite() take dev_priv as its first argument then.
      Suggested-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: Chris Wilson <chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3bdcfc0c
    • D
      drm/i915: Make for_each_plane() take dev_priv as argument · dd740780
      Damien Lespiau 提交于
      Implicit usage of local variables in macros isn't exactly the greatest
      thing in the world, especially when that variable is the drm device and
      we want to move towards a broader use of the i915 device structure.
      
      Let's make for_each_plane() take dev_priv as its first argument then.
      Suggested-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: Chris Wilson <chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      dd740780
    • M
      drm/i915: Kill intel_crtc->cursor_{width, height} (v2) · 3dd512fb
      Matt Roper 提交于
      The cursor size fields in intel_crtc just duplicate the data from
      cursor->state.crtc_{w,h} so we don't need them any more.  Worse, their
      use in the watermark code actually introduces a subtle bug since they
      don't get updated to mirror the state values until the plane commit
      stage, which is *after* we've already used them to calculate new
      watermark values.  This happens because we had to move watermark updates
      slightly earlier (outside vblank evasion) in commit
      
              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)
      
      Dropping the intel_crtc fields and just using the state values (which
      are properly updated by the time watermark updates happen) should solve
      the problem.
      
      Aside from the actual removal of the struct fields (which are formatted
      in a way that I couldn't figure out how to match in Coccinelle), the
      rest of this patch was generated via the following semantic patch:
      
              // Drop assignment
              @@
              struct intel_crtc *C;
              struct drm_plane_state S;
              @@
              (
              - C->cursor_width = S.crtc_w;
              |
              - C->cursor_height = S.crtc_h;
              )
      
              // Replace usage
              @@
              struct intel_crtc *C;
              expression E;
              @@
              (
              - C->cursor_width
              + C->base.cursor->state->crtc_w
              |
              - C->cursor_height
              + C->base.cursor->state->crtc_h
              |
              - to_intel_crtc(E)->cursor_width
              + E->cursor->state->crtc_w
              |
              - to_intel_crtc(E)->cursor_height
              + E->cursor->state->crtc_h
              )
      
      v2: Rebase
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Joe Konno <joe.konno@linux.intel.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89346Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3dd512fb
  2. 10 3月, 2015 1 次提交
  3. 05 3月, 2015 1 次提交
  4. 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
  5. 28 2月, 2015 7 次提交
  6. 26 2月, 2015 3 次提交
    • A
      drm/i915: Look at staged config when fixing pipe_src_w for LVDS · b4f2bf4c
      Ander Conselvan de Oliveira 提交于
      The code in function intel_crtc_compute_config() that evens pipe_src_w
      if necessary would look at the current config instead of the staged one
      when deciding if there is an LVDS encoder in use. This could potentially
      lead to the value not being updated, if during the modeset a crtc wasn't
      driving an LVDS encoder.
      Signed-off-by: NAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b4f2bf4c
    • M
      drm/i915: Ensure crtc_state backpointer is always initialized · 07878248
      Matt Roper 提交于
      As we transition to full atomic modesetting, we want to be able to pass
      intel_crtc_state around in various places that we pass intel_crtc
      directly today.  Ensure that the ->crtc backpointer is properly
      initialized in case we need to get back to the associated CRTC.
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      07878248
    • M
      drm/i915: Use enabled value from crtc_state rather than crtc (v2) · 83d65738
      Matt Roper 提交于
      As vendors transition their drivers from legacy to atomic there's some
      duplication of data between drm_crtc and drm_crtc_state (since
      unconverted drivers likely won't have a state structure).
      
      i915 is partially converted and does have a crtc->state structure, but
      still uses direct crtc fields internally in many places, which causes
      the two sets of data to get out of sync.  As of commit
      
              commit 31c946e8
              Author: Daniel Vetter <daniel.vetter@ffwll.ch>
              Date:   Sun Feb 22 12:24:17 2015 +0100
      
                  drm: If available use atomic state in getcrtc ioctl
      
                  This way drivers fully converted to atomic don't need to update these
                  legacy state variables in their modeset code any more.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      
      the DRM core starts assuming that the presence of a ->state structure
      implies that it should make use of the values stored there which, on
      i915, leads to the core code using stale values for CRTC 'enabled'
      status.
      
      Let's switch over to using the state value of 'enable' internally rather
      than using the drm_crtc field.  This ensures that our driver internals
      are working from the same data that the DRM core is, avoiding
      mismatches.
      
      This patch was generated with Coccinelle using the following semantic
      patch:
      
              <smpl>
              @@
              struct drm_crtc C;
              struct drm_crtc *CP;
              @@
              (
              - C.enabled
              + C.state->enable
              |
              - CP->enabled
              + CP->state->enable
              )
      
              // For assignments, we still update the legacy value as well as the state value
              // so add an extra assignment statement for that.
              @@
              struct drm_crtc C;
              struct drm_crtc *CP;
              expression E;
              @@
              (
                C.state->enable = E;
              + C.enabled = E;
              |
                CP->state->enable = E;
              + CP->enabled = E;
              )
              </smpl>
      
      The crtc->mode and crtc->hwmode fields should probably be transitioned
      over as well eventually, but we seem to do an okay job of keeping those
      up-to-date already so I want to minimize the changes that will clash
      with Ander's in-progress atomic work.
      
      v2: Don't remove the assignments to the legacy value when we assign to
          the state value.  A second cocci stanza takes care of adding the
          legacy assignment back where appropriate.  (Daniel)
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      83d65738
  7. 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
  8. 24 2月, 2015 4 次提交
  9. 23 2月, 2015 4 次提交
  10. 14 2月, 2015 13 次提交