aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_bo.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2007-12-16 01:12:07 -0800
committerKeith Packard <keithp@keithp.com>2007-12-21 12:16:29 -0800
commit881ee70ab7bab5d6f6140dc9bf1e19c7b5844084 (patch)
tree9048804d2930a7ff8c3cf77dfd9488a81668a9ae /linux-core/drm_bo.c
parent6d44f48002c19d67187adb660ef74dd1870d52c2 (diff)
Move dummy_read_page from drm_ttm_set_user to drm_ttm_create.
I'm hoping to use the dummy_read_page for kernel allocated buffers to avoid allocating extra pages for read-only buffers (like vertex and batch buffers). This also eliminates the 'write' parameter to drm_ttm_set_user and just has DRM_TTM_PAGE_WRITE passed into drm_ttm_create.
Diffstat (limited to 'linux-core/drm_bo.c')
-rw-r--r--linux-core/drm_bo.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index eced94ea..e7b9c5b1 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -137,27 +137,32 @@ static int drm_bo_add_ttm(struct drm_buffer_object *bo)
{
struct drm_device *dev = bo->dev;
int ret = 0;
+ uint32_t page_flags = 0;
DRM_ASSERT_LOCKED(&bo->mutex);
bo->ttm = NULL;
+ if (bo->mem.mask & DRM_BO_FLAG_WRITE)
+ page_flags |= DRM_TTM_PAGE_WRITE;
+
switch (bo->type) {
case drm_bo_type_dc:
case drm_bo_type_kernel:
- bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT, 0);
+ bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT,
+ page_flags, dev->bm.dummy_read_page);
if (!bo->ttm)
ret = -ENOMEM;
break;
case drm_bo_type_user:
- bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT, DRM_TTM_PAGE_USER);
+ bo->ttm = drm_ttm_create(dev, bo->num_pages << PAGE_SHIFT,
+ page_flags | DRM_TTM_PAGE_USER,
+ dev->bm.dummy_read_page);
if (!bo->ttm)
ret = -ENOMEM;
ret = drm_ttm_set_user(bo->ttm, current,
- bo->mem.mask & DRM_BO_FLAG_WRITE,
bo->buffer_start,
- bo->num_pages,
- dev->bm.dummy_read_page);
+ bo->num_pages);
if (ret)
return ret;