1. 23 6月, 2015 3 次提交
  2. 29 5月, 2015 1 次提交
  3. 21 5月, 2015 1 次提交
    • C
      drm/i915: Implement inter-engine read-read optimisations · b4716185
      Chris Wilson 提交于
      Currently, we only track the last request globally across all engines.
      This prevents us from issuing concurrent read requests on e.g. the RCS
      and BCS engines (or more likely the render and media engines). Without
      semaphores, we incur costly stalls as we synchronise between rings -
      greatly impacting the current performance of Broadwell versus Haswell in
      certain workloads (like video decode). With the introduction of
      reference counted requests, it is much easier to track the last request
      per ring, as well as the last global write request so that we can
      optimise inter-engine read read requests (as well as better optimise
      certain CPU waits).
      
      v2: Fix inverted readonly condition for nonblocking waits.
      v3: Handle non-continguous engine array after waits
      v4: Rebase, tidy, rewrite ring list debugging
      v5: Use obj->active as a bitfield, it looks cool
      v6: Micro-optimise, mostly involving moving code around
      v7: Fix retire-requests-upto for execlists (and multiple rq->ringbuf)
      v8: Rebase
      v9: Refactor i915_gem_object_sync() to allow the compiler to better
      optimise it.
      
      Benchmark: igt/gem_read_read_speed
      hsw:gt3e (with semaphores):
      Before: Time to read-read 1024k:		275.794µs
      After:  Time to read-read 1024k:		123.260µs
      
      hsw:gt3e (w/o semaphores):
      Before: Time to read-read 1024k:		230.433µs
      After:  Time to read-read 1024k:		124.593µs
      
      bdw-u (w/o semaphores):             Before          After
      Time to read-read 1x1:            26.274µs       10.350µs
      Time to read-read 128x128:        40.097µs       21.366µs
      Time to read-read 256x256:        77.087µs       42.608µs
      Time to read-read 512x512:       281.999µs      181.155µs
      Time to read-read 1024x1024:    1196.141µs     1118.223µs
      Time to read-read 2048x2048:    5639.072µs     5225.837µs
      Time to read-read 4096x4096:   22401.662µs    21137.067µs
      Time to read-read 8192x8192:   89617.735µs    85637.681µs
      
      Testcase: igt/gem_concurrent_blit (read-read and friends)
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> [v8]
      [danvet: s/\<rq\>/req/g]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b4716185
  4. 24 4月, 2015 2 次提交
  5. 21 4月, 2015 1 次提交
  6. 10 4月, 2015 1 次提交
  7. 20 3月, 2015 3 次提交
    • B
      drm/i915: Initialize all contexts · 6702cf16
      Ben Widawsky 提交于
      The problem is we're going to switch to a new context, which could be
      the default context. The plan was to use restore inhibit, which would be
      fine, except if we are using dynamic page tables (which we will). If we
      use dynamic page tables and we don't load new page tables, the previous
      page tables might go away, and future operations will fault.
      
      CTXA runs.
      switch to default, restore inhibit
      CTXA dies and has its address space taken away.
      Run CTXB, tries to save using the context A's address space - this
      fails.
      
      The general solution is to make sure every context has it's own state,
      and its own address space. For cases when we must restore inhibit, first
      thing we do is load a valid address space. I thought this would be
      enough, but apparently there are references within the context itself
      which will refer to the old address space - therefore, we also must
      reinitialize.
      
      v2: to->ppgtt is only valid in full ppgtt.
      v3: Rebased.
      v4: Make post PDP update clearer.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6702cf16
    • B
      drm/i915: Track page table reload need · 563222a7
      Ben Widawsky 提交于
      This patch was formerly known as, "Force pd restore when PDEs change,
      gen6-7." I had to change the name because it is needed for GEN8 too.
      
      The real issue this is trying to solve is when a new object is mapped
      into the current address space. The GPU does not snoop the new mapping
      so we must do the gen specific action to reload the page tables.
      
      GEN8 and GEN7 do differ in the way they load page tables for the RCS.
      GEN8 does so with the context restore, while GEN7 requires the proper
      load commands in the command streamer. Non-render is similar for both.
      
      Caveat for GEN7
      The docs say you cannot change the PDEs of a currently running context.
      We never map new PDEs of a running context, and expect them to be
      present - so I think this is okay. (We can unmap, but this should also
      be okay since we only unmap unreferenced objects that the GPU shouldn't
      be tryingto va->pa xlate.) The MI_SET_CONTEXT command does have a flag
      to signal that even if the context is the same, force a reload. It's
      unclear exactly what this does, but I have a hunch it's the right thing
      to do.
      
      The logic assumes that we always emit a context switch after mapping new
      PDEs, and before we submit a batch. This is the case today, and has been
      the case since the inception of hardware contexts. A note in the comment
      let's the user know.
      
      It's not just for gen8. If the current context has mappings change, we
      need a context reload to switch
      
      v2: Rebased after ppgtt clean up patches. Split the warning for aliasing
      and true ppgtt options. And do not break aliasing ppgtt, where to->ppgtt
      is always null.
      
      v3: Invalidate PPGTT TLBs inside alloc_va_range.
      
      v4: Rename ppgtt_invalidate_tlbs to mark_tlbs_dirty and move
      pd_dirty_rings from i915_address_space to i915_hw_ppgtt. Fixes when
      neither ctx->ppgtt and aliasing_ppgtt exist.
      
      v5: Removed references to teardown_va_range.
      
      v6: Updated needs_pd_load_pre/post.
      
      v7: Fix pd_dirty_rings check in needs_pd_load_post, and update/move
      comment about updated PDEs to object_pin/bind (Mika).
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      563222a7
    • B
      drm/i915: Extract context switch skip and add pd load logic · 317b4e90
      Ben Widawsky 提交于
      In Gen8, PDPs are saved and restored with legacy contexts (legacy contexts
      only exist on the render ring). So change the ordering of LRI vs MI_SET_CONTEXT
      for the initialization of the context. Also the only cases in which we
      need to manually update the PDPs are when MI_RESTORE_INHIBIT has been
      set in MI_SET_CONTEXT (i.e. when the context is not yet initialized or
      it is the default context).
      
      Legacy submission is not available post GEN8, so it isn't necessary to
      add extra checks for newer generations.
      
      v2: Use new functions to replace the logic right away (Daniel)
      v3: Add missing pd load logic.
      v4: Add warning in case pd_load_pre & pd_load_post are true, and add
      missing trace_switch_mm. Cleaned up pd_load conditions. Add more
      information about when is pd_load_post needed. (Mika)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      317b4e90
  8. 24 2月, 2015 1 次提交
  9. 08 1月, 2015 1 次提交
  10. 07 1月, 2015 1 次提交
  11. 16 12月, 2014 1 次提交
    • C
      drm/i915: Disable PSMI sleep messages on all rings around context switches · 2c550183
      Chris Wilson 提交于
      There exists a current workaround to prevent a hang on context switch
      should the ring go to sleep in the middle of the restore,
      WaProgramMiArbOnOffAroundMiSetContext (applicable to all gen7+). In
      spite of disabling arbitration (which prevents the ring from powering
      down during the critical section) we were still hitting hangs that had
      the hallmarks of the known erratum. That is we are still seeing hangs
      "on the last instruction in the context restore". By comparing -nightly
      (broken) with requests (working), we were able to deduce that it was the
      semaphore LRI cross-talk that reproduced the original failure. The key
      was that requests implemented deferred semaphore signalling, and
      disabling that, i.e. emitting the semaphore signal to every other ring
      after every batch restored the frequent hang.  Explicitly disabling PSMI
      sleep on the RCS ring was insufficient, all the rings had to be awake to
      prevent the hangs. Fortunately, we can reduce the wakelock to the
      MI_SET_CONTEXT operation itself, and so should be able to limit the extra
      power implications.
      
      Since the MI_ARB_ON_OFF workaround is listed for all gen7 and above
      products, we should apply this extra hammer for all of the same
      platforms despite so far that we have only been able to reproduce the
      hang on certain ivb and hsw models. The last question is whether we want
      to always use the extra hammer or only when we know semaphores are in
      operation. At the moment, we only use LRI on non-RCS rings for
      semaphores, but that may change in the future with the possibility of
      reintroducing this bug under subtle conditions.
      
      v2: Make it explicit that the PSMI LRI are an extension to the original
      workaround for the other rings.
      v3: Bikeshedding variable names and whitespacing
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80660
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83677
      Cc: Simon Farnsworth <simon@farnz.org.uk>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Tested-by: NPeter Frühberger <fritsch@xbmc.org>
      Reviewed-by: NDaniel Vetter <daniel@ffwll.ch>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      2c550183
  12. 15 12月, 2014 1 次提交
    • T
      drm/i915: Infrastructure for supporting different GGTT views per object · fe14d5f4
      Tvrtko Ursulin 提交于
      Things like reliable GGTT mappings and mirrored 2d-on-3d display will need
      to map objects into the same address space multiple times.
      
      Added a GGTT view concept and linked it with the VMA to distinguish between
      multiple instances per address space.
      
      New objects and GEM functions which do not take this new view as a parameter
      assume the default of zero (I915_GGTT_VIEW_NORMAL) which preserves the
      previous behaviour.
      
      This now means that objects can have multiple VMA entries so the code which
      assumed there will only be one also had to be modified.
      
      Alternative GGTT views are supposed to borrow DMA addresses from obj->pages
      which is DMA mapped on first VMA instantiation and unmapped on the last one
      going away.
      
      v2:
          * Removed per view special casing in i915_gem_ggtt_prepare /
            finish_object in favour of creating and destroying DMA mappings
            on first VMA instantiation and last VMA destruction. (Daniel Vetter)
          * Simplified i915_vma_unbind which does not need to count the GGTT views.
            (Daniel Vetter)
          * Also moved obj->map_and_fenceable reset under the same check.
          * Checkpatch cleanups.
      
      v3:
          * Only retire objects once the last VMA is unbound.
      
      v4:
          * Keep scatter-gather table for alternative views persistent for the
            lifetime of the VMA.
          * Propagate binding errors to callers and handle appropriately.
      
      v5:
          * Explicitly look for normal GGTT view in i915_gem_obj_bound to align
            usage in i915_gem_object_ggtt_unpin. (Michel Thierry)
          * Change to single if statement in i915_gem_obj_to_ggtt. (Michel Thierry)
          * Removed stray semi-colon in i915_gem_object_set_cache_level.
      
      For: VIZ-4544
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      [danvet: Drop hunk from i915_gem_shrink since it's just prettification
      but upsets a __must_check warning.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fe14d5f4
  13. 08 12月, 2014 1 次提交
  14. 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
  15. 14 11月, 2014 2 次提交
  16. 04 11月, 2014 1 次提交
  17. 03 9月, 2014 4 次提交
  18. 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
  19. 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
  20. 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
  21. 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
  22. 08 7月, 2014 1 次提交
    • 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