History

media: mediatek: vcodec: Alloc DMA memory with DMA_ATTR_ALLOC_SINGLE_PAGES

As talked about in commit 14d3ae2efeed ("ARM: 8507/1: dma-mapping: Use DMA_ATTR_ALLOC_SINGLE_PAGES hint to optimize alloc"), it doesn't really make sense to try to allocate contiguous chunks of memory for video encoding/decoding. Let's switch the Mediatek vcodec driver to pass DMA_ATTR_ALLOC_SINGLE_PAGES and take some of the stress off the memory subsystem.

Douglas Anderson committed 2 years ago

Commit b785ea51 parent 48d85de1 file · +2 −1Browse files

Unified · Split

drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c+2−1
@@ -63,7 +63,8 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) · 62 unmodified lines
6363 id = dec_ctx->id;
6464 }
6565
66− mem->va = dma_alloc_coherent(&plat_dev->dev, mem->size, &mem->dma_addr, GFP_KERNEL);
66+ mem->va = dma_alloc_attrs(&plat_dev->dev, mem->size, &mem->dma_addr,
67+ GFP_KERNEL, DMA_ATTR_ALLOC_SINGLE_PAGES);
6768 if (!mem->va) {
6869 mtk_v4l2_err(plat_dev, "%s dma_alloc size=0x%zx failed!",
6970 __func__, mem->size);