diff options
author | Marcin Slusarz <[email protected]> | 2012-06-05 23:26:05 +0200 |
---|---|---|
committer | Marcin Slusarz <[email protected]> | 2012-06-05 23:58:43 +0200 |
commit | 17e047242e82111859eb8220369c601c79a26350 (patch) | |
tree | 55f96793192a87f0d0e998abaf3bd2845ecbbc1c /src/gallium/drivers/nouveau | |
parent | 3232a86efe76df9fcee869c4ed4af8d68824920c (diff) |
nouveau: fix scratch buffer leak
...and create common function for destroying nouveau_context
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_context.h | 12 |
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 |