#define __NOUVEAU_CONTEXT_H__
#include "pipe/p_context.h"
+#include <libdrm/nouveau.h>
#define NOUVEAU_MAX_SCRATCH_BUFS 4
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
if (nv30->screen->cur_ctx == nv30)
nv30->screen->cur_ctx = NULL;
- FREE(nv30);
+ nouveau_context_destroy(&nv30->base);
}
#define FAIL_CONTEXT_INIT(str, err) \