Skip to contentSkip to conversation

nouveau: apply storage type to gart objects

PATCH New Maarten Lankhorst 1 participant 1 message Jul 27, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: apply storage type to gart objects

If you want to access gart as linear, don't specify a non-zero storage type.

---
 drivers/gpu/drm/nouveau/nouveau_mem.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/nouveau/nouveau_mem.c +9 -0
index 5b498ea..4642ea7 100644
@@ -1223,7 +1223,9 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
 			 struct ttm_mem_reg *mem)
 {
 	struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
+	struct nouveau_bo *nvbo = nouveau_bo(bo);
 	struct nouveau_mem *node;
+	uint32_t memtype = nvbo->tile_flags >> 8;
 
 	if (unlikely((mem->num_pages << PAGE_SHIFT) >=
 		     dev_priv->gart_info.aper_size))
@@ -1234,6 +1236,13 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
 		return -ENOMEM;
 	node->page_shift = 12;
 
+	if (dev_priv->card_type == NV_50) {
+		uint32_t comp = (memtype & 0x300) >> 8;
+		uint32_t type = (memtype & 0x07f);
+		node->memtype = (comp << 7) | type;
+	} else if (dev_priv->card_type >= NV_C0) {
+		node->memtype = memtype & 0xff;
+	}
 	mem->mm_node = node;
 	mem->start   = 0;
 	return 0;