1. 11 8月, 2014 1 次提交
    • O
      drm/i915/bdw: Initialization for Logical Ring Contexts · ede7d42b
      Oscar Mateo 提交于
      For the moment this is just a placeholder, but it shows one of the
      main differences between the good ol' HW contexts and the shiny
      new Logical Ring Contexts: LR contexts allocate  and free their
      own backing objects. Another difference is that the allocation is
      deferred (as the create function name suggests), but that does not
      happen in this patch yet, because for the moment we are only dealing
      with the default context.
      
      Early in the series we had our own gen8_gem_context_init/fini
      functions, but the truth is they now look almost the same as the
      legacy hw context init/fini functions. We can always split them
      later if this ceases to be the case.
      
      Also, we do not fall back to legacy ringbuffers when logical ring
      context initialization fails (not very likely to happen and, even
      if it does, hw contexts would probably fail as well).
      
      v2: Daniel says "explain, do not showcase".
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      [danvet: s/BUG_ON/WARN_ON/.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ede7d42b
  2. 23 7月, 2014 1 次提交
    • B
      drm/i915: Reorder ctx unref on ppgtt cleanup · 2f295791
      Ben Widawsky 提交于
      The comment [which was mine] is wrong. The context object can never be
      bound in a PPGTT because it is only capable of living in the Global GTT.
      So, remove the comment, and reorder the unref. What's nice about the
      latter is it keeps the context object alive past the PPGTT. This makes
      the destroy ordering symmetric with the creation ordering.
      
      Create:
      1. Create context
      2. Create PPGTT
      
      Destroy:
      1. Destroy PPGTT
      2. Destroy context
      
      As far as I know, this does not fix a bug. The code previously kept the
      context data structure, only the object was gone. As the code was,
      nothing tried to use the object after this point.
      
      NOTE: If in the future we have cases where the PPGTT can/should outlive
      the context (which doesn't occur today, but the code permits it), this
      ordering does not matter. Even if this occurs, as it stands now, we do
      not expect that to be the normal case, and having this order makes
      debugging a bit easier if we're tracking object lifetimes for the
      context vs ppgtt
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      [danvet: Resolve conflict with Oscar's execlist prep patches.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f295791
  3. 08 7月, 2014 3 次提交
    • O
      drm/i915: Emphasize that ctx->id is merely a user handle · 821d66dd
      Oscar Mateo 提交于
      This is an Execlists preparatory patch, since they make context ID become an
      overloaded term:
      
      - In the software, it was used to distinguish which context userspace was
        trying to use.
      - In the BSpec, the term is used to describe the 20-bits long field the
        hardware uses to it to discriminate the contexts that are submitted to
        the ELSP and inform the driver about their current status (via Context
        Switch Interrupts and Context Status Buffers).
      
      Initially, I tried to make the different meanings converge, but it proved
      impossible:
      
      - The software ctx->id is per-filp, while the hardware one needs to be
        globally unique.
      - Also, we multiplex several backing states objects per intel_context,
        and all of them need unique HW IDs.
      - I tried adding a per-filp ID and then composing the HW context ID as:
        ctx->id + file_priv->id + ring->id, but the fact that the hardware only
        uses 20-bits means we have to artificially limit the number of filps or
        contexts the userspace can create.
      
      The ctx->user_handle renaming bits are done with this Cocci patch (plus
      manual frobbing of the struct declaration):
      
          @@
          struct intel_context c;
          @@
          - (c).id
          + c.user_handle
      
          @@
          struct intel_context *c;
          @@
          - (c)->id
          + c->user_handle
      
      Also, while we are at it, s/DEFAULT_CONTEXT_ID/DEFAULT_CONTEXT_HANDLE and
      change the type to unsigned 32 bits.
      
      v2: s/handle/user_handle and change the type to uint32_t as suggested by
      Chris Wilson.
      
      Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> (v1)
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      821d66dd
    • O
      drm/i915: Emphasize that ctx->obj & ctx->is_initialized refer to the legacy rcs ctx · ea0c76f8
      Oscar Mateo 提交于
      We have already advanced that Logical Ring Contexts have their own kind
      of backing objects, but everything will be better explained in the Execlists
      series. For now, suffice it to say that the current backing object is only
      ever used with the render ring, so we're making this fact more explicit
      (which is a good reason on its own).
      
      As for the is_initialized flag, we only use to signify that the render state
      has been initialized (a.k.a. golden context, a.k.a. null context). It doesn't
      mean anything for the other engines, so make that distinction obvious.
      
      Done with the following Coccinelle patch (plus manual frobbing of the struct):
      
          @@
          struct intel_context c;
          @@
          - (c).obj
          + c.legacy_hw_ctx.rcs_state
      
          @@
          struct intel_context *c;
          @@
          - (c)->obj
          + c->legacy_hw_ctx.rcs_state
      
          @@
          struct intel_context c;
          @@
          - (c).is_initialized
          + c.legacy_hw_ctx.initialized
      
          @@
          struct intel_context *c;
          @@
          - (c)->is_initialized
          + c->legacy_hw_ctx.initialized
      
      This Execlists prep-work patch has been suggested by Chris Wilson and Daniel
      Vetter separately.
      
      Initially, it was two separate patches:
      drm/i915: Rename ctx->obj to ctx->rcs_state
      drm/i915: Make it obvious that ctx->id is merely a user handle
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: s/id/is_initialized/ to fix the subject and resolve a
      conflict in i915_gem_context_reset. Also introduce a new lctx local
      variable to avoid overtly long lines.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ea0c76f8
    • O
      drm/i915: Extract context backing object allocation · aa0c13da
      Oscar Mateo 提交于
      This is preparatory work for Execlists: we plan to use it later to
      allocate our own context objects (since Logical Ring Contexts do
      not have the same kind of backing objects).
      
      No functional changes.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      aa0c13da
  4. 07 7月, 2014 1 次提交
    • V
      drm/i915: Unpin last_context at reset · 4bfad3dd
      Ville Syrjälä 提交于
      We're forgetting to unpin the last_context from the ggtt at GPU reset
      time. This leads to the vma pin_count leaking at every reset if the
      last context wasn't the ring default context. Further use of the same
      context will trigger the pin_count check in i915_gem_object_pin() and
      userspace will be faced with EBUSY as a result.
      
      This plaques kms_flip rather badly since it performs lots of resets,
      and every fd has its own default context these days.
      
      Fix the problem by properly unpinning the last context at reset.
      
      This regression seems to back to
      
      commit acce9ffa
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:03 2013 -0800
      
         drm/i915: Better reset handling for contexts
      
      Testcase: igt/gem_ctx_exec/reset-pin-leak
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4bfad3dd
  5. 24 6月, 2014 1 次提交
  6. 19 6月, 2014 1 次提交
    • O
      drm/i915: Remove ctx->last_ring · 14d8ec54
      Oscar Mateo 提交于
      The original comment that introduced it said:
      
      commit 0009e46c
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:02 2013 -0800
      
          drm/i915: Track which ring a context ran on
      
          Previously we dropped the association of a context to a ring. It is
          however very important to know which ring a context ran on (we could
          have reused the other member, but I was nitpicky).
      
          This is very important when we switch address spaces, which unlike
          context objects, do change per ring.
      
          As an example, if we have:
      
                  RCS   BCS
          ctx            A
          ctx      A
          ctx      B
          ctx            B
      
          Without tracking the last ring B ran on, we wouldn't know to switch the
          address space on BCS in the last row.
      
      But this is not really true, because we are already checking to != from (with
      "from" being = ring->last_context) and that should be enough to make sure we
      switch to the right address space.
      
      We would have a problem if we switched the context object for every ring (since
      then we would fail to do it in some situations) but we only switch it for the
      render ring, so we don't care.
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      14d8ec54
  7. 23 5月, 2014 3 次提交
  8. 22 5月, 2014 1 次提交
    • M
      drm/i915: Add null state batch to active list · 46470fc9
      Mika Kuoppala 提交于
      for proper refcounting to take place as we use
      i915_add_request() for it.
      
      i915_add_request() also takes the context for the request
      from ring->last_context so move the null state batch
      submission after the ring context has been set.
      
      v2: we need to check for correct ring now (Ville Syrjälä)
      v3: no need to expose i915_gem_move_object_to_active (Chris Wilson)
      v4: cargoculted vma/active/inactive error handling removed (Chris Wilson)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Damien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      46470fc9
  9. 20 5月, 2014 1 次提交
  10. 17 5月, 2014 1 次提交
  11. 15 5月, 2014 1 次提交
  12. 11 4月, 2014 1 次提交
  13. 09 4月, 2014 1 次提交
  14. 03 4月, 2014 1 次提交
    • B
      drm/i915: Invariably invalidate before ctx switch · 057f6a8a
      Ben Widawsky 提交于
      We have been setting the bit which was originally BIOS dependent since:
      commit f05bb0c7
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Sun Jan 20 16:33:32 2013 +0000
      
          drm/i915: GFX_MODE Flush TLB Invalidate Mode must be '1' for scanline waits
      
      Therefore, we do not need to try to figure it out dynamically and we can
      just always invalidate the TLBs.
      
      It's a partial revert of:
      commit 12b0286f
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Mon Jun 4 14:42:50 2012 -0700
      
          drm/i915: possibly invalidate TLB before context switch
      
      The original commit attempted to only invalidate when necessary
      (very much a relic from the old days). Now, we can just always invalidate.
      
      I guess the old TODO still exists. Since we seem to have abandoned ILK
      contexts however, there isn't much point in even remembering.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      057f6a8a
  15. 02 4月, 2014 1 次提交
  16. 20 3月, 2014 1 次提交
  17. 18 3月, 2014 1 次提交
    • M
      drm/i915: Switch to fake context on older gens · a95f6a00
      Mika Kuoppala 提交于
      We used to have per file descriptor hang stats for the
      i915_get_reset_stats_ioctl() and for default context banning.
      
      commit 0eea67eb
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:19 2013 -0800
      
          drm/i915: Create a per file_priv default context
      
      made having separate hangstats in file_private redundant
      as i915_hw_context already contained hangstats. So
      
      commit c482972a
      Author: Ben Widawsky <benjamin.widawsky@intel.com>
      Date:   Fri Dec 6 14:11:20 2013 -0800
      
          drm/i915: Piggy back hangstats off of contexts
      
      consolidated the hangstats and enabled further improvements.
      
      commit 44e2c070
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Thu Jan 30 16:01:15 2014 +0200
      
          drm/i915: Use i915_hw_context to set reset stats
      
      tried to reap full benefits of consolidation but fell short
      as we never 'switch' to the fake private context on gens
      that don't have hw_contexts, so request->ctx remained NULL
      on those.
      
      Fix this by 'switching' to fake context so that when
      request is submitted to ring, proper context gets assigned
      to it.
      
      Testcase: igt/drv_hangman
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76055Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a95f6a00
  18. 06 3月, 2014 1 次提交
  19. 04 3月, 2014 3 次提交
  20. 14 2月, 2014 1 次提交
    • D
      drm/i915: Consolidate binding parameters into flags · 1ec9e26d
      Daniel Vetter 提交于
      Anything more than just one bool parameter is just a pain to read,
      symbolic constants are much better.
      
      Split out from Chris' vma-binding rework patch.
      
      v2: Undo the behaviour change in object_pin that Chris spotted.
      
      v3: Split out misplaced hunk to handle set_cache_level errors,
      spotted by Jani.
      
      v4: Keep the current over-zealous binding logic in the execbuffer code
      working with a quick hack while the overall binding code gets shuffled
      around.
      
      v5: Reorder the PIN_ flags for more natural patch splitup.
      
      v6: Pull out the PIN_GLOBAL split-up again.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1ec9e26d
  21. 04 2月, 2014 1 次提交
  22. 31 1月, 2014 1 次提交
  23. 28 1月, 2014 3 次提交
    • B
      drm/i915: Create a USES_PPGTT macro · c5dc5cec
      Ben Widawsky 提交于
      There are cases where we want to know if there is a full, or aliased
      PPGTT. Currently, in fact the only distinction we ever need to make is
      when we're using full PPGTT.
      
      This patch is simply to promote readability and clarify for the
      confusing existing usage where "aliasing" meant aliasing and full.
      
      v2: Remove USES_ALIASING_PPGTT since there are currently no cases where
      we need to check if we're using aliasing, but not full PPGTT. (Daniel)
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c5dc5cec
    • V
      drm/i915: We implement WaMiSetContext_Hang · 2b7e8082
      Ville Syrjälä 提交于
      WaMiSetContext_Hang tells us that a MI_NOOP must follow MI_SET_CONTEXT.
      
      The other thing WaMiSetContext_Hang seems to say is that URB_FENCE isn't
      allowed to straddle two cachelines. But we don't issue those from the
      kernel so we don't care.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2b7e8082
    • C
      drm/i915: Always pin the default context · 42c3b603
      Chris Wilson 提交于
      Through a twisty and circuituous path it is possible to currently trick
      the code into creating a default context and forgetting to pin it
      immediately into the GGTT. (This requires a system using contexts without
      an aliasing ppgtt, which is currently restricted to Baytrails machines
      manually specifying a module parameter to force enable contexts, or
      on Sandybridge and later that manually disable the aliasing ppgtt.) The
      consequence is that during module unload we attempt to unpin the default
      context twice and encounter a BUG remonstrating that we attempt to unpin
      an unbound object.
      
      [  161.002869] Kernel BUG at f84861f8 [verbose debug info unavailable]
      [  161.002875] invalid opcode: 0000 [#1] SMP
      [  161.002882] Modules linked in: coretemp kvm_intel kvm crc32_pclmul aesni_intel aes_i586 xts lrw gf128mul ablk_helper cryptd hid_sensor_accel_3d hid_sensor_gyro_3d hid_sensor_magn_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf industrialio hid_sensor_iio_common snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_seq_midi snd_seq_midi_event dm_multipath scsi_dh asix ppdev usbnet snd_rawmidi mii hid_sensor_hub microcode snd_seq rfcomm bnep snd_seq_device bluetooth snd_timer snd parport_pc binfmt_misc soundcore dw_dmac_pci dw_dmac_core mac_hid lp parport dm_mirror dm_region_hash dm_log hid_generic usbhid hid i915(O-) drm_kms_helper(O) igb dca ptp pps_core i2c_algo_bit drm(O) ahci libahci video
      [  161.002991] CPU: 0 PID: 2114 Comm: rmmod Tainted: G        W  O 3.13.0-rc8+ #2
      [  161.002997] Hardware name: NEXCOM VTC1010/Aptio CRB, BIOS 5.6.5 09/24/2013
      [  161.003004] task: dbdd6800 ti: dbe0e000 task.ti: dbe0e000
      [  161.003010] EIP: 0060:[<f84861f8>] EFLAGS: 00010246 CPU: 0
      [  161.003044] EIP is at i915_gem_object_ggtt_unpin+0x88/0x90 [i915]
      [  161.003050] EAX: dfce3840 EBX: 00000000 ECX: dfafd690 EDX: dfce3874
      [  161.003056] ESI: c0086b40 EDI: df962e00 EBP: dbe0fe1c ESP: dbe0fe0c
      [  161.003062]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      [  161.003068] CR0: 8005003b CR2: b7718000 CR3: 1bec0000 CR4: 001007f0
      [  161.003076] Stack:
      [  161.003081]  00afc014 00000004 c0086b40 dfafc000 dbe0fe38 f8487e5a dfaa5400 c0086b40
      [  161.003099]  dfafc000 dfaa5400 dfaa5414 dbe0fe58 f84741aa 00000000 f89c34b9 dfaa5414
      [  161.003117]  dfaa5400 dfaa5400 f644b000 dbe0fe6c f89a5443 dfaa5400 f8505000 f644b000
      [  161.003134] Call Trace:
      [  161.003169]  [<f8487e5a>] i915_gem_context_fini+0xba/0x1c0 [i915]
      [  161.003202]  [<f84741aa>] i915_driver_unload+0x1fa/0x2f0 [i915]
      [  161.003232]  [<f89a5443>] drm_dev_unregister+0x23/0x90 [drm]
      [  161.003259]  [<f89a54ed>] drm_put_dev+0x3d/0x70 [drm]
      [  161.003294]  [<f8470615>] i915_pci_remove+0x15/0x20 [i915]
      [  161.003306]  [<c1338a6f>] pci_device_remove+0x2f/0xa0
      [  161.003317]  [<c140c871>] __device_release_driver+0x61/0xc0
      [  161.003328]  [<c140d12f>] driver_detach+0x8f/0xa0
      [  161.003341]  [<c140c54f>] bus_remove_driver+0x4f/0xc0
      [  161.003353]  [<c140d708>] driver_unregister+0x28/0x60
      [  161.003362]  [<c10cee42>] ? stop_cpus+0x32/0x40
      [  161.003372]  [<c10bd510>] ? module_refcount+0x90/0x90
      [  161.003383]  [<c13378c5>] pci_unregister_driver+0x15/0x60
      [  161.003413]  [<f89a739f>] drm_pci_exit+0x9f/0xb0 [drm]
      [  161.003458]  [<f84e624a>] i915_exit+0x1b/0x1d [i915]
      [  161.003468]  [<c10bf8a8>] SyS_delete_module+0x158/0x1f0
      [  161.003480]  [<c1173d5d>] ? ____fput+0xd/0x10
      [  161.003488]  [<c106f0fe>] ? task_work_run+0x7e/0xb0
      [  161.003499]  [<c165a68d>] sysenter_do_call+0x12/0x28
      [  161.003505] Code: 0f b6 4d f3 8d 51 0f 83 e1 f0 83 e2 0f 09 d1 84 d2 88 48 54 75 07 80 a7 91 00 00 00 7f 83 c4 04 5b 5e 5f 5d c3 8d b6 00 00 00 00 <0f> 0b 8d b6 00 00 00 00 55 89 e5 57 56 53 83 ec 64 3e 8d 74 26
      [  161.003586] EIP: [<f84861f8>] i915_gem_object_ggtt_unpin+0x88/0x90 [i915] SS:ESP 0068:dbe0fe0c
      
      v2: Rename the local variable (is_default_ctx) to avoid confusion with
      the function is_default_ctx(). And correct Jesse's email address.
      Reported-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73985Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Tested-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: NBen Widawsky <benjamin.widawsky@intel.com>
      [danvet: Fix up the rebase fail from my first attempt, thankfully
      pointed out by Ville.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      42c3b603
  24. 10 1月, 2014 2 次提交
    • B
      drm/i915: set ctx->initialized only after RCS · ad1d2199
      Ben Widawsky 提交于
      The initialized flag is used to specify a context has been initialized
      and it's context is safe to load, ie. the 3d state is setup properly.
      With full PPGTT, we emit the address space loads during context switch
      and this currently marks a context as initialized. With full PPGTT
      patches, if a client first emits a batch to !RCS, then later, RCS, the
      code will mistake the context as initialized and try to reload an
      uninitialized context.
      
      1. context 1 blit // context marked as initialized, but isn't
      2. context 1 render // loads random state from step 2
      
      It is really easy to hit this with a planned upcoming patch which makes
      default context reuse possible.
      
      NOTE: This should only effect full PPGTT branches, ie. current
      drm-intel-nightly.
      
      Thanks to Chris for helping me track this down.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: Simplify the failure scenario in the commit message according
      to Chris' review a bit.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ad1d2199
    • B
      drm/i915/bdw: Return -ENONENT on default ctx destroy · c2cf2416
      Ben Widawsky 提交于
      This was an accidental "ABI" change introduced during PPGTT:
      
      commit 0eea67eb
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:19 2013 -0800
      
          drm/i915: Create a per file_priv default context
      
      The failure test application actually tests the return type. The other
      option is to simply change the test.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c2cf2416
  25. 07 1月, 2014 1 次提交
  26. 18 12月, 2013 6 次提交
    • 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: 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: Create a per file_priv default context · 0eea67eb
      Ben Widawsky 提交于
      Every file will get it's own context, and we use this context instead of
      the default context. The default context still exists for future
      shrinker usage as well as reset handling.
      
      v2: Updated to address Mika's recent context guilty changes
      Some more changes around this come up in later patches as well.
      
      v3: Use a fake context to avoid allocation for the !HAS_HW_CONTEXT case.
      I've tried the alternatives. This looks the best to me.
      Removed hangstat stuff from v2 - for a separate patch
      Demote failed PPGTT set to DRM_DEBUG_DRIVER since it can now be invoked
      easily from userspace.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0eea67eb
    • 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
      drm/i915: Add VM to context · c7c48dfd
      Ben Widawsky 提交于
      Pretty straightforward so far except for the bit about the refcounting.
      The PPGTT will potentially be shared amongst multiple contexts. Because
      contexts themselves have a refcounted lifecycle, the easiest way to
      manage this will be to refcount the PPGTT. To acheive this, we piggy
      back off of the existing context refcount, and will increment and
      decrement the PPGTT refcount with context creation, and destruction.
      
      To put it more clearly, if context A, and context B both use PPGTT 0, we
      can't free the PPGTT until both A, and B are destroyed.
      
      Note that because the PPGTT is permanently pinned (for now), it really
      just matters for the PPGTT destruction, as opposed to making space under
      memory pressure.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c7c48dfd