aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/cirrus/cirrus_ttm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/cirrus/cirrus_ttm.c')
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_ttm.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 92e6b7786097..dfffd528517a 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -298,18 +298,21 @@ void cirrus_mm_fini(struct cirrus_device *cirrus)
298void cirrus_ttm_placement(struct cirrus_bo *bo, int domain) 298void cirrus_ttm_placement(struct cirrus_bo *bo, int domain)
299{ 299{
300 u32 c = 0; 300 u32 c = 0;
301 bo->placement.fpfn = 0; 301 unsigned i;
302 bo->placement.lpfn = 0;
303 bo->placement.placement = bo->placements; 302 bo->placement.placement = bo->placements;
304 bo->placement.busy_placement = bo->placements; 303 bo->placement.busy_placement = bo->placements;
305 if (domain & TTM_PL_FLAG_VRAM) 304 if (domain & TTM_PL_FLAG_VRAM)
306 bo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; 305 bo->placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
307 if (domain & TTM_PL_FLAG_SYSTEM) 306 if (domain & TTM_PL_FLAG_SYSTEM)
308 bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; 307 bo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
309 if (!c) 308 if (!c)
310 bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; 309 bo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
311 bo->placement.num_placement = c; 310 bo->placement.num_placement = c;
312 bo->placement.num_busy_placement = c; 311 bo->placement.num_busy_placement = c;
312 for (i = 0; i < c; ++i) {
313 bo->placements[i].fpfn = 0;
314 bo->placements[i].lpfn = 0;
315 }
313} 316}
314 317
315int cirrus_bo_create(struct drm_device *dev, int size, int align, 318int cirrus_bo_create(struct drm_device *dev, int size, int align,
@@ -340,7 +343,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align,
340 ret = ttm_bo_init(&cirrus->ttm.bdev, &cirrusbo->bo, size, 343 ret = ttm_bo_init(&cirrus->ttm.bdev, &cirrusbo->bo, size,
341 ttm_bo_type_device, &cirrusbo->placement, 344 ttm_bo_type_device, &cirrusbo->placement,
342 align >> PAGE_SHIFT, false, NULL, acc_size, 345 align >> PAGE_SHIFT, false, NULL, acc_size,
343 NULL, cirrus_bo_ttm_destroy); 346 NULL, NULL, cirrus_bo_ttm_destroy);
344 if (ret) 347 if (ret)
345 return ret; 348 return ret;
346 349
@@ -365,7 +368,7 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 *gpu_addr)
365 368
366 cirrus_ttm_placement(bo, pl_flag); 369 cirrus_ttm_placement(bo, pl_flag);
367 for (i = 0; i < bo->placement.num_placement; i++) 370 for (i = 0; i < bo->placement.num_placement; i++)
368 bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; 371 bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
369 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); 372 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
370 if (ret) 373 if (ret)
371 return ret; 374 return ret;
@@ -392,7 +395,7 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo)
392 395
393 cirrus_ttm_placement(bo, TTM_PL_FLAG_SYSTEM); 396 cirrus_ttm_placement(bo, TTM_PL_FLAG_SYSTEM);
394 for (i = 0; i < bo->placement.num_placement ; i++) 397 for (i = 0; i < bo->placement.num_placement ; i++)
395 bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; 398 bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
396 399
397 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); 400 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
398 if (ret) { 401 if (ret) {
@@ -408,7 +411,7 @@ int cirrus_mmap(struct file *filp, struct vm_area_struct *vma)
408 struct cirrus_device *cirrus; 411 struct cirrus_device *cirrus;
409 412
410 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) 413 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
411 return drm_mmap(filp, vma); 414 return -EINVAL;
412 415
413 file_priv = filp->private_data; 416 file_priv = filp->private_data;
414 cirrus = file_priv->minor->dev->dev_private; 417 cirrus = file_priv->minor->dev->dev_private;