summaryrefslogtreecommitdiff
authorHui Zhang <hui.zhang@amlogic.com>2020-05-05 02:46:29 (GMT)
committer Hui Zhang <hui.zhang@amlogic.com>2020-05-06 03:02:12 (GMT)
commit085e40c65a03acf659d0c5e2c07354aa12f77d22 (patch)
tree10664c8cc97662aaff15bf278f2c99158182eea5
parent189b5c9ba1105a12da8f3311c1d43495bdb9bc53 (diff)
downloadmedia_modules-085e40c65a03acf659d0c5e2c07354aa12f77d22.zip
media_modules-085e40c65a03acf659d0c5e2c07354aa12f77d22.tar.gz
media_modules-085e40c65a03acf659d0c5e2c07354aa12f77d22.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>
Diffstat
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.c18
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.h4
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 ce30dbd..a8ae25a 100644
--- a/drivers/frame_provider/decoder/utils/vdec_input.c
+++ b/drivers/frame_provider/decoder/utils/vdec_input.c
@@ -518,16 +518,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);
@@ -1116,11 +1116,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 4e871e7..1ca9ebe 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;