diff options
author | Dave Airlie <airlied@redhat.com> | 2007-10-04 16:13:22 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2007-10-04 16:13:22 +1000 |
commit | 495bbbaadc93c574eb98dd2ad64bdca4d91d4152 (patch) | |
tree | c55f0012e8535475116511435eeb08f9355c7a4b /linux-core/drm_bo_move.c | |
parent | b0473699ed7bef4efd0742e0a350d345a7cc9a0c (diff) |
drm: fix page count calculation
Also no need to do pre-populate work on single page
Diffstat (limited to 'linux-core/drm_bo_move.c')
-rw-r--r-- | linux-core/drm_bo_move.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/linux-core/drm_bo_move.c b/linux-core/drm_bo_move.c index dae99181..2a35d45b 100644 --- a/linux-core/drm_bo_move.c +++ b/linux-core/drm_bo_move.c @@ -488,16 +488,6 @@ static int drm_bo_kmap_ttm(struct drm_buffer_object *bo, unsigned long start_pag BUG_ON(!ttm); - /* - * Populate the part we're mapping; - */ - - for (i=start_page; i< num_pages; ++i) { - d = drm_ttm_get_page(ttm, i); - if (!d) - return -ENOMEM; - } - if (num_pages == 1 && (mem->flags & DRM_BO_FLAG_CACHED)) { /* @@ -509,6 +499,15 @@ static int drm_bo_kmap_ttm(struct drm_buffer_object *bo, unsigned long start_pag map->page = drm_ttm_get_page(ttm, start_page); map->virtual = kmap(map->page); } else { + /* + * Populate the part we're mapping; + */ + + for (i = start_page; i< start_page + num_pages; ++i) { + d = drm_ttm_get_page(ttm, i); + if (!d) + return -ENOMEM; + } /* * We need to use vmap to get the desired page protection |