summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_context.h')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h
index 531c6238b9f..b3fe05b1019 100644
--- a/src/gallium/drivers/nouveau/nouveau_context.h
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -2,6 +2,7 @@
#define __NOUVEAU_CONTEXT_H__
#include "pipe/p_context.h"
+#include <libdrm/nouveau.h>
#define NOUVEAU_MAX_SCRATCH_BUFS 4
@@ -72,4 +73,15 @@ void *
nouveau_scratch_get(struct nouveau_context *, unsigned size, uint64_t *gpu_addr,
struct nouveau_bo **);
+static INLINE void
+nouveau_context_destroy(struct nouveau_context *ctx)
+{
+ int i;
+
+ for (i = 0; i < NOUVEAU_MAX_SCRATCH_BUFS; ++i)
+ if (ctx->scratch.bo[i])
+ nouveau_bo_ref(NULL, &ctx->scratch.bo[i]);
+
+ FREE(ctx);
+}
#endif