summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau/nouveau_stateobj.h
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-04 15:23:35 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-03-04 15:23:35 +0000
commit5b04939b16eb6e13858b070315dee1d0fc09d94f (patch)
tree0f8739ea6fa7219eaebbb9ff090f86713ef820e0 /src/gallium/drivers/nouveau/nouveau_stateobj.h
parentcfd5298f240612ef69ae321aebbc425710a8d731 (diff)
parentf9ce417aaf14c00e72e92307b910de5dbed1bb6d (diff)
Merge commit 'origin/master' into gallium-map-range
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_stateobj.h')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 029b01e17d..666e061ac3 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -16,7 +16,7 @@ struct nouveau_stateobj_reloc {
};
struct nouveau_stateobj {
- int refcount;
+ struct pipe_reference reference;
unsigned *push;
struct nouveau_stateobj_reloc *reloc;
@@ -32,7 +32,7 @@ so_new(unsigned push, unsigned reloc)
struct nouveau_stateobj *so;
so = MALLOC(sizeof(struct nouveau_stateobj));
- so->refcount = 0;
+ pipe_reference_init(&so->reference, 0);
so->push = MALLOC(sizeof(unsigned) * push);
so->reloc = MALLOC(sizeof(struct nouveau_stateobj_reloc) * reloc);
@@ -47,17 +47,11 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
{
struct nouveau_stateobj *so = *pso;
- if (ref) {
- ref->refcount++;
- }
-
- if (so && --so->refcount <= 0) {
+ if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
free(so->push);
free(so->reloc);
free(so);
}
-
- *pso = ref;
}
static INLINE void