1. 05 6月, 2014 4 次提交
    • V
      drm/i915: Set AGPBUSY# bit in init_clock_gating · 12fabbcb
      Ville Syrjälä 提交于
      I don't see why we wouldn't want interrupts to wake up the CPU from C3
      always, so just set the AGPBUSY# bit in gen3_init_clock_gating().
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      12fabbcb
    • D
      drm/i915: Extract gen8_gt_irq_reset · d6e3cca3
      Daniel Vetter 提交于
      Fallout from an intermediate patch revision that I deemed worth saving.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d6e3cca3
    • D
      drm/i915: Inline ilk/gen8_irq_reset · 723761b8
      Daniel Vetter 提交于
      No point in having this indirection.
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      723761b8
    • D
      drm/i915: Fix up fifo underrun tracking, take N · 2ae2a50c
      Daniel Vetter 提交于
      So apparently this is tricky.
      
      We need to consider:
      - We start out with all the hw enabling bits disabled, both the
        individual fifo underrun interrupts and the shared display error
        interrupts masked. Otherwise if the bios config is broken we'll blow
        up with a NULL deref in our interrupt handler since the crtc
        structures aren't set up yet at driver load time.
      - On gmch we need to mask fifo underruns on the sw side, so always
        need to set that in sanitize_crtc for those platforms.
      - On other platforms we try to set the sw tracking so that it reflects
        the real state. But since a few platforms have shared bits we must
        _not_ disable fifo underrun reporting. Otherwise we'll never enable
        the shared error interrupt.
      
      This is the state before out patch, but unfortunately this is not good
      enough. But after a suspend resume operation this is broken:
      1. We don't enable the hw interrupts since the same code runs on
      resume as on driver load.
      2. The fifo underrun state adjustments we do in sanitize_crtc doesn't
      fire on resume since (except for hilarious firmware) all pipes are off
      at that point. But they also don't hurt since the subsequent crtc
      enabling due to force_restore will enable fifo underruns.
      
      Which means when we enable fifo underrun reporting we notice that the
      per-crtc state is already correct and short-circuit everthing out. And
      the interrupt doesn't get enabled.
      
      A similar problem would happen if the bios doesn't light up anything
      when the driver loads. Which is exactly what happens when we reload
      the driver since our unload functions disables all outputs.
      
      Now we can't just rip out the short-circuit logic and unconditionally
      update the fifo underrun reporting interrupt masking: We have some
      checks for shared error interrupts to catch issues that happened when
      the shared error interrupt was disabled.
      
      The right fix is to push down this logic so that we can always update
      the hardware state, but only check for missed fifo underruns on a real
      enabled->disabled transition and ignore them when we're already
      disabled.
      
      On platforms with shared error interrupt the pipe CRC interrupts are
      grouped together with the fifo underrun reporting this fixes pipe CRC
      support after suspend and driver reloads.
      
      Testcase: igt/kms_pipe_crc_basic/suspend-*
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2ae2a50c
  2. 04 6月, 2014 1 次提交
  3. 23 5月, 2014 3 次提交
    • O
      drm/i915: Split the ringbuffers from the rings (3/3) · 93b0a4e0
      Oscar Mateo 提交于
      Manual cleanup after the previous Coccinelle script.
      
      Yes, I could write another Coccinelle script to do this but I
      don't want labor-replacing robots making an honest programmer's
      work obsolete (also, I'm lazy).
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      93b0a4e0
    • O
      drm/i915: Split the ringbuffers from the rings (2/3) · ee1b1e5e
      Oscar Mateo 提交于
      This refactoring has been performed using the following Coccinelle
      semantic script:
      
          @@
          struct intel_engine_cs r;
          @@
          (
          - (r).obj
          + r.buffer->obj
          |
          - (r).virtual_start
          + r.buffer->virtual_start
          |
          - (r).head
          + r.buffer->head
          |
          - (r).tail
          + r.buffer->tail
          |
          - (r).space
          + r.buffer->space
          |
          - (r).size
          + r.buffer->size
          |
          - (r).effective_size
          + r.buffer->effective_size
          |
          - (r).last_retired_head
          + r.buffer->last_retired_head
          )
      
          @@
          struct intel_engine_cs *r;
          @@
          (
          - (r)->obj
          + r->buffer->obj
          |
          - (r)->virtual_start
          + r->buffer->virtual_start
          |
          - (r)->head
          + r->buffer->head
          |
          - (r)->tail
          + r->buffer->tail
          |
          - (r)->space
          + r->buffer->space
          |
          - (r)->size
          + r->buffer->size
          |
          - (r)->effective_size
          + r->buffer->effective_size
          |
          - (r)->last_retired_head
          + r->buffer->last_retired_head
          )
      
          @@
          expression E;
          @@
          (
          - LP_RING(E)->obj
          + LP_RING(E)->buffer->obj
          |
          - LP_RING(E)->virtual_start
          + LP_RING(E)->buffer->virtual_start
          |
          - LP_RING(E)->head
          + LP_RING(E)->buffer->head
          |
          - LP_RING(E)->tail
          + LP_RING(E)->buffer->tail
          |
          - LP_RING(E)->space
          + LP_RING(E)->buffer->space
          |
          - LP_RING(E)->size
          + LP_RING(E)->buffer->size
          |
          - LP_RING(E)->effective_size
          + LP_RING(E)->buffer->effective_size
          |
          - LP_RING(E)->last_retired_head
          + LP_RING(E)->buffer->last_retired_head
          )
      
      Note: On top of this this patch also removes the now unused ringbuffer
      fields in intel_engine_cs.
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      [danvet: Add note about fixup patch included here.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ee1b1e5e
    • O
      drm/i915: s/intel_ring_buffer/intel_engine_cs · a4872ba6
      Oscar Mateo 提交于
      In the upcoming patches we plan to break the correlation between
      engine command streamers (a.k.a. rings) and ringbuffers, so it
      makes sense to refactor the code and make the change obvious.
      
      No functional changes.
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a4872ba6
  4. 22 5月, 2014 7 次提交
  5. 21 5月, 2014 1 次提交
    • D
      drm/i915: Accurately initialize fifo underrun state on gmch platforms · c5ab3bc0
      Daniel Vetter 提交于
      We don't have hardware based disable bits on gmch platforms, so need
      to block spurious underrun reports in software. Which means that we
      _must_ start out with fifo underrun reporting disabled everywhere.
      
      This is in big contrast to ilk/hsw/cpt where there's only _one_
      disable bit for all platforms and hence we must allow underrun
      reporting on disabled pipes. Otherwise nothing really works,
      especially the CRC support since that's key'ed off the same irq
      disable bit.
      
      This allows us to ditch the fifo underrun reporting hack from the vlv
      runtime pm code and unexport the internal function from i915_irq.c
      again. Yay!
      
      v2: Keep the display irq disabling, spotted by Imre.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c5ab3bc0
  6. 20 5月, 2014 3 次提交
  7. 17 5月, 2014 1 次提交
  8. 16 5月, 2014 1 次提交
    • B
      drm/i915/bdw: Implement a basic PM interrupt handler · 0961021a
      Ben Widawsky 提交于
      Almost all of it is reusable from the existing code. The primary
      difference is we need to do even less in the interrupt handler, since
      interrupts are not shared in the same way.
      
      The patch is mostly a copy-paste of the existing snb+ code, with updates
      to the relevant parts requiring changes to the interrupt handling. As
      such it /should/ be relatively trivial. It's highly likely that I missed
      some places where I need a gen8 version of the PM interrupts, but it has
      become invisible to me by now.
      
      This patch could probably be split into adding the new functions,
      followed by actually handling the interrupts. Since the code is
      currently disabled (and broken) I think the patch stands better by
      itself.
      
      v2: Move the commit about not touching the ringbuffer interrupt to the
      snb_* function where it belongs (Rodrigo)
      
      v3: Rebased on Paulo's runtime PM changes
      
      v4: Not well validated, but rebase on
      commit 730488b2
      Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Date:   Fri Mar 7 20:12:32 2014 -0300
      
          drm/i915: kill dev_priv->pm.regsave
      
      v5: Rebased on latest code base. (Deepak)
      
      v6: Remove conflict markers, Unnecessary empty line and use right
      IIR interrupt (Ville)
      
      v7: mask modified without rmw (Ville Syrjälä)
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDeepak S <deepak.s@linux.intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0961021a
  9. 13 5月, 2014 2 次提交
    • D
      drm/i915: Drop unecessary casts in i915_irq.c · 45a83f84
      Daniel Vetter 提交于
      Inspired by a review bikeshed from Jani.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      45a83f84
    • V
      drm/i915/chv: Preliminary interrupt support for Cherryview · 43f328d7
      Ville Syrjälä 提交于
      CHV has the Gen8 master interrupt register, as well as Gen8
      GT/PCU interrupt registers.
      
      The display block is based on VLV, with the main difference
      of adding pipe C.
      
      v2: Rewrite the order of operations to make more sense
          Don't bail out if MASTER_CTL register doesn't show an interrupt,
          as display interrupts aren't reported there.
      
      v3: Rebase on top of Egbert Eich's hpd irq handling rework by using
      the relevant port hotplug logic like for vlv.
      
      v4: Rebase on top of Ben's gt irq #define refactoring.
      
      v5: Squash in gen8_gt_irq_handler refactoring from Zhao Yakui
      <yakui.zhao@intel.com>
      
      v6: Adapt to upstream changes, dev_priv->irq_received is gone.
      
      v7: Enable 3 the commented-out 3 pipe support.
      
      v8: Rebase on top of Paulo's irq setup rework, use the renamed macros from
      upstream.
      
      v9: Grab irq_lock around i915_enable_pipestat()
      
      FIXME: There's probably some potential for more shared code between bdw and chv.
      
      Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v2)
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      [danvet: Drop the unnecessary cast Jani spotted.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      43f328d7
  10. 06 5月, 2014 1 次提交
    • V
      drm/i915: Make sprite updates atomic · 8d7849db
      Ville Syrjälä 提交于
      Add a mechanism by which we can evade the leading edge of vblank. This
      guarantees that no two sprite register writes will straddle on either
      side of the vblank start, and that means all the writes will be latched
      together in one atomic operation.
      
      We do the vblank evade by checking the scanline counter, and if it's too
      close to the start of vblank (too close has been hardcoded to 100usec
      for now), we will wait for the vblank start to pass. In order to
      eliminate random delayes from the rest of the system, we operate with
      interrupts disabled, except when waiting for the vblank obviously.
      
      Note that we now go digging through pipe_to_crtc_mapping[] in the
      vblank interrupt handler, which is a bit dangerous since we set up
      interrupts before the crtcs. However in this case since it's the vblank
      interrupt, we don't actually unmask it until some piece of code
      requests it.
      
      v2: preempt_check_resched() calls after local_irq_enable() (Jesse)
          Hook up the vblank irq stuff on BDW as well
      v3: Pass intel_crtc instead of drm_crtc (Daniel)
          Warn if crtc.mutex isn't locked (Daniel)
          Add an explicit compiler barrier and document the barriers (Daniel)
          Note the irq vs. modeset setup madness in the commit message (Daniel)
      v4: Use prepare_to_wait() & co. directly and eliminate vbl_received
      v5: Refactor intel_pipe_handle_vblank() vs. drm_handle_vblank() (Chris)
          Check for min/max scanline <= 0 (Chris)
          Don't call intel_pipe_update_end() if start failed totally (Chris)
          Check that the vblank counters match on both sides of the critical
          section (Chris)
      v6: Fix atomic update for interlaced modes
      v7: Reorder code for better readability (Chris)
      v8: Drop preempt_check_resched(). It's not available to modules
          anymore and isn't even needed unless we ourselves cause
          a wakeup needing reschedule while interrupts are off
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: NSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: NAkash Goel <akash.goels@gmail.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8d7849db
  11. 05 5月, 2014 6 次提交
    • B
      drm/i915: Move semaphore specific ring members to struct · ebc348b2
      Ben Widawsky 提交于
      This will be helpful in abstracting some of the code in preparation for
      gen8 semaphores.
      
      v2: Move mbox stuff to a separate struct
      
      v3: Rebased over VCS2 work
      
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ebc348b2
    • V
      drm/i915: Add intel_get_crtc_scanline() · a225f079
      Ville Syrjälä 提交于
      Add a new function intel_get_crtc_scanline() that returns the current
      scanline counter for the crtc.
      
      v2: Rebase after vblank timestamp changes.
          Use intel_ prefix instead of i915_ as is more customary for
          display related functions.
          Include DRM_SCANOUTPOS_INVBL in the return value even w/o
          adjustments, for a bit of extra consistency.
      v3: Change the implementation to be based on DSL on all gens,
          since that's enough for the needs of atomic updates, and
          it will avoid complicating the scanout position calculations
          for the vblank timestamps
      v4: Don't break scanline wraparound for interlaced modes
      Reviewed-by: NSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: NAkash Goel <akash.goels@gmail.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a225f079
    • V
      drm/i915: Fix scanout position for real · 78e8fc6b
      Ville Syrjälä 提交于
      Seems I've been a bit dense with regards to the start of vblank
      vs. the scanline counter / pixel counter.
      
      After staring at the pixel counter on gen4 I came to the conclusion
      that the start of vblank interrupt and scanline counter increment
      happen at the same time. The scanline counter increment is documented
      to occur at start of hsync, which means that the start of vblank
      interrupt must also trigger there. Looking at the pixel counter value
      when the scanline wraps from vtotal-1 to 0 confirms that, as the pixel
      counter at that point reads hsync_start. This also clarifies why we see
      need the +1 adjustment to the scaline counter. The counter actually
      starts counting from vtotal-1 on the first active line.
      
      I also confirmed that the frame start interrupt happens ~1 line after
      the start of vblank, but the frame start occurs at hblank_start instead.
      We only use the frame start interrupt on gen2 where the start of vblank
      interrupt isn't available. The only important thing to note here is that
      frame start occurs after vblank start, so we don't have to play any
      additional tricks to fix up the scanline counter.
      
      The other thing to note is the fact that the pixel counter on gen3-4
      starts counting from the start of horizontal active on the first active
      line. That means that when we get the start of vblank interrupt, the
      pixel counter reads (htotal*(vblank_start-1)+hsync_start). Since we
      consider vblank to start at (htotal*vblank_start) we need to add a
      constant (htotal-hsync_start) offset to the pixel counter, or else we
      risk misdetecting whether we're in vblank or not.
      
      I talked a bit with Art Runyan about these topics, and he confirmed my
      findings. And that the same rules should hold for platforms which don't
      have the pixel counter. That's good since without the pixel counter it's
      rather difficult to verify the timings to this accuracy.
      
      So the conclusion is that we can throw away all the ISR tricks I added,
      and just increment the scanline counter by one always.
      Reviewed-by: NSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: NAkash Goel <akash.goels@gmail.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      78e8fc6b
    • I
      drm/i915: get a runtime PM ref for the deferred GPU reset work · f454c694
      Imre Deak 提交于
      Atm we can end up in the GPU reset deferred work in D3 state if the last
      runtime PM reference is dropped between detecting a hang/scheduling the
      work and executing the work. At least one such case I could trigger is
      the simulated reset via the i915_wedged debugfs entry. Fix this by
      getting an RPM reference around accessing the HW in the reset work.
      
      v2:
      - Instead of getting/putting the RPM reference in the reset work itself,
        get it already before scheduling the work. By this we also prevent
        going to D3 before the work gets to run, in addition to making sure
        that we run the work itself in D0. (Ville, Daniel)
      v3:
      - fix inverted logic fail when putting the RPM ref on behalf of a
        cancelled GPU reset work (Ville)
      v4:
      - Taking the RPM ref in the interrupt handler isn't really needed b/c
        it's already guaranteed that we hold an RPM ref until the end of the
        reset work in all cases we care about. So take the ref in the reset
        work (for cases like i915_wedged_set). (Daniel)
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f454c694
    • I
      drm/i915: vlv: clear master interrupt flag when disabling interrupts · 843d0e7d
      Imre Deak 提交于
      Not clearing this flag causes spurious interrupts at least in D3 state,
      so before enabling RPM we need to fix this. We were already setting this
      flag when enabling interrupts, only clearing it was missing.
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      843d0e7d
    • Z
  12. 25 4月, 2014 1 次提交
    • D
      drm/i915: Don't WARN nor handle unexpected hpd interrupts on gmch platforms · 3ff04a16
      Daniel Vetter 提交于
      The status bits are unconditionally set, the control bits only enable
      the actual interrupt generation. Which means if we get some random
      other interrupts we'll bogusly complain about them.
      
      So restrict the WARN to platforms with a sane hotplug interrupt
      handling scheme. And even more important also don't attempt to process
      the hpd bit since we've detected a storm already. Instead just clear
      the bit silently.
      
      This WARN has been introduced in
      
      commit b8f102e8
      Author: Egbert Eich <eich@suse.de>
      Date:   Fri Jul 26 14:14:24 2013 +0200
      
          drm/i915: Add messages useful for HPD storm detection debugging (v2)
      
      before that we silently handled the hpd event and so partially
      defeated the storm detection.
      
      v2: Pimp commit message (Jani)
      
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Egbert Eich <eich@suse.de>
      Cc: bitlord <bitlord0xff@gmail.com>
      Reported-by: Nbitlord <bitlord0xff@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      3ff04a16
  13. 09 4月, 2014 1 次提交
  14. 03 4月, 2014 1 次提交
  15. 02 4月, 2014 7 次提交