Lines Matching refs:bo_gem

417         struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo;  in mos_gem_dump_validation_list()  local
419 if (bo_gem->relocs == nullptr || bo_gem->softpin_target == nullptr) { in mos_gem_dump_validation_list()
420 MOS_DBG("%2d: %d %s(%s)\n", i, bo_gem->gem_handle, in mos_gem_dump_validation_list()
421 bo_gem->is_softpin ? "*" : "", in mos_gem_dump_validation_list()
422 bo_gem->name); in mos_gem_dump_validation_list()
426 for (j = 0; j < bo_gem->reloc_count; j++) { in mos_gem_dump_validation_list()
427 struct mos_linux_bo *target_bo = bo_gem->reloc_target_info[j].bo; in mos_gem_dump_validation_list()
434 bo_gem->gem_handle, in mos_gem_dump_validation_list()
435 bo_gem->is_softpin ? "*" : "", in mos_gem_dump_validation_list()
436 bo_gem->name, in mos_gem_dump_validation_list()
437 upper_32_bits(bo_gem->relocs[j].offset), in mos_gem_dump_validation_list()
438 lower_32_bits(bo_gem->relocs[j].offset), in mos_gem_dump_validation_list()
443 bo_gem->relocs[j].delta); in mos_gem_dump_validation_list()
446 for (j = 0; j < bo_gem->softpin_target_count; j++) { in mos_gem_dump_validation_list()
447 struct mos_linux_bo *target_bo = bo_gem->softpin_target[j]; in mos_gem_dump_validation_list()
453 bo_gem->gem_handle, in mos_gem_dump_validation_list()
454 bo_gem->is_softpin ? "*" : "", in mos_gem_dump_validation_list()
455 bo_gem->name, in mos_gem_dump_validation_list()
467 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_reference() local
469 atomic_inc(&bo_gem->refcount); in mos_gem_bo_reference()
484 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_add_validate_buffer() local
489 if (bo_gem->validate_index != -1) in mos_add_validate_buffer()
516 bo_gem->validate_index = index; in mos_add_validate_buffer()
518 bufmgr_gem->exec_objects[index].handle = bo_gem->gem_handle; in mos_add_validate_buffer()
519 bufmgr_gem->exec_objects[index].relocation_count = bo_gem->reloc_count; in mos_add_validate_buffer()
520 bufmgr_gem->exec_objects[index].relocs_ptr = (uintptr_t) bo_gem->relocs; in mos_add_validate_buffer()
531 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *)bo; in mos_add_validate_buffer2() local
539 if (bo_gem->pad_to_size) in mos_add_validate_buffer2()
541 if (bo_gem->use_48b_address_range) in mos_add_validate_buffer2()
543 if (bo_gem->is_softpin) in mos_add_validate_buffer2()
545 if (bo_gem->exec_async) in mos_add_validate_buffer2()
548 if (bo_gem->validate_index != -1) { in mos_add_validate_buffer2()
549 bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |= flags; in mos_add_validate_buffer2()
577 bo_gem->validate_index = index; in mos_add_validate_buffer2()
579 bufmgr_gem->exec2_objects[index].handle = bo_gem->gem_handle; in mos_add_validate_buffer2()
580 bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count; in mos_add_validate_buffer2()
581 bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs; in mos_add_validate_buffer2()
583 bufmgr_gem->exec2_objects[index].offset = bo_gem->is_softpin ? in mos_add_validate_buffer2()
588 bufmgr_gem->exec2_objects[index].pad_to_size = bo_gem->pad_to_size; in mos_add_validate_buffer2()
598 struct mos_bo_gem *bo_gem, in mos_bo_gem_set_in_aperture_size() argument
603 assert(!bo_gem->used_as_reloc_target); in mos_bo_gem_set_in_aperture_size()
611 size = bo_gem->bo.size; in mos_bo_gem_set_in_aperture_size()
613 bo_gem->reloc_tree_size = size + alignment; in mos_bo_gem_set_in_aperture_size()
619 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_setup_reloc_list() local
626 bo_gem->relocs = (struct drm_i915_gem_relocation_entry *)malloc(max_relocs * in mos_setup_reloc_list()
628 bo_gem->reloc_target_info = (struct mos_reloc_target *)malloc(max_relocs * in mos_setup_reloc_list()
630 if (bo_gem->relocs == nullptr || bo_gem->reloc_target_info == nullptr) { in mos_setup_reloc_list()
631 bo_gem->has_error = true; in mos_setup_reloc_list()
633 free (bo_gem->relocs); in mos_setup_reloc_list()
634 bo_gem->relocs = nullptr; in mos_setup_reloc_list()
636 free (bo_gem->reloc_target_info); in mos_setup_reloc_list()
637 bo_gem->reloc_target_info = nullptr; in mos_setup_reloc_list()
649 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_busy() local
653 if (bo_gem->reusable && bo_gem->idle) in mos_gem_bo_busy()
657 busy.handle = bo_gem->gem_handle; in mos_gem_bo_busy()
661 bo_gem->idle = !busy.busy; in mos_gem_bo_busy()
671 struct mos_bo_gem *bo_gem, int state) in mos_gem_bo_madvise_internal() argument
676 madv.handle = bo_gem->gem_handle; in mos_gem_bo_madvise_internal()
699 struct mos_bo_gem *bo_gem; in mos_gem_bo_cache_purge_bucket() local
701 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_gem_bo_cache_purge_bucket()
704 (bufmgr_gem, bo_gem, I915_MADV_DONTNEED)) in mos_gem_bo_cache_purge_bucket()
707 DRMLISTDEL(&bo_gem->head); in mos_gem_bo_cache_purge_bucket()
708 mos_gem_bo_free(&bo_gem->bo); in mos_gem_bo_cache_purge_bucket()
722 struct mos_bo_gem *bo_gem; in mos_gem_bo_alloc_internal() local
750 bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem)); in mos_gem_bo_alloc_internal()
751 if (!bo_gem) in mos_gem_bo_alloc_internal()
754 bo_gem->bo.size = bo_size; in mos_gem_bo_alloc_internal()
755 bo_gem->bo.handle = -1; in mos_gem_bo_alloc_internal()
756 bo_gem->bo.bufmgr = bufmgr; in mos_gem_bo_alloc_internal()
757 bo_gem->bo.align = alignment; in mos_gem_bo_alloc_internal()
759 bo_gem->bo.virt = malloc(bo_size); in mos_gem_bo_alloc_internal()
760 bo_gem->mem_virtual = bo_gem->bo.virt; in mos_gem_bo_alloc_internal()
762 bo_gem->bo.virtual = malloc(bo_size); in mos_gem_bo_alloc_internal()
763 bo_gem->mem_virtual = bo_gem->bo.virtual; in mos_gem_bo_alloc_internal()
766 atomic_set(&bo_gem->refcount, 1); in mos_gem_bo_alloc_internal()
769 return &bo_gem->bo; in mos_gem_bo_alloc_internal()
782 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_gem_bo_alloc_internal()
784 DRMLISTDEL(&bo_gem->head); in mos_gem_bo_alloc_internal()
786 bo_gem->bo.align = alignment; in mos_gem_bo_alloc_internal()
796 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_gem_bo_alloc_internal()
798 if (!mos_gem_bo_busy(&bo_gem->bo)) { in mos_gem_bo_alloc_internal()
800 DRMLISTDEL(&bo_gem->head); in mos_gem_bo_alloc_internal()
806 (bufmgr_gem, bo_gem, I915_MADV_WILLNEED)) { in mos_gem_bo_alloc_internal()
807 mos_gem_bo_free(&bo_gem->bo); in mos_gem_bo_alloc_internal()
813 if (mos_gem_bo_set_tiling_internal(&bo_gem->bo, in mos_gem_bo_alloc_internal()
816 mos_gem_bo_free(&bo_gem->bo); in mos_gem_bo_alloc_internal()
826 bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem)); in mos_gem_bo_alloc_internal()
827 if (!bo_gem) in mos_gem_bo_alloc_internal()
830 bo_gem->bo.size = bo_size; in mos_gem_bo_alloc_internal()
838 bo_gem->gem_handle = create.handle; in mos_gem_bo_alloc_internal()
839 bo_gem->bo.handle = bo_gem->gem_handle; in mos_gem_bo_alloc_internal()
841 free(bo_gem); in mos_gem_bo_alloc_internal()
844 bo_gem->bo.bufmgr = bufmgr; in mos_gem_bo_alloc_internal()
845 bo_gem->bo.align = alignment; in mos_gem_bo_alloc_internal()
847 bo_gem->tiling_mode = I915_TILING_NONE; in mos_gem_bo_alloc_internal()
848 bo_gem->swizzle_mode = I915_BIT_6_SWIZZLE_NONE; in mos_gem_bo_alloc_internal()
849 bo_gem->stride = 0; in mos_gem_bo_alloc_internal()
853 DRMINITLISTHEAD(&bo_gem->name_list); in mos_gem_bo_alloc_internal()
854 DRMINITLISTHEAD(&bo_gem->vma_list); in mos_gem_bo_alloc_internal()
855 if (mos_gem_bo_set_tiling_internal(&bo_gem->bo, in mos_gem_bo_alloc_internal()
858 mos_gem_bo_free(&bo_gem->bo); in mos_gem_bo_alloc_internal()
863 bo_gem->name = name; in mos_gem_bo_alloc_internal()
864 atomic_set(&bo_gem->refcount, 1); in mos_gem_bo_alloc_internal()
865 bo_gem->validate_index = -1; in mos_gem_bo_alloc_internal()
866 bo_gem->reloc_tree_fences = 0; in mos_gem_bo_alloc_internal()
867 bo_gem->used_as_reloc_target = false; in mos_gem_bo_alloc_internal()
868 bo_gem->has_error = false; in mos_gem_bo_alloc_internal()
869 bo_gem->reusable = true; in mos_gem_bo_alloc_internal()
870 bo_gem->use_48b_address_range = bufmgr_gem->bufmgr.bo_use_48b_address_range ? true : false; in mos_gem_bo_alloc_internal()
872 mos_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, alignment); in mos_gem_bo_alloc_internal()
875 bo_gem->gem_handle, bo_gem->name, size); in mos_gem_bo_alloc_internal()
877 return &bo_gem->bo; in mos_gem_bo_alloc_internal()
961 struct mos_bo_gem *bo_gem; in mos_gem_bo_alloc_userptr() local
971 bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem)); in mos_gem_bo_alloc_userptr()
972 if (!bo_gem) in mos_gem_bo_alloc_userptr()
975 bo_gem->bo.size = size; in mos_gem_bo_alloc_userptr()
989 free(bo_gem); in mos_gem_bo_alloc_userptr()
993 bo_gem->gem_handle = userptr.handle; in mos_gem_bo_alloc_userptr()
994 bo_gem->bo.handle = bo_gem->gem_handle; in mos_gem_bo_alloc_userptr()
995 bo_gem->bo.bufmgr = bufmgr; in mos_gem_bo_alloc_userptr()
996 bo_gem->is_userptr = true; in mos_gem_bo_alloc_userptr()
998 bo_gem->bo.virt = addr; in mos_gem_bo_alloc_userptr()
1000 bo_gem->bo.virtual = addr; in mos_gem_bo_alloc_userptr()
1003 bo_gem->user_virtual = addr; in mos_gem_bo_alloc_userptr()
1004 bo_gem->tiling_mode = I915_TILING_NONE; in mos_gem_bo_alloc_userptr()
1005 bo_gem->swizzle_mode = I915_BIT_6_SWIZZLE_NONE; in mos_gem_bo_alloc_userptr()
1006 bo_gem->stride = 0; in mos_gem_bo_alloc_userptr()
1008 DRMINITLISTHEAD(&bo_gem->name_list); in mos_gem_bo_alloc_userptr()
1009 DRMINITLISTHEAD(&bo_gem->vma_list); in mos_gem_bo_alloc_userptr()
1011 bo_gem->name = name; in mos_gem_bo_alloc_userptr()
1012 atomic_set(&bo_gem->refcount, 1); in mos_gem_bo_alloc_userptr()
1013 bo_gem->validate_index = -1; in mos_gem_bo_alloc_userptr()
1014 bo_gem->reloc_tree_fences = 0; in mos_gem_bo_alloc_userptr()
1015 bo_gem->used_as_reloc_target = false; in mos_gem_bo_alloc_userptr()
1016 bo_gem->has_error = false; in mos_gem_bo_alloc_userptr()
1017 bo_gem->reusable = false; in mos_gem_bo_alloc_userptr()
1018 bo_gem->use_48b_address_range = bufmgr_gem->bufmgr.bo_use_48b_address_range ? true : false; in mos_gem_bo_alloc_userptr()
1020 mos_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, 0); in mos_gem_bo_alloc_userptr()
1024 addr, bo_gem->gem_handle, bo_gem->name, in mos_gem_bo_alloc_userptr()
1027 return &bo_gem->bo; in mos_gem_bo_alloc_userptr()
1106 struct mos_bo_gem *bo_gem; in mos_bo_gem_create_from_name() local
1122 bo_gem = DRMLISTENTRY(struct mos_bo_gem, list, name_list); in mos_bo_gem_create_from_name()
1123 if (bo_gem->global_name == handle) { in mos_bo_gem_create_from_name()
1124 mos_gem_bo_reference(&bo_gem->bo); in mos_bo_gem_create_from_name()
1126 return &bo_gem->bo; in mos_bo_gem_create_from_name()
1148 bo_gem = DRMLISTENTRY(struct mos_bo_gem, list, name_list); in mos_bo_gem_create_from_name()
1149 if (bo_gem->gem_handle == open_arg.handle) { in mos_bo_gem_create_from_name()
1150 mos_gem_bo_reference(&bo_gem->bo); in mos_bo_gem_create_from_name()
1152 return &bo_gem->bo; in mos_bo_gem_create_from_name()
1156 bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem)); in mos_bo_gem_create_from_name()
1157 if (!bo_gem) { in mos_bo_gem_create_from_name()
1162 bo_gem->bo.size = open_arg.size; in mos_bo_gem_create_from_name()
1163 bo_gem->bo.offset = 0; in mos_bo_gem_create_from_name()
1164 bo_gem->bo.offset64 = 0; in mos_bo_gem_create_from_name()
1166 bo_gem->bo.virt = nullptr; in mos_bo_gem_create_from_name()
1168 bo_gem->bo.virtual = nullptr; in mos_bo_gem_create_from_name()
1170 bo_gem->bo.bufmgr = bufmgr; in mos_bo_gem_create_from_name()
1171 bo_gem->name = name; in mos_bo_gem_create_from_name()
1172 atomic_set(&bo_gem->refcount, 1); in mos_bo_gem_create_from_name()
1173 bo_gem->validate_index = -1; in mos_bo_gem_create_from_name()
1174 bo_gem->gem_handle = open_arg.handle; in mos_bo_gem_create_from_name()
1175 bo_gem->bo.handle = open_arg.handle; in mos_bo_gem_create_from_name()
1176 bo_gem->global_name = handle; in mos_bo_gem_create_from_name()
1177 bo_gem->reusable = false; in mos_bo_gem_create_from_name()
1178 bo_gem->use_48b_address_range = bufmgr_gem->bufmgr.bo_use_48b_address_range ? true : false; in mos_bo_gem_create_from_name()
1181 get_tiling.handle = bo_gem->gem_handle; in mos_bo_gem_create_from_name()
1186 mos_gem_bo_unreference(&bo_gem->bo); in mos_bo_gem_create_from_name()
1190 bo_gem->tiling_mode = get_tiling.tiling_mode; in mos_bo_gem_create_from_name()
1191 bo_gem->swizzle_mode = get_tiling.swizzle_mode; in mos_bo_gem_create_from_name()
1193 mos_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, 0); in mos_bo_gem_create_from_name()
1195 DRMINITLISTHEAD(&bo_gem->vma_list); in mos_bo_gem_create_from_name()
1196 DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); in mos_bo_gem_create_from_name()
1198 MOS_DBG("bo_create_from_handle: %d (%s)\n", handle, bo_gem->name); in mos_bo_gem_create_from_name()
1200 return &bo_gem->bo; in mos_bo_gem_create_from_name()
1207 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_free() local
1212 free(bo_gem->mem_virtual); in mos_gem_bo_free()
1217 DRMLISTDEL(&bo_gem->vma_list); in mos_gem_bo_free()
1218 if (bo_gem->mem_virtual) { in mos_gem_bo_free()
1219 VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_virtual, 0)); in mos_gem_bo_free()
1220 drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); in mos_gem_bo_free()
1223 if (bo_gem->gtt_virtual) { in mos_gem_bo_free()
1224 drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); in mos_gem_bo_free()
1227 if (bo_gem->mem_wc_virtual) { in mos_gem_bo_free()
1228 VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_wc_virtual, 0)); in mos_gem_bo_free()
1229 drm_munmap(bo_gem->mem_wc_virtual, bo_gem->bo.size); in mos_gem_bo_free()
1235 close.handle = bo_gem->gem_handle; in mos_gem_bo_free()
1239 bo_gem->gem_handle, bo_gem->name, strerror(errno)); in mos_gem_bo_free()
1248 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_mark_mmaps_incoherent() local
1250 if (bo_gem->mem_virtual) in mos_gem_bo_mark_mmaps_incoherent()
1251 VALGRIND_MAKE_MEM_NOACCESS(bo_gem->mem_virtual, bo->size); in mos_gem_bo_mark_mmaps_incoherent()
1253 if (bo_gem->gtt_virtual) in mos_gem_bo_mark_mmaps_incoherent()
1254 VALGRIND_MAKE_MEM_NOACCESS(bo_gem->gtt_virtual, bo->size); in mos_gem_bo_mark_mmaps_incoherent()
1256 if (bo_gem->mem_wc_virtual) in mos_gem_bo_mark_mmaps_incoherent()
1257 VALGRIND_MAKE_MEM_NOACCESS(bo_gem->mem_wc_virtual, bo->size); in mos_gem_bo_mark_mmaps_incoherent()
1275 struct mos_bo_gem *bo_gem; in mos_gem_cleanup_bo_cache() local
1277 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_gem_cleanup_bo_cache()
1279 if (time - bo_gem->free_time <= 1) in mos_gem_cleanup_bo_cache()
1282 DRMLISTDEL(&bo_gem->head); in mos_gem_cleanup_bo_cache()
1284 mos_gem_bo_free(&bo_gem->bo); in mos_gem_cleanup_bo_cache()
1309 struct mos_bo_gem *bo_gem; in mos_gem_bo_purge_vma_cache() local
1311 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_gem_bo_purge_vma_cache()
1314 assert(bo_gem->map_count == 0); in mos_gem_bo_purge_vma_cache()
1315 DRMLISTDELINIT(&bo_gem->vma_list); in mos_gem_bo_purge_vma_cache()
1317 if (bo_gem->mem_virtual) { in mos_gem_bo_purge_vma_cache()
1318 drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); in mos_gem_bo_purge_vma_cache()
1319 bo_gem->mem_virtual = nullptr; in mos_gem_bo_purge_vma_cache()
1322 if (bo_gem->gtt_virtual) { in mos_gem_bo_purge_vma_cache()
1323 drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); in mos_gem_bo_purge_vma_cache()
1324 bo_gem->gtt_virtual = nullptr; in mos_gem_bo_purge_vma_cache()
1327 if (bo_gem->mem_wc_virtual) { in mos_gem_bo_purge_vma_cache()
1328 drm_munmap(bo_gem->mem_wc_virtual, bo_gem->bo.size); in mos_gem_bo_purge_vma_cache()
1329 bo_gem->mem_wc_virtual = nullptr; in mos_gem_bo_purge_vma_cache()
1336 struct mos_bo_gem *bo_gem) in mos_gem_bo_close_vma() argument
1339 DRMLISTADDTAIL(&bo_gem->vma_list, &bufmgr_gem->vma_cache); in mos_gem_bo_close_vma()
1340 if (bo_gem->mem_virtual) in mos_gem_bo_close_vma()
1342 if (bo_gem->gtt_virtual) in mos_gem_bo_close_vma()
1344 if (bo_gem->mem_wc_virtual) in mos_gem_bo_close_vma()
1350 struct mos_bo_gem *bo_gem) in mos_gem_bo_open_vma() argument
1353 DRMLISTDEL(&bo_gem->vma_list); in mos_gem_bo_open_vma()
1354 if (bo_gem->mem_virtual) in mos_gem_bo_open_vma()
1356 if (bo_gem->gtt_virtual) in mos_gem_bo_open_vma()
1358 if (bo_gem->mem_wc_virtual) in mos_gem_bo_open_vma()
1367 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_unreference_final() local
1372 for (i = 0; i < bo_gem->reloc_count; i++) { in mos_gem_bo_unreference_final()
1373 if (bo_gem->reloc_target_info[i].bo != bo) { in mos_gem_bo_unreference_final()
1374 mos_gem_bo_unreference_locked_timed(bo_gem-> in mos_gem_bo_unreference_final()
1379 for (i = 0; i < bo_gem->softpin_target_count; i++) in mos_gem_bo_unreference_final()
1380 mos_gem_bo_unreference_locked_timed(bo_gem->softpin_target[i], in mos_gem_bo_unreference_final()
1382 bo_gem->reloc_count = 0; in mos_gem_bo_unreference_final()
1383 bo_gem->used_as_reloc_target = false; in mos_gem_bo_unreference_final()
1384 bo_gem->softpin_target_count = 0; in mos_gem_bo_unreference_final()
1385 bo_gem->exec_async = false; in mos_gem_bo_unreference_final()
1388 bo_gem->gem_handle, bo_gem->name); in mos_gem_bo_unreference_final()
1389 bo_gem->pad_to_size = 0; in mos_gem_bo_unreference_final()
1392 if (bo_gem->reloc_target_info) { in mos_gem_bo_unreference_final()
1393 free(bo_gem->reloc_target_info); in mos_gem_bo_unreference_final()
1394 bo_gem->reloc_target_info = nullptr; in mos_gem_bo_unreference_final()
1396 if (bo_gem->relocs) { in mos_gem_bo_unreference_final()
1397 free(bo_gem->relocs); in mos_gem_bo_unreference_final()
1398 bo_gem->relocs = nullptr; in mos_gem_bo_unreference_final()
1400 if (bo_gem->softpin_target) { in mos_gem_bo_unreference_final()
1401 free(bo_gem->softpin_target); in mos_gem_bo_unreference_final()
1402 bo_gem->softpin_target = nullptr; in mos_gem_bo_unreference_final()
1403 bo_gem->softpin_target_size = 0; in mos_gem_bo_unreference_final()
1411 if (bo_gem->map_count) { in mos_gem_bo_unreference_final()
1412 MOS_DBG("bo freed with non-zero map-count %d\n", bo_gem->map_count); in mos_gem_bo_unreference_final()
1413 bo_gem->map_count = 0; in mos_gem_bo_unreference_final()
1414 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in mos_gem_bo_unreference_final()
1418 DRMLISTDEL(&bo_gem->name_list); in mos_gem_bo_unreference_final()
1422 if (bufmgr_gem->bo_reuse && bo_gem->reusable && bucket != nullptr && in mos_gem_bo_unreference_final()
1423 mos_gem_bo_madvise_internal(bufmgr_gem, bo_gem, in mos_gem_bo_unreference_final()
1425 bo_gem->free_time = time; in mos_gem_bo_unreference_final()
1427 bo_gem->name = nullptr; in mos_gem_bo_unreference_final()
1428 bo_gem->validate_index = -1; in mos_gem_bo_unreference_final()
1430 DRMLISTADDTAIL(&bo_gem->head, &bucket->head); in mos_gem_bo_unreference_final()
1439 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_unreference_locked_timed() local
1441 assert(atomic_read(&bo_gem->refcount) > 0); in mos_gem_bo_unreference_locked_timed()
1442 if (atomic_dec_and_test(&bo_gem->refcount)) in mos_gem_bo_unreference_locked_timed()
1448 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_unreference() local
1450 assert(atomic_read(&bo_gem->refcount) > 0); in mos_gem_bo_unreference()
1452 if (atomic_add_unless(&bo_gem->refcount, -1, 1)) { in mos_gem_bo_unreference()
1461 if (atomic_dec_and_test(&bo_gem->refcount)) { in mos_gem_bo_unreference()
1474 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in map_wc() local
1477 if (bo_gem->is_userptr) in map_wc()
1483 if (bo_gem->map_count++ == 0) in map_wc()
1484 mos_gem_bo_open_vma(bufmgr_gem, bo_gem); in map_wc()
1487 if (bo_gem->mem_wc_virtual == nullptr) { in map_wc()
1491 bo_gem->gem_handle, bo_gem->name, bo_gem->map_count); in map_wc()
1494 mmap_arg.handle = bo_gem->gem_handle; in map_wc()
1504 __FILE__, __LINE__, bo_gem->gem_handle, in map_wc()
1505 bo_gem->name, strerror(errno)); in map_wc()
1506 if (--bo_gem->map_count == 0) in map_wc()
1507 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in map_wc()
1511 bo_gem->mem_wc_virtual = (void *)(uintptr_t) mmap_arg.addr_ptr; in map_wc()
1514 bo->virt = bo_gem->mem_wc_virtual; in map_wc()
1516 bo->virtual = bo_gem->mem_wc_virtual; in map_wc()
1519 MOS_DBG("bo_map_wc: %d (%s) -> %p\n", bo_gem->gem_handle, bo_gem->name, in map_wc()
1520 bo_gem->mem_wc_virtual); in map_wc()
1529 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_map_wc() local
1535 bo->virt = bo_gem->mem_virtual; in mos_gem_bo_map_wc()
1537 bo->virtual = bo_gem->mem_virtual; in mos_gem_bo_map_wc()
1539 bo_gem->map_count++; in mos_gem_bo_map_wc()
1560 set_domain.handle = bo_gem->gem_handle; in mos_gem_bo_map_wc()
1568 __FILE__, __LINE__, bo_gem->gem_handle, in mos_gem_bo_map_wc()
1572 VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->mem_wc_virtual, bo->size)); in mos_gem_bo_map_wc()
1582 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_map_wc_unsynchronized() local
1591 VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->mem_wc_virtual, bo->size)); in mos_gem_bo_map_wc_unsynchronized()
1602 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_map() local
1608 bo->virt = bo_gem->mem_virtual; in mos_gem_bo_map()
1610 bo->virtual = bo_gem->mem_virtual; in mos_gem_bo_map()
1612 bo_gem->map_count++; in mos_gem_bo_map()
1616 if (bo_gem->is_userptr) { in mos_gem_bo_map()
1619 bo->virt = bo_gem->user_virtual; in mos_gem_bo_map()
1621 bo->virtual = bo_gem->user_virtual; in mos_gem_bo_map()
1628 if (bo_gem->map_count++ == 0) in mos_gem_bo_map()
1629 mos_gem_bo_open_vma(bufmgr_gem, bo_gem); in mos_gem_bo_map()
1631 if (!bo_gem->mem_virtual) { in mos_gem_bo_map()
1635 bo_gem->gem_handle, bo_gem->name, bo_gem->map_count); in mos_gem_bo_map()
1638 mmap_arg.handle = bo_gem->gem_handle; in mos_gem_bo_map()
1646 __FILE__, __LINE__, bo_gem->gem_handle, in mos_gem_bo_map()
1647 bo_gem->name, strerror(errno)); in mos_gem_bo_map()
1648 if (--bo_gem->map_count == 0) in mos_gem_bo_map()
1649 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in mos_gem_bo_map()
1654 bo_gem->mem_virtual = (void *)(uintptr_t) mmap_arg.addr_ptr; in mos_gem_bo_map()
1656 MOS_DBG("bo_map: %d (%s) -> %p\n", bo_gem->gem_handle, bo_gem->name, in mos_gem_bo_map()
1657 bo_gem->mem_virtual); in mos_gem_bo_map()
1659 bo->virt = bo_gem->mem_virtual; in mos_gem_bo_map()
1661 bo->virtual = bo_gem->mem_virtual; in mos_gem_bo_map()
1665 set_domain.handle = bo_gem->gem_handle; in mos_gem_bo_map()
1676 __FILE__, __LINE__, bo_gem->gem_handle, in mos_gem_bo_map()
1681 bo_gem->mapped_cpu_write = true; in mos_gem_bo_map()
1684 VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->mem_virtual, bo->size)); in mos_gem_bo_map()
1694 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in map_gtt() local
1699 bo->virt = bo_gem->mem_virtual; in map_gtt()
1701 bo->virtual = bo_gem->mem_virtual; in map_gtt()
1703 bo_gem->map_count++; in map_gtt()
1707 if (bo_gem->is_userptr) in map_gtt()
1710 if (bo_gem->map_count++ == 0) in map_gtt()
1711 mos_gem_bo_open_vma(bufmgr_gem, bo_gem); in map_gtt()
1714 if (bo_gem->gtt_virtual == nullptr) { in map_gtt()
1718 bo_gem->gem_handle, bo_gem->name, bo_gem->map_count); in map_gtt()
1721 mmap_arg.handle = bo_gem->gem_handle; in map_gtt()
1731 bo_gem->gem_handle, bo_gem->name, in map_gtt()
1733 if (--bo_gem->map_count == 0) in map_gtt()
1734 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in map_gtt()
1739 bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, in map_gtt()
1742 if (bo_gem->gtt_virtual == MAP_FAILED) { in map_gtt()
1743 bo_gem->gtt_virtual = nullptr; in map_gtt()
1747 bo_gem->gem_handle, bo_gem->name, in map_gtt()
1749 if (--bo_gem->map_count == 0) in map_gtt()
1750 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in map_gtt()
1755 bo->virt = bo_gem->gtt_virtual; in map_gtt()
1757 bo->virtual = bo_gem->gtt_virtual; in map_gtt()
1760 MOS_DBG("bo_map_gtt: %d (%s) -> %p\n", bo_gem->gem_handle, bo_gem->name, in map_gtt()
1761 bo_gem->gtt_virtual); in map_gtt()
1770 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_map_gtt() local
1792 set_domain.handle = bo_gem->gem_handle; in mos_gem_bo_map_gtt()
1800 __FILE__, __LINE__, bo_gem->gem_handle, in mos_gem_bo_map_gtt()
1805 VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->gtt_virtual, bo->size)); in mos_gem_bo_map_gtt()
1830 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_map_unsynchronized() local
1849 VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->gtt_virtual, bo->size)); in mos_gem_bo_map_unsynchronized()
1860 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_unmap() local
1866 if (bo_gem->is_userptr) in mos_gem_bo_unmap()
1872 --bo_gem->map_count ; in mos_gem_bo_unmap()
1878 if (bo_gem->map_count <= 0) { in mos_gem_bo_unmap()
1887 if (bo_gem->mapped_cpu_write) { in mos_gem_bo_unmap()
1896 sw_finish.handle = bo_gem->gem_handle; in mos_gem_bo_unmap()
1902 bo_gem->mapped_cpu_write = false; in mos_gem_bo_unmap()
1909 if (--bo_gem->map_count == 0) { in mos_gem_bo_unmap()
1910 mos_gem_bo_close_vma(bufmgr_gem, bo_gem); in mos_gem_bo_unmap()
1940 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_get_fake_offset() local
1943 mmap_arg.handle = bo_gem->gem_handle; in mos_gem_bo_get_fake_offset()
1953 bo_gem->gem_handle, bo_gem->name, in mos_gem_bo_get_fake_offset()
1967 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_subdata() local
1971 if (bo_gem->is_userptr) in mos_gem_bo_subdata()
1975 pwrite.handle = bo_gem->gem_handle; in mos_gem_bo_subdata()
1982 memcpy((unsigned char *)bo_gem->mem_virtual+offset, data, size); in mos_gem_bo_subdata()
1991 __FILE__, __LINE__, bo_gem->gem_handle, (int)offset, in mos_gem_bo_subdata()
2028 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_get_subdata() local
2032 if (bo_gem->is_userptr) in mos_gem_bo_get_subdata()
2036 pread.handle = bo_gem->gem_handle; in mos_gem_bo_get_subdata()
2046 __FILE__, __LINE__, bo_gem->gem_handle, (int)offset, in mos_gem_bo_get_subdata()
2094 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_wait() local
2110 wait.bo_handle = bo_gem->gem_handle; in mos_gem_bo_wait()
2130 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_start_gtt_access() local
2135 set_domain.handle = bo_gem->gem_handle; in mos_gem_bo_start_gtt_access()
2143 __FILE__, __LINE__, bo_gem->gem_handle, in mos_gem_bo_start_gtt_access()
2166 struct mos_bo_gem *bo_gem; in mos_bufmgr_gem_destroy() local
2169 bo_gem = DRMLISTENTRY(struct mos_bo_gem, in mos_bufmgr_gem_destroy()
2171 DRMLISTDEL(&bo_gem->head); in mos_bufmgr_gem_destroy()
2173 mos_gem_bo_free(&bo_gem->bo); in mos_bufmgr_gem_destroy()
2207 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in do_bo_emit_reloc() local
2211 if (bo_gem->has_error) in do_bo_emit_reloc()
2215 bo_gem->has_error = true; in do_bo_emit_reloc()
2225 if (bo_gem->relocs == nullptr && mos_setup_reloc_list(bo)) in do_bo_emit_reloc()
2229 assert(bo_gem->reloc_count < bufmgr_gem->max_relocs); in do_bo_emit_reloc()
2246 assert(!bo_gem->used_as_reloc_target); in do_bo_emit_reloc()
2247 if (target_bo_gem != bo_gem) { in do_bo_emit_reloc()
2249 bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size; in do_bo_emit_reloc()
2250 bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences; in do_bo_emit_reloc()
2253 bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo; in do_bo_emit_reloc()
2257 bo_gem->reloc_target_info[bo_gem->reloc_count].flags = in do_bo_emit_reloc()
2260 bo_gem->reloc_target_info[bo_gem->reloc_count].flags = 0; in do_bo_emit_reloc()
2262 bo_gem->relocs[bo_gem->reloc_count].offset = offset; in do_bo_emit_reloc()
2263 bo_gem->relocs[bo_gem->reloc_count].delta = target_offset; in do_bo_emit_reloc()
2264 bo_gem->relocs[bo_gem->reloc_count].target_handle = in do_bo_emit_reloc()
2266 bo_gem->relocs[bo_gem->reloc_count].read_domains = read_domains; in do_bo_emit_reloc()
2267 bo_gem->relocs[bo_gem->reloc_count].write_domain = write_domain; in do_bo_emit_reloc()
2268 bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset64; in do_bo_emit_reloc()
2269 bo_gem->reloc_count++; in do_bo_emit_reloc()
2281 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in do_bo_emit_reloc2() local
2285 if (bo_gem->has_error) in do_bo_emit_reloc2()
2289 bo_gem->has_error = true; in do_bo_emit_reloc2()
2299 if (bo_gem->relocs == nullptr && mos_setup_reloc_list(bo)) in do_bo_emit_reloc2()
2303 assert(bo_gem->reloc_count < bufmgr_gem->max_relocs); in do_bo_emit_reloc2()
2320 assert(!bo_gem->used_as_reloc_target); in do_bo_emit_reloc2()
2321 if (target_bo_gem != bo_gem) { in do_bo_emit_reloc2()
2323 bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size; in do_bo_emit_reloc2()
2324 bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences; in do_bo_emit_reloc2()
2327 bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo; in do_bo_emit_reloc2()
2331 bo_gem->reloc_target_info[bo_gem->reloc_count].flags = in do_bo_emit_reloc2()
2334 bo_gem->reloc_target_info[bo_gem->reloc_count].flags = 0; in do_bo_emit_reloc2()
2336 bo_gem->relocs[bo_gem->reloc_count].offset = offset; in do_bo_emit_reloc2()
2337 bo_gem->relocs[bo_gem->reloc_count].delta = target_offset; in do_bo_emit_reloc2()
2338 bo_gem->relocs[bo_gem->reloc_count].target_handle = in do_bo_emit_reloc2()
2340 bo_gem->relocs[bo_gem->reloc_count].read_domains = read_domains; in do_bo_emit_reloc2()
2341 bo_gem->relocs[bo_gem->reloc_count].write_domain = write_domain; in do_bo_emit_reloc2()
2342 bo_gem->relocs[bo_gem->reloc_count].presumed_offset = presumed_offset; in do_bo_emit_reloc2()
2343 bo_gem->reloc_count++; in do_bo_emit_reloc2()
2351 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_use_48b_address_range() local
2352 bo_gem->use_48b_address_range = enable; in mos_gem_bo_use_48b_address_range()
2358 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *)bo; in mos_gem_bo_set_exec_object_async() local
2359 bo_gem->exec_async = true; in mos_gem_bo_set_exec_object_async()
2366 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_add_softpin_target() local
2368 if (bo_gem->has_error) in mos_gem_bo_add_softpin_target()
2372 bo_gem->has_error = true; in mos_gem_bo_add_softpin_target()
2378 if (target_bo_gem == bo_gem) in mos_gem_bo_add_softpin_target()
2381 if (bo_gem->softpin_target_count == bo_gem->softpin_target_size) { in mos_gem_bo_add_softpin_target()
2382 int new_size = bo_gem->softpin_target_size * 2; in mos_gem_bo_add_softpin_target()
2386 bo_gem->softpin_target = (struct mos_linux_bo **)realloc(bo_gem->softpin_target, new_size * in mos_gem_bo_add_softpin_target()
2388 if (!bo_gem->softpin_target) in mos_gem_bo_add_softpin_target()
2391 bo_gem->softpin_target_size = new_size; in mos_gem_bo_add_softpin_target()
2393 bo_gem->softpin_target[bo_gem->softpin_target_count] = target_bo; in mos_gem_bo_add_softpin_target()
2395 bo_gem->softpin_target_count++; in mos_gem_bo_add_softpin_target()
2403 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_pad_to_size() local
2408 bo_gem->pad_to_size = pad_to_size; in mos_gem_bo_pad_to_size()
2455 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_get_reloc_count() local
2457 return bo_gem->reloc_count; in mos_gem_bo_get_reloc_count()
2479 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_clear_relocs() local
2487 assert(bo_gem->reloc_count >= start); in mos_gem_bo_clear_relocs()
2492 for (i = start; i < bo_gem->reloc_count; i++) { in mos_gem_bo_clear_relocs()
2493 struct mos_bo_gem *target_bo_gem = (struct mos_bo_gem *) bo_gem->reloc_target_info[i].bo; in mos_gem_bo_clear_relocs()
2495 bo_gem->reloc_tree_fences -= target_bo_gem->reloc_tree_fences; in mos_gem_bo_clear_relocs()
2500 bo_gem->reloc_count = start; in mos_gem_bo_clear_relocs()
2502 for (i = 0; i < bo_gem->softpin_target_count; i++) { in mos_gem_bo_clear_relocs()
2503 struct mos_bo_gem *target_bo_gem = (struct mos_bo_gem *) bo_gem->softpin_target[i]; in mos_gem_bo_clear_relocs()
2506 bo_gem->softpin_target_count = 0; in mos_gem_bo_clear_relocs()
2520 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_process_reloc() local
2523 if (bo_gem->relocs == nullptr) in mos_gem_bo_process_reloc()
2526 for (i = 0; i < bo_gem->reloc_count; i++) { in mos_gem_bo_process_reloc()
2527 struct mos_linux_bo *target_bo = bo_gem->reloc_target_info[i].bo; in mos_gem_bo_process_reloc()
2545 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *)bo; in mos_gem_bo_process_reloc2() local
2548 if (bo_gem->relocs == nullptr && bo_gem->softpin_target == nullptr) in mos_gem_bo_process_reloc2()
2551 for (i = 0; i < bo_gem->reloc_count; i++) { in mos_gem_bo_process_reloc2()
2552 struct mos_linux_bo *target_bo = bo_gem->reloc_target_info[i].bo; in mos_gem_bo_process_reloc2()
2563 need_fence = (bo_gem->reloc_target_info[i].flags & in mos_gem_bo_process_reloc2()
2570 for (i = 0; i < bo_gem->softpin_target_count; i++) { in mos_gem_bo_process_reloc2()
2571 struct mos_linux_bo *target_bo = bo_gem->softpin_target[i]; in mos_gem_bo_process_reloc2()
2589 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_update_buffer_offsets() local
2594 bo_gem->gem_handle, bo_gem->name, in mos_update_buffer_offsets()
2612 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *)bo; in mos_update_buffer_offsets2() local
2619 assert(!bo_gem->is_softpin); in mos_update_buffer_offsets2()
2621 bo_gem->gem_handle, bo_gem->name, in mos_update_buffer_offsets2()
2714 struct mos_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]); in mos_gem_bo_exec() local
2716 bo_gem->idle = false; in mos_gem_bo_exec()
2719 bo_gem->validate_index = -1; in mos_gem_bo_exec()
2831 struct mos_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]); in do_exec2() local
2833 bo_gem->idle = false; in do_exec2()
2836 bo_gem->validate_index = -1; in do_exec2()
2883 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_pin() local
2888 pin.handle = bo_gem->gem_handle; in mos_gem_bo_pin()
2906 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_unpin() local
2911 unpin.handle = bo_gem->gem_handle; in mos_gem_bo_unpin()
2926 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_set_tiling_internal() local
2930 if (bo_gem->global_name == 0 && in mos_gem_bo_set_tiling_internal()
2931 tiling_mode == bo_gem->tiling_mode && in mos_gem_bo_set_tiling_internal()
2932 stride == bo_gem->stride) in mos_gem_bo_set_tiling_internal()
2941 set_tiling.handle = bo_gem->gem_handle; in mos_gem_bo_set_tiling_internal()
2952 bo_gem->tiling_mode = set_tiling.tiling_mode; in mos_gem_bo_set_tiling_internal()
2953 bo_gem->swizzle_mode = set_tiling.swizzle_mode; in mos_gem_bo_set_tiling_internal()
2954 bo_gem->stride = set_tiling.stride; in mos_gem_bo_set_tiling_internal()
2963 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_set_tiling() local
2969 if (bo_gem->is_userptr) in mos_gem_bo_set_tiling()
2980 mos_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, 0); in mos_gem_bo_set_tiling()
2981 *tiling_mode = bo_gem->tiling_mode; in mos_gem_bo_set_tiling()
2989 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_get_tiling() local
2991 *tiling_mode = bo_gem->tiling_mode; in mos_gem_bo_get_tiling()
2992 *swizzle_mode = bo_gem->swizzle_mode; in mos_gem_bo_get_tiling()
2999 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_set_softpin_offset() local
3001 bo_gem->is_softpin = true; in mos_gem_bo_set_softpin_offset()
3013 struct mos_bo_gem *bo_gem; in mos_bo_gem_create_from_prime() local
3033 bo_gem = DRMLISTENTRY(struct mos_bo_gem, list, name_list); in mos_bo_gem_create_from_prime()
3034 if (bo_gem->gem_handle == handle) { in mos_bo_gem_create_from_prime()
3035 mos_gem_bo_reference(&bo_gem->bo); in mos_bo_gem_create_from_prime()
3037 return &bo_gem->bo; in mos_bo_gem_create_from_prime()
3041 bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem)); in mos_bo_gem_create_from_prime()
3042 if (!bo_gem) { in mos_bo_gem_create_from_prime()
3053 bo_gem->bo.size = ret; in mos_bo_gem_create_from_prime()
3055 bo_gem->bo.size = size; in mos_bo_gem_create_from_prime()
3057 bo_gem->bo.handle = handle; in mos_bo_gem_create_from_prime()
3058 bo_gem->bo.bufmgr = bufmgr; in mos_bo_gem_create_from_prime()
3060 bo_gem->gem_handle = handle; in mos_bo_gem_create_from_prime()
3062 atomic_set(&bo_gem->refcount, 1); in mos_bo_gem_create_from_prime()
3064 bo_gem->name = "prime"; in mos_bo_gem_create_from_prime()
3065 bo_gem->validate_index = -1; in mos_bo_gem_create_from_prime()
3066 bo_gem->reloc_tree_fences = 0; in mos_bo_gem_create_from_prime()
3067 bo_gem->used_as_reloc_target = false; in mos_bo_gem_create_from_prime()
3068 bo_gem->has_error = false; in mos_bo_gem_create_from_prime()
3069 bo_gem->reusable = false; in mos_bo_gem_create_from_prime()
3070 bo_gem->use_48b_address_range = bufmgr_gem->bufmgr.bo_use_48b_address_range ? true : false; in mos_bo_gem_create_from_prime()
3072 DRMINITLISTHEAD(&bo_gem->vma_list); in mos_bo_gem_create_from_prime()
3073 DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); in mos_bo_gem_create_from_prime()
3077 get_tiling.handle = bo_gem->gem_handle; in mos_bo_gem_create_from_prime()
3083 mos_gem_bo_unreference(&bo_gem->bo); in mos_bo_gem_create_from_prime()
3086 bo_gem->tiling_mode = get_tiling.tiling_mode; in mos_bo_gem_create_from_prime()
3087 bo_gem->swizzle_mode = get_tiling.swizzle_mode; in mos_bo_gem_create_from_prime()
3089 mos_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, 0); in mos_bo_gem_create_from_prime()
3090 return &bo_gem->bo; in mos_bo_gem_create_from_prime()
3097 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_bo_gem_export_to_prime() local
3100 if (DRMLISTEMPTY(&bo_gem->name_list)) in mos_bo_gem_export_to_prime()
3101 DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); in mos_bo_gem_export_to_prime()
3104 if (drmPrimeHandleToFD(bufmgr_gem->fd, bo_gem->gem_handle, in mos_bo_gem_export_to_prime()
3108 bo_gem->reusable = false; in mos_bo_gem_export_to_prime()
3117 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_flink() local
3120 if (!bo_gem->global_name) { in mos_gem_bo_flink()
3124 flink.handle = bo_gem->gem_handle; in mos_gem_bo_flink()
3134 bo_gem->global_name = flink.name; in mos_gem_bo_flink()
3135 bo_gem->reusable = false; in mos_gem_bo_flink()
3137 if (DRMLISTEMPTY(&bo_gem->name_list)) in mos_gem_bo_flink()
3138 DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); in mos_gem_bo_flink()
3142 *name = bo_gem->global_name; in mos_gem_bo_flink()
3184 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_get_aperture_space() local
3188 if (bo == nullptr || bo_gem->included_in_check_aperture) in mos_gem_bo_get_aperture_space()
3192 bo_gem->included_in_check_aperture = true; in mos_gem_bo_get_aperture_space()
3194 for (i = 0; i < bo_gem->reloc_count; i++) in mos_gem_bo_get_aperture_space()
3196 mos_gem_bo_get_aperture_space(bo_gem-> in mos_gem_bo_get_aperture_space()
3217 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo_array[i]; in mos_gem_total_fences() local
3219 if (bo_gem == nullptr) in mos_gem_total_fences()
3222 total += bo_gem->reloc_tree_fences; in mos_gem_total_fences()
3234 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_clear_aperture_space_flag() local
3237 if (bo == nullptr || !bo_gem->included_in_check_aperture) in mos_gem_bo_clear_aperture_space_flag()
3240 bo_gem->included_in_check_aperture = false; in mos_gem_bo_clear_aperture_space_flag()
3242 for (i = 0; i < bo_gem->reloc_count; i++) in mos_gem_bo_clear_aperture_space_flag()
3243 mos_gem_bo_clear_aperture_space_flag(bo_gem-> in mos_gem_bo_clear_aperture_space_flag()
3258 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo_array[i]; in mos_gem_estimate_batch_space() local
3259 if (bo_gem != nullptr) in mos_gem_estimate_batch_space()
3260 total += bo_gem->reloc_tree_size; in mos_gem_estimate_batch_space()
3288 struct mos_bo_gem *bo_gem = in mos_gem_compute_batch_space() local
3290 bo_gem->reloc_tree_size = total; in mos_gem_compute_batch_space()
3355 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_disable_reuse() local
3357 bo_gem->reusable = false; in mos_gem_bo_disable_reuse()
3364 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in mos_gem_bo_is_reusable() local
3366 return bo_gem->reusable; in mos_gem_bo_is_reusable()
3372 struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo; in _mos_gem_bo_references() local
3375 for (i = 0; i < bo_gem->reloc_count; i++) { in _mos_gem_bo_references()
3376 if (bo_gem->reloc_target_info[i].bo == target_bo) in _mos_gem_bo_references()
3378 if (bo == bo_gem->reloc_target_info[i].bo) in _mos_gem_bo_references()
3380 if (_mos_gem_bo_references(bo_gem->reloc_target_info[i].bo, in _mos_gem_bo_references()
3385 for (i = 0; i< bo_gem->softpin_target_count; i++) { in _mos_gem_bo_references()
3386 if (bo_gem->softpin_target[i] == target_bo) in _mos_gem_bo_references()
3388 if (_mos_gem_bo_references(bo_gem->softpin_target[i], target_bo)) in _mos_gem_bo_references()