author | Hui Zhang <hui.zhang@amlogic.com> | 2020-05-05 02:46:29 (GMT) |
---|---|---|
committer | Shen Liu <shen.liu@amlogic.com> | 2020-05-26 06:33:46 (GMT) |
commit | 7b3500dc7cc1ae0dd900db2261f79ded56e3204e (patch) | |
tree | c88a2e01fad7b371122cfbdb5b8f2aec2a42f6b8 | |
parent | 09ed775b969bbb70f9ee69a325d3cc25562cf691 (diff) | |
download | media_modules-7b3500dc7cc1ae0dd900db2261f79ded56e3204e.zip media_modules-7b3500dc7cc1ae0dd900db2261f79ded56e3204e.tar.gz media_modules-7b3500dc7cc1ae0dd900db2261f79ded56e3204e.tar.bz2 |
media_module: Fixed stream buf pollution issue [1/1]
PD#SWPL-25250
Problem:
when dmc monitor enabled for vdec. there is sometimes error
in swap dma, and cause streambuf context polluted because
cacheline flush
Solution:
use coherent alloc for swap buf.
Verify:
U215
Change-Id: I53a711fbd1c80b8b0c898a33f13f58ee80fd42f6
Signed-off-by: Hui Zhang <hui.zhang@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/utils/vdec_input.c | 18 | ||||
-rw-r--r-- | drivers/frame_provider/decoder/utils/vdec_input.h | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/drivers/frame_provider/decoder/utils/vdec_input.c b/drivers/frame_provider/decoder/utils/vdec_input.c index af95293..93b632f 100644 --- a/drivers/frame_provider/decoder/utils/vdec_input.c +++ b/drivers/frame_provider/decoder/utils/vdec_input.c @@ -503,16 +503,16 @@ int vdec_input_set_buffer(struct vdec_input_s *input, u32 start, u32 size) input->swap_page_phys = codec_mm_alloc_for_dma("SWAP", 1, 0, CODEC_MM_FLAGS_TVP); else { - input->swap_page = alloc_page(GFP_KERNEL); - if (input->swap_page) { - input->swap_page_phys = - page_to_phys(input->swap_page); - } + input->swap_page = dma_alloc_coherent(v4l_get_dev_from_codec_mm(), + PAGE_SIZE, + &input->swap_page_phys, GFP_KERNEL); + + if (input->swap_page == NULL) + return -ENOMEM; } if (input->swap_page_phys == 0) return -ENOMEM; - return 0; } EXPORT_SYMBOL(vdec_input_set_buffer); @@ -1073,11 +1073,13 @@ void vdec_input_release(struct vdec_input_s *input) } /* release swap pages */ - if (input->swap_page_phys) { + if (input->swap_page) { if (vdec_secure(input->vdec)) codec_mm_free_for_dma("SWAP", input->swap_page_phys); else - __free_page(input->swap_page); + dma_free_coherent(v4l_get_dev_from_codec_mm(), + PAGE_SIZE, input->swap_page, + input->swap_page_phys); input->swap_page = NULL; input->swap_page_phys = 0; } diff --git a/drivers/frame_provider/decoder/utils/vdec_input.h b/drivers/frame_provider/decoder/utils/vdec_input.h index d2304f6..abad7de 100644 --- a/drivers/frame_provider/decoder/utils/vdec_input.h +++ b/drivers/frame_provider/decoder/utils/vdec_input.h @@ -80,8 +80,8 @@ struct vdec_input_s { bool swap_valid; bool swap_needed; bool eos; - struct page *swap_page; - unsigned long swap_page_phys; + void *swap_page; + dma_addr_t swap_page_phys; u64 total_wr_count; u64 total_rd_count; u64 streaming_rp; |