1. 14 2月, 2014 3 次提交
  2. 13 2月, 2014 3 次提交
    • C
      drm/i915: Flush GPU rendering with a lockless wait during a pagefault · 6e4930f6
      Chris Wilson 提交于
      Arjan van de Ven reported that on his test machine that he was seeing
      stalls of greater than 1 frame greatly impacting the user experience. He
      tracked this down to being the locked flush during a pagefault as being
      the culprit hogging the struct_mutex and so blocking any other user from
      proceeding. Stalling on a pagefault is bad behaviour on userspace's
      part, for one it means that they are ignoring the coherency rules on
      pointer access through the GTT, but fortunately we can apply the same
      trick as the set-to-domain ioctl to do a lightweight, nonblocking flush
      of outstanding rendering first.
      
      "Prior to the patch it looks like this
      (this one testrun does not show the 20ms+ I've seen occasionally)
      
        4.99 ms     2.36 ms    31360  __wait_seqno i915_wait_seqno i915_gem_object_wait_rendering i915_gem_object_set_to_gtt_domain i915_gem_fault __do_fault handle_
      +pte_fault handle_mm_fault __do_page_fault do_page_fault page_fault
         4.99 ms     2.75 ms   107751  __wait_seqno i915_gem_wait_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         4.99 ms     1.63 ms     1666  i915_mutex_lock_interruptible i915_gem_fault __do_fault handle_pte_fault handle_mm_fault __do_page_fault do_page_fault page_fa
      +ult
         4.93 ms     2.45 ms      980  i915_mutex_lock_interruptible intel_crtc_page_flip drm_mode_page_flip_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_
      +sysret
         4.89 ms     2.20 ms     3283  i915_mutex_lock_interruptible i915_gem_wait_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         4.34 ms     1.66 ms     1715  i915_mutex_lock_interruptible i915_gem_pwrite_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         3.73 ms     3.73 ms       49  i915_mutex_lock_interruptible i915_gem_set_domain_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         3.17 ms     0.33 ms      931  i915_mutex_lock_interruptible i915_gem_madvise_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         2.97 ms     0.43 ms     1029  i915_mutex_lock_interruptible i915_gem_busy_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         2.55 ms     0.51 ms      735  i915_gem_get_tiling drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
      
      After the patch it looks like this:
      
         4.99 ms     2.14 ms    22212  __wait_seqno i915_gem_wait_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         4.86 ms     0.99 ms    14170  __wait_seqno i915_gem_object_wait_rendering__nonblocking i915_gem_fault __do_fault handle_pte_fault handle_mm_fault __do_page_
      +fault do_page_fault page_fault
         3.59 ms     1.31 ms      325  i915_gem_get_tiling drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         3.37 ms     3.37 ms       65  i915_mutex_lock_interruptible i915_gem_wait_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         2.58 ms     2.58 ms       65  i915_mutex_lock_interruptible i915_gem_do_execbuffer.isra.23 i915_gem_execbuffer2 drm_ioctl i915_compat_ioctl compat_sys_ioctl
      +ia32_sysret
         2.19 ms     2.19 ms       65  i915_mutex_lock_interruptible intel_crtc_page_flip drm_mode_page_flip_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_
      +sysret
         2.18 ms     2.18 ms       65  i915_mutex_lock_interruptible i915_gem_busy_ioctl drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
         1.66 ms     1.66 ms       65  i915_gem_set_tiling drm_ioctl i915_compat_ioctl compat_sys_ioctl ia32_sysret
      
      It may not look like it, but this is quite a large difference, and I've
      been unable to reproduce > 5 msec delays at all, while before they do
      happen (just not in the trace above)."
      
      gem_gtt_hog on an old Pineview (GMA3150),
      before: 4969.119ms
      after:  4122.749ms
      Reported-by: NArjan van de Ven <arjan.van.de.ven@intel.com>
      Testcase: igt/gem_gtt_hog
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6e4930f6
    • C
      drm/i915: Downgrade *ERROR* message for invalid user input · bd9b6a4e
      Chris Wilson 提交于
      When we detect that the user passed along an invalid handle or object,
      we emit a warning as an aide for debugging. Since these are indeed only
      for debugging user triggerable errors (and the errors are reported back
      to userspace by the errno), the messages should only be at the debug
      level and not claiming that there is a catastrophic error in the
      driver/hardware.
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=74704Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bd9b6a4e
    • D
      drm/i915: Always use INTEL_INFO() to access the device_info structure · 3d13ef2e
      Damien Lespiau 提交于
      If we make sure that all the dev_priv->info usages are wrapped by
      INTEL_INFO(), we can easily modify the ->info field to be structure and
      not a pointer while keeping the const protection in the INTEL_INFO()
      macro.
      
      v2: Rebased onto latest drm-nightly
      Suggested-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3d13ef2e
  3. 05 2月, 2014 2 次提交
  4. 04 2月, 2014 3 次提交
  5. 31 1月, 2014 2 次提交
  6. 28 1月, 2014 2 次提交
    • D
      drm/i915: GEN7_MSG_CONTROL is ivb-only · 6ba844b0
      Daniel Vetter 提交于
      At least I couldn't find it in the Haswell Bspec any more and we've
      tried to test-boot a Haswell machine with num_pipes forced to 0 (i.e.
      hit the PCH_NOP path) and the unclaimed register logic complained.
      
      So restrict this dance to just ivb platforms.
      
      v2: Art pointed out that the bits simply moved on hsw+
      
      v3: Buy code terseneness with a notch of sublety as suggested by
      Chris.
      
      v4: Frob the right bit, spotted by Art.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Arthur Ranyan <arthur.j.runyan@intel.com>
      Cc: Dave Airlie <airlied@gmail.com>
      Reviewed-by: NArt Runyan <arthur.j.runyan@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6ba844b0
    • J
      drm/i915: move module parameters into a struct, in a new file · d330a953
      Jani Nikula 提交于
      With 20+ module parameters, I think referring to them via a struct
      improves clarity over just having a bunch of globals. While at it, move
      the parameter initialization and definitions into a new file
      i915_params.c to reduce clutter in i915_drv.c.
      
      Apart from the ill-named i915_enable_rc6, i915_enable_fbc and
      i915_enable_ppgtt parameters, for which we lose the "i915_" prefix
      internally, the module parameters now look the same both on the kernel
      command line and in code. For example, "i915.modeset".
      
      The downsides of the change are losing static on a couple of variables
      and not having the initialization and module_param_named() right next to
      each other. On the other hand, all module parameters are now defined in
      one place at i915_params.c. Plus you can do this to find all module
      parameter references:
      
      $ git grep "i915\." -- drivers/gpu/drm/i915
      
      v2:
      - move the definitions into a new file
      - s/i915_params/i915/
      - make i915_try_reset i915.reset, for consistency
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d330a953
  7. 26 1月, 2014 1 次提交
  8. 22 1月, 2014 3 次提交
    • C
      drm/i915: Wait for completion of pending flips when starved of fences · 5dce5b93
      Chris Wilson 提交于
      On older generations (gen2, gen3) the GPU requires fences for many
      operations, such as blits. The display hardware also requires fences for
      scanouts and this leads to a situation where an arbitrary number of
      fences may be pinned by old scanouts following a pageflip but before we
      have executed the unpin workqueue. This is unpredictable by userspace
      and leads to random EDEADLK when submitting an otherwise benign
      execbuffer. However, we can detect when we have an outstanding flip and
      so cause userspace to wait upon their completion before finally
      declaring that the system is starved of fences. This is really no worse
      than forcing the GPU to stall waiting for older execbuffer to retire and
      release their fences before we can reallocate them for the next
      execbuffer.
      
      v2: move the test for a pending fb unpin to a common routine for
      later reuse during eviction
      
      Reported-and-tested-by: dimon@gmx.net
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73696Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJon Bloomfield <jon.bloomfield@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5dce5b93
    • B
      drm/i915/ppgtt: Defer request freeing on reset · 1d62beea
      Ben Widawsky 提交于
      We need to defer the free request until the object/vma is capable of
      being freed - or else we have a problem  when we try to destroy the
      context.
      
      The exact same issue is described and fixed here:
      commit e2078043
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:22 2013 -0800
      
          drm/i915: Defer request freeing
      
      I had this fix previously, but decided not to keep it for some reason I
      can no longer remember.
      
      gem_reset_stats is a really good test at hitting the problem.
      
      For the inquisitive:
      [  170.516392] ------------[ cut here ]------------
      [  170.517227] WARNING: CPU: 1 PID: 105 at drivers/gpu/drm/drm_mm.c:578 drm_mm_takedown+0x2e/0x30 [drm]()
      [  170.518064] Memory manager not clean during takedown.
      [  170.518941] CPU: 1 PID: 105 Comm: kworker/1:1 Not tainted 3.13.0-rc4-BEN+ #28
      [  170.519787] Hardware name: Hewlett-Packard HP EliteBook 8470p/179B, BIOS 68ICF Ver. F.02 04/27/2012
      [  170.520662] Call Trace:
      [  170.521517]  [<ffffffff814f0589>] dump_stack+0x4e/0x7a
      [  170.522373]  [<ffffffff81049e6d>] warn_slowpath_common+0x7d/0xa0
      [  170.523227]  [<ffffffff81049edc>] warn_slowpath_fmt+0x4c/0x50
      [  170.524079]  [<ffffffffa06c414e>] drm_mm_takedown+0x2e/0x30 [drm]
      [  170.524934]  [<ffffffffa07213f3>] gen6_ppgtt_cleanup+0x23/0x110
      [i915]
      [  170.525777]  [<ffffffffa07837ed>] ppgtt_release.part.5+0x24/0x29
      [i915]
      [  170.526603]  [<ffffffffa071aaa5>] i915_gem_context_free+0x195/0x1a0
      [i915]
      [  170.527423]  [<ffffffffa071189d>] i915_gem_free_request+0x9d/0xb0
      [i915]
      [  170.528247]  [<ffffffffa0718af9>] i915_gem_reset+0x1f9/0x3f0 [i915]
      [  170.529065]  [<ffffffffa0700cce>] i915_reset+0x4e/0x180 [i915]
      [  170.529870]  [<ffffffffa070829d>] i915_error_work_func+0xcd/0x120
      [i915]
      [  170.530666]  [<ffffffff8106c13a>] process_one_work+0x1fa/0x6d0
      [  170.531453]  [<ffffffff8106c0d8>] ? process_one_work+0x198/0x6d0
      [  170.532230]  [<ffffffff8106c72b>] worker_thread+0x11b/0x3a0
      [  170.532996]  [<ffffffff8106c610>] ? process_one_work+0x6d0/0x6d0
      [  170.533771]  [<ffffffff810743ef>] kthread+0xff/0x120
      [  170.534548]  [<ffffffff810742f0>] ? insert_kthread_work+0x80/0x80
      [  170.535322]  [<ffffffff814f97ac>] ret_from_fork+0x7c/0xb0
      [  170.536089]  [<ffffffff810742f0>] ? insert_kthread_work+0x80/0x80
      [  170.536847] ---[ end trace 3d4c12892e42d58f ]---
      
      v2: Whitespace fix. (Chris)
      
      Note: This is a bug that only hits the ppgtt topic branch but I've
      figured that doing the request cleanup in this order is generally the
      right thing to do.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      [danvet: Add a code comment to clarify what's actually going on since
      the lifetime rules aroung ppgtt cleanup are ... fuzzy a best atm. Also
      add a note about why we need this.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1d62beea
    • D
      drm/i915: Tune down reset_stat output from ERROR to debug · 86648500
      Daniel Vetter 提交于
      This is user-triggerable and hence we should not allow it to spam
      dmesg. Also, it upsets the nice dmesg tracking piglit does.
      
      Note that this is just extra debugging information, mostly
      unwanted, in case of a hang and that there is a separate message to the
      user giving instructions on how to report a bug for a GPU hang.
      
      v2: Add note as suggests in Chris' reply.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72740
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      86648500
  9. 10 1月, 2014 1 次提交
  10. 19 12月, 2013 1 次提交
    • D
      Revert "drm/i915: Do not allow buffers at offset 0" · bfca0527
      Daniel Vetter 提交于
      This reverts commit 4fe9adbc.
      
      The patch completely lacks a detailed explanation of what exactly
      blows up and how, so is insufficiently justified as a band-aid.
      
      Otoh the justification as a safety measure against userspace botching
      up relocations is also fairly weak: If we want real project we need to
      at least make the gab big enough that the gpu doesn't scribble over
      more important stuff. With 4k screens that would be 32MB.
      
      Also I think this would be much better in conjunction with a (debug)
      switch to disable our use of the scratch page.
      
      Hence revert this.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bfca0527
  11. 18 12月, 2013 17 次提交
    • D
      drm/i915: Reject the pin ioctl on gen6+ · 02f6bccc
      Daniel Vetter 提交于
      Especially with ppgtt this kinda stopped making sense. And if we
      indeed need this to hack around an issue, we need something that also
      works for non-root.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      02f6bccc
    • B
      drm/i915: Use multiple VMs -- the point of no return · 7e0d96bc
      Ben Widawsky 提交于
      As with processes which run on the CPU, the goal of multiple VMs is to
      provide process isolation. Specific to GEN, there is also the ability to
      map more objects per process (2GB each instead of 2Gb-2k total).
      
      For the most part, all the pipes have been laid, and all we need to do
      is remove asserts and actually start changing address spaces with the
      context switch. Since prior to this we've converted the setting of the
      page tables to a streamed version, this is quite easy.
      
      One important thing to point out (since it'd been hotly contested) is
      that with this patch, every context created will have it's own address
      space (provided the HW can do it).
      
      v2: Disable BDW on rebase
      
      NOTE: I tried to make this commit as small as possible. I needed one
      place where I could "turn everything on" and that is here. It could be
      split into finer commits, but I didn't really see much point.
      
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7e0d96bc
    • B
      drm/i915: Do not allow buffers at offset 0 · 4fe9adbc
      Ben Widawsky 提交于
      This is primarily a band aid for an unexplainable error in
      gem_reloc_vs_gpu/forked-faulting-reloc-thrashing. Essentially as soon as
      a relocated buffer (which had a non-zero presumed offset) moved to
      offset 0, something goes bad. Since I have been unable to solve this,
      and potentially this is a good thing to do anyway, since many things can
      accidentally write to offset 0, why not?
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4fe9adbc
    • B
      drm/i915: Defer request freeing · e2078043
      Ben Widawsky 提交于
      With context destruction, we always want to be able to tear down the
      underlying address space. This is invoked on the last unreference to the
      context which could happen before we've moved all objects to the
      inactive list. To enable a clean tear down the address space, make sure
      to process the request free lastly.
      
      Without this change, we cannot guarantee to we don't still have active
      objects in the VM.
      
      As an example of a failing case:
      CTX-A is created, count=1
      CTX-A is used during execbuf
      	does a context switch count = 2
      	and add_request count = 3
      CTX B runs, switches, CTX-A count = 2
      CTX-A is destroyed, count = 1
      retire requests is called
      	free_request from CTX-A, count = 0 <--- free context with active object
      
      As mentioned above, by doing the free request after processing the
      active list, we can avoid this case.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e2078043
    • B
      drm/i915: Get context early in execbuf · 41bde553
      Ben Widawsky 提交于
      We need to have the address space when reserving space for the objects.
      Since the address space and context are tied together, and reserve
      occurs before context switch (for good reason), we must lookup our
      context earlier in the process.
      
      This leaves some room for optimizations where we no longer need to use
      ctx_id in certain places. This will be addressed in a subsequent patch.
      
      Important tricky bit:
      Because slow relocations during execbuffer drop struct_mutex
      
      Perhaps it would be best to acquire the reference when we get the
      context, but I'll save that for another day (note I have written the
      patch before, and I found the changes required to be uglier than this).
      
      Note that since we currently access everything via context id, and not
      the data structure this is fine, though not desirable. The next change
      attempts to get the context only once via the context ID idr lookup, and
      as such, the following can happen:
      
      CTX-A is created, refcount = 1
      CTX-A execbuf, mutex dropped
      close IOCTL called on CTX-A, refcount = 0
      CTX-A resumes in execbuf.
      
      v2: Rebased on top of
      commit b6359918
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Wed Oct 30 15:44:16 2013 +0200
      
          drm/i915: add i915_get_reset_stats_ioctl
      
      v3: Rebased on top of
      commit 25b3dfc8
      Author: Mika Westerberg <mika.westerberg@linux.intel.com>
      Date:   Tue Nov 12 11:57:30 2013 +0200
      
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Tue Nov 26 16:14:33 2013 +0200
      
          drm/i915: check context reset stats before relocations
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      41bde553
    • B
      drm/i915: Piggy back hangstats off of contexts · c482972a
      Ben Widawsky 提交于
      To simplify the codepaths somewhat, we can simply always create a
      context. Contexts already keep hangstat information. This prevents us
      from having to differentiate at other parts in the code.
      
      There is allocation overhead, but it should not be measurable.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c482972a
    • B
      drm/i915: Do aliasing PPGTT init with contexts · bdf4fd7e
      Ben Widawsky 提交于
      We have a default context which suits the aliasing PPGTT well. Tie them
      together so it looks like any other context/PPGTT pair. This makes the
      code cleaner as it won't have to special case aliasing as often.
      
      The patch has one slightly tricky part in the default context creation
      function. In the future (and on aliased setup) we create a new VM for a
      context (potentially). However, if we have aliasing PPGTT, which occurs
      at this point in time for all platforms GEN6+, we can simply manage the
      refcounting to allow things to behave as normal. Now is a good time to
      recall that the aliasing_ppgtt doesn't have a real VM, it uses the GGTT
      drm_mm.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bdf4fd7e
    • B
      a3d67d23
    • B
      drm/i915: Split context enabling from init · 2fa48d8d
      Ben Widawsky 提交于
      We **need** to do this for exactly 1 reason, because we want to embed a
      PPGTT into the context, but we don't want to special case the default
      context.
      
      To achieve that, we must be able to initialize contexts after the GTT is
      setup (so we can allocate and pin the default context's BO), but before
      the PPGTT and rings are initialized. This is because, currently, context
      initialization requires ring usage. We don't have rings until after the
      GTT is setup. If we split the enabling part of context initialization,
      the part requiring the ringbuffer, we can untangle this, and then later
      embed the PPGTT
      
      Incidentally this allows us to also adhere to the original design of
      context init/fini in future patches: they were only ever meant to be
      called at driver load and unload.
      
      v2: Move hw_contexts_disabled test in i915_gem_context_enable() (Chris)
      
      v3: BUG_ON after checking for disabled contexts. Or else it blows up pre
      gen6 (Ben)
      
      v4: Forward port
      Modified enable for each ring, since that patch is earlier in the series
      Dropped ring arg from create_default_context so it can be used by others
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2fa48d8d
    • B
      drm/i915: Better reset handling for contexts · acce9ffa
      Ben Widawsky 提交于
      This patch adds to changes for contexts on reset:
      Sets last context to default - this will prevent the context switch
      happening after a reset. That switch is not possible because the
      rings are hung during reset and context switch requires reset. This
      behavior will need to be reworked in the future, but this is what we
      want for now.
      
      In the future, we'll also want to reset the guilty context to
      uninitialized. We should wait for ARB_Robustness related code to land
      for that.
      
      This is somewhat for paranoia.  Because we really don't know what the
      GPU was doing when it hung, or the state it was in (mid context write,
      for example), later restoring the context is a bad idea. By setting the
      flag to not initialized, the next load of that context will not restore
      the state, and thus on the subsequent switch away from the context will
      overwrite the old data.
      
      NOTE: This code needs a fixup when we actually have multiple VMs. The
      issue that can occur is inactive objects in a VM will need to be
      destroyed before the last context unref. This can now happen via the
      fake switch introduced in this patch (and it other ways in the future)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      acce9ffa
    • B
      drm/i915: Add a context open function · e422b888
      Ben Widawsky 提交于
      We'll be doing a bit more stuff with each file, so having our own open
      function should make things clean.
      
      This also allows us to easily add conditionals for stuff we don't want
      to do when we don't have HW contexts.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e422b888
    • B
      drm/i915: Create bind/unbind abstraction for VMAs · 6f65e29a
      Ben Widawsky 提交于
      To sum up what goes on here, we abstract the vma binding, similarly to
      the previous object binding. This helps for distinguishing legacy
      binding, versus modern binding. To keep the code churn as minimal as
      possible, I am leaving in insert_entries(). It serves as the per
      platform pte writing basically. bind_vma and insert_entries do share a
      lot of similarities, and I did have designs to combine the two, but as
      mentioned already... too much churn in an already massive patchset.
      
      What follows are the 3 commits which existed discretely in the original
      submissions. Upon rebasing on Broadwell support, it became clear that
      separation was not good, and only made for more error prone code. Below
      are the 3 commit messages with all their history.
      
      drm/i915: Add bind/unbind object functions to VMA
      drm/i915: Use the new vm [un]bind functions
      drm/i915: reduce vm->insert_entries() usage
      
      drm/i915: Add bind/unbind object functions to VMA
      
      As we plumb the code with more VM information, it has become more
      obvious that the easiest way to deal with bind and unbind is to simply
      put the function pointers in the vm, and let those choose the correct
      way to handle the page table updates. This change allows many places in
      the code to simply be vm->bind, and not have to worry about
      distinguishing PPGTT vs GGTT.
      
      Notice that this patch has no impact on functionality. I've decided to
      save the actual change until the next patch because I think it's easier
      to review that way. I'm happy to squash the two, or let Daniel do it on
      merge.
      
      v2:
      Make ggtt handle the quirky aliasing ppgtt
      Add flags to bind object to support above
      Don't ever call bind/unbind directly for PPGTT until we have real, full
      PPGTT (use NULLs to assert this)
      Make sure we rebind the ggtt if there already is a ggtt binding.  This
      happens on set cache levels.
      Use VMA for bind/unbind (Daniel, Ben)
      
      v3: Reorganize ggtt_vma_bind to be more concise and easier to read
      (Ville). Change logic in unbind to only unbind ggtt when there is a
      global mapping, and to remove a redundant check if the aliasing ppgtt
      exists.
      
      v4: Make the bind function a bit smarter about the cache levels to avoid
      unnecessary multiple remaps. "I accept it is a wart, I think unifying
      the pin_vma / bind_vma could be unified later" (Chris)
      Removed the git notes, and put version info here. (Daniel)
      
      v5: Update the comment to not suck (Chris)
      
      v6:
      Move bind/unbind to the VMA. It makes more sense in the VMA structure
      (always has, but I was previously lazy). With this change, it will allow
      us to keep a distinct insert_entries.
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      
      drm/i915: Use the new vm [un]bind functions
      
      Building on the last patch which created the new function pointers in
      the VM for bind/unbind, here we actually put those new function pointers
      to use.
      
      Split out as a separate patch to aid in review. I'm fine with squashing
      into the previous patch if people request it.
      
      v2: Updated to address the smart ggtt which can do aliasing as needed
      Make sure we bind to global gtt when mappable and fenceable. I thought
      we could get away without this initialy, but we cannot.
      
      v3: Make the global GTT binding explicitly use the ggtt VM for
      bind_vma(). While at it, use the new ggtt_vma helper (Chris)
      
      At this point the original mailing list thread diverges. ie.
      
      v4^:
      use target_obj instead of obj for gen6 relocate_entry
      vma->bind_vma() can be called safely during pin. So simply do that
      instead of the complicated conditionals.
      Don't restore PPGTT bound objects on resume path
      Bug fix in resume path for globally bound Bos
      Properly handle secure dispatch
      Rebased on vma bind/unbind conversion
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      
      drm/i915: reduce vm->insert_entries() usage
      
      FKA: drm/i915: eliminate vm->insert_entries()
      
      With bind/unbind function pointers in place, we no longer need
      insert_entries. We could, and want, to remove clear_range, however it's
      not totally easy at this point. Since it's used in a couple of place
      still that don't only deal in objects: setup, ppgtt init, and restore
      gtt mappings.
      
      v2: Don't actually remove insert_entries, just limit its usage. It will
      be useful when we introduce gen8. It will always be called from the vma
      bind/unbind.
      
      Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6f65e29a
    • B
      drm/i915: Make pin count per VMA · d7f46fc4
      Ben Widawsky 提交于
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d7f46fc4
    • B
      drm/i915: Handle inactivating objects for all VMAs · feb822cf
      Ben Widawsky 提交于
      This came from a patch called, "drm/i915: Move active to vma"
      
      When moving an object to the inactive list, we do it for all VMs for
      which the object is bound.
      
      The primary difference from that patch is this time around we don't not
      track 'active' per vma, but rather by object. Therefore, we only need
      one unref.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      feb822cf
    • B
      drm/i915: Takedown drm_mm on failed gtt setup · c39538a8
      Ben Widawsky 提交于
      This was found by code inspection. If the GTT setup fails then we are
      left without properly tearing down the drm_mm.
      
      Hopefully this never happens.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c39538a8
    • B
      drm/i915: Allow ggtt lookups to not WARN · 6e164c33
      Ben Widawsky 提交于
      To be able to effectively use the GGTT object lookup function, we don't
      want to warn when there is no GGTT mapping. Let the caller deal with it
      instead.
      
      Originally, I had intended to have this behavior, and has not
      introduced the WARN. It was introduced during review with the addition
      of the follow commit
      
      commit 5c2abbea
      Author: Ben Widawsky <benjamin.widawsky@intel.com>
      Date:   Tue Sep 24 09:57:57 2013 -0700
      
          drm/i915: Provide a cheap ggtt vma lookup
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6e164c33
    • B
      drm/i915: Don't unconditionally try to deref aliasing ppgtt · 6f425321
      Ben Widawsky 提交于
      Since the beginning, the functions which try to properly reference the
      aliasing PPGTT have deferences a potentially null aliasing_ppgtt member.
      Since the accessors are meant to be global, this will not do.
      
      Introduced originally in:
      commit a70a3148
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Wed Jul 31 16:59:56 2013 -0700
      
          drm/i915: Make proper functions for VMs
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6f425321
  12. 14 12月, 2013 1 次提交
  13. 13 12月, 2013 1 次提交