Lines Matching refs:mapping

218 	struct etnaviv_vram_mapping *mapping;  in etnaviv_gem_get_vram_mapping()  local
220 list_for_each_entry(mapping, &obj->vram_list, obj_node) { in etnaviv_gem_get_vram_mapping()
221 if (mapping->context == context) in etnaviv_gem_get_vram_mapping()
222 return mapping; in etnaviv_gem_get_vram_mapping()
228 void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping) in etnaviv_gem_mapping_unreference() argument
230 struct etnaviv_gem_object *etnaviv_obj = mapping->object; in etnaviv_gem_mapping_unreference()
233 WARN_ON(mapping->use == 0); in etnaviv_gem_mapping_unreference()
234 mapping->use -= 1; in etnaviv_gem_mapping_unreference()
245 struct etnaviv_vram_mapping *mapping; in etnaviv_gem_mapping_get() local
250 mapping = etnaviv_gem_get_vram_mapping(etnaviv_obj, mmu_context); in etnaviv_gem_mapping_get()
251 if (mapping) { in etnaviv_gem_mapping_get()
258 if (mapping->use == 0) { in etnaviv_gem_mapping_get()
260 if (mapping->context == mmu_context) in etnaviv_gem_mapping_get()
261 if (va && mapping->iova != va) { in etnaviv_gem_mapping_get()
262 etnaviv_iommu_reap_mapping(mapping); in etnaviv_gem_mapping_get()
263 mapping = NULL; in etnaviv_gem_mapping_get()
265 mapping->use += 1; in etnaviv_gem_mapping_get()
268 mapping = NULL; in etnaviv_gem_mapping_get()
270 if (mapping) in etnaviv_gem_mapping_get()
273 mapping->use += 1; in etnaviv_gem_mapping_get()
288 mapping = etnaviv_gem_get_vram_mapping(etnaviv_obj, NULL); in etnaviv_gem_mapping_get()
289 if (!mapping) { in etnaviv_gem_mapping_get()
290 mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); in etnaviv_gem_mapping_get()
291 if (!mapping) { in etnaviv_gem_mapping_get()
296 INIT_LIST_HEAD(&mapping->scan_node); in etnaviv_gem_mapping_get()
297 mapping->object = etnaviv_obj; in etnaviv_gem_mapping_get()
299 list_del(&mapping->obj_node); in etnaviv_gem_mapping_get()
302 mapping->use = 1; in etnaviv_gem_mapping_get()
306 mapping, va); in etnaviv_gem_mapping_get()
308 kfree(mapping); in etnaviv_gem_mapping_get()
310 list_add_tail(&mapping->obj_node, &etnaviv_obj->vram_list); in etnaviv_gem_mapping_get()
320 return mapping; in etnaviv_gem_mapping_get()
492 struct etnaviv_vram_mapping *mapping, *tmp; in etnaviv_gem_free_object() local
501 list_for_each_entry_safe(mapping, tmp, &etnaviv_obj->vram_list, in etnaviv_gem_free_object()
503 struct etnaviv_iommu_context *context = mapping->context; in etnaviv_gem_free_object()
505 WARN_ON(mapping->use); in etnaviv_gem_free_object()
508 etnaviv_iommu_unmap_gem(context, mapping); in etnaviv_gem_free_object()
510 list_del(&mapping->obj_node); in etnaviv_gem_free_object()
511 kfree(mapping); in etnaviv_gem_free_object()