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; }
void gpu_query_free (gpuQueryP p) { int i; if (p) { for (i = 0; i < NCONTEXTS; i++) gpu_context_free (p->contexts[i]); if (p->program) clReleaseProgram (p->program); free (p); } }