1. 25 7月, 2013 1 次提交
    • D
      drm/i915: fix reference counting in i915_gem_create · d861e338
      Daniel Vetter 提交于
      This function is called without the dev->struct_mutex held, hence we
      need to use the _unlocked unreference variants.
      
      As soon as the object is registered userspace can sneak in here with a
      gem_close ioctl call, so the object can (and with my new evil tests
      actually does) get the final unreference in this place. The lack of
      locking then results in hilarity and some good leakage.
      
      To fix this we simply need to revert
      
      Chris Wilson <chris@chris-wilson.co.uk>
      
      v2: We need to make the trace call _before_ we drop our ref - the
      object might very well be gone by then already.
      
      v3: Just revert the original patch as suggested by Chris Wilson.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: Remove the added white line again to tighten the return
      block, requested by Chris.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d861e338
  2. 24 7月, 2013 1 次提交
  3. 19 7月, 2013 3 次提交
  4. 18 7月, 2013 4 次提交
    • B
      drm/i915: Create VMAs · 2f633156
      Ben Widawsky 提交于
      Formerly: "drm/i915: Create VMAs (part 1)"
      
      In a previous patch, the notion of a VM was introduced. A VMA describes
      an area of part of the VM address space. A VMA is similar to the concept
      in the linux mm. However, instead of representing regular memory, a VMA
      is backed by a GEM BO. There may be many VMAs for a given object, one
      for each VM the object is to be used in. This may occur through flink,
      dma-buf, or a number of other transient states.
      
      Currently the code depends on only 1 VMA per object, for the global GTT
      (and aliasing PPGTT). The following patches will address this and make
      the rest of the infrastructure more suited
      
      v2: s/i915_obj/i915_gem_obj (Chris)
      
      v3: Only move an object to the now global unbound list if there are no
      more VMAs for the object which are bound into a VM (ie. the list is
      empty).
      
      v4: killed obj->gtt_space
      some reworks due to rebase
      
      v5: Free vma on error path (Imre)
      
      v6: Another missed vma free in i915_gem_object_bind_to_gtt error path
      (Imre)
      Fixed vma freeing in stolen preallocation (Imre)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      [danvet: Squash in fixup from Ben to not deref a non-existing vma in
      set_cache_level, reported by Chris.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f633156
    • B
      drm/i915: Move active/inactive lists to new mm · 5cef07e1
      Ben Widawsky 提交于
      Shamelessly manipulated out of Daniel :-)
      "When moving the lists around explain that the active/inactive stuff is
      used by eviction when we run out of address space, so needs to be
      per-vma and per-address space. Bound/unbound otoh is used by the
      shrinker which only cares about the amount of memory used and not one
      bit about in which address space this memory is all used in. Of course
      to actual kick out an object we need to unbind it from every address
      space, but for that we have the per-object list of vmas."
      
      v2: Leave the bound list as a global one. (Chris, indirectly)
      
      v3: Rebased with no i915_gtt_vm. In most places I added a new *vm local,
      since it will eventually be replaces by a vm argument.
      Put comment back inline, since it no longer makes sense to do otherwise.
      
      v4: Rebased on hangcheck/error state movement
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5cef07e1
    • B
      drm/i915: Put the mm in the parent address space · 93bd8649
      Ben Widawsky 提交于
      Every address space should support object allocation. It therefore makes
      sense to have the allocator be part of the "superclass" which GGTT and
      PPGTT will derive.
      
      Since our maximum address space size is only 2GB we're not yet able to
      avoid doing allocation/eviction; but we'd hope one day this becomes
      almost irrelvant.
      
      v2: Rebased
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      93bd8649
    • B
      drm/i915: Move gtt and ppgtt under address space umbrella · 853ba5d2
      Ben Widawsky 提交于
      The GTT and PPGTT can be thought of more generally as GPU address
      spaces. Many of their actions (insert entries), state (LRU lists), and
      many of their characteristics (size) can be shared. Do that.
      
      The change itself doesn't actually impact most of the VMA/VM rework
      coming up, it just fits in with the grand scheme of abstracting the GPU
      VM operations. GGTT will usually be a special case where we either know
      an object must be in the GGTT (dislay engine, workarounds, etc.).
      
      The scratch page is left as part of the VM (even though it's currently
      shared with the ppgtt code) because in the future when we have Full
      PPGTT, I intend to create a separate scratch page for each.
      
      v2: Drop usage of i915_gtt_vm (Daniel)
      Make cleanup also part of the parent class (Ben)
      Modified commit msg
      Rebased
      
      v3: Properly share scratch page (Imre)
      Finish commit message (Daniel, Imre)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      853ba5d2
  5. 16 7月, 2013 3 次提交
  6. 10 7月, 2013 1 次提交
    • D
      drm/i915: don't frob mm.suspended when not using ums · db1b76ca
      Daniel Vetter 提交于
      In kernel modeset driver mode we're in full control of the chip,
      always. So there's no need at all to set mm.suspended in
      i915_gem_idle. Hence move that out into the leavevt ioctl. Since
      i915_gem_idle doesn't suspend gem any more we can also drop the
      re-enabling for KMS in the thaw function.
      
      Also clean up the handling of mm.suspend at driver load by coalescing
      all the assignments.
      
      Stumbled over while reading through our resume code for unrelated
      reasons.
      
      v2: Shovel mm.suspended into the (newly created) ums dungeon as
      suggested by Chris Wilson. The plan is that once we've completely
      stopped relying on the register save/restore code we could shovel even
      that in there.
      
      v3: Improve the locking for the entervt/leavevt ioctls a bit by moving
      the dev->struct_mutex locking outside of i915_gem_idle. Also don't
      clear dev_priv->ums.mm_suspended for the kms case, we allocate it with
      kzalloc. Both suggested by Chris Wilson.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v2)
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      db1b76ca
  7. 09 7月, 2013 3 次提交
    • B
      drm/i915: Embed drm_mm_node in i915 gem obj · c6cfb325
      Ben Widawsky 提交于
      Embedding the node in the obj is more natural in the transition to VMAs
      which will also have embedded nodes. This change also helps transition
      away from put_block to remove node.
      
      Though it's quite an uncommon occurrence, it's somewhat convenient to not
      fail at bind time because we cannot allocate the node. Though in
      practice there are other allocations (like the request structure) which
      would probably make this point not terribly useful.
      
      Quoting Daniel:
      Note that the only difference between put_block and remove_node is
      that the former fills up the preallocation cache. Which we don't need
      anyway and hence is just wasted space.
      
      v2: Clean up the stolen preallocation code.
      Rebased on the reserve_node patches
      renames ggtt_ stuff to gtt_ stuff
      WARN_ON if the object is already bound (which doesn't mean it's in the
      bound list, tricky)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c6cfb325
    • B
      drm/i915: Kill obj->gtt_offset · edd41a87
      Ben Widawsky 提交于
      With the getters in place from the previous patch this members serves no
      purpose other than saving one spare pointer chase, which will be killed
      in the next patch anyway.
      
      Moving to VMAs, this members adds unnecessary confusion since an object
      may exist at different offsets in different VMs.
      
      v2: Properly preserve the stolen offset. This code is a bit hacky but it
      all goes away when we embed the drm_mm_node and removes the need for the
      incorrect patch I submitted previously: "Use gtt_space->start for stolen
      reservation"
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      edd41a87
    • B
      drm/i915: Getter/setter for object attributes · f343c5f6
      Ben Widawsky 提交于
      Soon we want to gut a lot of our existing assumptions how many address
      spaces an object can live in, and in doing so, embed the drm_mm_node in
      the object (and later the VMA).
      
      It's possible in the future we'll want to add more getter/setter
      methods, but for now this is enough to enable the VMAs.
      
      v2: Reworked commit message (Ben)
      Added comments to the main functions (Ben)
      sed -i "s/i915_gem_obj_set_color/i915_gem_obj_ggtt_set_color/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_bound/i915_gem_obj_ggtt_bound/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_size/i915_gem_obj_ggtt_size/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_offset/i915_gem_obj_ggtt_offset/" drivers/gpu/drm/i915/*.[ch]
      (Daniel)
      
      v3: Rebased on new reserve_node patch
      Changed DRM_DEBUG_KMS to actually work (will need fixing later)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f343c5f6
  8. 01 7月, 2013 4 次提交
    • C
      drm/i915: Refactor the wait_rendering completion into a common routine · d26e3af8
      Chris Wilson 提交于
      Harmonise the completion logic between the non-blocking and normal
      wait_rendering paths, and move that logic into a common function.
      
      In the process, we note that the last_write_seqno is by definition the
      earlier of the two read/write seqnos and so all successful waits will
      have passed the last_write_seqno. Therefore we can unconditionally clear
      the write seqno and its domains in the completion logic.
      
      v2: Add the missing ring parameter, because sometimes it is good to have
      things compile.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d26e3af8
    • C
      drm/i915: Only clear write-domains after a successful wait-seqno · daa13e1c
      Chris Wilson 提交于
      In the introduction of the non-blocking wait, I cut'n'pasted the wait
      completion code from normal locked path. Unfortunately, this neglected
      that the normal path returned early if the wait returned early. The
      result is that read-only waits may return whilst the GPU is still
      writing to the bo.
      
      Fixes regression from
      commit 3236f57a [v3.7]
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Fri Aug 24 09:35:09 2012 +0100
      
          drm/i915: Use a non-blocking wait for set-to-domain ioctl
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66163
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      daa13e1c
    • J
      drm/i915: fix build warning on format specifier mismatch · 3765f304
      Jani Nikula 提交于
      drivers/gpu/drm/i915/i915_gem.c: In function ‘i915_gem_object_bind_to_gtt’:
      drivers/gpu/drm/i915/i915_gem.c:3002:3: warning: format ‘%ld’ expects
      argument of type ‘long int’, but argument 5 has type ‘size_t’ [-Wformat]
      
      v2: Use %zu instead of %d. Two char patch, and 100% wrong. (Ville)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3765f304
    • K
      drm/i915: make compact dma scatter lists creation work with SWIOTLB backend. · 1625e7e5
      Konrad Rzeszutek Wilk 提交于
      Git commit 90797e6d
      ("drm/i915: create compact dma scatter lists for gem objects") makes
      certain assumptions about the under laying DMA API that are not always
      correct.
      
      On a ThinkPad X230 with an Intel HD 4000 with Xen during the bootup
      I see:
      
      [drm:intel_pipe_set_base] *ERROR* pin & fence failed
      [drm:intel_crtc_set_config] *ERROR* failed to set mode on [CRTC:3], err = -28
      
      Bit of debugging traced it down to dma_map_sg failing (in
      i915_gem_gtt_prepare_object) as some of the SG entries were huge (3MB).
      
      That unfortunately are sizes that the SWIOTLB is incapable of handling -
      the maximum it can handle is a an entry of 512KB of virtual contiguous
      memory for its bounce buffer. (See IO_TLB_SEGSIZE).
      
      Previous to the above mention git commit the SG entries were of 4KB, and
      the code introduced by above git commit squashed the CPU contiguous PFNs
      in one big virtual address provided to DMA API.
      
      This patch is a simple semi-revert - were we emulate the old behavior
      if we detect that SWIOTLB is online. If it is not online then we continue
      on with the new compact scatter gather mechanism.
      
      An alternative solution would be for the the '.get_pages' and the
      i915_gem_gtt_prepare_object to retry with smaller max gap of the
      amount of PFNs that can be combined together - but with this issue
      discovered during rc7 that might be too risky.
      Reported-and-Tested-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      CC: Chris Wilson <chris@chris-wilson.co.uk>
      CC: Imre Deak <imre.deak@intel.com>
      CC: Daniel Vetter <daniel.vetter@ffwll.ch>
      CC: David Airlie <airlied@linux.ie>
      CC: <dri-devel@lists.freedesktop.org>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1625e7e5
  9. 13 6月, 2013 3 次提交
  10. 03 6月, 2013 4 次提交
  11. 01 6月, 2013 2 次提交
  12. 23 5月, 2013 2 次提交
  13. 22 5月, 2013 1 次提交
  14. 06 5月, 2013 1 次提交
  15. 30 4月, 2013 1 次提交
  16. 18 4月, 2013 4 次提交
  17. 09 4月, 2013 1 次提交
  18. 28 3月, 2013 1 次提交