Exemplo n.º 1
0
static struct nvhost_hwctx *ctx3d_alloc(struct nvhost_channel *ch)
{
	struct nvhost_hwctx *ctx;
	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
	if (!ctx)
		return NULL;
	ctx->restore = nvmap_alloc(context_restore_size * 4, 32,
				NVMEM_HANDLE_WRITE_COMBINE,
				(void**)&ctx->save_cpu_data);
	if (IS_ERR_OR_NULL(ctx->restore)) {
		kfree(ctx);
		return NULL;
	}
	setup_restore(ctx->save_cpu_data, NVWAITBASE_3D);
	ctx->channel = ch;
	ctx->restore_phys = nvmap_pin_single(ctx->restore);
	ctx->restore_size = context_restore_size;
	ctx->save = context_save_buf;
	ctx->save_phys = context_save_phys;
	ctx->save_size = context_save_size;
	ctx->save_incrs = 3;
	ctx->restore_incrs = 1;
	ctx->valid = false;
	kref_init(&ctx->ref);
	return ctx;
}
Exemplo n.º 2
0
int __init nvhost_3dctx_handler_init(struct nvhost_hwctx_handler *h)
{
	setup_save(NULL, &context_save_size, &context_restore_size, 0, 0);

	context_save_buf = nvmap_alloc(context_save_size * 4, 32,
				NVMEM_HANDLE_WRITE_COMBINE,
				(void**)&context_save_ptr);
	if (IS_ERR_OR_NULL(context_save_buf))
		return PTR_ERR(context_save_buf);
	context_save_phys = nvmap_pin_single(context_save_buf);
	setup_save(context_save_ptr, NULL, NULL, NVSYNCPT_3D, NVWAITBASE_3D);

	h->init = ctx3d_init;
	h->deinit = ctx3d_deinit;
	h->save_service = ctx3d_save_service;
	return 0;
}
Exemplo n.º 3
0
static int ctx3d_init(struct nvhost_hwctx *ctx)
{
	ctx->restore = nvmap_alloc(context_restore_size * 4, 32,
				NVMEM_HANDLE_WRITE_COMBINE,
				(void**)&ctx->save_cpu_data);
	if (IS_ERR_OR_NULL(ctx->restore))
		return PTR_ERR(ctx->restore);

	setup_restore(ctx->save_cpu_data, NVWAITBASE_3D);
	ctx->restore_phys = nvmap_pin_single(ctx->restore);
	ctx->restore_size = context_restore_size;
	ctx->save = context_save_buf;
	ctx->save_phys = context_save_phys;
	ctx->save_size = context_save_size;
	ctx->save_incrs = 3;
	ctx->restore_incrs = 1;
	ctx->valid = false;
	return 0;
}