aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_bo.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2011-11-01 20:46:13 -0400
committerDave Airlie <airlied@redhat.com>2011-12-06 05:39:17 -0500
commit649bf3ca77343e3be1e0af8e21356fa569b1abd9 (patch)
tree01ad6a5f3f74b087cb791f5965d3190916975789 /drivers/gpu/drm/nouveau/nouveau_bo.c
parent822c4d9ae0d55a4fcea9f0a462bc6406a06692e2 (diff)
drm/ttm: merge ttm_backend and ttm_tt V5
ttm_backend will only exist with a ttm_tt, and ttm_tt will only be of interest when bound to a backend. Merge them to avoid code and data duplication. V2 Rebase on top of memory accounting overhaul V3 Rebase on top of more memory accounting changes V4 Rebase on top of no memory account changes (where/when is my delorean when i need it ?) V5 make sure ttm is unbound before destroying, change commit message on suggestion from Tormod Volden Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bo.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 7226f419e178..b060fa48135c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -343,8 +343,10 @@ nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val)
343 *mem = val; 343 *mem = val;
344} 344}
345 345
346static struct ttm_backend * 346static struct ttm_tt *
347nouveau_bo_create_ttm_backend_entry(struct ttm_bo_device *bdev) 347nouveau_ttm_tt_create(struct ttm_bo_device *bdev,
348 unsigned long size, uint32_t page_flags,
349 struct page *dummy_read_page)
348{ 350{
349 struct drm_nouveau_private *dev_priv = nouveau_bdev(bdev); 351 struct drm_nouveau_private *dev_priv = nouveau_bdev(bdev);
350 struct drm_device *dev = dev_priv->dev; 352 struct drm_device *dev = dev_priv->dev;
@@ -352,11 +354,13 @@ nouveau_bo_create_ttm_backend_entry(struct ttm_bo_device *bdev)
352 switch (dev_priv->gart_info.type) { 354 switch (dev_priv->gart_info.type) {
353#if __OS_HAS_AGP 355#if __OS_HAS_AGP
354 case NOUVEAU_GART_AGP: 356 case NOUVEAU_GART_AGP:
355 return ttm_agp_backend_init(bdev, dev->agp->bridge); 357 return ttm_agp_tt_create(bdev, dev->agp->bridge,
358 size, page_flags, dummy_read_page);
356#endif 359#endif
357 case NOUVEAU_GART_PDMA: 360 case NOUVEAU_GART_PDMA:
358 case NOUVEAU_GART_HW: 361 case NOUVEAU_GART_HW:
359 return nouveau_sgdma_init_ttm(dev); 362 return nouveau_sgdma_create_ttm(bdev, size, page_flags,
363 dummy_read_page);
360 default: 364 default:
361 NV_ERROR(dev, "Unknown GART type %d\n", 365 NV_ERROR(dev, "Unknown GART type %d\n",
362 dev_priv->gart_info.type); 366 dev_priv->gart_info.type);
@@ -1045,7 +1049,7 @@ nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence)
1045} 1049}
1046 1050
1047struct ttm_bo_driver nouveau_bo_driver = { 1051struct ttm_bo_driver nouveau_bo_driver = {
1048 .create_ttm_backend_entry = nouveau_bo_create_ttm_backend_entry, 1052 .ttm_tt_create = &nouveau_ttm_tt_create,
1049 .invalidate_caches = nouveau_bo_invalidate_caches, 1053 .invalidate_caches = nouveau_bo_invalidate_caches,
1050 .init_mem_type = nouveau_bo_init_mem_type, 1054 .init_mem_type = nouveau_bo_init_mem_type,
1051 .evict_flags = nouveau_bo_evict_flags, 1055 .evict_flags = nouveau_bo_evict_flags,