/* * Make a copy of the object's sgt, so that we can make an independent * mapping
*/
sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); if (!sgt) {
ret = -ENOMEM; goto err;
}
ret = sg_alloc_table(sgt, obj->mm.pages->orig_nents, GFP_KERNEL); if (ret) goto err_free;
sgt = dma_buf_map_attachment(obj->base.import_attach,
DMA_BIDIRECTIONAL); if (IS_ERR(sgt)) return PTR_ERR(sgt);
/* * DG1 is special here since it still snoops transactions even with * CACHE_NONE. This is not the case with other HAS_SNOOP platforms. We * might need to revisit this as we add new discrete platforms. * * XXX: Consider doing a vmap flush or something, where possible. * Currently we just do a heavy handed wbinvd_on_all_cpus() here since * the underlying sg_table might not even point to struct pages, so we * can't just call drm_clflush_sg or similar, like we do elsewhere in * the driver.
*/ if (i915_gem_object_can_bypass_llc(obj) ||
(!HAS_LLC(i915) && !IS_DG1(i915)))
wbinvd_on_all_cpus();
/* is this one of own objects? */ if (dma_buf->ops == &i915_dmabuf_ops) {
obj = dma_buf_to_obj(dma_buf); /* is it from our device? */ if (obj->base.dev == dev &&
!I915_SELFTEST_ONLY(force_different_devices)) { /* * Importing dmabuf exported from out own gem increases * refcount on gem itself instead of f_count of dmabuf.
*/ return &i915_gem_object_get(obj)->base;
}
}
if (i915_gem_object_size_2big(dma_buf->size)) return ERR_PTR(-E2BIG);
/* need to attach */
attach = dma_buf_attach(dma_buf, dev->dev); if (IS_ERR(attach)) return ERR_CAST(attach);
get_dma_buf(dma_buf);
obj = i915_gem_object_alloc(); if (!obj) {
ret = -ENOMEM; goto fail_detach;
}
/* We use GTT as shorthand for a coherent domain, one that is * neither in the GPU cache nor in the CPU cache, where all * writes are immediately visible in memory. (That's not strictly * true, but it's close! There are internal buffers such as the * write-combined buffer or a delay through the chipset for GTT * writes that do require us to treat GTT as a separate cache domain.)
*/
obj->read_domains = I915_GEM_DOMAIN_GTT;
obj->write_domain = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.