struct nouveau_bo *
nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes)
{
	struct nouveau_device *dev = nouveau_screen(pscreen)->device;
	struct nouveau_bo *bo = NULL;
	int ret;

	ret = nouveau_bo_user(dev, ptr, bytes, &bo);
	if (ret)
		return NULL;

	return bo;
}
Beispiel #2
0
static struct pipe_buffer *
nouveau_pipe_bo_user_create(struct pipe_winsys *ws, void *ptr, unsigned bytes)
{
	struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws);
	struct nouveau_device *dev = nvpws->channel->device;
	struct nouveau_pipe_buffer *nvbuf;

	nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer);
	if (!nvbuf)
		return NULL;
	pipe_reference_init(&nvbuf->base.reference, 1);
	nvbuf->base.size = bytes;

	if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) {
		FREE(nvbuf);
		return NULL;
	}

	return &nvbuf->base;
}