• Home
  • Raw
  • Download

Lines Matching refs:bo

32 	struct qxl_bo *bo;  in qxl_ttm_bo_destroy()  local
35 bo = to_qxl_bo(tbo); in qxl_ttm_bo_destroy()
36 qdev = to_qxl(bo->tbo.base.dev); in qxl_ttm_bo_destroy()
38 qxl_surface_evict(qdev, bo, false); in qxl_ttm_bo_destroy()
39 WARN_ON_ONCE(bo->map_count > 0); in qxl_ttm_bo_destroy()
41 list_del_init(&bo->list); in qxl_ttm_bo_destroy()
43 drm_gem_object_release(&bo->tbo.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()
111 struct qxl_bo *bo; in qxl_bo_create() local
120 bo = kzalloc(sizeof(struct qxl_bo), GFP_KERNEL); in qxl_bo_create()
121 if (bo == NULL) in qxl_bo_create()
124 r = drm_gem_object_init(&qdev->ddev, &bo->tbo.base, size); in qxl_bo_create()
126 kfree(bo); in qxl_bo_create()
129 bo->tbo.base.funcs = &qxl_object_funcs; in qxl_bo_create()
130 bo->type = domain; in qxl_bo_create()
131 bo->pin_count = pinned ? 1 : 0; in qxl_bo_create()
132 bo->surface_id = 0; in qxl_bo_create()
133 INIT_LIST_HEAD(&bo->list); in qxl_bo_create()
136 bo->surf = *surf; in qxl_bo_create()
138 qxl_ttm_placement_from_domain(bo, domain, pinned); in qxl_bo_create()
140 bo->tbo.priority = priority; in qxl_bo_create()
141 r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, in qxl_bo_create()
142 &bo->placement, 0, !kernel, size, in qxl_bo_create()
151 *bo_ptr = bo; in qxl_bo_create()
155 int qxl_bo_kmap(struct qxl_bo *bo, void **ptr) in qxl_bo_kmap() argument
160 if (bo->kptr) { in qxl_bo_kmap()
162 *ptr = bo->kptr; in qxl_bo_kmap()
163 bo->map_count++; in qxl_bo_kmap()
166 r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap); in qxl_bo_kmap()
169 bo->kptr = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem); in qxl_bo_kmap()
171 *ptr = bo->kptr; in qxl_bo_kmap()
172 bo->map_count = 1; in qxl_bo_kmap()
177 struct qxl_bo *bo, int page_offset) in qxl_bo_kmap_atomic_page() argument
184 if (bo->tbo.mem.mem_type == TTM_PL_VRAM) in qxl_bo_kmap_atomic_page()
186 else if (bo->tbo.mem.mem_type == TTM_PL_PRIV) in qxl_bo_kmap_atomic_page()
191 offset = bo->tbo.mem.start << PAGE_SHIFT; in qxl_bo_kmap_atomic_page()
194 if (bo->kptr) { in qxl_bo_kmap_atomic_page()
195 rptr = bo->kptr + (page_offset * PAGE_SIZE); in qxl_bo_kmap_atomic_page()
199 ret = qxl_bo_kmap(bo, &rptr); in qxl_bo_kmap_atomic_page()
207 void qxl_bo_kunmap(struct qxl_bo *bo) in qxl_bo_kunmap() argument
209 if (bo->kptr == NULL) in qxl_bo_kunmap()
211 bo->map_count--; in qxl_bo_kunmap()
212 if (bo->map_count > 0) in qxl_bo_kunmap()
214 bo->kptr = NULL; in qxl_bo_kunmap()
215 ttm_bo_kunmap(&bo->kmap); in qxl_bo_kunmap()
219 struct qxl_bo *bo, void *pmap) in qxl_bo_kunmap_atomic_page() argument
221 if ((bo->tbo.mem.mem_type != TTM_PL_VRAM) && in qxl_bo_kunmap_atomic_page()
222 (bo->tbo.mem.mem_type != TTM_PL_PRIV)) in qxl_bo_kunmap_atomic_page()
228 qxl_bo_kunmap(bo); in qxl_bo_kunmap_atomic_page()
231 void qxl_bo_unref(struct qxl_bo **bo) in qxl_bo_unref() argument
233 if ((*bo) == NULL) in qxl_bo_unref()
236 drm_gem_object_put(&(*bo)->tbo.base); in qxl_bo_unref()
237 *bo = NULL; in qxl_bo_unref()
240 struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo) in qxl_bo_ref() argument
242 drm_gem_object_get(&bo->tbo.base); in qxl_bo_ref()
243 return bo; in qxl_bo_ref()
246 static int __qxl_bo_pin(struct qxl_bo *bo) in __qxl_bo_pin() argument
249 struct drm_device *ddev = bo->tbo.base.dev; in __qxl_bo_pin()
252 if (bo->pin_count) { in __qxl_bo_pin()
253 bo->pin_count++; in __qxl_bo_pin()
256 qxl_ttm_placement_from_domain(bo, bo->type, true); in __qxl_bo_pin()
257 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); in __qxl_bo_pin()
259 bo->pin_count = 1; in __qxl_bo_pin()
262 dev_err(ddev->dev, "%p pin failed\n", bo); in __qxl_bo_pin()
266 static int __qxl_bo_unpin(struct qxl_bo *bo) in __qxl_bo_unpin() argument
269 struct drm_device *ddev = bo->tbo.base.dev; in __qxl_bo_unpin()
272 if (!bo->pin_count) { in __qxl_bo_unpin()
273 dev_warn(ddev->dev, "%p unpin not necessary\n", bo); in __qxl_bo_unpin()
276 bo->pin_count--; in __qxl_bo_unpin()
277 if (bo->pin_count) in __qxl_bo_unpin()
279 for (i = 0; i < bo->placement.num_placement; i++) in __qxl_bo_unpin()
280 bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT; in __qxl_bo_unpin()
281 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); in __qxl_bo_unpin()
283 dev_err(ddev->dev, "%p validate failed for unpin\n", bo); in __qxl_bo_unpin()
292 int qxl_bo_pin(struct qxl_bo *bo) in qxl_bo_pin() argument
296 r = qxl_bo_reserve(bo); in qxl_bo_pin()
300 r = __qxl_bo_pin(bo); in qxl_bo_pin()
301 qxl_bo_unreserve(bo); in qxl_bo_pin()
310 int qxl_bo_unpin(struct qxl_bo *bo) in qxl_bo_unpin() argument
314 r = qxl_bo_reserve(bo); in qxl_bo_unpin()
318 r = __qxl_bo_unpin(bo); in qxl_bo_unpin()
319 qxl_bo_unreserve(bo); in qxl_bo_unpin()
325 struct qxl_bo *bo, *n; in qxl_bo_force_delete() local
330 list_for_each_entry_safe(bo, n, &qdev->gem.objects, list) { in qxl_bo_force_delete()
332 &bo->tbo.base, bo, (unsigned long)bo->tbo.base.size, in qxl_bo_force_delete()
333 *((unsigned long *)&bo->tbo.base.refcount)); in qxl_bo_force_delete()
335 list_del_init(&bo->list); in qxl_bo_force_delete()
338 drm_gem_object_put(&bo->tbo.base); in qxl_bo_force_delete()
352 int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo) in qxl_bo_check_id() argument
356 if (bo->type == QXL_GEM_DOMAIN_SURFACE && bo->surface_id == 0) { in qxl_bo_check_id()
358 ret = qxl_surface_id_alloc(qdev, bo); in qxl_bo_check_id()
362 ret = qxl_hw_surface_alloc(qdev, bo); in qxl_bo_check_id()