summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2009-12-28 18:00:09 -0500
committerYounes Manton <younes.m@gmail.com>2009-12-28 18:07:08 -0500
commitcd2e4ba9aac65d10cf790990a8b86feed1cdd774 (patch)
treef285499979532c0b762ff2ce99145fe9f0b94099
parentcb1caaaa05ba96b98bf9af1190f6830d8b0608bc (diff)
nouveau: Unreference pushbuf objects on channel destruction.
- unreference pushbuf objects on channel destruction Based on Krzysztof Smiechowicz's patch.
-rw-r--r--nouveau/nouveau_channel.c1
-rw-r--r--nouveau/nouveau_private.h2
-rw-r--r--nouveau/nouveau_pushbuf.c16
3 files changed, 16 insertions, 3 deletions
diff --git a/nouveau/nouveau_channel.c b/nouveau/nouveau_channel.c
index 674c5c37..638aee30 100644
--- a/nouveau/nouveau_channel.c
+++ b/nouveau/nouveau_channel.c
@@ -111,6 +111,7 @@ nouveau_channel_free(struct nouveau_channel **chan)
FIRE_RING(&nvchan->base);
+ nouveau_pushbuf_fini(&nvchan->base);
nouveau_bo_unmap(nvchan->notifier_bo);
nouveau_bo_ref(NULL, &nvchan->notifier_bo);
diff --git a/nouveau/nouveau_private.h b/nouveau/nouveau_private.h
index 784afc91..39758d18 100644
--- a/nouveau/nouveau_private.h
+++ b/nouveau/nouveau_private.h
@@ -64,6 +64,8 @@ struct nouveau_pushbuf_priv {
int
nouveau_pushbuf_init(struct nouveau_channel *);
+void
+nouveau_pushbuf_fini(struct nouveau_channel *);
struct nouveau_channel_priv {
struct nouveau_channel base;
diff --git a/nouveau/nouveau_pushbuf.c b/nouveau/nouveau_pushbuf.c
index b90e9234..7da3a47a 100644
--- a/nouveau/nouveau_pushbuf.c
+++ b/nouveau/nouveau_pushbuf.c
@@ -80,13 +80,13 @@ nouveau_pushbuf_space(struct nouveau_channel *chan, unsigned min)
nvpb->pushbuf = NULL;
}
- nvpb->size = min < PB_MIN_USER_DWORDS ? PB_MIN_USER_DWORDS : min;
+ nvpb->size = min < PB_MIN_USER_DWORDS ? PB_MIN_USER_DWORDS : min;
nvpb->pushbuf = malloc(sizeof(uint32_t) * nvpb->size);
nvpb->base.channel = chan;
nvpb->base.remaining = nvpb->size;
nvpb->base.cur = nvpb->pushbuf;
-
+
return 0;
}
@@ -165,11 +165,21 @@ nouveau_pushbuf_init(struct nouveau_channel *chan)
sizeof(struct drm_nouveau_gem_pushbuf_bo));
nvpb->relocs = calloc(NOUVEAU_GEM_MAX_RELOCS,
sizeof(struct drm_nouveau_gem_pushbuf_reloc));
-
+
chan->pushbuf = &nvpb->base;
return 0;
}
+void
+nouveau_pushbuf_fini(struct nouveau_channel *chan)
+{
+ struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
+ struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
+ nouveau_pushbuf_fini_call(chan);
+ free(nvpb->buffers);
+ free(nvpb->relocs);
+}
+
int
nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
{