Lines Matching refs:device

46 bo_dump_stats(struct v3dv_device *device)
48 struct v3dv_bo_cache *cache = &device->bo_cache;
50 fprintf(stderr, " BOs allocated: %d\n", device->bo_count);
51 fprintf(stderr, " BOs size: %dkb\n", device->bo_size / 1024);
95 bo_from_cache(struct v3dv_device *device, uint32_t size, const char *name)
97 struct v3dv_bo_cache *cache = &device->bo_cache;
114 if (!v3dv_bo_wait(device, bo, 0)) {
128 bo_free(struct v3dv_device *device,
140 int ret = v3dv_ioctl(device->pdevice->render_fd, DRM_IOCTL_GEM_CLOSE, &c);
144 device->bo_count--;
145 device->bo_size -= bo->size;
152 bo_dump_stats(device);
155 /* Our BO structs are stored in a sparse array in the physical device,
165 bo_cache_free_all(struct v3dv_device *device,
168 struct v3dv_bo_cache *cache = &device->bo_cache;
175 bo_free(device, bo);
204 v3dv_bo_alloc(struct v3dv_device *device,
215 bo = bo_from_cache(device, size, name);
220 bo_dump_stats(device);
234 int ret = v3dv_ioctl(device->pdevice->render_fd,
237 if (!list_is_empty(&device->bo_cache.time_list) &&
240 bo_cache_free_all(device, true);
244 fprintf(stderr, "Failed to allocate device memory for BO\n");
251 bo = v3dv_device_lookup_bo(device->pdevice, create.handle);
256 device->bo_count++;
257 device->bo_size += bo->size;
260 bo_dump_stats(device);
267 v3dv_bo_map_unsynchronized(struct v3dv_device *device,
279 int ret = v3dv_ioctl(device->pdevice->render_fd,
287 device->pdevice->render_fd, map.offset);
301 v3dv_bo_wait(struct v3dv_device *device,
309 return v3dv_ioctl(device->pdevice->render_fd,
314 v3dv_bo_map(struct v3dv_device *device, struct v3dv_bo *bo, uint32_t size)
318 bool ok = v3dv_bo_map_unsynchronized(device, bo, size);
322 ok = v3dv_bo_wait(device, bo, PIPE_TIMEOUT_INFINITE);
332 v3dv_bo_unmap(struct v3dv_device *device, struct v3dv_bo *bo)
344 struct v3dv_device *device,
348 vk_alloc(&device->vk.alloc, sizeof(struct list_head) * size, 8,
376 vk_free(&device->vk.alloc, old_list);
382 v3dv_bo_cache_init(struct v3dv_device *device)
384 device->bo_size = 0;
385 device->bo_count = 0;
386 list_inithead(&device->bo_cache.time_list);
390 device->bo_cache.size_list_size = 0;
394 device->bo_cache.max_cache_size = DEFAULT_MAX_BO_CACHE_SIZE;
396 device->bo_cache.max_cache_size = atoll(max_cache_size_str);
399 fprintf(stderr, "MAX BO CACHE SIZE: %iMB\n", device->bo_cache.max_cache_size);
402 device->bo_cache.max_cache_size *= 1024 * 1024;
403 device->bo_cache.cache_count = 0;
404 device->bo_cache.cache_size = 0;
408 v3dv_bo_cache_destroy(struct v3dv_device *device)
410 bo_cache_free_all(device, true);
411 vk_free(&device->vk.alloc, device->bo_cache.size_list);
415 bo_dump_stats(device);
421 free_stale_bos(struct v3dv_device *device,
424 struct v3dv_bo_cache *cache = &device->bo_cache;
433 bo_dump_stats(device);
438 bo_free(device, bo);
446 bo_dump_stats(device);
451 v3dv_bo_free(struct v3dv_device *device,
461 v3dv_bo_unmap(device, bo);
464 struct v3dv_bo_cache *cache = &device->bo_cache;
471 free_stale_bos(device, time.tv_sec);
477 return bo_free(device, bo);
484 if (!reallocate_size_list(cache, device, page_index + 1)) {
485 bool outcome = bo_free(device, bo);
490 bo_cache_free_all(device, false);
506 bo_dump_stats(device);
510 free_stale_bos(device, time.tv_sec);