summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_bo.c8
-rw-r--r--linux-core/drm_bo_move.c4
-rw-r--r--linux-core/drm_objects.h4
-rw-r--r--linux-core/drm_ttm.c16
4 files changed, 16 insertions, 16 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index d308dcfd..4845f442 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -144,12 +144,12 @@ static int drm_bo_add_ttm(struct drm_buffer_object *bo)
switch (bo->type) {
case drm_bo_type_dc:
case drm_bo_type_kernel:
- bo->ttm = drm_ttm_init(dev, bo->num_pages << PAGE_SHIFT);
+ bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT, 0);
if (!bo->ttm)
ret = -ENOMEM;
break;
case drm_bo_type_user:
- bo->ttm = drm_ttm_init(dev, bo->num_pages << PAGE_SHIFT);
+ bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT, DRM_TTM_PAGE_USER);
if (!bo->ttm)
ret = -ENOMEM;
@@ -262,7 +262,7 @@ out_err:
new_man = &bm->man[bo->mem.mem_type];
if ((new_man->flags & _DRM_FLAG_MEMTYPE_FIXED) && bo->ttm) {
drm_ttm_unbind(bo->ttm);
- drm_destroy_ttm(bo->ttm);
+ drm_ttm_destroy(bo->ttm);
bo->ttm = NULL;
}
@@ -419,7 +419,7 @@ static void drm_bo_destroy_locked(struct drm_buffer_object *bo)
if (bo->ttm) {
drm_ttm_unbind(bo->ttm);
- drm_destroy_ttm(bo->ttm);
+ drm_ttm_destroy(bo->ttm);
bo->ttm = NULL;
}
diff --git a/linux-core/drm_bo_move.c b/linux-core/drm_bo_move.c
index 971b4af8..00d8d3e6 100644
--- a/linux-core/drm_bo_move.c
+++ b/linux-core/drm_bo_move.c
@@ -260,7 +260,7 @@ out2:
if ((man->flags & _DRM_FLAG_MEMTYPE_FIXED) && (ttm != NULL)) {
drm_ttm_unbind(ttm);
- drm_destroy_ttm(ttm);
+ drm_ttm_destroy(ttm);
bo->ttm = NULL;
}
@@ -365,7 +365,7 @@ int drm_bo_move_accel_cleanup(struct drm_buffer_object *bo,
if ((man->flags & _DRM_FLAG_MEMTYPE_FIXED) && (bo->ttm != NULL)) {
drm_ttm_unbind(bo->ttm);
- drm_destroy_ttm(bo->ttm);
+ drm_ttm_destroy(bo->ttm);
bo->ttm = NULL;
}
} else {
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 1dc61fde..66611f6d 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -297,7 +297,7 @@ struct drm_ttm {
};
-extern struct drm_ttm *drm_ttm_init(struct drm_device *dev, unsigned long size);
+extern struct drm_ttm *drm_ttm_create(struct drm_device *dev, unsigned long size, uint32_t page_flags);
extern int drm_bind_ttm(struct drm_ttm *ttm, struct drm_bo_mem_reg *bo_mem);
extern void drm_ttm_unbind(struct drm_ttm *ttm);
extern void drm_ttm_evict(struct drm_ttm *ttm);
@@ -318,7 +318,7 @@ extern int drm_ttm_set_user(struct drm_ttm *ttm,
* Otherwise it is called when the last vma exits.
*/
-extern int drm_destroy_ttm(struct drm_ttm *ttm);
+extern int drm_ttm_destroy(struct drm_ttm *ttm);
#define DRM_FLAG_MASKED(_old, _new, _mask) {\
(_old) ^= (((_old) ^ (_new)) & (_mask)); \
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 3540571f..4200bc1a 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -193,7 +193,7 @@ static void drm_ttm_free_alloced_pages(struct drm_ttm *ttm)
* Free all resources associated with a ttm.
*/
-int drm_destroy_ttm(struct drm_ttm *ttm)
+int drm_ttm_destroy(struct drm_ttm *ttm)
{
struct drm_ttm_backend *be;
@@ -251,11 +251,11 @@ int drm_ttm_set_user(struct drm_ttm *ttm,
int i;
BUG_ON(num_pages != ttm->num_pages);
+ BUG_ON((ttm->page_flags & DRM_TTM_PAGE_USER) == 0);
ttm->dummy_read_page = dummy_read_page;
- ttm->page_flags |= DRM_TTM_PAGE_USER |
- ((write) ? DRM_TTM_PAGE_USER_WRITE : 0);
-
+ if (write)
+ ttm->page_flags |= DRM_TTM_PAGE_USER_WRITE;
down_read(&mm->mmap_sem);
ret = get_user_pages(tsk, mm, start, num_pages,
@@ -299,7 +299,7 @@ int drm_ttm_populate(struct drm_ttm *ttm)
* Initialize a ttm.
*/
-struct drm_ttm *drm_ttm_init(struct drm_device *dev, unsigned long size)
+struct drm_ttm *drm_ttm_create(struct drm_device *dev, unsigned long size, uint32_t page_flags)
{
struct drm_bo_driver *bo_driver = dev->driver->bo_driver;
struct drm_ttm *ttm;
@@ -317,7 +317,7 @@ struct drm_ttm *drm_ttm_init(struct drm_device *dev, unsigned long size)
ttm->destroy = 0;
ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
- ttm->page_flags = 0;
+ ttm->page_flags = page_flags;
/*
* Account also for AGP module memory usage.
@@ -325,13 +325,13 @@ struct drm_ttm *drm_ttm_init(struct drm_device *dev, unsigned long size)
ttm_alloc_pages(ttm);
if (!ttm->pages) {
- drm_destroy_ttm(ttm);
+ drm_ttm_destroy(ttm);
DRM_ERROR("Failed allocating page table\n");
return NULL;
}
ttm->be = bo_driver->create_ttm_backend_entry(dev);
if (!ttm->be) {
- drm_destroy_ttm(ttm);
+ drm_ttm_destroy(ttm);
DRM_ERROR("Failed creating ttm backend entry\n");
return NULL;
}