aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYounes Manton2009-12-28 17:00:09 -0600
committerYounes Manton2009-12-28 17:07:08 -0600
commitcd2e4ba9aac65d10cf790990a8b86feed1cdd774 (patch)
treef285499979532c0b762ff2ce99145fe9f0b94099 /nouveau
parentcb1caaaa05ba96b98bf9af1190f6830d8b0608bc (diff)
downloadlibdrm-cd2e4ba9aac65d10cf790990a8b86feed1cdd774.tar.gz
libdrm-cd2e4ba9aac65d10cf790990a8b86feed1cdd774.tar.xz
libdrm-cd2e4ba9aac65d10cf790990a8b86feed1cdd774.zip
nouveau: Unreference pushbuf objects on channel destruction.
- unreference pushbuf objects on channel destruction Based on Krzysztof Smiechowicz's patch.
Diffstat (limited to 'nouveau')
-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)
111 111
112 FIRE_RING(&nvchan->base); 112 FIRE_RING(&nvchan->base);
113 113
114 nouveau_pushbuf_fini(&nvchan->base);
114 nouveau_bo_unmap(nvchan->notifier_bo); 115 nouveau_bo_unmap(nvchan->notifier_bo);
115 nouveau_bo_ref(NULL, &nvchan->notifier_bo); 116 nouveau_bo_ref(NULL, &nvchan->notifier_bo);
116 117
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 {
64 64
65int 65int
66nouveau_pushbuf_init(struct nouveau_channel *); 66nouveau_pushbuf_init(struct nouveau_channel *);
67void
68nouveau_pushbuf_fini(struct nouveau_channel *);
67 69
68struct nouveau_channel_priv { 70struct nouveau_channel_priv {
69 struct nouveau_channel base; 71 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)
80 nvpb->pushbuf = NULL; 80 nvpb->pushbuf = NULL;
81 } 81 }
82 82
83 nvpb->size = min < PB_MIN_USER_DWORDS ? PB_MIN_USER_DWORDS : min; 83 nvpb->size = min < PB_MIN_USER_DWORDS ? PB_MIN_USER_DWORDS : min;
84 nvpb->pushbuf = malloc(sizeof(uint32_t) * nvpb->size); 84 nvpb->pushbuf = malloc(sizeof(uint32_t) * nvpb->size);
85 85
86 nvpb->base.channel = chan; 86 nvpb->base.channel = chan;
87 nvpb->base.remaining = nvpb->size; 87 nvpb->base.remaining = nvpb->size;
88 nvpb->base.cur = nvpb->pushbuf; 88 nvpb->base.cur = nvpb->pushbuf;
89 89
90 return 0; 90 return 0;
91} 91}
92 92
@@ -165,11 +165,21 @@ nouveau_pushbuf_init(struct nouveau_channel *chan)
165 sizeof(struct drm_nouveau_gem_pushbuf_bo)); 165 sizeof(struct drm_nouveau_gem_pushbuf_bo));
166 nvpb->relocs = calloc(NOUVEAU_GEM_MAX_RELOCS, 166 nvpb->relocs = calloc(NOUVEAU_GEM_MAX_RELOCS,
167 sizeof(struct drm_nouveau_gem_pushbuf_reloc)); 167 sizeof(struct drm_nouveau_gem_pushbuf_reloc));
168 168
169 chan->pushbuf = &nvpb->base; 169 chan->pushbuf = &nvpb->base;
170 return 0; 170 return 0;
171} 171}
172 172
173void
174nouveau_pushbuf_fini(struct nouveau_channel *chan)
175{
176 struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
177 struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
178 nouveau_pushbuf_fini_call(chan);
179 free(nvpb->buffers);
180 free(nvpb->relocs);
181}
182
173int 183int
174nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min) 184nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
175{ 185{