Commit cbc1f3cb authored by Chris Wilson's avatar Chris Wilson

drm/i915: Skip CPU synchronisation on dmabuf attachments

dma-bufs are device coherent, with explicit CPU synchronisation provided
via the begin/end cpu access ioctls. As the coherency of the dma-buf is
explicitly defined to be under user control, flushing any caches on
attach/detach of the dma-buf is additional work that doesn't aide the
user in the slightest.
Suggested-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarDongwon Kim <dongwon.kim@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171130180702.29357-1-chris@chris-wilson.co.uk
parent 4746fd5c
...@@ -48,7 +48,9 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme ...@@ -48,7 +48,9 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
src = sg_next(src); src = sg_next(src);
} }
if (!dma_map_sg(attachment->dev, st->sgl, st->nents, dir)) { if (!dma_map_sg_attrs(attachment->dev,
st->sgl, st->nents, dir,
DMA_ATTR_SKIP_CPU_SYNC)) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_free_sg; goto err_free_sg;
} }
...@@ -71,7 +73,9 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment, ...@@ -71,7 +73,9 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
{ {
struct drm_i915_gem_object *obj = dma_buf_to_obj(attachment->dmabuf); struct drm_i915_gem_object *obj = dma_buf_to_obj(attachment->dmabuf);
dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir); dma_unmap_sg_attrs(attachment->dev,
sg->sgl, sg->nents, dir,
DMA_ATTR_SKIP_CPU_SYNC);
sg_free_table(sg); sg_free_table(sg);
kfree(sg); kfree(sg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment