struct aml_vcodec_ctx *ctx = (struct aml_vcodec_ctx *)data;
struct device *dev = &ctx->dev->plat_dev->dev;
- //mem->vaddr = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
- mem->vaddr = codec_mm_dma_alloc_coherent(dev_name(dev), size,
- &mem->dma_addr, GFP_KERNEL, 0);
+ mem->vaddr = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
+ //mem->vaddr = codec_mm_dma_alloc_coherent(dev_name(dev), size,
+ // &mem->dma_addr, GFP_KERNEL, 0);
if (!mem->vaddr) {
v4l_dbg(ctx, V4L_DEBUG_CODEC_ERROR,
"%s dma_alloc size=%ld failed!\n", dev_name(dev),
block->input->sequence++;
}
+static bool is_coherent_buff = 1;
+
static void vframe_block_free_block(struct vframe_block_list_s *block)
{
- if (block->addr) {
- codec_mm_free_for_dma(MEM_NAME, block->addr);
+ if (is_coherent_buff) {
+ if (block->mem_handle) {
+ codec_mm_dma_free_coherent(block->mem_handle);
+ }
+ } else {
+ if (block->addr) {
+ codec_mm_free_for_dma(MEM_NAME, block->addr);
+ }
}
/*
*pr_err("free block %d, size=%d\n", block->id, block->size);
block->priv = priv;
} else {
alloc_size = PAGE_ALIGN(alloc_size);
- block->addr = codec_mm_alloc_for_dma_ex(
- MEM_NAME,
- alloc_size/PAGE_SIZE,
- VFRAME_BLOCK_PAGEALIGN,
- CODEC_MM_FLAGS_DMA_CPU | CODEC_MM_FLAGS_FOR_VDECODER,
- input->id,
- block->id);
+ if (is_coherent_buff) {
+ block->start_virt = codec_mm_dma_alloc_coherent(&block->mem_handle, &block->addr, alloc_size, MEM_NAME);
+ } else {
+ block->addr = codec_mm_alloc_for_dma_ex(
+ MEM_NAME,
+ alloc_size/PAGE_SIZE,
+ VFRAME_BLOCK_PAGEALIGN,
+ CODEC_MM_FLAGS_DMA_CPU | CODEC_MM_FLAGS_FOR_VDECODER,
+ input->id,
+ block->id);
+ }
if (!block->addr) {
pr_err("Input block allocation failed\n");
return -ENOMEM;
}
- block->start_virt = (void *)codec_mm_phys_to_virt(block->addr);
+ if (!is_coherent_buff)
+ block->start_virt = (void *)codec_mm_phys_to_virt(block->addr);
if (block->start_virt)
block->is_mapped = true;
block->start = block->addr;
input->swap_page_phys = codec_mm_alloc_for_dma("SWAP",
1, 0, CODEC_MM_FLAGS_TVP);
else {
- input->swap_page = dma_alloc_coherent(v4l_get_dev_from_codec_mm(),
- PAGE_SIZE,
- &input->swap_page_phys, GFP_KERNEL);
-
+ input->swap_page = codec_mm_dma_alloc_coherent(&input->mem_handle,
+ (ulong *)&input->swap_page_phys,
+ PAGE_SIZE, MEM_NAME);
if (input->swap_page == NULL)
return -ENOMEM;
}
if (input->swap_page_phys)
codec_mm_free_for_dma("SWAP", input->swap_page_phys);
} else {
- if (input->swap_page) {
- dma_free_coherent(v4l_get_dev_from_codec_mm(),
- PAGE_SIZE, input->swap_page,
- input->swap_page_phys);
- }
+ if (input->swap_page)
+ codec_mm_dma_free_coherent(input->mem_handle);
}
input->swap_page = NULL;
input->swap_page_phys = 0;
static void pm_vdec_legacy_power_on(struct device *dev, int id)
{
void *decomp_addr = NULL;
- dma_addr_t decomp_dma_addr;
+ ulong decomp_dma_addr;
+ ulong mem_handle;
u32 decomp_addr_aligned = 0;
int hevc_loop = 0;
int sleep_val, iso_val;
if (hevc_workaround_needed() &&
(id == VDEC_HEVC)) {
- decomp_addr = codec_mm_dma_alloc_coherent("vdec_prealloc",
- SZ_64K + SZ_4K, &decomp_dma_addr, GFP_KERNEL, 0);
-
+ decomp_addr = codec_mm_dma_alloc_coherent(&mem_handle,
+ &decomp_dma_addr, SZ_64K + SZ_4K, "vdec_prealloc");
if (decomp_addr) {
decomp_addr_aligned = ALIGN(decomp_dma_addr, SZ_64K);
memset((u8 *)decomp_addr +
}
if (decomp_addr)
- codec_mm_dma_free_coherent("vdec_prealloc",
- SZ_64K + SZ_4K, decomp_addr, decomp_dma_addr, 0);
+ codec_mm_dma_free_coherent(mem_handle);
}
static void pm_vdec_legacy_power_off(struct device *dev, int id)