1. 20 May, 2014 13 commits
  2. 19 May, 2014 11 commits
  3. 16 May, 2014 16 commits
    • Chris Wilson's avatar
      drm/i915: Only unpin the default ctx object if it exists · d3b448d9
      Chris Wilson authored
      Since commit 691e6415
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Wed Apr 9 09:07:36 2014 +0100
      
          drm/i915: Always use kref tracking for all contexts.
      
      we have contexts everywhere, and so we must be careful to distinguish
      fake contexts, which do not have an associated bo, and real ones, which
      do. In particular, we now need to be careful not to dereference NULL
      pointers.
      
      This is one such example, as the commit highlighted above failed to move
      the unpinning of the default ctx object into the real-context-only
      branch.
      Reported-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78792Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d3b448d9
    • Ville Syrjälä's avatar
      drm/i915: Convert uncleared FIFO underrun message to errors · 823c6909
      Ville Syrjälä authored
      Some platforms have a shared error interrupt, so if FIFO underrun
      reporting gets disabled for one pipe/transcoder it gets disabled
      for all pipes/transcoders.
      
      When we disable FIFO underrun reporting we check whether the
      interrupt was enabled or not. If it wasn't we might have missed
      an underrun and we perform one last check right there. Currently
      we print a debug message when an underrun is detect using this
      mechanism. Promote the message to DRM_ERROR() to match the other
      underrun error messages.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      823c6909
    • Chris Wilson's avatar
      drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl · 5cc9ed4b
      Chris Wilson authored
      By exporting the ability to map user address and inserting PTEs
      representing their backing pages into the GTT, we can exploit UMA in order
      to utilize normal application data as a texture source or even as a
      render target (depending upon the capabilities of the chipset). This has
      a number of uses, with zero-copy downloads to the GPU and efficient
      readback making the intermixed streaming of CPU and GPU operations
      fairly efficient. This ability has many widespread implications from
      faster rendering of client-side software rasterisers (chromium),
      mitigation of stalls due to read back (firefox) and to faster pipelining
      of texture data (such as pixel buffer objects in GL or data blobs in CL).
      
      v2: Compile with CONFIG_MMU_NOTIFIER
      v3: We can sleep while performing invalidate-range, which we can utilise
      to drop our page references prior to the kernel manipulating the vma
      (for either discard or cloning) and so protect normal users.
      v4: Only run the invalidate notifier if the range intercepts the bo.
      v5: Prevent userspace from attempting to GTT mmap non-page aligned buffers
      v6: Recheck after reacquire mutex for lost mmu.
      v7: Fix implicit padding of ioctl struct by rounding to next 64bit boundary.
      v8: Fix rebasing error after forwarding porting the back port.
      v9: Limit the userptr to page aligned entries. We now expect userspace
          to handle all the offset-in-page adjustments itself.
      v10: Prevent vma from being copied across fork to avoid issues with cow.
      v11: Drop vma behaviour changes -- locking is nigh on impossible.
           Use a worker to load user pages to avoid lock inversions.
      v12: Use get_task_mm()/mmput() for correct refcounting of mm.
      v13: Use a worker to release the mmu_notifier to avoid lock inversion
      v14: Decouple mmu_notifier from struct_mutex using a custom mmu_notifer
           with its own locking and tree of objects for each mm/mmu_notifier.
      v15: Prevent overlapping userptr objects, and invalidate all objects
           within the mmu_notifier range
      v16: Fix a typo for iterating over multiple objects in the range and
           rearrange error path to destroy the mmu_notifier locklessly.
           Also close a race between invalidate_range and the get_pages_worker.
      v17: Close a race between get_pages_worker/invalidate_range and fresh
           allocations of the same userptr range - and notice that
           struct_mutex was presumed to be held when during creation it wasn't.
      v18: Sigh. Fix the refactor of st_set_pages() to allocate enough memory
           for the struct sg_table and to clear it before reporting an error.
      v19: Always error out on read-only userptr requests as we don't have the
           hardware infrastructure to support them at the moment.
      v20: Refuse to implement read-only support until we have the required
           infrastructure - but reserve the bit in flags for future use.
      v21: use_mm() is not required for get_user_pages(). It is only meant to
           be used to fix up the kernel thread's current->mm for use with
           copy_user().
      v22: Use sg_alloc_table_from_pages for that chunky feeling
      v23: Export a function for sanity checking dma-buf rather than encode
           userptr details elsewhere, and clean up comments based on
           suggestions by Bradley.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: "Gong, Zhipeng" <zhipeng.gong@intel.com>
      Cc: Akash Goel <akash.goel@intel.com>
      Cc: "Volkin, Bradley D" <bradley.d.volkin@intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: default avatarBrad Volkin <bradley.d.volkin@intel.com>
      [danvet: Frob ioctl allocation to pick the next one - will cause a bit
      of fuss with create2 apparently, but such are the rules.]
      [danvet2: oops, forgot to git add after manual patch application]
      [danvet3: Appease sparse.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      5cc9ed4b
    • Mika Kuoppala's avatar
      drm/i915: Be careful with non-disp bit in PMINTRMSK · 992f191f
      Mika Kuoppala authored
      Bit 31 in GEN6_PMINTRMSK is not an interrupt disable bit with gen8.
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      992f191f
    • Oscar Mateo's avatar
      drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display · 19656430
      Oscar Mateo authored
      Otherwise, we do a NULL pointer dereference.
      
      I've seen this happen while handling an error in
      i915_gem_object_pin_to_display_plane():
      
      If i915_gem_object_set_cache_level() fails, we call is_pin_display()
      to handle the error. At this point, the object is still not pinned
      to GGTT and maybe not even bound, so we have to check before we
      dereference its GGTT vma.
      
      The IGT kms_flip/bo-too-big tests for this bug.
      
      v2: Chris Wilson says restoring the old value is easier, but that
      is_pin_display is useful as a theory of operation. Take the solomonic
      decision: at least this way is_pin_display is a little more robust
      (until Chris can kill it off).
      
      v3: Chris suggests the WARN in i915_gem_obj_to_ggtt has outlived its
      usefulness: add a reminder to remove it.
      
      Issue: VIZ-3772
      Signed-off-by: default avatarOscar Mateo <oscar.mateo@intel.com>
      Testcase: igt/kms_flip/bo-too-big
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      19656430
    • Daniel Vetter's avatar
      drm/i915: Stop calling encoder->mode_set · 4271b753
      Daniel Vetter authored
      All the callbacks are gone now.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      4271b753
    • Daniel Vetter's avatar
      drm/i915/dsi: Remove ->mode_set callback · 07e4fb9e
      Daniel Vetter authored
      Looking at our current dsi driver I note that:
      - We don't have any slave driver right now.
      - There's zero support for the hardware state readout and cross check
        code.
      - All the modeset state seems to be tracked in the intel_dsi structure
        instead of the pipe config.
      
      Given all that I can't properly audit the dsi ->mode_set callback. So
      just do it as the first thing in the ->pre_pll_enable hook and hope
      for the best.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      07e4fb9e
    • Daniel Vetter's avatar
      drm/i915/ddi: Remove ->mode_set callback · 30cf6db8
      Daniel Vetter authored
      A bit more care required here since there are some very few things
      between the call to encoder->mode_set and encoder->pre_enable. But
      they're either book-keeping or only matter for the vga port on the
      pch. So of no concern.
      
      Note that with the new sequence we write the infoframes after
      selecting the clock source, but that shouldn't matter. I've simply
      opted for this to have simpler code.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      30cf6db8
    • Daniel Vetter's avatar
      drm/i915/lvds: Remove ->mode_set callback · 85a50fb0
      Daniel Vetter authored
      All the hard work was already done, only thing left to do is remove
      the empty callback. And a now rather misleading comment I've spotted
      while reading through code.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      85a50fb0
    • Daniel Vetter's avatar
      drm/i915/hdmi: Remove ->mode_set callback · 4cde8a21
      Daniel Vetter authored
      Similar to dp the only thing we do is call intel_write_eld and prepare
      a bit of state for the enable hooks. The only difference is that we
      write that to the hardware instead of keeping track of it somewhere in
      software.
      
      Still we can just move all this to the very first enable hook.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      4cde8a21
    • Daniel Vetter's avatar
      drm/i915/hdmi: Remove redundant IS_VLV checks · e55dd225
      Daniel Vetter authored
      Those functions are only used on vlv platforms, so no need to check.
      Especially if we're not too consistent about it.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      e55dd225
    • Daniel Vetter's avatar
      drm/i915/dp: Remove ->mode_set callback · 8ac33ed3
      Daniel Vetter authored
      With all the preceding refactoring the dp mode_set callback only
      computes a bit of state (all derived from the pipe config) and also
      writes the eld. As long as we do that before we enable the audio bit
      or depend upon the correct value in intel_dp->DP we'll be fine.
      
      No other hw state is touched.
      
      We therefore only need to check that clearing intel_dp->DP is save.
      Which it is since when we re-enable we already mask out all the bits
      the link training code sets. And we need to keep on doing that so that
      the re-train loop walking over pre-emph/voltage-swing values still
      works properly.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      8ac33ed3
    • Daniel Vetter's avatar
      drm/i915/dp: Move port A pll setup to g4x_pre_enable_dp · d41f1efb
      Daniel Vetter authored
      Only ilk/snb/ivb need the port A pll setup, so move it to the
      pre_enable hook for those platforms. We can savely do this since on
      those platforms there's nothing that touches the hardware between the
      encoder->mode_set and the encoder->pre_enable calls.
      
      Also add a comment that port A is ilk+ only.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d41f1efb
    • Daniel Vetter's avatar
      drm/i915: Track has_audio in the pipe config · 9ed109a7
      Daniel Vetter authored
      Including state readout and cross-checking. This allows us to get rid
      of crtc->eld_vld on hsw+. It also means that fastboot will be unhappy
      if the BIOS hasn't set up the audio routing like we want it too.
      
      Wrt fastboot and external screens I see a few options:
      - Don't.
      - Try to fix up eld, infoframes and audio settings after the fact. But
        that means some pretty extensive reworking of our code which
        currently does all this while the pipe/port is still off.
      
      I won't bother with converting SDVO over to this because the audio
      support for SDVO is very lacking:
      - We don't update the eld.
      - We don't update the audio state on the sdvo encoder.
      - We don't check whether the platform can even feed audio to the sdvo
        encoder.
      
      I've converted hdmi, dp & ddi all in one go since ddi needs both hdmi
      and dp converted and so doing it step-by-step would have required a
      few intermediate hacks.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      9ed109a7
    • Daniel Vetter's avatar
      drm/i915: Simplify audio handling on DDI ports · acfa75b0
      Daniel Vetter authored
      There's no need to check whether audio is enabled (which for ddi ports
      is done through the crtc->eld_vld flag) since at the cost of a
      potentially unecessary register rmw cycle we can unconditionally do
      this.
      
      Note that the edp check is just paranoia since we won't ever call the
      write_eld function for an edp panel.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      acfa75b0
    • Daniel Vetter's avatar
      drm/i915/sdvo: use config->has_hdmi_sink · 9f04003e
      Daniel Vetter authored
      This way we can rely on the state cross-checker to have a bit
      assurance that we'll get it right.
      Reviewed-by: default avatarNaresh Kumar Kachhi <naresh.kumar.kachhi@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      9f04003e