• Home
  • Raw
  • Download

Lines Matching refs:bo

32 	struct qxl_bo *bo;  in qxl_ttm_bo_destroy()  local
35 bo = container_of(tbo, struct qxl_bo, tbo); in qxl_ttm_bo_destroy()
36 qdev = (struct qxl_device *)bo->gem_base.dev->dev_private; in qxl_ttm_bo_destroy()
38 qxl_surface_evict(qdev, bo, false); in qxl_ttm_bo_destroy()
39 qxl_fence_fini(&bo->fence); in qxl_ttm_bo_destroy()
41 list_del_init(&bo->list); in qxl_ttm_bo_destroy()
43 drm_gem_object_release(&bo->gem_base); in qxl_ttm_bo_destroy()
44 kfree(bo); in qxl_ttm_bo_destroy()
47 bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo) in qxl_ttm_bo_is_qxl_bo() argument
49 if (bo->destroy == &qxl_ttm_bo_destroy) in qxl_ttm_bo_is_qxl_bo()
80 struct qxl_bo *bo; in qxl_bo_create() local
91 bo = kzalloc(sizeof(struct qxl_bo), GFP_KERNEL); in qxl_bo_create()
92 if (bo == NULL) in qxl_bo_create()
95 r = drm_gem_object_init(qdev->ddev, &bo->gem_base, size); in qxl_bo_create()
97 kfree(bo); in qxl_bo_create()
100 bo->gem_base.driver_private = NULL; in qxl_bo_create()
101 bo->type = domain; in qxl_bo_create()
102 bo->pin_count = 0; in qxl_bo_create()
103 bo->surface_id = 0; in qxl_bo_create()
104 qxl_fence_init(qdev, &bo->fence); in qxl_bo_create()
105 INIT_LIST_HEAD(&bo->list); in qxl_bo_create()
106 atomic_set(&bo->reserve_count, 0); in qxl_bo_create()
108 bo->surf = *surf; in qxl_bo_create()
110 qxl_ttm_placement_from_domain(bo, domain); in qxl_bo_create()
112 r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, in qxl_bo_create()
113 &bo->placement, 0, !kernel, NULL, size, in qxl_bo_create()
122 *bo_ptr = bo; in qxl_bo_create()
126 int qxl_bo_kmap(struct qxl_bo *bo, void **ptr) in qxl_bo_kmap() argument
131 if (bo->kptr) { in qxl_bo_kmap()
133 *ptr = bo->kptr; in qxl_bo_kmap()
136 r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap); in qxl_bo_kmap()
139 bo->kptr = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem); in qxl_bo_kmap()
141 *ptr = bo->kptr; in qxl_bo_kmap()
146 struct qxl_bo *bo, int page_offset) in qxl_bo_kmap_atomic_page() argument
148 struct ttm_mem_type_manager *man = &bo->tbo.bdev->man[bo->tbo.mem.mem_type]; in qxl_bo_kmap_atomic_page()
153 if (bo->tbo.mem.mem_type == TTM_PL_VRAM) in qxl_bo_kmap_atomic_page()
155 else if (bo->tbo.mem.mem_type == TTM_PL_PRIV0) in qxl_bo_kmap_atomic_page()
161 ret = ttm_mem_io_reserve(bo->tbo.bdev, &bo->tbo.mem); in qxl_bo_kmap_atomic_page()
164 return io_mapping_map_atomic_wc(map, bo->tbo.mem.bus.offset + page_offset); in qxl_bo_kmap_atomic_page()
166 if (bo->kptr) { in qxl_bo_kmap_atomic_page()
167 rptr = bo->kptr + (page_offset * PAGE_SIZE); in qxl_bo_kmap_atomic_page()
171 ret = qxl_bo_kmap(bo, &rptr); in qxl_bo_kmap_atomic_page()
179 void qxl_bo_kunmap(struct qxl_bo *bo) in qxl_bo_kunmap() argument
181 if (bo->kptr == NULL) in qxl_bo_kunmap()
183 bo->kptr = NULL; in qxl_bo_kunmap()
184 ttm_bo_kunmap(&bo->kmap); in qxl_bo_kunmap()
188 struct qxl_bo *bo, void *pmap) in qxl_bo_kunmap_atomic_page() argument
190 struct ttm_mem_type_manager *man = &bo->tbo.bdev->man[bo->tbo.mem.mem_type]; in qxl_bo_kunmap_atomic_page()
193 if (bo->tbo.mem.mem_type == TTM_PL_VRAM) in qxl_bo_kunmap_atomic_page()
195 else if (bo->tbo.mem.mem_type == TTM_PL_PRIV0) in qxl_bo_kunmap_atomic_page()
203 ttm_mem_io_free(bo->tbo.bdev, &bo->tbo.mem); in qxl_bo_kunmap_atomic_page()
207 qxl_bo_kunmap(bo); in qxl_bo_kunmap_atomic_page()
210 void qxl_bo_unref(struct qxl_bo **bo) in qxl_bo_unref() argument
214 if ((*bo) == NULL) in qxl_bo_unref()
216 tbo = &((*bo)->tbo); in qxl_bo_unref()
219 *bo = NULL; in qxl_bo_unref()
222 struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo) in qxl_bo_ref() argument
224 ttm_bo_reference(&bo->tbo); in qxl_bo_ref()
225 return bo; in qxl_bo_ref()
228 int qxl_bo_pin(struct qxl_bo *bo, u32 domain, u64 *gpu_addr) in qxl_bo_pin() argument
230 struct qxl_device *qdev = (struct qxl_device *)bo->gem_base.dev->dev_private; in qxl_bo_pin()
233 if (bo->pin_count) { in qxl_bo_pin()
234 bo->pin_count++; in qxl_bo_pin()
236 *gpu_addr = qxl_bo_gpu_offset(bo); in qxl_bo_pin()
239 qxl_ttm_placement_from_domain(bo, domain); in qxl_bo_pin()
240 for (i = 0; i < bo->placement.num_placement; i++) in qxl_bo_pin()
241 bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; in qxl_bo_pin()
242 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false); in qxl_bo_pin()
244 bo->pin_count = 1; in qxl_bo_pin()
246 *gpu_addr = qxl_bo_gpu_offset(bo); in qxl_bo_pin()
249 dev_err(qdev->dev, "%p pin failed\n", bo); in qxl_bo_pin()
253 int qxl_bo_unpin(struct qxl_bo *bo) in qxl_bo_unpin() argument
255 struct qxl_device *qdev = (struct qxl_device *)bo->gem_base.dev->dev_private; in qxl_bo_unpin()
258 if (!bo->pin_count) { in qxl_bo_unpin()
259 dev_warn(qdev->dev, "%p unpin not necessary\n", bo); in qxl_bo_unpin()
262 bo->pin_count--; in qxl_bo_unpin()
263 if (bo->pin_count) in qxl_bo_unpin()
265 for (i = 0; i < bo->placement.num_placement; i++) in qxl_bo_unpin()
266 bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; in qxl_bo_unpin()
267 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false); in qxl_bo_unpin()
269 dev_err(qdev->dev, "%p validate failed for unpin\n", bo); in qxl_bo_unpin()
275 struct qxl_bo *bo, *n; in qxl_bo_force_delete() local
280 list_for_each_entry_safe(bo, n, &qdev->gem.objects, list) { in qxl_bo_force_delete()
283 &bo->gem_base, bo, (unsigned long)bo->gem_base.size, in qxl_bo_force_delete()
284 *((unsigned long *)&bo->gem_base.refcount)); in qxl_bo_force_delete()
286 list_del_init(&bo->list); in qxl_bo_force_delete()
289 drm_gem_object_unreference(&bo->gem_base); in qxl_bo_force_delete()
304 int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo) in qxl_bo_check_id() argument
307 if (bo->type == QXL_GEM_DOMAIN_SURFACE && bo->surface_id == 0) { in qxl_bo_check_id()
309 ret = qxl_surface_id_alloc(qdev, bo); in qxl_bo_check_id()
313 ret = qxl_hw_surface_alloc(qdev, bo, NULL); in qxl_bo_check_id()
325 qxl_bo_unreserve(entry->bo); in qxl_bo_list_unreserve()
331 int qxl_bo_list_add(struct qxl_reloc_list *reloc_list, struct qxl_bo *bo) in qxl_bo_list_add() argument
337 if (entry->bo == bo) in qxl_bo_list_add()
345 entry->bo = bo; in qxl_bo_list_add()
348 ret = qxl_bo_reserve(bo, false); in qxl_bo_list_add()
352 if (!bo->pin_count) { in qxl_bo_list_add()
353 qxl_ttm_placement_from_domain(bo, bo->type); in qxl_bo_list_add()
354 ret = ttm_bo_validate(&bo->tbo, &bo->placement, in qxl_bo_list_add()
361 ret = qxl_bo_check_id(bo->gem_base.dev->dev_private, bo); in qxl_bo_list_add()