From 76c4043ce92b3efa79f80a814ca47760c0b23295 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Thu, 21 Jun 2018 19:40:26 +0800 Subject: [PATCH] PD#168285: mh264: fix cann't play UHD video on widevine. 1.tee video firmware be loaded twice, cause the decoder isn't working properly. Delete the one in the vh264_init function. 2.Remove needn't debug code and optimize code logic. Change-Id: Ifa19b3334a25d0b52d9173537e1b2a1a6a5cea3d Signed-off-by: Peng Yixin --- .../decoder/h264_multi/vmh264.c | 51 ++++++++----------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index 650d483a656f..690c04c3ba35 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -5150,7 +5150,6 @@ static void vh264_local_init(struct vdec_h264_hw_s *hw) static s32 vh264_init(struct vdec_h264_hw_s *hw) { /* int trickmode_fffb = 0; */ - int firmwareloaded = 0; /* pr_info("\nvh264_init\n"); */ /* init_timer(&hw->recycle_timer); */ @@ -5191,39 +5190,29 @@ static s32 vh264_init(struct vdec_h264_hw_s *hw) return -ENOMEM; } } - if (tee_enabled() && !firmwareloaded) { - pr_info("VMH264 start tee load sec firmware ...\n"); - if (hw->mmu_enable && - tee_load_video_fw((u32)VIDEO_DEC_H264_MULTI_MMU, 2) - != 0) { - amvdec_enable_flag = false; - amvdec_disable(); - pr_info("%s: Error amvdec_mmu_loadmc fail\n", - __func__); - return -1; - } - } else { - /* -- ucode loading (amrisc and swap code) */ - hw->mc_cpu_addr = - dma_alloc_coherent(amports_get_dma_device(), MC_TOTAL_SIZE, - &hw->mc_dma_handle, GFP_KERNEL); - if (!hw->mc_cpu_addr) { - amvdec_enable_flag = false; - amvdec_disable(); - if (hw->mmu_enable) - amhevc_disable(); - pr_info("vh264_init: Can not allocate mc memory.\n"); - return -ENOMEM; - } - - /*pr_info("264 ucode swap area: phyaddr %p, cpu vaddr %p\n", - (void *)hw->mc_dma_handle, hw->mc_cpu_addr); - */ - if (!firmwareloaded) { + if (!tee_enabled()) { int ret = 0, size = -1; int fw_size = 0x1000 * 16; struct firmware_s *fw = NULL; + /* -- ucode loading (amrisc and swap code) */ + hw->mc_cpu_addr = + dma_alloc_coherent(amports_get_dma_device(), MC_TOTAL_SIZE, + &hw->mc_dma_handle, GFP_KERNEL); + if (!hw->mc_cpu_addr) { + amvdec_enable_flag = false; + amvdec_disable(); + if (hw->mmu_enable) + amhevc_disable(); + pr_info("vh264_init: Can not allocate mc memory.\n"); + return -ENOMEM; + } + + /*pr_info("264 ucode swap area: phyaddr %p, cpu vaddr %p\n", + (void *)hw->mc_dma_handle, hw->mc_cpu_addr); + */ + + pr_debug("start load orignal firmware ...\n"); fw = vmalloc(sizeof(struct firmware_s) + fw_size); @@ -5306,7 +5295,7 @@ static s32 vh264_init(struct vdec_h264_hw_s *hw) } return -EBUSY; } - } + } #if 1 /* #ifdef BUFFER_MGR_IN_C */ hw->lmem_addr = __get_free_page(GFP_KERNEL);