1. 10 Dec, 2012 6 commits
    • Maarten Lankhorst's avatar
      drm/ttm: cope with reserved buffers on lru list in ttm_mem_evict_first, v2 · e7ab2019
      Maarten Lankhorst authored
      Replace the goto loop with a simple for each loop, and only run the
      delayed destroy cleanup if we can reserve the buffer first.
      
      No race occurs, since lru lock is never dropped any more. An empty list
      and a list full of unreservable buffers both cause -EBUSY to be returned,
      which is identical to the previous situation, because previously buffers
      on the lru list were always guaranteed to be reservable.
      
      This should work since currently ttm guarantees items on the lru are
      always reservable, and reserving items blockingly with some bo held
      are enough to cause you to run into a deadlock.
      
      Currently this is not a concern since removal off the lru list and
      reservations are always done with atomically, but when this guarantee
      no longer holds, we have to handle this situation or end up with
      possible deadlocks.
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      e7ab2019
    • Maarten Lankhorst's avatar
      drm/ttm: cope with reserved buffers on swap list in ttm_bo_swapout, v2 · 2b7b3ad2
      Maarten Lankhorst authored
      Replace the while loop with a simple for each loop, and only run the
      delayed destroy cleanup if we can reserve the buffer first.
      
      No race occurs, since lru lock is never dropped any more. An empty list
      and a list full of unreservable buffers both cause -EBUSY to be returned,
      which is identical to the previous situation.
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      2b7b3ad2
    • Maarten Lankhorst's avatar
      drm/ttm: call ttm_bo_cleanup_refs with reservation and lru lock held, v3 · 85b144f8
      Maarten Lankhorst authored
      By removing the unlocking of lru and retaking it immediately, a race is
      removed where the bo is taken off the swap list or the lru list between
      the unlock and relock. As such the cleanup_refs code can be simplified,
      it will attempt to call ttm_bo_wait non-blockingly, and if it fails
      it will drop the locks and perform a blocking wait, or return an error
      if no_wait_gpu was set.
      
      The need for looping is also eliminated, since swapout and evict_mem_first
      will always follow the destruction path, no new fence is allowed
      to be attached. As far as I can see this may already have been the case,
      but the unlocking / relocking required a complicated loop to deal with
      re-reservation.
      
      Changes since v1:
       - Simplify no_wait_gpu case by folding it in with empty ddestroy.
       - Hold a reservation while calling ttm_bo_cleanup_memtype_use again.
      Changes since v2:
       - Do not remove bo from lru list while waiting
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      85b144f8
    • Maarten Lankhorst's avatar
      drm/radeon: allow move_notify to be called without reservation · 6ed9ccb4
      Maarten Lankhorst authored
      The few places that care should have those checks instead.
      This allows destruction of bo backed memory without a reservation.
      It's required for being able to rework the delayed destroy path,
      as it is no longer guaranteed to hold a reservation before unlocking.
      
      However any previous wait is still guaranteed to complete, and it's
      one of the last things to be done before the buffer object is freed.
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      6ed9ccb4
    • Maarten Lankhorst's avatar
      drm/ttm: change fence_lock to inner lock · 4154f051
      Maarten Lankhorst authored
      This requires changing the order in ttm_bo_cleanup_refs_or_queue to
      take the reservation first, as there is otherwise no race free way to
      take lru lock before fence_lock.
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      4154f051
    • Dave Airlie's avatar
      Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm-next · 1a1494de
      Dave Airlie authored
      Alex writes:
      Pretty minor -next pull request.  We some additional new bits waiting
      internally for release.  Hopefully Monday we can get at least some of
      them out.  The others will probably take a few more weeks.
      
      Highlights of the current request:
      - ELD registers for passing audio information to the sound hardware
      - Handle GPUVM page faults more gracefully
      - Misc fixes
      
      Merge radeon test
      * 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux: (483 commits)
        drm/radeon: bump driver version for new info ioctl requests
        drm/radeon: fix eDP clk and lane setup for scaled modes
        drm/radeon: add new INFO ioctl requests
        drm/radeon/dce32+: use fractional fb dividers for high clocks
        drm/radeon: use cached memory when evicting for vram on non agp
        drm/radeon: add a CS flag END_OF_FRAME
        drm/radeon: stop page faults from hanging the system (v2)
        drm/radeon/dce4/5: add registers for ELD handling
        drm/radeon/dce3.2: add registers for ELD handling
        radeon: fix pll/ctrc mapping on dce2 and dce3 hardware
        Linux 3.7-rc7
        powerpc/eeh: Do not invalidate PE properly
        Revert "drm/i915: enable rc6 on ilk again"
        ALSA: hda - Fix build without CONFIG_PM
        of/address: sparc: Declare of_iomap as an extern function for sparc again
        PM / QoS: fix wrong error-checking condition
        bnx2x: remove redundant warning log
        vxlan: fix command usage in its doc
        8139cp: revert "set ring address before enabling receiver"
        MPI: Fix compilation on MIPS with GCC 4.4 and newer
        ...
      
      Conflicts:
      	drivers/gpu/drm/exynos/exynos_drm_encoder.c
      	drivers/gpu/drm/exynos/exynos_drm_fbdev.c
      	drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
      1a1494de
  2. 08 Dec, 2012 7 commits
  3. 06 Dec, 2012 1 commit
    • Dave Airlie's avatar
      Merge branch 'connector-to-object-prop' of git://github.com/robclark/kernel-omap4 into drm-next · 8de9e417
      Dave Airlie authored
      * 'connector-to-object-prop' of git://github.com/robclark/kernel-omap4:
        drm: remove legacy drm_connector_property fxns
        drm/nouveau: drm_connector_property -> drm_object_property
        drm/i915: One more drm_connector_property -> drm_object_property
        drm/i2c: drm_connector_property -> drm_object_property
        drm/vmwgfx: drm_connector_property -> drm_object_property
        drm/udl: drm_connector_property -> drm_object_property
        drm/shmob: drm_connector_property -> drm_object_property
        drm/radeon: drm_connector_property -> drm_object_property
        drm/gma500: drm_connector_property -> drm_object_property
      8de9e417
  4. 05 Dec, 2012 13 commits
  5. 04 Dec, 2012 7 commits
    • Inki Dae's avatar
      drm/exynos: add vm_ops to specific gem mmaper · 5b07c660
      Inki Dae authored
      Changelog v3:
      use drm_file's file object instead of gem object's
      - gem object's file represents the shmem storage so
        process-unique file object should be used instead.
      
      Changelog v2:
      call mutex_lock before drm_vm_open_locked is called.
      
      Changelog v1:
      This patch makes it takes a reference to gem object when
      specific gem mmap is requested. For this, it sets
      dev->driver->gem_vm_ops to vma->vm_ops.
      
      And this patch is based on exynos-drm-next-iommu branch of
      	git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynosSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      5b07c660
    • Inki Dae's avatar
      drm/exynos: add userptr feature for g2d module · 2a3098ff
      Inki Dae authored
      This patch adds userptr feautre for G2D module.
      
      The userptr means user space address allocated by malloc().
      And the purpose of this feature is to make G2D's dma able
      to access the user space region.
      
      To user this feature, user should flag G2D_BUF_USRPTR to
      offset variable of struct drm_exynos_g2d_cmd and fill
      struct drm_exynos_g2d_userptr with user space address
      and size for it and then should set a pointer to
      drm_exynos_g2d_userptr object to data variable of struct
      drm_exynos_g2d_cmd. The last bit of offset variable is used
      to check if the cmdlist's buffer type is userptr or not.
      If userptr, the g2d driver gets user space address and size
      and then gets pages through get_user_pages().
      (another case is counted as gem handle)
      
      Below is sample codes:
      
      static void set_cmd(struct drm_exynos_g2d_cmd *cmd,
      		unsigned long offset, unsigned long data)
      {
      	cmd->offset = offset;
      	cmd->data = data;
      }
      
      static int solid_fill_test(int x, int y, unsigned long userptr)
      {
      	struct drm_exynos_g2d_cmd cmd_gem[5];
      	struct drm_exynos_g2d_userptr g2d_userptr;
      	unsigned int gem_nr = 0;
      	...
      
      	g2d_userptr.userptr = userptr;
      	g2d_userptr.size = x * y * 4;
      
      	set_cmd(&cmd_gem[gem_nr++], DST_BASE_ADDR_REG |
      					G2D_BUF_USERPTR,
      			(unsigned long)&g2d_userptr);
      	...
      }
      
      int main(int argc, char **argv)
      {
      	unsigned long addr;
      	...
      
      	addr = malloc(x * y * 4);
      	...
      
      	solid_fill_test(x, y, addr);
      	...
      }
      
      And next, the pages are mapped with iommu table and the device
      address is set to cmdlist so that G2D's dma can access it.
      As you may know, the pages from get_user_pages() are pinned.
      In other words, they CAN NOT be migrated and also swapped out.
      So the dma access would be safe.
      
      But the use of userptr feature has performance overhead so
      this patch also has memory pool to the userptr feature.
      Please, assume that user sends cmdlist filled with userptr
      and size every time to g2d driver, and the get_user_pages
      funcion will be called every time.
      
      The memory pool has maximum 64MB size and the userptr that
      user had ever sent, is holded in the memory pool.
      This meaning is that if the userptr from user is same as one
      in the memory pool, device address to the userptr in the memory
      pool is set to cmdlist.
      
      And last, the pages from get_user_pages() will be freed once
      user calls free() and the dma access is completed. Actually,
      get_user_pages() takes 2 reference counts if the user process
      has never accessed user region allocated by malloc(). Then, if
      the user calls free(), the page reference count becomes 1 and
      becomes 0 with put_page() call. And the reverse holds as well.
      This means how the pages backed are used by dma and freed.
      
      This patch is based on "drm/exynos: add iommu support for g2d",
      	https://patchwork.kernel.org/patch/1629481/Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      2a3098ff
    • Prathyush K's avatar
      drm/exynos: remove unnecessary sg_alloc_table call · 1119707e
      Prathyush K authored
      The function dma_get_sgtable will allocate a sg table internally so
      it is not necessary to allocate a sg table before it. The unnecessary
      'sg_alloc_table' call is removed.
      Signed-off-by: default avatarPrathyush K <prathyush.k@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      1119707e
    • Rahul Sharma's avatar
      drm: exynos: fix for mapping of dma buffers · 4ddc404b
      Rahul Sharma authored
      This patch fixes the problem of mapping contigous and non contigous dma buffers.
      
      Currently page struct is calculated from the buf->dma_addr which is not the
      physical address. It is replaced by buf->pages which points to the page struct
      of the first page of contigous memory chunk. This gives the correct page frame
      number for mapping.
      
      Non-contigous dma buffers are described using SG table and SG lists. Each
      valid SG List is pointing to a single page or group of pages which are
      physically contigous. Current implementation just maps the first page of each
      SG List and leave the other pages unmapped, leading to a crash. Given solution
      finds the page struct for the faulting page through parsing SG table and map it.
      Signed-off-by: default avatarRahul Sharma <rahul.sharma@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      4ddc404b
    • Inki Dae's avatar
      drm/exynos: remove EXYNOS_BO_NONCONTIG type checking. · ea6d66c3
      Inki Dae authored
      With iommu support, non-continuous buffer also is supported so
      this patch removes these checking from exynos_drm_gem_get/put_dma_addr
      funciton.
      
      This patch is based on the below patch set, "drm/exynos: add
      iommu support for -next".
      	http://www.spinics.net/lists/dri-devel/msg29041.htmlSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      ea6d66c3
    • Inki Dae's avatar
      drm/exynos: add iommu support for g2d · d87342c1
      Inki Dae authored
      Chagelog v2:
      removed unnecessary structure, struct g2d_gem_node.
      
      Chagelog v1:
      This patch adds iommu support for g2d driver. For this, it
      adds subdrv_probe/remove callback to enable or disable
      g2d iommu. And with this patch, in case of using g2d iommu,
      we can get or put device address to a gem handle from user
      through exynos_drm_gem_get/put_dma_addr(). Actually, these
      functions take a reference to a gem handle so that the gem
      object used by g2d dma is released properly.
      
      And runqueue_node has a pointer to drm_file object of current
      process to manage gem handles to owner.
      
      This patch is based on the below patch set, "drm/exynos: add
      iommu support for -next".
           http://www.spinics.net/lists/dri-devel/msg29041.htmlSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      d87342c1
    • Inki Dae's avatar
      drm/exynos: add iommu support for hdmi driver · 1055b39f
      Inki Dae authored
      Changelog v2:
      move iommu support feature to mixer side.
      And below is Prathyush's comment.
      
      According to the new IOMMU framework for exynos sysmmus,
      the owner of the sysmmu-tv is mixer (which is the actual
      device that does DMA) and not hdmi.
      The mmu-master in sysmmu-tv node is set as below in exynos5250.dtsi
      	sysmmu-tv {
      		-
      		mmu-master = <&mixer>;
      	};
      
      Changelog v1:
      The iommu will be enabled when hdmi sub driver is probed and
      will be disabled when removed.
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      1055b39f
  6. 03 Dec, 2012 2 commits
  7. 30 Nov, 2012 4 commits