1. 18 Aug, 2013 8 commits
  2. 08 Aug, 2013 1 commit
  3. 07 Aug, 2013 10 commits
  4. 06 Aug, 2013 1 commit
  5. 04 Aug, 2013 1 commit
  6. 01 Aug, 2013 1 commit
    • David Herrmann's avatar
      drm/mm: include required headers in drm_mm.h · 86e81f0e
      David Herrmann authored
      We need BUG_ON(), spinlock_t and standard kernel data-types so include the
      right headers.
      
      Subject: [drm-intel:drm-intel-nightly 154/166] include/drm/drm_mm.h:67:2:
       error: unknown type name 'spinlock_t'
      Message-ID: <51f14693.g5HGdcuw2v3m8FOd%fengguang.wu@intel.com>
      
      In case it didn't link to it correctly. Somehow this bug doesn't occur
      here on my machine, hmm. But I think fixing drm_mm.h is better than
      changing the include-order in drm_vma_manager.h, so this is what I
      did.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      86e81f0e
  7. 26 Jul, 2013 5 commits
  8. 25 Jul, 2013 12 commits
    • Imre Deak's avatar
      drm/i915: dvo_ch7xxx: fix vsync polarity setting · 3b27af35
      Imre Deak authored
      This fixes a typo which set the wrong vsync and possibly also hsync
      polarity for any modes with positive vsync polarity.
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      3b27af35
    • Daniel Vetter's avatar
      drm/i915: fix the racy object accounting · c20e8355
      Daniel Vetter authored
      Just use a spinlock to protect them.
      
      v2: Rebase onto the new object create refcount fix patch.
      
      v3: Don't kill dev_priv->mm.object_memory as requested by Chris and
      hence just use a spinlock instead of atomic_t.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67287Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      c20e8355
    • Chris Wilson's avatar
      drm/i915: Convert the register access tracepoint to be conditional · ed71f1b4
      Chris Wilson authored
      The TRACE_EVENT_CONDITION is supposed to generate more efficient code
      than if (cond) trace(), which is what we are currently using inside the
      register access functions.
      
      v2: Rebase onto uncore
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      ed71f1b4
    • Chris Wilson's avatar
      drm/i915: Squash gen lookup through multiple indirections inside GT access · a7f31ee0
      Chris Wilson authored
      The INTEL_INFO() macro extracts the dev_private pointer from the device,
      so passing in the dev_private->dev is a long winded circumlocution.
      
      v2: rebase onto uncore
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      a7f31ee0
    • Chris Wilson's avatar
      drm/i915: Use the common register access functions for NOTRACE variants · dba8e41f
      Chris Wilson authored
      Detangle the confusion that NOTRACE variants of the register read/write
      routines were directly using the raw register access. We need for those
      routines to reuse the common code for serializing register access and
      ensuring the correct register power states. This is only possible now
      that the only routines that required raw access use their own API.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      dba8e41f
    • Chris Wilson's avatar
      drm/i915: Use a private interface for register access within GT · 6af5d92f
      Chris Wilson authored
      The GT functions for enabling register access also need to occasionally
      write to and read from registers. To avoid the potential recursion as we
      modify the public interface to be stricter, introduce a private register
      access API for the GT functions.
      
      v2: Rebase
      v3: Rebase onto uncore
      v4: Use raw interfaces consistently so that we only use the low-level
          readN functions from a single location.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      6af5d92f
    • Chris Wilson's avatar
      drm/i915: Colocate all GT access routines in the same file · 907b28c5
      Chris Wilson authored
      Currently, the register access code is split between i915_drv.c and
      intel_pm.c. It only bares a superficial resemblance to the reset of the
      powermanagement code, so move it all into its own file. This is to ease
      further patches to enforce serialised register access.
      
      v2: Scan for random abuse of I915_WRITE_NOTRACE
      v3: Take the opportunity to rename the GT functions as uncore. Uncore is
      the term used by the hardware design (and bspec) for all functions
      outside of the GPU (and CPU) cores in what is also known as the System
      Agent.
      v4: Rebase onto SNB rc6 fixes
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
      [danvet: Wrestle patch into applying and inline
      intel_uncore_early_sanitize (plus move the old comment to the new
      function). Also keep the _santize postfix for intel_uncore_sanitize.]
      [danvet: Squash in fixup spotted by Chris on irc: We need to call
      intel_pm_init before intel_uncore_sanitize since the later will call
      cancel_work on the delayed rps setup work the former initializes.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      907b28c5
    • Daniel Vetter's avatar
      Merge commit 'Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux' · cb54b53a
      Daniel Vetter authored
      This backmerges Linus' merge commit of the latest drm-fixes pull:
      
      commit 549f3a12
      Merge: 42577ca8 058ca4a2
      Author: Linus Torvalds <torvalds@linux-foundation.org>
      Date:   Tue Jul 23 15:47:08 2013 -0700
      
          Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
      
      We've accrued a few too many conflicts, but the real reason is that I
      want to merge the 100% solution for Haswell concurrent registers
      writes into drm-intel-next. But that depends upon the 90% bandaid
      merged into -fixes:
      
      commit a7cd1b8f
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Fri Jul 19 20:36:51 2013 +0100
      
          drm/i915: Serialize almost all register access
      
      Also, we can roll up on accrued conflicts.
      
      Usually I'd backmerge a tagged -rc, but I want to get this done before
      heading off to vacations next week ;-)
      
      Conflicts:
      	drivers/gpu/drm/i915/i915_dma.c
      	drivers/gpu/drm/i915/i915_gem.c
      
      v2: For added hilarity we have a init sequence conflict around the
      gt_lock, so need to move that one, too. Spotted by Jani Nikula.
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      cb54b53a
    • David Herrmann's avatar
      drm/vma: provide drm_vma_node_unmap() helper · 51335df9
      David Herrmann authored
      Instead of unmapping the nodes in TTM and GEM users manually, we provide
      a generic wrapper which does the correct thing for all vma-nodes.
      
      v2: remove bdev->dev_mapping test in ttm_bo_unmap_virtual_unlocked() as
      ttm_mem_io_free_vm() does nothing in that case (io_reserved_vm is 0).
      v4: Fix docbook comments
      v5: use drm_vma_node_size()
      
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
      51335df9
    • David Herrmann's avatar
      drm/ttm: convert to unified vma offset manager · 72525b3f
      David Herrmann authored
      Use the new vma-manager infrastructure. This doesn't change any
      implementation details as the vma-offset-manager is nearly copied 1-to-1
      from TTM.
      
      The vm_lock is moved into the offset manager so we can drop it from TTM.
      During lookup, we use the vma locking helpers to take a reference to the
      found object.
      In all other scenarios, locking stays the same as before. We always
      guarantee that drm_vma_offset_remove() is called only during destruction.
      Hence, helpers like drm_vma_node_offset_addr() are always safe as long as
      the node has a valid offset.
      
      This also drops the addr_space_offset member as it is a copy of vm_start
      in vma_node objects. Use the accessor functions instead.
      
      v4:
       - remove vm_lock
       - use drm_vma_offset_lock_lookup() to protect lookup (instead of vm_lock)
      
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Martin Peres <martin.peres@labri.fr>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
      72525b3f
    • David Herrmann's avatar
      drm/gem: convert to new unified vma manager · 0de23977
      David Herrmann authored
      Use the new vma manager instead of the old hashtable. Also convert all
      drivers to use the new convenience helpers. This drops all the
      (map_list.hash.key << PAGE_SHIFT) non-sense.
      
      Locking and access-management is exactly the same as before with an
      additional lock inside of the vma-manager, which strictly wouldn't be
      needed for gem.
      
      v2:
       - rebase on drm-next
       - init nodes via drm_vma_node_reset() in drm_gem.c
      v3:
       - fix tegra
      v4:
       - remove duplicate if (drm_vma_node_has_offset()) checks
       - inline now trivial drm_vma_node_offset_addr() calls
      v5:
       - skip node-reset on gem-init due to kzalloc()
       - do not allow mapping gem-objects with offsets (backwards compat)
       - remove unneccessary casts
      
      Cc: Inki Dae <inki.dae@samsung.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
      0de23977
    • David Herrmann's avatar
      drm: add unified vma offset manager · fe3078fa
      David Herrmann authored
      If we want to map GPU memory into user-space, we need to linearize the
      addresses to not confuse mm-core. Currently, GEM and TTM both implement
      their own offset-managers to assign a pgoff to each object for user-space
      CPU access. GEM uses a hash-table, TTM uses an rbtree.
      
      This patch provides a unified implementation that can be used to replace
      both. TTM allows partial mmaps with a given offset, so we cannot use
      hashtables as the start address may not be known at mmap time. Hence, we
      use the rbtree-implementation of TTM.
      
      We could easily update drm_mm to use an rbtree instead of a linked list
      for it's object list and thus drop the rbtree from the vma-manager.
      However, this would slow down drm_mm object allocation for all other
      use-cases (rbtree insertion) and add another 4-8 bytes to each mm node.
      Hence, use the separate tree but allow for later migration.
      
      This is a rewrite of the 2012-proposal by David Airlie <airlied@linux.ie>
      
      v2:
       - fix Docbook integration
       - drop drm_mm_node_linked() and use drm_mm_node_allocated()
       - remove unjustified likely/unlikely usage (but keep for rbtree paths)
       - remove BUG_ON() as drm_mm already does that
       - clarify page-based vs. byte-based addresses
       - use drm_vma_node_reset() for initialization, too
      v4:
       - allow external locking via drm_vma_offset_un/lock_lookup()
       - add locked lookup helper drm_vma_offset_lookup_locked()
      v5:
       - fix drm_vma_offset_lookup() to correctly validate range-mismatches
         (fix (offset > start + pages))
       - fix drm_vma_offset_exact_lookup() to actually do what it says
       - remove redundant vm_pages member (add drm_vma_node_size() helper)
       - remove unneeded goto
       - fix documentation
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
      fe3078fa
  9. 24 Jul, 2013 1 commit
    • Daniel Vetter's avatar
      drm/i915: fix reference counting in i915_gem_create · d861e338
      Daniel Vetter authored
      This function is called without the dev->struct_mutex held, hence we
      need to use the _unlocked unreference variants.
      
      As soon as the object is registered userspace can sneak in here with a
      gem_close ioctl call, so the object can (and with my new evil tests
      actually does) get the final unreference in this place. The lack of
      locking then results in hilarity and some good leakage.
      
      To fix this we simply need to revert
      
      Chris Wilson <chris@chris-wilson.co.uk>
      
      v2: We need to make the trace call _before_ we drop our ref - the
      object might very well be gone by then already.
      
      v3: Just revert the original patch as suggested by Chris Wilson.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      [danvet: Remove the added white line again to tighten the return
      block, requested by Chris.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d861e338