• Home
  • Raw
  • Download

Lines Matching refs:vc4

42 static void vc4_bo_stats_print(struct drm_printer *p, struct vc4_dev *vc4)  in vc4_bo_stats_print()  argument
46 for (i = 0; i < vc4->num_labels; i++) { in vc4_bo_stats_print()
47 if (!vc4->bo_labels[i].num_allocated) in vc4_bo_stats_print()
51 vc4->bo_labels[i].name, in vc4_bo_stats_print()
52 vc4->bo_labels[i].size_allocated / 1024, in vc4_bo_stats_print()
53 vc4->bo_labels[i].num_allocated); in vc4_bo_stats_print()
56 mutex_lock(&vc4->purgeable.lock); in vc4_bo_stats_print()
57 if (vc4->purgeable.num) in vc4_bo_stats_print()
59 vc4->purgeable.size / 1024, vc4->purgeable.num); in vc4_bo_stats_print()
61 if (vc4->purgeable.purged_num) in vc4_bo_stats_print()
63 vc4->purgeable.purged_size / 1024, in vc4_bo_stats_print()
64 vc4->purgeable.purged_num); in vc4_bo_stats_print()
65 mutex_unlock(&vc4->purgeable.lock); in vc4_bo_stats_print()
72 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_stats_debugfs() local
75 vc4_bo_stats_print(&p, vc4); in vc4_bo_stats_debugfs()
88 static int vc4_get_user_label(struct vc4_dev *vc4, const char *name) in vc4_get_user_label() argument
93 for (i = 0; i < vc4->num_labels; i++) { in vc4_get_user_label()
94 if (!vc4->bo_labels[i].name) { in vc4_get_user_label()
96 } else if (strcmp(vc4->bo_labels[i].name, name) == 0) { in vc4_get_user_label()
103 WARN_ON(vc4->bo_labels[free_slot].num_allocated != 0); in vc4_get_user_label()
104 vc4->bo_labels[free_slot].name = name; in vc4_get_user_label()
107 u32 new_label_count = vc4->num_labels + 1; in vc4_get_user_label()
109 krealloc(vc4->bo_labels, in vc4_get_user_label()
118 free_slot = vc4->num_labels; in vc4_get_user_label()
119 vc4->bo_labels = new_labels; in vc4_get_user_label()
120 vc4->num_labels = new_label_count; in vc4_get_user_label()
122 vc4->bo_labels[free_slot].name = name; in vc4_get_user_label()
123 vc4->bo_labels[free_slot].num_allocated = 0; in vc4_get_user_label()
124 vc4->bo_labels[free_slot].size_allocated = 0; in vc4_get_user_label()
133 struct vc4_dev *vc4 = to_vc4_dev(gem_obj->dev); in vc4_bo_set_label() local
135 lockdep_assert_held(&vc4->bo_lock); in vc4_bo_set_label()
138 vc4->bo_labels[label].num_allocated++; in vc4_bo_set_label()
139 vc4->bo_labels[label].size_allocated += gem_obj->size; in vc4_bo_set_label()
142 vc4->bo_labels[bo->label].num_allocated--; in vc4_bo_set_label()
143 vc4->bo_labels[bo->label].size_allocated -= gem_obj->size; in vc4_bo_set_label()
145 if (vc4->bo_labels[bo->label].num_allocated == 0 && in vc4_bo_set_label()
152 kfree(vc4->bo_labels[bo->label].name); in vc4_bo_set_label()
153 vc4->bo_labels[bo->label].name = NULL; in vc4_bo_set_label()
167 struct vc4_dev *vc4 = to_vc4_dev(obj->dev); in vc4_bo_destroy() local
169 lockdep_assert_held(&vc4->bo_lock); in vc4_bo_destroy()
185 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); in vc4_bo_remove_from_cache() local
187 lockdep_assert_held(&vc4->bo_lock); in vc4_bo_remove_from_cache()
195 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_get_cache_list_for_size() local
198 if (vc4->bo_cache.size_list_size <= page_index) { in vc4_get_cache_list_for_size()
199 uint32_t new_size = max(vc4->bo_cache.size_list_size * 2, in vc4_get_cache_list_for_size()
212 for (i = 0; i < vc4->bo_cache.size_list_size; i++) { in vc4_get_cache_list_for_size()
214 &vc4->bo_cache.size_list[i]; in vc4_get_cache_list_for_size()
222 for (i = vc4->bo_cache.size_list_size; i < new_size; i++) in vc4_get_cache_list_for_size()
225 kfree(vc4->bo_cache.size_list); in vc4_get_cache_list_for_size()
226 vc4->bo_cache.size_list = new_list; in vc4_get_cache_list_for_size()
227 vc4->bo_cache.size_list_size = new_size; in vc4_get_cache_list_for_size()
230 return &vc4->bo_cache.size_list[page_index]; in vc4_get_cache_list_for_size()
235 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_cache_purge() local
237 mutex_lock(&vc4->bo_lock); in vc4_bo_cache_purge()
238 while (!list_empty(&vc4->bo_cache.time_list)) { in vc4_bo_cache_purge()
239 struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, in vc4_bo_cache_purge()
244 mutex_unlock(&vc4->bo_lock); in vc4_bo_cache_purge()
249 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); in vc4_bo_add_to_purgeable_pool() local
251 mutex_lock(&vc4->purgeable.lock); in vc4_bo_add_to_purgeable_pool()
252 list_add_tail(&bo->size_head, &vc4->purgeable.list); in vc4_bo_add_to_purgeable_pool()
253 vc4->purgeable.num++; in vc4_bo_add_to_purgeable_pool()
254 vc4->purgeable.size += bo->base.base.size; in vc4_bo_add_to_purgeable_pool()
255 mutex_unlock(&vc4->purgeable.lock); in vc4_bo_add_to_purgeable_pool()
260 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); in vc4_bo_remove_from_purgeable_pool_locked() local
275 vc4->purgeable.num--; in vc4_bo_remove_from_purgeable_pool_locked()
276 vc4->purgeable.size -= bo->base.base.size; in vc4_bo_remove_from_purgeable_pool_locked()
281 struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); in vc4_bo_remove_from_purgeable_pool() local
283 mutex_lock(&vc4->purgeable.lock); in vc4_bo_remove_from_purgeable_pool()
285 mutex_unlock(&vc4->purgeable.lock); in vc4_bo_remove_from_purgeable_pool()
305 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_userspace_cache_purge() local
307 mutex_lock(&vc4->purgeable.lock); in vc4_bo_userspace_cache_purge()
308 while (!list_empty(&vc4->purgeable.list)) { in vc4_bo_userspace_cache_purge()
309 struct vc4_bo *bo = list_first_entry(&vc4->purgeable.list, in vc4_bo_userspace_cache_purge()
321 mutex_unlock(&vc4->purgeable.lock); in vc4_bo_userspace_cache_purge()
340 mutex_lock(&vc4->purgeable.lock); in vc4_bo_userspace_cache_purge()
343 vc4->purgeable.purged_size += purged_size; in vc4_bo_userspace_cache_purge()
344 vc4->purgeable.purged_num++; in vc4_bo_userspace_cache_purge()
347 mutex_unlock(&vc4->purgeable.lock); in vc4_bo_userspace_cache_purge()
354 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_get_from_cache() local
360 mutex_lock(&vc4->bo_lock); in vc4_bo_get_from_cache()
361 if (page_index >= vc4->bo_cache.size_list_size) in vc4_bo_get_from_cache()
364 if (list_empty(&vc4->bo_cache.size_list[page_index])) in vc4_bo_get_from_cache()
367 bo = list_first_entry(&vc4->bo_cache.size_list[page_index], in vc4_bo_get_from_cache()
375 mutex_unlock(&vc4->bo_lock); in vc4_bo_get_from_cache()
389 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_create_object() local
399 mutex_lock(&vc4->bo_lock); in vc4_create_object()
401 vc4->bo_labels[VC4_BO_TYPE_KERNEL].num_allocated++; in vc4_create_object()
402 vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size; in vc4_create_object()
403 mutex_unlock(&vc4->bo_lock); in vc4_create_object()
414 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_create() local
456 struct drm_printer p = drm_info_printer(vc4->base.dev); in vc4_bo_create()
458 vc4_bo_stats_print(&p, vc4); in vc4_bo_create()
469 mutex_lock(&vc4->bo_lock); in vc4_bo_create()
471 mutex_unlock(&vc4->bo_lock); in vc4_bo_create()
504 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_cache_free_old() local
507 lockdep_assert_held(&vc4->bo_lock); in vc4_bo_cache_free_old()
509 while (!list_empty(&vc4->bo_cache.time_list)) { in vc4_bo_cache_free_old()
510 struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, in vc4_bo_cache_free_old()
513 mod_timer(&vc4->bo_cache.time_timer, in vc4_bo_cache_free_old()
530 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_free_object() local
540 mutex_lock(&vc4->bo_lock); in vc4_free_object()
583 list_add(&bo->unref_head, &vc4->bo_cache.time_list); in vc4_free_object()
590 mutex_unlock(&vc4->bo_lock); in vc4_free_object()
595 struct vc4_dev *vc4 = in vc4_bo_cache_time_work() local
597 struct drm_device *dev = &vc4->base; in vc4_bo_cache_time_work()
599 mutex_lock(&vc4->bo_lock); in vc4_bo_cache_time_work()
601 mutex_unlock(&vc4->bo_lock); in vc4_bo_cache_time_work()
657 struct vc4_dev *vc4 = from_timer(vc4, t, bo_cache.time_timer); in vc4_bo_cache_time_timer() local
659 schedule_work(&vc4->bo_cache.time_work); in vc4_bo_cache_time_timer()
741 static int vc4_grab_bin_bo(struct vc4_dev *vc4, struct vc4_file *vc4file) in vc4_grab_bin_bo() argument
745 if (!vc4->v3d) in vc4_grab_bin_bo()
751 ret = vc4_v3d_bin_bo_get(vc4, &vc4file->bin_bo_used); in vc4_grab_bin_bo()
763 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_create_bo_ioctl() local
767 ret = vc4_grab_bin_bo(vc4, vc4file); in vc4_create_bo_ioctl()
812 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_create_shader_bo_ioctl() local
832 ret = vc4_grab_bin_bo(vc4, vc4file); in vc4_create_shader_bo_ioctl()
956 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_cache_init() local
963 vc4->bo_labels = kcalloc(VC4_BO_TYPE_COUNT, sizeof(*vc4->bo_labels), in vc4_bo_cache_init()
965 if (!vc4->bo_labels) in vc4_bo_cache_init()
967 vc4->num_labels = VC4_BO_TYPE_COUNT; in vc4_bo_cache_init()
971 vc4->bo_labels[i].name = bo_type_names[i]; in vc4_bo_cache_init()
973 mutex_init(&vc4->bo_lock); in vc4_bo_cache_init()
977 INIT_LIST_HEAD(&vc4->bo_cache.time_list); in vc4_bo_cache_init()
979 INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); in vc4_bo_cache_init()
980 timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0); in vc4_bo_cache_init()
987 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_bo_cache_destroy() local
990 del_timer(&vc4->bo_cache.time_timer); in vc4_bo_cache_destroy()
991 cancel_work_sync(&vc4->bo_cache.time_work); in vc4_bo_cache_destroy()
995 for (i = 0; i < vc4->num_labels; i++) { in vc4_bo_cache_destroy()
996 if (vc4->bo_labels[i].num_allocated) { in vc4_bo_cache_destroy()
999 vc4->bo_labels[i].num_allocated, in vc4_bo_cache_destroy()
1000 vc4->bo_labels[i].name); in vc4_bo_cache_destroy()
1004 kfree(vc4->bo_labels[i].name); in vc4_bo_cache_destroy()
1006 kfree(vc4->bo_labels); in vc4_bo_cache_destroy()
1012 struct vc4_dev *vc4 = to_vc4_dev(dev); in vc4_label_bo_ioctl() local
1032 mutex_lock(&vc4->bo_lock); in vc4_label_bo_ioctl()
1033 label = vc4_get_user_label(vc4, name); in vc4_label_bo_ioctl()
1038 mutex_unlock(&vc4->bo_lock); in vc4_label_bo_ioctl()