Mesa (master): nouveau: fix some pipe_buffer reference counting issues
Ben Skeggs
darktama at kemper.freedesktop.org
Tue Mar 24 19:12:47 PDT 2009
Module: Mesa
Branch: master
Commit: 88b19bbe651e4362d0bc96eb6ec10218c2ef6cf2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=88b19bbe651e4362d0bc96eb6ec10218c2ef6cf2
Author: Ben Skeggs <bskeggs at redhat.com>
Date: Wed Mar 25 12:09:58 2009 +1000
nouveau: fix some pipe_buffer reference counting issues
---
src/gallium/drivers/nouveau/nouveau_stateobj.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 9785911..a54820e 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -46,9 +46,12 @@ static INLINE void
so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
{
struct nouveau_stateobj *so = *pso;
+ int i;
if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
free(so->push);
+ for (i = 0; i < so->cur_reloc; i++)
+ pipe_buffer_reference(&so->reloc[i].bo, NULL);
free(so->reloc);
free(so);
}
@@ -83,7 +86,8 @@ so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo,
{
struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++];
- r->bo = bo;
+ r->bo = NULL;
+ pipe_buffer_reference(&r->bo, bo);
r->offset = so->cur - so->push;
r->packet = so->cur_packet;
r->data = data;
More information about the mesa-commit
mailing list