int etna_free(struct etna_ctx *ctx) { if(ctx == NULL) return ETNA_INVALID_ADDR; /* Free kernel command queue */ etna_queue_free(ctx->queue); #ifdef GCABI_HAS_CONTEXT /* Free context buffer */ etna_bo_del(ctx->conn, ctx->ctx_bo, NULL); #endif /* Free command buffers */ for(int x=0; x<NUM_COMMAND_BUFFERS; ++x) { viv_user_signal_destroy(ctx->conn, ctx->cmdbufi[x].sig_id); etna_bo_del(ctx->conn, ctx->cmdbufi[x].bo, NULL); ETNA_FREE(ctx->cmdbuf[x]); } viv_user_signal_destroy(ctx->conn, ctx->sig_id); #ifndef GCABI_HAS_CONTEXT gpu_context_free(ctx); #endif ETNA_FREE(ctx); return ETNA_OK; }
int etna_free(struct etna_ctx *ctx) { if(ctx == NULL) return ETNA_INVALID_ADDR; /* Free kernel command queue */ etna_queue_free(ctx->queue); #ifdef GCABI_HAVE_CONTEXT /* Free context buffer */ gpu_context_free_buffer(ctx, &ctx->ctx_info, false); #endif /* Free command buffers */ for(int x=0; x<NUM_COMMAND_BUFFERS; ++x) { viv_free_contiguous(ctx->conn, ctx->cmdbufi[x].bytes, (viv_addr_t)ctx->cmdbufi[x].physical, VIV_TO_PTR(ctx->cmdbufi[x].logical)); ETNA_FREE(ctx->cmdbuf[x]); } ETNA_FREE(ctx); return ETNA_OK; }