1. 08 12月, 2014 1 次提交
  2. 03 12月, 2014 2 次提交
    • T
      drm/i915: Fix startup failure in LRC mode after recent init changes · e7778be1
      Thomas Daniel 提交于
      A previous commit introduced engine init changes:
      
          commit 372ee59699d9 ("drm/i915: Only init engines once")
      
      This broke execlists as intel_lr_context_render_state_init was trying to emit
      commands to the RCS for the default context before the ring->init_hw was called.
      
      Made a new gen8_init_rcs_context function and assign in to render ring
      init_context.  Moved call to intel_logical_ring_workarounds_emit into
      gen8_init_rcs_context to maintain previous functionality.
      
      Moved call to render_state_init from lr_context_deferred_create into
      gen8_init_rcs_context, and modified deferred_create to call ring->init_context
      for non-default contexts.
      
      Modified i915_gem_context_enable to call ring->init_context for the default
      context.
      
      So init_context will now always be called when the hw is ready - in
      i915_gem_context_enable for the default context and in lr_context_deferred_create
      for other contexts.
      Signed-off-by: NThomas Daniel <thomas.daniel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e7778be1
    • J
      drm/i915: Remove the now redundant 'obj->ring' · 41c52415
      John Harrison 提交于
      The ring member of the object structure was always updated with the
      last_read_seqno member. Thus with the conversion to last_read_req, obj->ring is
      now a direct copy of obj->last_read_req->ring. This makes it somewhat redundant
      and potentially misleading (especially as there was no comment to explain its
      purpose).
      
      This checkin removes the redundant field. Many uses were simply testing for
      non-null to see if the object is active on the GPU. Some of these have been
      converted to check 'obj->active' instead. Others (where the last_read_req is
      about to be used anyway) have been changed to check obj->last_read_req. The rest
      simply pull the ring out from the request structure and proceed as before.
      
      For: VIZ-4377
      Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
      Reviewed-by: NThomas Daniel <Thomas.Daniel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      41c52415
  3. 14 11月, 2014 2 次提交
  4. 04 11月, 2014 1 次提交
  5. 03 9月, 2014 4 次提交
  6. 13 8月, 2014 5 次提交
    • D
      drm/i915: Drop create_vm argument to i915_gem_create_context · d624d86e
      Daniel Vetter 提交于
      Now that all the flow is streamlined the rule is simple: We create
      a new ppgtt for a new context when we have full ppgtt enabled.
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d624d86e
    • D
      drm/i915: Only track real ppgtt for a context · ae6c4806
      Daniel Vetter 提交于
      There's a bit a confusion since we track the global gtt,
      the aliasing and real ppgtt in the ctx->vm pointer. And not
      all callers really bother to check for the different cases and just
      presume that it points to a real ppgtt.
      
      Now looking closely we don't actually need ->vm to always point at an
      address space - the only place that cares actually has fixup code
      already to decide whether to look at the per-proces or the global
      address space.
      
      So switch to just tracking the ppgtt directly and ditch all the
      extraneous code.
      
      v2: Fixup the ppgtt debugfs file to not oops on a NULL ctx->ppgtt.
      Also drop the early exit - without aliasing ppgtt we want to dump all
      the ppgtts of the contexts if we have full ppgtt.
      
      v3: Actually git add the compile fix.
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Cc: "Thierry, Michel" <michel.thierry@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      OTC-Jira: VIZ-3724
      [danvet: Resolve conflicts with execlist patches while applying.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ae6c4806
    • D
      drm/i915: Initialize the aliasing ppgtt as part of global gtt · fa76da34
      Daniel Vetter 提交于
      Stuffing this into the context setup code doesn't make a lot of sense.
      Also reusing the real ppgtt setup code makes even less sense since the
      aliasing ppgtt isn't a real address space. Leaving all that stuff
      unitialized will make sure that we catch any abusers promptly.
      
      This is also a prep work to clean up the context->ppgtt link.
      
      v2: Fix up the logic fail, I've fumbled it so badly to completely
      disable ppgtt on gen6. Spotted by Ville and Michel. Also move around
      the pde write into the gen6 init function, since otherwise it won't
      work at all.
      
      v3: Only initialize the aliasing ppgtt when we actually enable it.
      
      Cc: "Thierry, Michel" <michel.thierry@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      [danvet: Squash in fixup from Fengguang Wu.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fa76da34
    • D
      drm/i915: Rework ppgtt init to no require an aliasing ppgtt · 82460d97
      Daniel Vetter 提交于
      Currently we abuse the aliasing ppgtt to set up the ppgtt support in
      general. Which is a bit backwards since with full ppgtt we don't ever
      need the aliasing ppgtt.
      
      So untangle this and separate the ppgtt init from the aliasing
      ppgtt. While at it drag it out of the context enabling (which just
      does a switch to the default context).
      
      Note that we still have the differentiation between synchronous and
      asynchronous ppgtt setup, but that will soon vanish. So also correctly
      wire up the return value handling to be prepared for when ->switch_mm
      drops the synchronous parameter and could start to fail.
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      82460d97
    • D
      drm/i915: Track file_priv, not ctx in the ppgtt structure · 4d884705
      Daniel Vetter 提交于
      Hardware contexts reference a ppgtt, not the other way round. And the
      only user of this (in debugfs) actually only cares about which file
      the ppgtt is associated with. So give it what it wants.
      
      While at it give the ppgtt create function a proper name&place.
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4d884705
  7. 12 8月, 2014 2 次提交
    • D
      drm/i915: Some cleanups for the ppgtt lifetime handling · ee960be7
      Daniel Vetter 提交于
      So when reviewing Michel's patch I've noticed a few things and cleaned
      them up:
      - The early checks in ppgtt_release are now redundant: The inactive
        list should always be empty now, so we can ditch these checks. Even
        for the aliasing ppgtt (though that's a different confusion) since
        we tear that down after all the objects are gone.
      - The ppgtt handling functions are splattered all over. Consolidate
        them in i915_gem_gtt.c, give them OCD prefixes and add wrappers for
        get/put.
      - There was a bit a confusion in ppgtt_release about whether it cares
        about the active or inactive list. It should care about them both,
        so augment the WARNINGs to check for both.
      
      There's still create_vm_for_ctx left to do, put that is blocked on the
      removal of ppgtt->ctx. Once that's done we can rename it to
      i915_ppgtt_create and move it to its siblings for handling ppgtts.
      
      v2: Move the ppgtt checks into the inline get/put functions as
      suggested by Chris.
      
      v3: Inline the now redundant ppgtt local variable.
      
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ee960be7
    • M
      drm/i915: vma/ppgtt lifetime rules · b9d06dd9
      Michel Thierry 提交于
      VMAs should take a reference of the address space they use.
      
      Now, when the fd is closed, it will release the ref that the context was
      holding, but it will still be referenced by any vmas that are still
      active.
      
      ppgtt_release() should then only be called when the last thing referencing
      it releases the ref, and it can just call the base cleanup and free the
      ppgtt.
      
      Note that with this we will extend the lifetime of ppgtts which
      contain shared objects. But all the non-shared objects will get
      removed as soon as they drop of the active list and for the shared
      ones the shrinker can eventually reap them. Since we currently can't
      evict ppgtt pagetables either I don't think that temporary leak is
      important.
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      [danvet: Add note about potential ppgtt leak with this approach.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b9d06dd9
  8. 11 8月, 2014 4 次提交
    • O
      drm/i915/bdw: Generic logical ring init and cleanup · 48d82387
      Oscar Mateo 提交于
      Allocate and populate the default LRC for every ring, call
      gen-specific init/cleanup, init/fini the command parser and
      set the status page (now inside the LRC object). These are
      things all engines/rings have in common.
      
      Stopping the ring before cleanup and initializing the seqnos
      is left as a TODO task (we need more infrastructure in place
      before we can achieve this).
      
      v2: Check the ringbuffer backing obj for ring_is_initialized,
      instead of the context backing obj (similar, but not exactly
      the same).
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      48d82387
    • O
      drm/i915/bdw: Deferred creation of user-created LRCs · ec3e9963
      Oscar Mateo 提交于
      The backing objects and ringbuffers for contexts created via open
      fd are actually empty until the user starts sending execbuffers to
      them. At that point, we allocate & populate them. We do this because,
      at create time, we really don't know which engine is going to be used
      with the context later on (and we don't want to waste memory on
      objects that we might never use).
      
      v2: As contexts created via ioctl can only be used with the render
      ring, we have enough information to allocate & populate them right
      away.
      
      v3: Defer the creation always, even with ioctl-created contexts, as
      requested by Daniel Vetter.
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ec3e9963
    • O
      drm/i915/bdw: A bit more advanced LR context alloc/free · 8c857917
      Oscar Mateo 提交于
      Now that we have the ability to allocate our own context backing objects
      and we have multiplexed one of them per engine inside the context structs,
      we can finally allocate and free them correctly.
      
      Regarding the context size, reading the register to calculate the sizes
      can work, I think, however the docs are very clear about the actual
      context sizes on GEN8, so just hardcode that and use it.
      
      v2: Rebased on top of the Full PPGTT series. It is important to notice
      that at this point we have one global default context per engine, all
      of them using the aliasing PPGTT (as opposed to the single global
      default context we have with legacy HW contexts).
      
      v3:
      - Go back to one single global default context, this time with multiple
        backing objects inside.
      - Use different context sizes for non-render engines, as suggested by
        Damien (still hardcoded, since the information about the context size
        registers in the BSpec is, well, *lacking*).
      - Render ctx size is 20 (or 19) pages, but not 21 (caught by Damien).
      - Move default context backing object creation to intel_init_ring (so
        that we don't waste memory in rings that might not get initialized).
      
      v4:
      - Reuse the HW legacy context init/fini.
      - Create a separate free function.
      - Rename the functions with an intel_ preffix.
      
      v5: Several rebases to account for the changes in the previous patches.
      
      Signed-off-by: Ben Widawsky <ben@bwidawsk.net> (v1)
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8c857917
    • 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
  9. 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
  10. 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
  11. 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
  12. 24 6月, 2014 1 次提交
  13. 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
  14. 23 5月, 2014 3 次提交
  15. 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
  16. 20 5月, 2014 1 次提交
  17. 17 5月, 2014 1 次提交
  18. 15 5月, 2014 1 次提交
  19. 11 4月, 2014 1 次提交
  20. 09 4月, 2014 1 次提交
  21. 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
  22. 02 4月, 2014 1 次提交
  23. 20 3月, 2014 1 次提交