Lines Matching refs:bo_fake

429 	drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo;  in alloc_block()  local
433 unsigned int align_log2 = ffs(bo_fake->alignment) - 1; in alloc_block()
439 sz = (bo->size + bo_fake->alignment - 1) & ~(bo_fake->alignment - 1); in alloc_block()
456 bo_fake->block = block; in alloc_block()
467 drm_intel_bo_fake *bo_fake; in free_block() local
474 bo_fake = (drm_intel_bo_fake *) block->bo; in free_block()
476 if (bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE)) in free_block()
479 if (!skip_dirty_copy && (bo_fake->card_dirty == 1)) { in free_block()
480 memcpy(bo_fake->backing_store, block->virtual, block->bo->size); in free_block()
481 bo_fake->card_dirty = 0; in free_block()
482 bo_fake->dirty = 1; in free_block()
503 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in alloc_backing_store() local
504 assert(!bo_fake->backing_store); in alloc_backing_store()
505 assert(!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE))); in alloc_backing_store()
507 bo_fake->backing_store = malloc(bo->size); in alloc_backing_store()
509 DBG("alloc_backing - buf %d %p %lu\n", bo_fake->id, in alloc_backing_store()
510 bo_fake->backing_store, bo->size); in alloc_backing_store()
511 assert(bo_fake->backing_store); in alloc_backing_store()
517 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in free_backing_store() local
519 if (bo_fake->backing_store) { in free_backing_store()
520 assert(!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE))); in free_backing_store()
521 free(bo_fake->backing_store); in free_backing_store()
522 bo_fake->backing_store = NULL; in free_backing_store()
531 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in set_dirty() local
533 if (bo_fake->flags & BM_NO_BACKING_STORE in set_dirty()
534 && bo_fake->invalidate_cb != NULL) in set_dirty()
535 bo_fake->invalidate_cb(bo, bo_fake->invalidate_ptr); in set_dirty()
537 assert(!(bo_fake->flags & BM_PINNED)); in set_dirty()
539 DBG("set_dirty - buf %d\n", bo_fake->id); in set_dirty()
540 bo_fake->dirty = 1; in set_dirty()
551 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in evict_lru() local
553 if (bo_fake != NULL && (bo_fake->flags & BM_NO_FENCE_SUBDATA)) in evict_lru()
560 set_dirty(&bo_fake->bo); in evict_lru()
561 bo_fake->block = NULL; in evict_lru()
578 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in evict_mru() local
580 if (bo_fake && (bo_fake->flags & BM_NO_FENCE_SUBDATA)) in evict_mru()
583 set_dirty(&bo_fake->bo); in evict_mru()
584 bo_fake->block = NULL; in evict_mru()
666 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in evict_and_alloc_block() local
668 assert(bo_fake->block == NULL); in evict_and_alloc_block()
752 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_wait_rendering_locked() local
754 if (bo_fake->block == NULL || !bo_fake->block->fenced) in drm_intel_fake_bo_wait_rendering_locked()
757 _fence_wait_internal(bufmgr_fake, bo_fake->block->fence); in drm_intel_fake_bo_wait_rendering_locked()
813 drm_intel_bo_fake *bo_fake; in drm_intel_fake_bo_alloc() local
819 bo_fake = calloc(1, sizeof(*bo_fake)); in drm_intel_fake_bo_alloc()
820 if (!bo_fake) in drm_intel_fake_bo_alloc()
823 bo_fake->bo.size = size; in drm_intel_fake_bo_alloc()
824 bo_fake->bo.offset = -1; in drm_intel_fake_bo_alloc()
825 bo_fake->bo.virtual = NULL; in drm_intel_fake_bo_alloc()
826 bo_fake->bo.bufmgr = bufmgr; in drm_intel_fake_bo_alloc()
827 bo_fake->refcount = 1; in drm_intel_fake_bo_alloc()
833 bo_fake->alignment = alignment; in drm_intel_fake_bo_alloc()
834 bo_fake->id = ++bufmgr_fake->buf_nr; in drm_intel_fake_bo_alloc()
835 bo_fake->name = name; in drm_intel_fake_bo_alloc()
836 bo_fake->flags = 0; in drm_intel_fake_bo_alloc()
837 bo_fake->is_static = 0; in drm_intel_fake_bo_alloc()
839 DBG("drm_bo_alloc: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name, in drm_intel_fake_bo_alloc()
840 bo_fake->bo.size / 1024); in drm_intel_fake_bo_alloc()
842 return &bo_fake->bo; in drm_intel_fake_bo_alloc()
878 drm_intel_bo_fake *bo_fake; in drm_intel_bo_fake_alloc_static() local
884 bo_fake = calloc(1, sizeof(*bo_fake)); in drm_intel_bo_fake_alloc_static()
885 if (!bo_fake) in drm_intel_bo_fake_alloc_static()
888 bo_fake->bo.size = size; in drm_intel_bo_fake_alloc_static()
889 bo_fake->bo.offset = offset; in drm_intel_bo_fake_alloc_static()
890 bo_fake->bo.virtual = virtual; in drm_intel_bo_fake_alloc_static()
891 bo_fake->bo.bufmgr = bufmgr; in drm_intel_bo_fake_alloc_static()
892 bo_fake->refcount = 1; in drm_intel_bo_fake_alloc_static()
893 bo_fake->id = ++bufmgr_fake->buf_nr; in drm_intel_bo_fake_alloc_static()
894 bo_fake->name = name; in drm_intel_bo_fake_alloc_static()
895 bo_fake->flags = BM_PINNED; in drm_intel_bo_fake_alloc_static()
896 bo_fake->is_static = 1; in drm_intel_bo_fake_alloc_static()
898 DBG("drm_bo_alloc_static: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_bo_fake_alloc_static()
899 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_bo_fake_alloc_static()
901 return &bo_fake->bo; in drm_intel_bo_fake_alloc_static()
909 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_reference() local
912 bo_fake->refcount++; in drm_intel_fake_bo_reference()
919 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_reference_locked() local
921 bo_fake->refcount++; in drm_intel_fake_bo_reference_locked()
929 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_unreference_locked() local
932 if (--bo_fake->refcount == 0) { in drm_intel_fake_bo_unreference_locked()
933 assert(bo_fake->map_count == 0); in drm_intel_fake_bo_unreference_locked()
935 if (bo_fake->block) in drm_intel_fake_bo_unreference_locked()
936 free_block(bufmgr_fake, bo_fake->block, 1); in drm_intel_fake_bo_unreference_locked()
939 for (i = 0; i < bo_fake->nr_relocs; i++) in drm_intel_fake_bo_unreference_locked()
940 drm_intel_fake_bo_unreference_locked(bo_fake->relocs[i]. in drm_intel_fake_bo_unreference_locked()
943 DBG("drm_bo_unreference: free buf %d %s\n", bo_fake->id, in drm_intel_fake_bo_unreference_locked()
944 bo_fake->name); in drm_intel_fake_bo_unreference_locked()
946 free(bo_fake->relocs); in drm_intel_fake_bo_unreference_locked()
974 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_bo_fake_disable_backing_store() local
978 if (bo_fake->backing_store) in drm_intel_bo_fake_disable_backing_store()
981 bo_fake->flags |= BM_NO_BACKING_STORE; in drm_intel_bo_fake_disable_backing_store()
983 DBG("disable_backing_store set buf %d dirty\n", bo_fake->id); in drm_intel_bo_fake_disable_backing_store()
984 bo_fake->dirty = 1; in drm_intel_bo_fake_disable_backing_store()
985 bo_fake->invalidate_cb = invalidate_cb; in drm_intel_bo_fake_disable_backing_store()
986 bo_fake->invalidate_ptr = ptr; in drm_intel_bo_fake_disable_backing_store()
1007 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_map_locked() local
1010 if (bo_fake->is_static) { in drm_intel_fake_bo_map_locked()
1011 if (bo_fake->card_dirty) { in drm_intel_fake_bo_map_locked()
1013 bo_fake->card_dirty = 0; in drm_intel_fake_bo_map_locked()
1022 if (bo_fake->map_count++ != 0) in drm_intel_fake_bo_map_locked()
1026 DBG("drm_bo_map: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_fake_bo_map_locked()
1027 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_fake_bo_map_locked()
1032 } else if (bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED)) { in drm_intel_fake_bo_map_locked()
1034 if (!bo_fake->block && !evict_and_alloc_block(bo)) { in drm_intel_fake_bo_map_locked()
1039 assert(bo_fake->block); in drm_intel_fake_bo_map_locked()
1040 bo_fake->dirty = 0; in drm_intel_fake_bo_map_locked()
1042 if (!(bo_fake->flags & BM_NO_FENCE_SUBDATA) && in drm_intel_fake_bo_map_locked()
1043 bo_fake->block->fenced) { in drm_intel_fake_bo_map_locked()
1048 bo->virtual = bo_fake->block->virtual; in drm_intel_fake_bo_map_locked()
1054 if (bo_fake->backing_store == 0) in drm_intel_fake_bo_map_locked()
1057 if ((bo_fake->card_dirty == 1) && bo_fake->block) { in drm_intel_fake_bo_map_locked()
1058 if (bo_fake->block->fenced) in drm_intel_fake_bo_map_locked()
1062 memcpy(bo_fake->backing_store, in drm_intel_fake_bo_map_locked()
1063 bo_fake->block->virtual, in drm_intel_fake_bo_map_locked()
1064 bo_fake->block->bo->size); in drm_intel_fake_bo_map_locked()
1065 bo_fake->card_dirty = 0; in drm_intel_fake_bo_map_locked()
1068 bo->virtual = bo_fake->backing_store; in drm_intel_fake_bo_map_locked()
1094 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_unmap_locked() local
1097 if (bo_fake->is_static) in drm_intel_fake_bo_unmap_locked()
1100 assert(bo_fake->map_count != 0); in drm_intel_fake_bo_unmap_locked()
1101 if (--bo_fake->map_count != 0) in drm_intel_fake_bo_unmap_locked()
1104 DBG("drm_bo_unmap: (buf %d: %s, %lu kb)\n", bo_fake->id, bo_fake->name, in drm_intel_fake_bo_unmap_locked()
1105 bo_fake->bo.size / 1024); in drm_intel_fake_bo_unmap_locked()
1151 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in drm_intel_fake_kick_all_locked() local
1155 bo_fake->block = NULL; in drm_intel_fake_kick_all_locked()
1156 bo_fake->validated = 0; in drm_intel_fake_kick_all_locked()
1157 if (!(bo_fake->flags & BM_NO_BACKING_STORE)) in drm_intel_fake_kick_all_locked()
1158 bo_fake->dirty = 1; in drm_intel_fake_kick_all_locked()
1167 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_bo_validate() local
1171 DBG("drm_bo_validate: (buf %d: %s, %lu kb)\n", bo_fake->id, in drm_intel_fake_bo_validate()
1172 bo_fake->name, bo_fake->bo.size / 1024); in drm_intel_fake_bo_validate()
1178 assert(bo_fake->map_count == 0); in drm_intel_fake_bo_validate()
1180 if (bo_fake->is_static) { in drm_intel_fake_bo_validate()
1187 if (!bo_fake->block && !evict_and_alloc_block(bo)) { in drm_intel_fake_bo_validate()
1189 DBG("Failed to validate buf %d:%s\n", bo_fake->id, in drm_intel_fake_bo_validate()
1190 bo_fake->name); in drm_intel_fake_bo_validate()
1194 assert(bo_fake->block); in drm_intel_fake_bo_validate()
1195 assert(bo_fake->block->bo == &bo_fake->bo); in drm_intel_fake_bo_validate()
1197 bo->offset = bo_fake->block->mem->ofs; in drm_intel_fake_bo_validate()
1200 if (bo_fake->dirty) { in drm_intel_fake_bo_validate()
1201 DBG("Upload dirty buf %d:%s, sz %lu offset 0x%x\n", bo_fake->id, in drm_intel_fake_bo_validate()
1202 bo_fake->name, bo->size, bo_fake->block->mem->ofs); in drm_intel_fake_bo_validate()
1204 assert(!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED))); in drm_intel_fake_bo_validate()
1215 if (bo_fake->backing_store) in drm_intel_fake_bo_validate()
1216 memcpy(bo_fake->block->virtual, bo_fake->backing_store, in drm_intel_fake_bo_validate()
1219 memset(bo_fake->block->virtual, 0, bo->size); in drm_intel_fake_bo_validate()
1221 bo_fake->dirty = 0; in drm_intel_fake_bo_validate()
1224 bo_fake->block->fenced = 0; in drm_intel_fake_bo_validate()
1225 bo_fake->block->on_hardware = 1; in drm_intel_fake_bo_validate()
1226 DRMLISTDEL(bo_fake->block); in drm_intel_fake_bo_validate()
1227 DRMLISTADDTAIL(bo_fake->block, &bufmgr_fake->on_hardware); in drm_intel_fake_bo_validate()
1229 bo_fake->validated = 1; in drm_intel_fake_bo_validate()
1265 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_emit_reloc() local
1274 if (bo_fake->relocs == NULL) { in drm_intel_fake_emit_reloc()
1275 bo_fake->relocs = in drm_intel_fake_emit_reloc()
1279 r = &bo_fake->relocs[bo_fake->nr_relocs++]; in drm_intel_fake_emit_reloc()
1281 assert(bo_fake->nr_relocs <= MAX_RELOCS); in drm_intel_fake_emit_reloc()
1286 bo_fake->child_size += in drm_intel_fake_emit_reloc()
1288 bo_fake->child_size += target_fake->child_size; in drm_intel_fake_emit_reloc()
1301 for (i = 0; i < bo_fake->nr_relocs - 1; i++) { in drm_intel_fake_emit_reloc()
1302 struct fake_buffer_reloc *r2 = &bo_fake->relocs[i]; in drm_intel_fake_emit_reloc()
1320 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_calculate_domains() local
1323 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_fake_calculate_domains()
1324 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_fake_calculate_domains()
1341 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_fake_reloc_and_validate_buffer() local
1344 assert(bo_fake->map_count == 0); in drm_intel_fake_reloc_and_validate_buffer()
1346 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_fake_reloc_and_validate_buffer()
1347 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_fake_reloc_and_validate_buffer()
1380 if (bo_fake->write_domain != 0) { in drm_intel_fake_reloc_and_validate_buffer()
1381 if (!(bo_fake->flags & (BM_NO_BACKING_STORE | BM_PINNED))) { in drm_intel_fake_reloc_and_validate_buffer()
1382 if (bo_fake->backing_store == 0) in drm_intel_fake_reloc_and_validate_buffer()
1385 bo_fake->card_dirty = 1; in drm_intel_fake_reloc_and_validate_buffer()
1397 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo; in drm_intel_bo_fake_post_submit() local
1400 for (i = 0; i < bo_fake->nr_relocs; i++) { in drm_intel_bo_fake_post_submit()
1401 struct fake_buffer_reloc *r = &bo_fake->relocs[i]; in drm_intel_bo_fake_post_submit()
1409 bo_fake->name, (uint32_t) bo->offset, r->offset, in drm_intel_bo_fake_post_submit()
1414 assert(bo_fake->map_count == 0); in drm_intel_bo_fake_post_submit()
1415 bo_fake->validated = 0; in drm_intel_bo_fake_post_submit()
1416 bo_fake->read_domains = 0; in drm_intel_bo_fake_post_submit()
1417 bo_fake->write_domain = 0; in drm_intel_bo_fake_post_submit()
1515 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) bo_array[i]; in drm_intel_fake_check_aperture_space() local
1517 if (bo_fake == NULL) in drm_intel_fake_check_aperture_space()
1520 if (!bo_fake->is_static) in drm_intel_fake_check_aperture_space()
1521 sz += ALIGN(bo_array[i]->size, bo_fake->alignment); in drm_intel_fake_check_aperture_space()
1522 sz += bo_fake->child_size; in drm_intel_fake_check_aperture_space()
1567 drm_intel_bo_fake *bo_fake = (drm_intel_bo_fake *) block->bo; in drm_intel_bufmgr_fake_evict_all() local
1572 bo_fake->block = NULL; in drm_intel_bufmgr_fake_evict_all()