Lines Matching refs:bo_fake
421 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in alloc_block() local
425 unsigned int align_log2 = ffs(bo_fake->alignment) - 1; in alloc_block()
431 sz = (bo->size + bo_fake->alignment - 1) & ~(bo_fake->alignment - 1); in alloc_block()
448 bo_fake->block = block; in alloc_block()
459 drm_intel_bo_fake *bo_fake; in free_block() local
466 bo_fake = (drm_intel_bo_fake *) block->bo; in free_block()
468 if (bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE)) in free_block()
471 if (!skip_dirty_copy && (bo_fake->card_dirty == 1)) { in free_block()
472 memcpy(bo_fake->backing_store, block->virtual, block->bo->size); in free_block()
473 bo_fake->card_dirty = 0; in free_block()
474 bo_fake->dirty = 1; in free_block()
495 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in alloc_backing_store() local
496 assert(!bo_fake->backing_store); in alloc_backing_store()
497 assert(!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE))); in alloc_backing_store()
499 bo_fake->backing_store = malloc(bo->size); in alloc_backing_store()
501 DBG("alloc_backing - buf %d %p %lu\n", bo_fake->id, in alloc_backing_store()
502 bo_fake->backing_store, bo->size); in alloc_backing_store()
503 assert(bo_fake->backing_store); in alloc_backing_store()
509 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in free_backing_store() local
511 if (bo_fake->backing_store) { in free_backing_store()
512 assert(!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE))); in free_backing_store()
513 free(bo_fake->backing_store); in free_backing_store()
514 bo_fake->backing_store = NULL; in free_backing_store()
523 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in set_dirty() local
525 if (bo_fake->flags & BM_NO_BACKING_STORE in set_dirty()
526 && bo_fake->invalidate_cb != NULL) in set_dirty()
527 bo_fake->invalidate_cb(bo, bo_fake->invalidate_ptr); in set_dirty()
529 assert(!(bo_fake->flags & BM_PINNED)); in set_dirty()
531 DBG("set_dirty - buf %d\n", bo_fake->id); in set_dirty()
532 bo_fake->dirty = 1; in set_dirty()
543 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in evict_lru() local
545 if (bo_fake != NULL && (bo_fake->flags & BM_NO_FENCE_SUBDATA)) in evict_lru()
552 set_dirty(&bo_fake->bo); in evict_lru()
553 bo_fake->block = NULL; in evict_lru()
570 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in evict_mru() local
572 if (bo_fake && (bo_fake->flags & BM_NO_FENCE_SUBDATA)) in evict_mru()
575 set_dirty(&bo_fake->bo); in evict_mru()
576 bo_fake->block = NULL; in evict_mru()
658 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in evict_and_alloc_block() local
660 assert(bo_fake->block == NULL); in evict_and_alloc_block()
744 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_wait_rendering_locked() local
746 if (bo_fake->block == NULL || !bo_fake->block->fenced) in drm_intel_fake_bo_wait_rendering_locked()
749 _fence_wait_internal(bufmgr_fake, bo_fake->block->fence); in drm_intel_fake_bo_wait_rendering_locked()
805 drm_intel_bo_fake *bo_fake; in drm_intel_fake_bo_alloc() local
811 bo_fake = calloc(1, sizeof(*bo_fake)); in drm_intel_fake_bo_alloc()
812 if (!bo_fake) in drm_intel_fake_bo_alloc()
815 bo_fake->bo.size = size; in drm_intel_fake_bo_alloc()
816 bo_fake->bo.offset = -1; in drm_intel_fake_bo_alloc()
817 bo_fake->bo.virtual = NULL; in drm_intel_fake_bo_alloc()
818 bo_fake->bo.bufmgr = bufmgr; in drm_intel_fake_bo_alloc()
819 bo_fake->refcount = 1; in drm_intel_fake_bo_alloc()
825 bo_fake->alignment = alignment; in drm_intel_fake_bo_alloc()
826 bo_fake->id = ++bufmgr_fake->buf_nr; in drm_intel_fake_bo_alloc()
827 bo_fake->name = name; in drm_intel_fake_bo_alloc()
828 bo_fake->flags = 0; in drm_intel_fake_bo_alloc()
829 bo_fake->is_static = 0; in drm_intel_fake_bo_alloc()
831 DBG("drm_bo_alloc: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name, in drm_intel_fake_bo_alloc()
832 bo_fake->bo.size / 1024); in drm_intel_fake_bo_alloc()
834 return &bo_fake->bo; in drm_intel_fake_bo_alloc()
870 drm_intel_bo_fake *bo_fake; in drm_intel_bo_fake_alloc_static() local
876 bo_fake = calloc(1, sizeof(*bo_fake)); in drm_intel_bo_fake_alloc_static()
877 if (!bo_fake) in drm_intel_bo_fake_alloc_static()
880 bo_fake->bo.size = size; in drm_intel_bo_fake_alloc_static()
881 bo_fake->bo.offset = offset; in drm_intel_bo_fake_alloc_static()
882 bo_fake->bo.virtual = virtual; in drm_intel_bo_fake_alloc_static()
883 bo_fake->bo.bufmgr = bufmgr; in drm_intel_bo_fake_alloc_static()
884 bo_fake->refcount = 1; in drm_intel_bo_fake_alloc_static()
885 bo_fake->id = ++bufmgr_fake->buf_nr; in drm_intel_bo_fake_alloc_static()
886 bo_fake->name = name; in drm_intel_bo_fake_alloc_static()
887 bo_fake->flags = BM_PINNED; in drm_intel_bo_fake_alloc_static()
888 bo_fake->is_static = 1; in drm_intel_bo_fake_alloc_static()
890 DBG("drm_bo_alloc_static: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_bo_fake_alloc_static()
891 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_bo_fake_alloc_static()
893 return &bo_fake->bo; in drm_intel_bo_fake_alloc_static()
901 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_reference() local
904 bo_fake->refcount++; in drm_intel_fake_bo_reference()
911 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_reference_locked() local
913 bo_fake->refcount++; in drm_intel_fake_bo_reference_locked()
921 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_unreference_locked() local
924 if (--bo_fake->refcount == 0) { in drm_intel_fake_bo_unreference_locked()
925 assert(bo_fake->map_count == 0); in drm_intel_fake_bo_unreference_locked()
927 if (bo_fake->block) in drm_intel_fake_bo_unreference_locked()
928 free_block(bufmgr_fake, bo_fake->block, 1); in drm_intel_fake_bo_unreference_locked()
931 for (i = 0; i < bo_fake->nr_relocs; i++) in drm_intel_fake_bo_unreference_locked()
932 drm_intel_fake_bo_unreference_locked(bo_fake->relocs[i]. in drm_intel_fake_bo_unreference_locked()
935 DBG("drm_bo_unreference: free buf %d %s\n", bo_fake->id, in drm_intel_fake_bo_unreference_locked()
936 bo_fake->name); in drm_intel_fake_bo_unreference_locked()
938 free(bo_fake->relocs); in drm_intel_fake_bo_unreference_locked()
966 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_bo_fake_disable_backing_store() local
970 if (bo_fake->backing_store) in drm_intel_bo_fake_disable_backing_store()
973 bo_fake->flags |= BM_NO_BACKING_STORE; in drm_intel_bo_fake_disable_backing_store()
975 DBG("disable_backing_store set buf %d dirty\n", bo_fake->id); in drm_intel_bo_fake_disable_backing_store()
976 bo_fake->dirty = 1; in drm_intel_bo_fake_disable_backing_store()
977 bo_fake->invalidate_cb = invalidate_cb; in drm_intel_bo_fake_disable_backing_store()
978 bo_fake->invalidate_ptr = ptr; in drm_intel_bo_fake_disable_backing_store()
999 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_map_locked() local
1002 if (bo_fake->is_static) { in drm_intel_fake_bo_map_locked()
1003 if (bo_fake->card_dirty) { in drm_intel_fake_bo_map_locked()
1005 bo_fake->card_dirty = 0; in drm_intel_fake_bo_map_locked()
1014 if (bo_fake->map_count++ != 0) in drm_intel_fake_bo_map_locked()
1018 DBG("drm_bo_map: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_fake_bo_map_locked()
1019 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_fake_bo_map_locked()
1024 } else if (bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED)) { in drm_intel_fake_bo_map_locked()
1026 if (!bo_fake->block && !evict_and_alloc_block(bo)) { in drm_intel_fake_bo_map_locked()
1031 assert(bo_fake->block); in drm_intel_fake_bo_map_locked()
1032 bo_fake->dirty = 0; in drm_intel_fake_bo_map_locked()
1034 if (!(bo_fake->flags & BM_NO_FENCE_SUBDATA) && in drm_intel_fake_bo_map_locked()
1035 bo_fake->block->fenced) { in drm_intel_fake_bo_map_locked()
1040 bo->virtual = bo_fake->block->virtual; in drm_intel_fake_bo_map_locked()
1046 if (bo_fake->backing_store == 0) in drm_intel_fake_bo_map_locked()
1049 if ((bo_fake->card_dirty == 1) && bo_fake->block) { in drm_intel_fake_bo_map_locked()
1050 if (bo_fake->block->fenced) in drm_intel_fake_bo_map_locked()
1054 memcpy(bo_fake->backing_store, in drm_intel_fake_bo_map_locked()
1055 bo_fake->block->virtual, in drm_intel_fake_bo_map_locked()
1056 bo_fake->block->bo->size); in drm_intel_fake_bo_map_locked()
1057 bo_fake->card_dirty = 0; in drm_intel_fake_bo_map_locked()
1060 bo->virtual = bo_fake->backing_store; in drm_intel_fake_bo_map_locked()
1086 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_unmap_locked() local
1089 if (bo_fake->is_static) in drm_intel_fake_bo_unmap_locked()
1092 assert(bo_fake->map_count != 0); in drm_intel_fake_bo_unmap_locked()
1093 if (--bo_fake->map_count != 0) in drm_intel_fake_bo_unmap_locked()
1096 DBG("drm_bo_unmap: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name, in drm_intel_fake_bo_unmap_locked()
1097 bo_fake->bo.size / 1024); in drm_intel_fake_bo_unmap_locked()
1143 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in drm_intel_fake_kick_all_locked() local
1147 bo_fake->block = NULL; in drm_intel_fake_kick_all_locked()
1148 bo_fake->validated = 0; in drm_intel_fake_kick_all_locked()
1149 if (!(bo_fake->flags & BM_NO_BACKING_STORE)) in drm_intel_fake_kick_all_locked()
1150 bo_fake->dirty = 1; in drm_intel_fake_kick_all_locked()
1159 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_validate() local
1163 DBG("drm_bo_validate: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_fake_bo_validate()
1164 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_fake_bo_validate()
1170 assert(bo_fake->map_count == 0); in drm_intel_fake_bo_validate()
1172 if (bo_fake->is_static) { in drm_intel_fake_bo_validate()
1179 if (!bo_fake->block && !evict_and_alloc_block(bo)) { in drm_intel_fake_bo_validate()
1181 DBG("Failed to validate buf %d:%s\n", bo_fake->id, in drm_intel_fake_bo_validate()
1182 bo_fake->name); in drm_intel_fake_bo_validate()
1186 assert(bo_fake->block); in drm_intel_fake_bo_validate()
1187 assert(bo_fake->block->bo == &bo_fake->bo); in drm_intel_fake_bo_validate()
1189 bo->offset = bo_fake->block->mem->ofs; in drm_intel_fake_bo_validate()
1192 if (bo_fake->dirty) { in drm_intel_fake_bo_validate()
1193 DBG("Upload dirty buf %d:%s, sz %lu offset 0x%x\n", bo_fake->id, in drm_intel_fake_bo_validate()
1194 bo_fake->name, bo->size, bo_fake->block->mem->ofs); in drm_intel_fake_bo_validate()
1196 assert(!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED))); in drm_intel_fake_bo_validate()
1207 if (bo_fake->backing_store) in drm_intel_fake_bo_validate()
1208 memcpy(bo_fake->block->virtual, bo_fake->backing_store, in drm_intel_fake_bo_validate()
1211 memset(bo_fake->block->virtual, 0, bo->size); in drm_intel_fake_bo_validate()
1213 bo_fake->dirty = 0; in drm_intel_fake_bo_validate()
1216 bo_fake->block->fenced = 0; in drm_intel_fake_bo_validate()
1217 bo_fake->block->on_hardware = 1; in drm_intel_fake_bo_validate()
1218 DRMLISTDEL(bo_fake->block); in drm_intel_fake_bo_validate()
1219 DRMLISTADDTAIL(bo_fake->block, &bufmgr_fake->on_hardware); in drm_intel_fake_bo_validate()
1221 bo_fake->validated = 1; in drm_intel_fake_bo_validate()
1257 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_emit_reloc() local
1266 if (bo_fake->relocs == NULL) { in drm_intel_fake_emit_reloc()
1267 bo_fake->relocs = in drm_intel_fake_emit_reloc()
1271 r = &bo_fake->relocs[bo_fake->nr_relocs++]; in drm_intel_fake_emit_reloc()
1273 assert(bo_fake->nr_relocs <= MAX_RELOCS); in drm_intel_fake_emit_reloc()
1278 bo_fake->child_size += in drm_intel_fake_emit_reloc()
1280 bo_fake->child_size += target_fake->child_size; in drm_intel_fake_emit_reloc()
1293 for (i = 0; i < bo_fake->nr_relocs - 1; i++) { in drm_intel_fake_emit_reloc()
1294 struct fake_buffer_reloc *r2 = &bo_fake->relocs[i]; in drm_intel_fake_emit_reloc()
1312 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_calculate_domains() local
1315 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_fake_calculate_domains()
1316 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_fake_calculate_domains()
1333 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_reloc_and_validate_buffer() local
1336 assert(bo_fake->map_count == 0); in drm_intel_fake_reloc_and_validate_buffer()
1338 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_fake_reloc_and_validate_buffer()
1339 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_fake_reloc_and_validate_buffer()
1372 if (bo_fake->write_domain != 0) { in drm_intel_fake_reloc_and_validate_buffer()
1373 if (!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED))) { in drm_intel_fake_reloc_and_validate_buffer()
1374 if (bo_fake->backing_store == 0) in drm_intel_fake_reloc_and_validate_buffer()
1377 bo_fake->card_dirty = 1; in drm_intel_fake_reloc_and_validate_buffer()
1389 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_bo_fake_post_submit() local
1392 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_bo_fake_post_submit()
1393 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_bo_fake_post_submit()
1401 bo_fake->name, (uint32_t) bo->offset, r->offset, in drm_intel_bo_fake_post_submit()
1406 assert(bo_fake->map_count == 0); in drm_intel_bo_fake_post_submit()
1407 bo_fake->validated = 0; in drm_intel_bo_fake_post_submit()
1408 bo_fake->read_domains = 0; in drm_intel_bo_fake_post_submit()
1409 bo_fake->write_domain = 0; in drm_intel_bo_fake_post_submit()
1507 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo_array[i]; in drm_intel_fake_check_aperture_space() local
1509 if (bo_fake == NULL) in drm_intel_fake_check_aperture_space()
1512 if (!bo_fake->is_static) in drm_intel_fake_check_aperture_space()
1513 sz += ALIGN(bo_array[i]->size, bo_fake->alignment); in drm_intel_fake_check_aperture_space()
1514 sz += bo_fake->child_size; in drm_intel_fake_check_aperture_space()
1559 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in drm_intel_bufmgr_fake_evict_all() local
1564 bo_fake->block = NULL; in drm_intel_bufmgr_fake_evict_all()