Lines Matching full:mapping

7 #include <linux/dma-mapping.h>
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()
256 * the MMU owns this mapping to close this race. 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 mapping->use += 1; in etnaviv_gem_mapping_get()
263 mapping = NULL; in etnaviv_gem_mapping_get()
265 if (mapping) in etnaviv_gem_mapping_get()
268 mapping->use += 1; in etnaviv_gem_mapping_get()
280 * See if we have a reaped vram mapping we can re-use before in etnaviv_gem_mapping_get()
281 * allocating a fresh mapping. in etnaviv_gem_mapping_get()
283 mapping = etnaviv_gem_get_vram_mapping(etnaviv_obj, NULL); in etnaviv_gem_mapping_get()
284 if (!mapping) { in etnaviv_gem_mapping_get()
285 mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); in etnaviv_gem_mapping_get()
286 if (!mapping) { in etnaviv_gem_mapping_get()
291 INIT_LIST_HEAD(&mapping->scan_node); in etnaviv_gem_mapping_get()
292 mapping->object = etnaviv_obj; in etnaviv_gem_mapping_get()
294 list_del(&mapping->obj_node); in etnaviv_gem_mapping_get()
297 mapping->use = 1; in etnaviv_gem_mapping_get()
301 mapping, va); in etnaviv_gem_mapping_get()
303 kfree(mapping); in etnaviv_gem_mapping_get()
305 list_add_tail(&mapping->obj_node, &etnaviv_obj->vram_list); in etnaviv_gem_mapping_get()
315 return mapping; in etnaviv_gem_mapping_get()
485 struct etnaviv_vram_mapping *mapping, *tmp; in etnaviv_gem_free_object() local
494 list_for_each_entry_safe(mapping, tmp, &etnaviv_obj->vram_list, in etnaviv_gem_free_object()
496 struct etnaviv_iommu_context *context = mapping->context; in etnaviv_gem_free_object()
498 WARN_ON(mapping->use); in etnaviv_gem_free_object()
501 etnaviv_iommu_unmap_gem(context, mapping); in etnaviv_gem_free_object()
503 list_del(&mapping->obj_node); in etnaviv_gem_free_object()
504 kfree(mapping); in etnaviv_gem_free_object()