1. 20 4月, 2015 4 次提交
  2. 10 4月, 2015 14 次提交
  3. 09 4月, 2015 2 次提交
  4. 27 3月, 2015 6 次提交
    • J
      drm/i915: Compare GGTT view structs instead of types · 9abc4648
      Joonas Lahtinen 提交于
      To allow for views where the view type is not defined by the view type only,
      like it is in stereo or rotated 90 degree view, change the semantic to require
      the whole view structure for comparison when we match a GGTT view.
      
      This allows including parameters like offset to be included in the view which
      is useful for eg. partial views.
      
      v3:
      - Rely on ggtt_view type being 0 for non-GGTT vma's, which equals to
        I915_GGTT_VIEW_NORMAL. (Daniel Vetter)
      - Do not use potentially slower comparison when we only want to know if
        something is or is not a normal view.
      - Rebase on top of rotated view patches. Add rotated view singleton.
      - If one view is missing in comparison they're equal only if both are missing.
      
      v4:
      - Use comparison helper in obj_to_ggtt_view too. (Tvrtko Ursulin)
      - Do WARN_ON if one view is NULL. (Tvrtko Ursulin)
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9abc4648
    • K
      drm/i915: fix simple_return.cocci warnings · 2f2cf682
      kbuild test robot 提交于
      drivers/gpu/drm/i915/i915_gem_gtt.c:1349:1-4: WARNING: end returns can be simpified and declaration on line 1347 can be dropped
      
       Simplify a trivial if-return sequence.  Possibly combine with a
       preceding function call.
      Generated by: scripts/coccinelle/misc/simple_return.cocci
      
      CC: Michel Thierry <michel.thierry@intel.com>
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f2cf682
    • M
      drm/i915: Add dynamic page trace events · 72744cb1
      Michel Thierry 提交于
      Traces for page directories and tables allocation and map.
      
      v2: Removed references to teardown.
      v3: bitmap_scnprintf has been deprecated.
      v4: Replace bitmap_scnprintf with scnprintf correctly, and get right
      range lengths. (Mika)
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      72744cb1
    • M
      drm/i915: Finish gen6/7 dynamic page table allocation · 4933d519
      Michel Thierry 提交于
      This patch continues on the idea from "Track GEN6 page table usage".
      From here on, in the steady state, PDEs are all pointing to the scratch
      page table (as recommended in the spec). When an object is allocated in
      the VA range, the code will determine if we need to allocate a page for
      the page table. Similarly when the object is destroyed, we will remove,
      and free the page table pointing the PDE back to the scratch page.
      
      Following patches will work to unify the code a bit as we bring in GEN8
      support. GEN6 and GEN8 are different enough that I had a hard time to
      get to this point with as much common code as I do.
      
      The aliasing PPGTT must pre-allocate all of the page tables. There are a
      few reasons for this. Two trivial ones: aliasing ppgtt goes through the
      ggtt paths, so it's hard to maintain, we currently do not restore the
      default context (assuming the previous force reload is indeed
      necessary). Most importantly though, the only way (it seems from
      empirical evidence) to invalidate the CS TLBs on non-render ring is to
      either use ring sync (which requires actually stopping the rings in
      order to synchronize when the sync completes vs. where you are in
      execution), or to reload DCLV.  Since without full PPGTT we do not ever
      reload the DCLV register, there is no good way to achieve this. The
      simplest solution is just to not support dynamic page table
      creation/destruction in the aliasing PPGTT.
      
      We could always reload DCLV, but this seems like quite a bit of excess
      overhead only to save at most 2MB-4k of memory for the aliasing PPGTT
      page tables.
      
      v2: Make the page table bitmap declared inside the function (Chris)
      Simplify the way scratching address space works.
      Move the alloc/teardown tracepoints up a level in the call stack so that
      both all implementations get the trace.
      
      v3: Updated trace event to spit out a name
      
      v4: Aliasing ppgtt is now initialized differently (in setup global gtt)
      
      v5: Rebase to latest code. Also removed unnecessary aliasing ppgtt check
      for trace, as it is no longer possible after the PPGTT cleanup patch series
      of a couple of months ago (Daniel).
      
      v6: Implement changes from code review (Daniel):
       - allocate/teardown_va_range calls added.
       - Add a scratch page allocation helper (only need the address).
       - Move trace events to a new patch.
       - Use updated mark_tlbs_dirty.
       - Moved pt preallocation for aliasing ppgtt into gen6_ppgtt_init.
      
      v7: teardown_va_range removed (Daniel).
          In init, gen6_ppgtt_clear_range call is only needed for aliasing ppgtt.
      
      v8: Rebase after s/page_tables/page_table/.
      
      v9: Remove unnecessary scratch flag in page_table struct, future patches
      can just compare against ppgtt->scratch_pt, and alloc_pt_scratch becomes
      redundant. Initialize scratch_pt and pt. (Mika)
      
      v10: Clean up aliasing ppgtt init error path and prevent leaking the
      ppgtt obj when init fails. (Mika)
      Updated commit author. (Daniel)
      
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v4+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4933d519
    • M
      drm/i915: Remove unnecessary gen6_ppgtt_unmap_pages · 59568eb5
      Michel Thierry 提交于
      We are already unmapping them in gen6_ppgtt_free. This function became
      redundant since commit 06fda602
      ("drm/i915: Create page table allocators").
      
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      59568eb5
    • M
      drm/i915: Fix i915_dma_map_single positive error code · 1266cdb1
      Michel Thierry 提交于
      i915_dma_map_single relies on dma_mapping_error, which returns positive
      error codes. Found by static checker.
      
      Introduced by commit 678d96fb
      ("drm/i915: Track GEN6 page table usage").
      
      v2: Return negative error code and renamed commit title. (Dan)
      v3: Missing reported-by tag (Daniel)
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1266cdb1
  5. 26 3月, 2015 1 次提交
  6. 23 3月, 2015 1 次提交
    • T
      drm/i915/skl: Support secondary (rotated) frame buffer mapping · 50470bb0
      Tvrtko Ursulin 提交于
      90/270 rotated scanout needs a rotated GTT view of the framebuffer.
      
      This is put in a separate VMA with a dedicated ggtt view and wired such that
      it is created when a framebuffer is pinned to a 90/270 rotated plane.
      
      Rotation is only possible with Yb/Yf buffers and error is propagated to
      user space in case of a mismatch.
      
      Special rotated page view is constructed at the VMA creation time by
      borrowing the DMA addresses from obj->pages.
      
      v2:
          * Do not bother with pages for rotated sg list, just populate the DMA
            addresses. (Daniel Vetter)
          * Checkpatch cleanup.
      
      v3:
          * Rebased on top of new plane handling (create rotated mapping when
            setting the rotation property).
          * Unpin rotated VMA on unpinning from display plane.
          * Simplify rotation check using bitwise AND. (Chris Wilson)
      
      v4:
          * Fix unpinning of optional rotated mapping so it is really considered
            to be optional.
      
      v5:
         * Rebased for fb modifier changes.
         * Rebased for atomic commit.
         * Only pin needed view for display. (Ville Syrjälä, Daniel Vetter)
      
      v6:
         * Rebased after preparatory work has been extracted out. (Daniel Vetter)
      
      v7:
         * Slightly simplified tiling geometry calculation.
         * Moved rotated GGTT view implementation into i915_gem_gtt.c (Daniel Vetter)
      
      v8:
         * Do not use i915_gem_obj_size to get object size since that actually
           returns the size of an VMA which may not exist.
         * Rebased for ggtt view changes.
      
      v9:
         * Rebased after code review changes on the preceding patches.
         * Tidy function definitions. (Joonas Lahtinen)
      
      For: VIZ-4726
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: Michel Thierry <michel.thierry@intel.com> (v4)
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      50470bb0
  7. 20 3月, 2015 6 次提交
    • 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: Track GEN6 page table usage · 678d96fb
      Ben Widawsky 提交于
      Instead of implementing the full tracking + dynamic allocation, this
      patch does a bit less than half of the work, by tracking and warning on
      unexpected conditions. The tracking itself follows which PTEs within a
      page table are currently being used for objects. The next patch will
      modify this to actually allocate the page tables only when necessary.
      
      With the current patch there isn't much in the way of making a gen
      agnostic range allocation function. However, in the next patch we'll add
      more specificity which makes having separate functions a bit easier to
      manage.
      
      One important change introduced here is that DMA mappings are
      created/destroyed at the same page directories/tables are
      allocated/deallocated.
      
      Notice that aliasing PPGTT is not managed here. The patch which actually
      begins dynamic allocation/teardown explains the reasoning for this.
      
      v2: s/pdp.page_directory/pdp.page_directories
      Make a scratch page allocation helper
      
      v3: Rebase and expand commit message.
      
      v4: Allocate required pagetables only when it is needed, _bind_to_vm
      instead of bind_vma (Daniel).
      
      v5: Rebased to remove the unnecessary noise in the diff, also:
       - PDE mask is GEN agnostic, renamed GEN6_PDE_MASK to I915_PDE_MASK.
       - Removed unnecessary checks in gen6_alloc_va_range.
       - Changed map/unmap_px_single macros to use dma functions directly and
         be part of a static inline function instead.
       - Moved drm_device plumbing through page tables operation to its own
         patch.
       - Moved allocate/teardown_va_range calls until they are fully
         implemented (in subsequent patch).
       - Merged pt and scratch_pt unmap_and_free path.
       - Moved scratch page allocator helper to the patch that will use it.
      
      v6: Reduce complexity by not tearing down pagetables dynamically, the
      same can be achieved while freeing empty vms. (Daniel)
      
      v7: s/i915_dma_map_px_single/i915_dma_map_single
      s/gen6_write_pdes/gen6_write_pde
      Prevent a NULL case when only GGTT is available. (Mika)
      
      v8: Rebased after s/page_tables/page_table/.
      
      v9: Reworked i915_pte_index and i915_pte_count.
      Also exercise bitmap allocation here (gen6_alloc_va_range) and fix
      incorrect write_page_range in i915_gem_restore_gtt_mappings (Mika).
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      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> (v3+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      678d96fb
    • M
      drm/i915: page table generalizations · 07749ef3
      Michel Thierry 提交于
      No functional changes, but will improve code clarity and removed some
      duplicated defines.
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      07749ef3
    • D
      drm/i915: kerneldoc for i915_gem_shrinker.c · eb0b44ad
      Daniel Vetter 提交于
      And remove one bogus * from i915_gem_gtt.c since that's not a
      kerneldoc there.
      
      v2: Review from Chris:
      - Clarify memory space to better distinguish from address space.
      - Add note that shrink doesn't guarantee the freed memory and that
        users must fall back to shrink_all.
      - Explain how pinning ties in with eviction/shrinker.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      eb0b44ad
    • D
      drm/i915: memory leak in __i915_gem_vma_create() · dabde5c7
      Dan Carpenter 提交于
      In the original code then if WARN_ON(i915_is_ggtt(vm) != !!ggtt_view)
      was true then we leak "vma".  Presumably that doesn't happen often but
      static checkers complain and this bug is easy to fix.
      
      Fixes: c3bbb6f2825d ('drm/i915: Do not use ggtt_view with (aliasing) PPGTT')
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      dabde5c7
    • J
      drm/i915: Do not use ggtt_view with (aliasing) PPGTT · ec7adb6e
      Joonas Lahtinen 提交于
      GGTT views are only applicable when dealing with GGTT. Change the code to
      reject ggtt_view where it should not be used and require it when it should
      be.
      
      v2:
      - Dropped _ppgtt_ infixes, allow both types to be passed
      - Disregard other but normal views when no view is specified
      - More checks that valid parameters are passed
      - More readable error checking
      
      v3:
      - Prefer WARN_ONCE over BUG_ON when there is code path for failure
      Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      [danvet: Drop unecessary forward decl from earlier patch iterations.]
      [danvet: Remove unused variable spotted by Tvrtko.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ec7adb6e
  8. 18 3月, 2015 1 次提交
    • M
      drm/i915: Setup all page directories for gen8 · 2934368e
      Mika Kuoppala 提交于
      If the requested size is less than what the full range
      of pdps can address, we end up setting pdps for only the
      requested area.
      
      The logical context however needs all pdp entries to be valid.
      Prior to commit 06fda602 ("drm/i915: Create page table allocators")
      we have been writing pdp entries with dma address of zero instead
      of valid pdps. This is supposedly bad even if those pdps are not
      addressed.
      
      As commit 06fda602 ("drm/i915: Create page table allocators")
      introduced more dynamic structure for pdps, we ended up oopsing
      when we populated the lrc context. Analyzing this oops revealed
      the fact that we have not been writing valid pdps with bsw, as
      it is doing the ppgtt init with 2GB limit in some cases.
      
      We should do the right thing and setup the non addressable part
      pdps/pde/pte to scratch page through the minimal structure by
      having just pdp with pde entries pointing to same page with
      pte entries pointing to scratch page.
      
      But instead of going through that trouble, setup all the pdps
      through individual pd pages and pt entries, even for non
      addressable parts. And let the clear range point them to scratch
      page. This way we populate the lrc with valid pdps and wait
      for dynamic page allocation work to land, and do the heavy lifting
      for truncating page table tree according to usage.
      
      The regression of oopsing in init was introduced by
      commit 06fda602 ("drm/i915: Create page table allocators")
      
      v2: Clear the range for the unused part also (Ville)
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89350
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Tested-by: NValtteri Rantala <valtteri.rantala@intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2934368e
  9. 05 3月, 2015 1 次提交
  10. 27 2月, 2015 1 次提交
  11. 26 2月, 2015 1 次提交
  12. 25 2月, 2015 2 次提交
    • M
      drm/i915: Plumb drm_device through page tables operations · 06dc68d6
      Michel Thierry 提交于
      The next patch in the series will require it for alloc_pt_single.
      
      v2: Rebased after s/page_tables/page_table/.
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      06dc68d6
    • B
      drm/i915: Create page table allocators · 06fda602
      Ben Widawsky 提交于
      As we move toward dynamic page table allocation, it becomes much easier
      to manage our data structures if break do things less coarsely by
      breaking up all of our actions into individual tasks.  This makes the
      code easier to write, read, and verify.
      
      Aside from the dissection of the allocation functions, the patch
      statically allocates the page table structures without a page directory.
      This remains the same for all platforms,
      
      The patch itself should not have much functional difference. The primary
      noticeable difference is the fact that page tables are no longer
      allocated, but rather statically declared as part of the page directory.
      This has non-zero overhead, but things gain additional complexity as a
      result.
      
      This patch exists for a few reasons:
      1. Splitting out the functions allows easily combining GEN6 and GEN8
      code. Page tables have no difference based on GEN8. As we'll see in a
      future patch when we add the DMA mappings to the allocations, it
      requires only one small change to make work, and error handling should
      just fall into place.
      
      2. Unless we always want to allocate all page tables under a given PDE,
      we'll have to eventually break this up into an array of pointers (or
      pointer to pointer).
      
      3. Having the discrete functions is easier to review, and understand.
      All allocations and frees now take place in just a couple of locations.
      Reviewing, and catching leaks should be easy.
      
      4. Less important: the GFP flags are confined to one location, which
      makes playing around with such things trivial.
      
      v2: Updated commit message to explain why this patch exists
      
      v3: For lrc, s/pdp.page_directory[i].daddr/pdp.page_directory[i]->daddr/
      
      v4: Renamed free_pt/pd_single functions to unmap_and_free_pt/pd (Daniel)
      
      v5: Added additional safety checks in gen8 clear/free/unmap.
      
      v6: Use WARN_ON and return -EINVAL in alloc_pt_range (Mika).
      
      v7: Make err_out loop symmetrical to the way we allocate in
      alloc_pt_range. Also s/page_tables/page_table and correct commit
      message (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> (v3+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      06fda602