Exemplo n.º 1
0
void nvrm_device_set_pb_pointer_found(struct gpu_object *obj, bool pb_pointer_found)
{
	struct gpu_object *dev = nvrm_get_device(obj);

	assert(dev);
	struct nvrm_device *ndev = nvrm_dev(dev);
	if (!ndev) {
		nvrm_get_chipset(obj);
		ndev = nvrm_dev(dev);
	}
	assert(ndev);
	ndev->pb_pointer_found = pb_pointer_found;
}
Exemplo n.º 2
0
bool nvrm_get_pb_pointer_found(struct gpu_object *obj)
{
	struct gpu_object *dev = nvrm_get_device(obj);

	assert(dev);

	struct nvrm_device *ndev = nvrm_dev(dev);
	assert(ndev);
	if (!ndev)
		return false;

	return ndev->pb_pointer_found;
}
Exemplo n.º 3
0
int nvrm_get_chipset(struct gpu_object *obj)
{
	struct gpu_object *dev = nvrm_get_device(obj);

	if (dev && dev->class_data)
		return nvrm_dev(dev)->chipset;

	if (chipset)
		return chipset;

	mmt_error("Can't detect chipset, you need to use -m option or regenerate trace with newer mmt (> Sep 7 2014)%s\n", "");
	demmt_abort();
}
Exemplo n.º 4
0
static struct gpu_object *nvrm_add_object(uint32_t fd, uint32_t cid, uint32_t parent, uint32_t handle, uint32_t class_)
{
	struct gpu_object *obj = gpu_object_add(fd, cid, parent, handle, class_);
	if (dump_object_tree_on_create_destroy)
	{
		mmt_log("Object tree after create: %s\n", "");
		dump_object_trees(obj);
	}

	if (is_fifo_ib_class(class_) || is_fifo_dma_class(class_))
	{
		struct gpu_object *dev = nvrm_get_device(obj);
		if (dev && dev->class_data)
			nvrm_dev(dev)->fifos++;
	}

	return obj;
}
Exemplo n.º 5
0
static void nvrm_destroy_gpu_object(uint32_t fd, uint32_t cid, uint32_t parent, uint32_t handle)
{
	struct gpu_object *obj = gpu_object_find(cid, handle);
	if (obj == NULL)
	{
		uint16_t cl = handle & 0xffff;
		// userspace deletes objects which it didn't create and kernel returns SUCCESS :/
		// just ignore known offenders
		switch (cl)
		{
			case 0x0014:
			case 0x0202:
			case 0x0301:
			case 0x0308:
			case 0x0360:
			case 0x0371:
			case 0x1e00:
			case 0x1e01:
			case 0x1e10:
			case 0x1e20:
				break;
			default:
				mmt_error("trying to destroy object 0x%08x / 0x%08x which does not exist!\n", cid, handle);
		}
		return;
	}

	if (dump_object_tree_on_create_destroy)
	{
		mmt_log("Object tree before destroy: %s\n", "");
		dump_object_trees(obj);
	}

	if (is_fifo_ib_class(obj->class_) || is_fifo_dma_class(obj->class_))
	{
		struct gpu_object *dev = nvrm_get_device(obj);
		if (dev && dev->class_data)
			nvrm_dev(dev)->fifos--;
	}

	gpu_object_destroy(obj);
}
Exemplo n.º 6
0
struct gpu_object *nvrm_get_fifo(struct gpu_object *obj, uint64_t gpu_addr, int strict)
{
	struct gpu_object *last = NULL;
	while (obj)
	{
		if (is_fifo(obj, 0))
			last = obj;
		if (is_fifo_and_addr_belongs(obj, gpu_addr))
			return obj;
		if (obj->class_ == NVRM_DEVICE_0)
		{
			struct gpu_object *fifo = nvrm_find_object_by_func(obj, is_fifo_and_addr_belongs, gpu_addr);
			if (!fifo && !strict) // fallback, for traces without ioctl_create args
			{
				fifo = nvrm_find_object_by_func(obj, is_fifo, 0);

				struct gpu_object *dev = nvrm_get_device(obj);
				int fifos = 0;
				if (dev && dev->class_data)
					fifos = nvrm_dev(dev)->fifos;

				static int warned = 0;
				if (fifos > 1 && !warned)
				{
					int chipset = nvrm_get_chipset(dev);
					if (chipset > 0x80 || chipset == 0x50)
						mmt_error("This trace may not be decoded accurately because there are multiple fifo objects "
								"and ioctl_creates for some of them were not captured with argument data%s\n", "");
					else
						mmt_error("This trace may not be decoded accurately because there are multiple fifo objects "
								"and USER buffer detection is not implemented yet%s\n", "");
					warned = 1;
				}
			}
			return fifo;
		}

		obj = obj->parent_object;
	}

	return last;
}
Exemplo n.º 7
0
static void handle_nvrm_ioctl_call(struct nvrm_ioctl_call *s, struct mmt_memory_dump *args, int argc)
{
	struct mmt_buf *data = find_ptr(s->ptr, args, argc);
	if (!data)
		return;

	if (s->mthd == NVRM_MTHD_FIFO_IB_OBJECT_INFO || s->mthd == NVRM_MTHD_FIFO_IB_OBJECT_INFO2)
	{
		struct nvrm_mthd_fifo_ib_object_info *mthd_data = (void *) data->data;
		struct gpu_object *obj = gpu_object_find(s->cid, s->handle);
		pushbuf_add_object_name(mthd_data->handle, mthd_data->name, obj);
	}
	else if (s->mthd == NVRM_MTHD_SUBDEVICE_GET_CHIPSET)
	{
		struct nvrm_mthd_subdevice_get_chipset *mthd_data = (void *) data->data;
		struct gpu_object *obj = gpu_object_find(s->cid, s->handle);
		if (obj)
			obj = nvrm_get_device(obj);
		if (obj)
			nvrm_device_set_chipset(obj, mthd_data->major | mthd_data->minor);
	}
}