Skip to contentSkip to conversation

A few patches for ng

PATCH Maarten Maathuis 1 participant 1 message Dec 23, 2008

lore
Share & tools
lore
#0 lore raw

The first patch (for drm) fixes a very annoying bug for nv50 gart. The 2nd is just a few cleanups in libnouveau_drm.

I also pushed a few changes to the ng ddx, and I'm at the moment thinking on how to deal with the issue of nv50.

We are no longer garuanteed that pixmaps are really migrated upon mapping, so that is the first thing to do. Probably a good idea to begin with making the bo copy stuff in kernel functional with tiled memory. Then the simple start would be to copy the bo upon map and and copy back upon unmap, the downside of this is a syncing requirement (the tiled copy musn't be accessed at the same time). Another attempt would to be finally try that wfb stuff in xorg and get that going. And i have some more ideas floating around. Anyway, i'll have some more stuff ready once you (darktama) are done moving.

Maarten.

From 8caaf0c4a3dc4579e09963173438d876d335fbb5 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Tue, 23 Dec 2008 21:12:14 +0100
Subject: [PATCH] nv50: properly handle gart.

---
 shared-core/nouveau_object.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
shared-core/nouveau_object.c +8 -1
index 4c8d364..f7d93a8 100644
@@ -961,6 +961,8 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
 
 	/* VRAM ctxdma */
 	if (dev_priv->card_type >= NV_50) {
+		/* VRAM is mapped into 512-1024 MB in the page directory. */
+		/* The reason available size is used, is to avoid dma'ing into RAMIN. */
 		ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY,
 					     (512*1024*1024),
 					     dev_priv->fb_available_size,
@@ -986,7 +988,12 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
 
 	/* TT memory ctxdma */
 	if (dev_priv->card_type >= NV_50) {
-		tt = vram;
+		/* GART is mapped into 0-512MB of the page directory. */
+		ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY,
+					     0,
+					     512*1024*1024,
+					     NV_DMA_ACCESS_RW,
+					     NV_DMA_TARGET_AGP, &tt);
 	} else
 	if (dev_priv->gart_info.type != NOUVEAU_GART_NONE) {
 		ret = nouveau_gpuobj_gart_dma_new(chan, 0,
Signature · 1 line
1.6.0.4

From abed0dd3583ac173e19570a4a0010eb56b45bc0b Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Tue, 23 Dec 2008 21:16:10 +0100
Subject: [PATCH] A few minor fixes.

---
 src/nouveau_bo.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
src/nouveau_bo.c +12 -5
index 851eaf9..de6f167 100644
@@ -328,7 +328,9 @@ nouveau_bo_wait(struct nouveau_bo *bo, int cpu_write)
 		nouveau_pushbuf_flush(nvbo->pending_channel, 0);
 	}
 
-	nouveau_bo_kmap(nvbo);
+	ret = nouveau_bo_kmap(nvbo);
+	if (ret)
+		return ret;
 
 	req.handle = nvbo->handle;
 	ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_PREP,
@@ -350,8 +352,11 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t flags)
 		return -EINVAL;
 
 	if (!nouveau_bo_allocated(nvbo)) {
-		if (nvbo->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART))
-			nouveau_bo_kalloc(nvbo, NULL);
+		if (nvbo->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) {
+			ret = nouveau_bo_kalloc(nvbo, NULL);
+			if (ret)
+				return ret;
+		}
 
 		if (!nouveau_bo_allocated(nvbo)) {
 			ret = nouveau_bo_ualloc(nvbo);
@@ -468,7 +473,9 @@ nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo)
 		return nvbo->pending;
 
 	if (!nvbo->handle) {
-		nouveau_bo_kalloc(nvbo, chan);
+		ret = nouveau_bo_kalloc(nvbo, chan);
+		if (ret)
+			return NULL;
 		if (nvbo->sysmem) {
 			void *sysmem_tmp = nvbo->sysmem;
 
@@ -494,7 +501,7 @@ nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo)
 	pbbo->user_priv = (uint64_t)(unsigned long)ref;
 	pbbo->handle = nvbo->handle;
 	pbbo->valid_domains = NOUVEAU_GEM_DOMAIN_VRAM | NOUVEAU_GEM_DOMAIN_GART;
-	pbbo->read_domains =
+	pbbo->read_domains = 0;
 	pbbo->write_domains = 0;
 	pbbo->presumed_domain = nvbo->domain;
 	pbbo->presumed_offset = nvbo->offset;
Signature · 1 line
1.6.0.4

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau