Example #1
0
bool
hsp_delete_context(uint64 ctxId)
{
	TRACE("%s(ctxId: %d)\n", __FUNCTION__, ctxId);
	struct hsp_context *ctx = NULL;
	bool ret = false;

	if (!hsp_dev) {
		TRACE("%s> there's no hsp_dev so nothing to do\n",
			__FUNCTION__);
		return false;
	}

	pipe_mutex_lock(hsp_dev->mutex);

	ctx = hsp_lookup_context(ctxId);
	if (ctx) {
		TRACE("%s> found context: %p\n", __FUNCTION__, ctx);
		GLcontext *glctx = ctx->st->ctx;
		GET_CURRENT_CONTEXT(glcurctx);

		if (glcurctx == glctx)
			st_make_current(NULL, NULL, NULL);

		if (ctx->draw) {
			TRACE("%s> found context draw framebuffer, destroying: %p\n",
				__FUNCTION__, ctx->draw);
			framebuffer_destroy(ctx->draw);
		}
		if (ctx->read) {
			TRACE("%s> found context read framebuffer, destroying: %p\n",
				__FUNCTION__, ctx->read);
			framebuffer_destroy(ctx->read);
		}

		#warning TODO: destroy ctx->bitmap here ?
		
		st_destroy_context(ctx->st);

		FREE(ctx);

		hsp_dev->ctx_array[ctxId - 1].ctx = NULL;
		ret = true;
	}

	pipe_mutex_unlock(hsp_dev->mutex);
	return ret;
}
Example #2
0
void ppmoutput_cleanup_frame( stream_node_t *node, framebuffer_t *frame )
{
    // Either destroy the frame or insert it in the output buffer
    if( node->output == NULL )
    {
        framebuffer_destroy( frame );
        free( frame );
    }
    else
    {
        buffer_insert( node->output, frame );
    }
}