There is no need synchronise buffer cache for OUTPUT devices when the buffer is dequeued as the hardware only reads from the buffer. Only sync for capture buffers. Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 5 +++-- drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 320e53a..41d5782 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -115,9 +115,10 @@ static void vb2_dc_finish(void *buf_priv) * DMABUF exporter will flush the cache for us; only USERPTR * and MMAP buffers with non-coherent memory will be flushed. */ - if (buf->attrs & DMA_ATTR_NON_CONSISTENT && !WARN_ON_ONCE(!sgt)) + if (buf->attrs & DMA_ATTR_NON_CONSISTENT && !WARN_ON_ONCE(!sgt) && + buf->dma_dir == DMA_FROM_DEVICE) dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir); + DMA_FROM_DEVICE); } /*********************************************/ diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index 88b2530..e30c869 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -218,9 +218,10 @@ static void vb2_dma_sg_finish(void *buf_priv) * DMABUF exporter will flush the cache for us; only USERPTR * and MMAP buffers with non-coherent memory will be flushed. */ - if (buf->dma_attrs & DMA_ATTR_NON_CONSISTENT) + if (buf->dma_attrs & DMA_ATTR_NON_CONSISTENT && + buf->dma_dir == DMA_FROM_DEVICE) dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, - buf->dma_dir); + DMA_FROM_DEVICE); } static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr, -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel