summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h14
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h7
2 files changed, 8 insertions, 13 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 4ae4ff4..9785911 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -1,7 +1,7 @@
#ifndef __NOUVEAU_STATEOBJ_H__
#define __NOUVEAU_STATEOBJ_H__
-#include "pipe/p_debug.h"
+#include "util/u_debug.h"
struct nouveau_stateobj_reloc {
struct pipe_buffer *bo;
@@ -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, 1);
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
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index b86c4b9..ff7dd1c 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -19,11 +19,12 @@
#define NOUVEAU_TEXTURE_USAGE_LINEAR (1 << 16)
-#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
-#define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
+#define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_TRANSFER (1 << 18)
struct nouveau_winsys {
- struct nouveau_context *nv;
+ struct pipe_winsys *ws;
struct nouveau_channel *channel;