Пример #1
0
int host1x_gr3d_init(struct host1x *host1x, struct host1x_gr3d *gr3d)
{
	int err;

	gr3d->commands = host1x_bo_create(host1x, 32 * 4096,
					  NVHOST_BO_FLAG_COMMAND_BUFFER);
	if (!gr3d->commands)
		return -ENOMEM;

	err = HOST1X_BO_MMAP(gr3d->commands, NULL);
	if (err < 0) {
		host1x_bo_free(gr3d->commands);
		return err;
	}

	gr3d->attributes = host1x_bo_create(host1x, 12 * 4096,
					    NVHOST_BO_FLAG_ATTRIBUTES);
	if (!gr3d->attributes) {
		host1x_bo_free(gr3d->commands);
		return -ENOMEM;
	}

	err = HOST1X_BO_MMAP(gr3d->attributes, NULL);
	if (err < 0) {
		host1x_bo_free(gr3d->attributes);
		host1x_bo_free(gr3d->commands);
		return err;
	}

	if (HOST1X_GR3D_TEST) {
		err = host1x_gr3d_test(gr3d);
		if (err < 0) {
			host1x_error("host1x_gr3d_test() failed: %d\n", err);
			host1x_bo_free(gr3d->attributes);
			host1x_bo_free(gr3d->commands);
			return err;
		}
	}

	err = host1x_gr3d_reset(gr3d);
	if (err < 0) {
		host1x_bo_free(gr3d->attributes);
		host1x_bo_free(gr3d->commands);
		return err;
	}

	return 0;
}
Пример #2
0
int host1x_gr3d_init(struct host1x *host1x, struct host1x_gr3d *gr3d)
{
	int err;

	gr3d->commands = host1x_bo_create(host1x, 32 * 4096, 2);
	if (!gr3d->commands)
		return -ENOMEM;

	err = host1x_bo_mmap(gr3d->commands, NULL);
	if (err < 0) {
		host1x_bo_free(gr3d->commands);
		return err;
	}

	gr3d->attributes = host1x_bo_create(host1x, 12 * 4096, 4);
	if (!gr3d->attributes) {
		host1x_bo_free(gr3d->commands);
		return -ENOMEM;
	}

	err = host1x_bo_mmap(gr3d->attributes, NULL);
	if (err < 0) {
		host1x_bo_free(gr3d->attributes);
		host1x_bo_free(gr3d->commands);
		return err;
	}

	if (HOST1X_GR3D_TEST) {
		err = host1x_gr3d_test(gr3d);
		if (err < 0) {
			fprintf(stderr, "host1x_gr3d_test() failed: %d\n",
				err);
			host1x_bo_free(gr3d->attributes);
			host1x_bo_free(gr3d->commands);
			return err;
		}
	}

	err = host1x_gr3d_reset(gr3d);
	if (err < 0) {
		host1x_bo_free(gr3d->attributes);
		host1x_bo_free(gr3d->commands);
		return err;
	}

	return 0;
}