diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drmP.h | 15 | ||||
-rw-r--r-- | linux-core/drm_bo.c | 10 | ||||
-rw-r--r-- | linux-core/drm_bo_move.c | 33 | ||||
-rw-r--r-- | linux-core/drm_compat.c | 2 |
4 files changed, 31 insertions, 29 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index aff10b62..7b8f2c66 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -697,9 +697,8 @@ typedef struct drm_bo_driver{ int (*init_mem_type)(struct drm_device *dev, uint32_t type, drm_mem_type_manager_t *man); uint32_t (*evict_flags) (struct drm_device *dev, uint32_t type); - int (*move)(struct drm_device *dev, - struct drm_ttm *ttm, int evict, int no_wait, - struct drm_bo_mem_reg *old_mem, + int (*move)(struct drm_buffer_object *bo, + int evict, int no_wait, struct drm_bo_mem_reg *new_mem); } drm_bo_driver_t; @@ -1517,15 +1516,13 @@ extern int drm_fence_buffer_objects(drm_file_t * priv, * drm_bo_move.c */ -extern int drm_bo_move_ttm(drm_device_t *dev, - drm_ttm_t *ttm, int evict, +extern int drm_bo_move_ttm(drm_buffer_object_t *bo, + int evict, int no_wait, - drm_bo_mem_reg_t *old_mem, drm_bo_mem_reg_t *new_mem); -extern int drm_bo_move_memcpy(drm_device_t *dev, - drm_ttm_t *ttm, int evict, +extern int drm_bo_move_memcpy(drm_buffer_object_t *bo, + int evict, int no_wait, - drm_bo_mem_reg_t *old_mem, drm_bo_mem_reg_t *new_mem); extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 845db3fe..728afb41 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -124,7 +124,6 @@ static int drm_bo_add_ttm(drm_buffer_object_t * bo) { drm_device_t *dev = bo->dev; int ret = 0; - bo->ttm = NULL; switch (bo->type) { @@ -174,14 +173,11 @@ static int drm_bo_handle_move_mem(drm_buffer_object_t *bo, if (!(old_man->flags & _DRM_FLAG_MEMTYPE_FIXED) && !(new_man->flags & _DRM_FLAG_MEMTYPE_FIXED)) { - ret = drm_bo_move_ttm(dev, bo->ttm, evict, no_wait, - &bo->mem, mem); + ret = drm_bo_move_ttm(bo, evict, no_wait, mem); } else if (dev->driver->bo_driver->move) { - ret = dev->driver->bo_driver->move(dev, bo->ttm, evict, - no_wait, &bo->mem, mem); + ret = dev->driver->bo_driver->move(bo, evict, no_wait, mem); } else { - ret = drm_bo_move_memcpy(dev, bo->ttm, evict, no_wait, - &bo->mem, mem); + ret = drm_bo_move_memcpy(bo, evict, no_wait, mem); } if (old_is_pci || new_is_pci) diff --git a/linux-core/drm_bo_move.c b/linux-core/drm_bo_move.c index 23e8c0f2..b7a49299 100644 --- a/linux-core/drm_bo_move.c +++ b/linux-core/drm_bo_move.c @@ -30,13 +30,14 @@ #include "drmP.h" -int drm_bo_move_ttm(drm_device_t *dev, - drm_ttm_t *ttm, +int drm_bo_move_ttm(drm_buffer_object_t *bo, int evict, int no_wait, - drm_bo_mem_reg_t *old_mem, drm_bo_mem_reg_t *new_mem) { + drm_device_t *dev = bo->dev; + drm_ttm_t *ttm = bo->ttm; + drm_bo_mem_reg_t *old_mem = &bo->mem; uint32_t save_flags = old_mem->flags; uint32_t save_mask = old_mem->mask; int ret; @@ -135,8 +136,9 @@ void drm_mem_reg_iounmap(drm_device_t *dev, drm_bo_mem_reg_t *mem, bm = &dev->bm; man = &bm->man[mem->mem_type]; - if (virtual && (man->flags & _DRM_FLAG_NEEDS_IOREMAP)) + if (virtual && (man->flags & _DRM_FLAG_NEEDS_IOREMAP)) { iounmap(virtual); + } } @@ -188,13 +190,16 @@ static int drm_copy_ttm_io_page(drm_ttm_t *ttm, void *dst, unsigned long page) } -int drm_bo_move_memcpy(drm_device_t *dev, - drm_ttm_t *ttm, +int drm_bo_move_memcpy(drm_buffer_object_t *bo, int evict, int no_wait, - drm_bo_mem_reg_t *old_mem, drm_bo_mem_reg_t *new_mem) { + drm_device_t *dev = bo->dev; + drm_mem_type_manager_t *man = &dev->bm.man[new_mem->mem_type]; + drm_ttm_t *ttm = bo->ttm; + drm_bo_mem_reg_t *old_mem = &bo->mem; + drm_bo_mem_reg_t old_copy = *old_mem; void *old_iomap; void *new_iomap; int ret; @@ -205,7 +210,6 @@ int drm_bo_move_memcpy(drm_device_t *dev, unsigned long add = 0; int dir; - ret = drm_mem_reg_ioremap(dev, old_mem, &old_iomap); if (ret) return ret; @@ -237,15 +241,22 @@ int drm_bo_move_memcpy(drm_device_t *dev, if (ret) goto out1; } - + mb(); out2: *old_mem = *new_mem; new_mem->mm_node = NULL; old_mem->mask = save_mask; DRM_FLAG_MASKED(save_flags, new_mem->flags, DRM_BO_MASK_MEMTYPE); + + if ((man->flags & _DRM_FLAG_MEMTYPE_FIXED) && (ttm != NULL)) { + drm_ttm_unbind(ttm); + drm_destroy_ttm(ttm); + bo->ttm = NULL; + } + out1: - drm_mem_reg_iounmap(dev, new_mem, &new_iomap); + drm_mem_reg_iounmap(dev, new_mem, new_iomap); out: - drm_mem_reg_iounmap(dev, old_mem, old_iomap); + drm_mem_reg_iounmap(dev, &old_copy, old_iomap); return ret; } diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c index d0bca672..8dd15ded 100644 --- a/linux-core/drm_compat.c +++ b/linux-core/drm_compat.c @@ -250,7 +250,6 @@ struct page *drm_bo_vm_nopage(struct vm_area_struct *vma, } get_page(page); - out_unlock: mutex_unlock(&bo->mutex); return page; @@ -274,7 +273,6 @@ int drm_bo_map_bound(struct vm_area_struct *vma) if (bus_size) { unsigned long pfn = (bus_base + bus_offset) >> PAGE_SHIFT; pgprot_t pgprot = drm_io_prot(_DRM_AGP, vma); - ret = io_remap_pfn_range(vma, vma->vm_start, pfn, vma->vm_end - vma->vm_start, pgprot); |