summaryrefslogtreecommitdiff
authorNanxin Qin <nanxin.qin@amlogic.com>2017-04-03 08:07:01 (GMT)
committer Nanxin Qin <nanxin.qin@amlogic.com>2017-04-05 13:57:55 (GMT)
commit761218bbe92ef8617beee6a8b402b98e04b812ef (patch)
treea7f868339a2c30636175fd9664b6b7428a8ba9fd
parenta3759dc2cc036d6528e7ebcea2287a81eb503efb (diff)
downloadmedia-761218bbe92ef8617beee6a8b402b98e04b812ef.zip
media-761218bbe92ef8617beee6a8b402b98e04b812ef.tar.gz
media-761218bbe92ef8617beee6a8b402b98e04b812ef.tar.bz2
PD#142052: fix the some issues for the media module.
1.add exit function for media_clock module 2.add exit function for mmu & bmmu modules 3.fix the bug of the amstream moudule unable to remove 4.optimize the module of the firmware drv 5.optimze the Media.mk and coding style for android Change-Id: I0cd2e9293b82499d548b2da8a5f068bfdb887d67 Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
Diffstat
-rw-r--r--Media.mk25
-rw-r--r--drivers/common/firmware/firmware_drv.c57
-rw-r--r--drivers/common/media_clock/clk/clk.c16
-rw-r--r--drivers/common/media_clock/clk/clk.h26
-rw-r--r--drivers/common/media_clock/clk/clkgx.c10
-rw-r--r--drivers/frame_provider/decoder/h264/vh264.c13
-rw-r--r--drivers/frame_provider/decoder/h264/vh264.h2
-rw-r--r--drivers/frame_provider/decoder/h264/vh264_4k2k.c3
-rw-r--r--drivers/frame_provider/decoder/h265/vh265.c10
-rw-r--r--drivers/frame_provider/decoder/mpeg12/vmpeg12.c2
-rw-r--r--drivers/frame_provider/decoder/utils/decoder_bmmu_box.c7
-rw-r--r--drivers/frame_provider/decoder/utils/decoder_bmmu_box.h2
-rw-r--r--drivers/frame_provider/decoder/utils/decoder_mmu_box.c6
-rw-r--r--drivers/frame_provider/decoder/utils/decoder_mmu_box.h1
-rw-r--r--drivers/frame_provider/decoder/utils/utils.c3
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.c70
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.h2
-rw-r--r--drivers/frame_provider/decoder/vp9/vvp9.c23
-rw-r--r--drivers/stream_input/amports/amstream.c14
-rw-r--r--drivers/stream_input/parser/rmparser.c3
20 files changed, 178 insertions, 117 deletions
diff --git a/Media.mk b/Media.mk
index bc17e84..135325e 100644
--- a/Media.mk
+++ b/Media.mk
@@ -1,6 +1,6 @@
-ARCH ?= arm64
-TOOLS := aarch64-linux-gnu-
+KERNEL_ARCH := arm64
+TOOLS := /opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
CONFIGS := CONFIG_AMLOGIC_MEDIA_VDEC_MPEG12=m \
CONFIG_AMLOGIC_MEDIA_VDEC_MPEG4=m \
CONFIG_AMLOGIC_MEDIA_VDEC_MPEG4_MULTI=m \
@@ -37,10 +37,23 @@ ifeq (,$(wildcard $(INCLUDE)))
$(error No find the dir of include.)
endif
+MEDIA_MODULES := $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/media
+ifeq (,$(wildcard $(MEDIA_MODULES)))
+$(shell mkdir $(MEDIA_MODULES) -p)
+endif
+
+MODS_OUT := $(ANDROID_BUILD_TOP)/$(TARGET_OUT)/lib
+ifeq (,$(wildcard $(MODS_OUT)))
+$(error No find the dir of modules out.)
+endif
+
+$(shell cp $(MEDIA_DRIVERS)/* $(MEDIA_MODULES) -rfa)
+
define media-modules
- $(MAKE) -C $(KDIR) M=$(MEDIA_DRIVERS) ARCH=$(ARCH) \
+ @$(MAKE) -C $(KDIR) M=$(MEDIA_MODULES) ARCH=$(KERNEL_ARCH) \
CROSS_COMPILE=$(TOOLS) $(CONFIGS) \
- EXTRA_CFLAGS+=-I$(INCLUDE)
+ EXTRA_CFLAGS+=-I$(INCLUDE) modules; \
+ find $(MEDIA_MODULES) -name "*.ko" | xargs -i cp {} $(MODS_OUT)
endef
else
@@ -67,7 +80,7 @@ endif
TOOLS := /opt/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
modules:
- $(MAKE) -C $(KDIR) M=$(MEDIA_DRIVERS) ARCH=$(ARCH) \
+ $(MAKE) -C $(KDIR) M=$(MEDIA_DRIVERS) ARCH=$(KERNEL_ARCH) \
CROSS_COMPILE=$(TOOLS) $(CONFIGS) \
EXTRA_CFLAGS+=-I$(INCLUDE)
@@ -78,6 +91,6 @@ copy-modules:
all: modules copy-modules
clean:
- $(MAKE) -C $(KDIR) M=$(MEDIA_DRIVERS) ARCH=$(ARCH) clean
+ $(MAKE) -C $(KDIR) M=$(MEDIA_DRIVERS) ARCH=$(KERNEL_ARCH) clean
endif
diff --git a/drivers/common/firmware/firmware_drv.c b/drivers/common/firmware/firmware_drv.c
index 81084c7..56420e1 100644
--- a/drivers/common/firmware/firmware_drv.c
+++ b/drivers/common/firmware/firmware_drv.c
@@ -23,7 +23,6 @@
#include <linux/device.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
-#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/amlogic/media/utils/vformat.h>
@@ -42,8 +41,7 @@
#define CLASS_NAME "firmware_codec"
#define DEV_NAME "firmware_vdec"
#define DIR "video"
-#define FRIMWARE_SIZE (30*1024) /*30k*/
-#define PACK_SIZE (512*1024)
+#define FRIMWARE_SIZE (64*1024) /*64k*/
#define BUFF_SIZE (512*1024)
#define PACK ('P' << 24 | 'A' << 16 | 'C' << 8 | 'K')
@@ -147,7 +145,7 @@ static int request_firmware_from_sys(const char *file_name,
memcpy(buf, (char *)firmware->data, firmware->size);
- pr_info("Load mcode size : %zd, Name : %s.\n",
+ pr_info("load firmware size : %zd, Name : %s.\n",
firmware->size, file_name);
ret = firmware->size;
release:
@@ -216,7 +214,6 @@ static void del_info(struct firmware_info_s *info)
flags = firmware_mgr_lock(mgr);
list_del(&info->node);
- kfree(info);
firmware_mgr_unlock(mgr, flags);
}
@@ -372,11 +369,9 @@ static int check_repeat(struct firmware_s *data, enum firmware_type_e type)
return 0;
}
-static int firmware_parse_package(struct firmware_info_s *package,
- char *buf, int size)
+static int firmware_parse_package(char *buf, int size)
{
int ret = 0;
- struct package_s *pack;
struct package_info_s *pack_info;
struct firmware_info_s *info;
struct firmware_s *data;
@@ -384,22 +379,10 @@ static int firmware_parse_package(struct firmware_info_s *package,
int info_len, len;
char *path = __getname();
- if (IS_ERR_OR_NULL(path)) {
- ret = -ENOMEM;
- goto err;
- }
-
- pack = vmalloc(PACK_SIZE);
- if (IS_ERR_OR_NULL(pack)) {
- __putname(path);
- ret = -ENOMEM;
- goto err;
- }
-
- memset(pack, 0, PACK_SIZE);
- memcpy(pack, buf, size);
+ if (IS_ERR_OR_NULL(path))
+ return -ENOMEM;
- pack_data = pack->data;
+ pack_data = ((struct package_s *)buf)->data;
pack_info = (struct package_info_s *)pack_data;
info_len = sizeof(struct package_info_s);
@@ -444,8 +427,11 @@ static int firmware_parse_package(struct firmware_info_s *package,
}
ret = check_repeat(data, info->type);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ kfree(data);
+ kfree(info);
+ goto out;
+ }
if (ret) {
kfree(info);
@@ -457,9 +443,6 @@ static int firmware_parse_package(struct firmware_info_s *package,
}
out:
__putname(path);
- vfree(pack);
-err:
- del_info(package);
return ret;
}
@@ -502,7 +485,7 @@ static int set_firmware_data(void)
int ret = 0, magic = 0;
struct firmware_mgr_s *mgr = g_mgr;
struct firmware_info_s *info, *temp;
- char *buf;
+ char *buf = NULL;
int size;
if (list_empty(&mgr->head)) {
@@ -520,7 +503,10 @@ static int set_firmware_data(void)
switch (magic) {
case PACK:
- ret = firmware_parse_package(info, buf, size);
+ ret = firmware_parse_package(buf, size);
+
+ del_info(info);
+ kfree(info);
break;
case CODE:
@@ -643,13 +629,8 @@ static void firmware_info_clean(void)
kfree(info);
}
firmware_mgr_unlock(mgr, flags);
-}
-static void firmware_mgr_clean(void)
-{
- struct firmware_mgr_s *mgr = g_mgr;
-
- kfree(mgr);
+ kfree(g_mgr);
}
static void firmware_driver_exit(void)
@@ -659,8 +640,6 @@ static void firmware_driver_exit(void)
class_unregister(&firmware_class);
unregister_chrdev_region(g_dev->dev_no, 1);
kfree(g_dev);
-
- pr_info("Firmware driver cleaned up.\n");
}
static int __init firmware_module_init(void)
@@ -691,8 +670,8 @@ err:
static void __exit firmware_module_exit(void)
{
firmware_info_clean();
- firmware_mgr_clean();
firmware_driver_exit();
+ pr_info("Firmware driver cleaned up.\n");
}
module_param(debug, uint, 0664);
diff --git a/drivers/common/media_clock/clk/clk.c b/drivers/common/media_clock/clk/clk.c
index a32c8d0..18d308f 100644
--- a/drivers/common/media_clock/clk/clk.c
+++ b/drivers/common/media_clock/clk/clk.c
@@ -350,6 +350,14 @@ int register_vdec_clk_mgr(int cputype[], enum vdec_type_e vdec_type,
}
EXPORT_SYMBOL(register_vdec_clk_mgr);
+int unregister_vdec_clk_mgr(enum vdec_type_e vdec_type)
+{
+ kfree(get_current_vdec_chip()->clk_mgr[vdec_type]);
+
+ return 0;
+}
+EXPORT_SYMBOL(unregister_vdec_clk_mgr);
+
static int register_vdec_clk_setting_per_cpu(int cputype,
struct clk_set_setting *setting, int size)
{
@@ -387,3 +395,11 @@ int register_vdec_clk_setting(int cputype[],
}
EXPORT_SYMBOL(register_vdec_clk_setting);
+int unregister_vdec_clk_setting(void)
+{
+ kfree(get_current_vdec_chip()->clk_setting_array);
+
+ return 0;
+}
+EXPORT_SYMBOL(unregister_vdec_clk_setting);
+
diff --git a/drivers/common/media_clock/clk/clk.h b/drivers/common/media_clock/clk/clk.h
index 64cdd73..2693763 100644
--- a/drivers/common/media_clock/clk/clk.h
+++ b/drivers/common/media_clock/clk/clk.h
@@ -61,9 +61,13 @@ void vdec2_clock_hi_enable(void);
int register_vdec_clk_mgr(int cputype[],
enum vdec_type_e vdec_type, struct chip_vdec_clk_s *t_mgr);
+int unregister_vdec_clk_mgr(enum vdec_type_e vdec_type);
+
int register_vdec_clk_setting(int cputype[],
struct clk_set_setting *p_seting, int size);
+int unregister_vdec_clk_setting(void);
+
#ifdef INCLUDE_FROM_ARCH_CLK_MGR
static struct chip_vdec_clk_s vdec_clk_mgr __initdata = {
.clock_init = vdec_clock_init,
@@ -122,7 +126,29 @@ static int __init vdec_init_clk(void)
return 0;
}
+static void __exit vdec_clk_exit(void)
+{
+ unregister_vdec_clk_mgr(VDEC_1);
+#ifdef VDEC_HAS_VDEC2
+ unregister_vdec_clk_mgr(VDEC_2);
+#endif
+#ifdef VDEC_HAS_HEVC
+ unregister_vdec_clk_mgr(VDEC_HEVC);
+#endif
+#ifdef VDEC_HAS_VDEC_HCODEC
+ unregister_vdec_clk_mgr(VDEC_HCODEC);
+#endif
+#ifdef VDEC_HAS_CLK_SETTINGS
+ unregister_vdec_clk_setting();
+#endif
+ pr_info("media clock exit.\n");
+}
+
#define ARCH_VDEC_CLK_INIT()\
module_init(vdec_init_clk)
+
+#define ARCH_VDEC_CLK_EXIT()\
+ module_exit(vdec_clk_exit)
+
#endif
#endif
diff --git a/drivers/common/media_clock/clk/clkgx.c b/drivers/common/media_clock/clk/clkgx.c
index bf4cdab..119a046 100644
--- a/drivers/common/media_clock/clk/clkgx.c
+++ b/drivers/common/media_clock/clk/clkgx.c
@@ -416,7 +416,7 @@ static int vdec_clock_init(void)
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXL) {
pr_info("used fix clk for vdec clk source!\n");
- /*update_vdec_clk_config_settings(1);*//*mask*/
+ //update_vdec_clk_config_settings(1);//DEBUG_TMP
}
return (gp_pll_user_vdec) ? 0 : -ENOMEM;
}
@@ -424,7 +424,7 @@ static int vdec_clock_init(void)
static void update_clk_with_clk_configs(int clk, int *source, int *div,
int *rclk)
{
- unsigned int config = 0;/*get_vdec_clk_config_settings();*//*mask*/
+ unsigned int config = 0;//get_vdec_clk_config_settings();//DEBUG_TMP
if (!config)
return;
@@ -436,8 +436,8 @@ static void update_clk_with_clk_configs(int clk, int *source, int *div,
}
}
#endif
-#define NO_GP0_PLL 0/*(get_vdec_clk_config_settings() == 1)*//*mask*/
-#define ALWAYS_GP0_PLL 0/*(get_vdec_clk_config_settings() == 2)*//*mask*/
+#define NO_GP0_PLL 0//(get_vdec_clk_config_settings() == 1)//DEBUG_TMP
+#define ALWAYS_GP0_PLL 0//(get_vdec_clk_config_settings() == 2)//DEBUG_TMP
static int vdec_clock_set(int clk)
{
@@ -644,4 +644,6 @@ static int vdec_clock_get(enum vdec_type_e core)
0}
#include "clk.h"
ARCH_VDEC_CLK_INIT();
+ARCH_VDEC_CLK_EXIT();
+
MODULE_LICENSE("GPL");
diff --git a/drivers/frame_provider/decoder/h264/vh264.c b/drivers/frame_provider/decoder/h264/vh264.c
index 8a9861c..86b9a26 100644
--- a/drivers/frame_provider/decoder/h264/vh264.c
+++ b/drivers/frame_provider/decoder/h264/vh264.c
@@ -46,6 +46,7 @@
#include "vh264.h"
#include "../../../stream_input/parser/streambuf.h"
#include <linux/delay.h>
+#include <linux/amlogic/media/video_sink/video.h>
/*#include <linux/amlogic/ge2d/ge2d.h>*/
@@ -308,7 +309,7 @@ static s32 vh264_init(void);
#define DFS_HIGH_THEASHOLD 3
static bool pts_discontinue;
-#if 0
+#if 0//DEBUG_TMP
static struct ge2d_context_s *ge2d_videoh264_context;
@@ -392,7 +393,7 @@ static int ge2d_canvas_dup(struct canvas_s *srcy, struct canvas_s *srcu,
return 0;
}
-#endif/*mask*/
+#endif
static inline int fifo_level(void)
{
@@ -829,8 +830,8 @@ static void vh264_set_params(struct work_struct *work)
addr += ((mb_total << 8) + (mb_total << 7));/*keep last frame */
WRITE_VREG(AV_SCRATCH_1, addr);
WRITE_VREG(AV_SCRATCH_3, post_canvas); /* should be modified later */
- /*canvas_read((READ_VCBUS_REG(VD1_IF0_CANVAS0) & 0xff), &cur_canvas);
- disp_addr = (cur_canvas.addr + 7) >> 3;*//*mask*/
+ //canvas_read((READ_VCBUS_REG(VD1_IF0_CANVAS0) & 0xff), &cur_canvas);
+ //disp_addr = (cur_canvas.addr + 7) >> 3;//DEBUG_TMP
if ((addr + mb_total * mb_mv_byte * max_reference_size)
>= buf_end) {
fatal_error_flag =
@@ -2730,12 +2731,12 @@ static void stream_switching_do(struct work_struct *work)
((u_index << 8) & 0x0000ff00));
des_index = ((y_desindex & 0xff) |
((u_desindex << 8) & 0x0000ff00));
-#if 0
+#if 0//DEBUG_TMP
ge2d_canvas_dup(&csy, &csu, &cyd,
GE2D_FORMAT_M24_NV21,
src_index,
des_index);
-#endif/*mask*/
+#endif
}
vf->mem_handle = decoder_bmmu_box_get_mem_handle(
mm_blk_handle,
diff --git a/drivers/frame_provider/decoder/h264/vh264.h b/drivers/frame_provider/decoder/h264/vh264.h
index a8b0c62..45d2849 100644
--- a/drivers/frame_provider/decoder/h264/vh264.h
+++ b/drivers/frame_provider/decoder/h264/vh264.h
@@ -18,8 +18,6 @@
#ifndef VH264_H
#define VH264_H
-extern int query_video_status(int type, int *value);
-
/* extern s32 vh264_init(void); */
extern s32 vh264_release(void);
diff --git a/drivers/frame_provider/decoder/h264/vh264_4k2k.c b/drivers/frame_provider/decoder/h264/vh264_4k2k.c
index 7841f33..370363a 100644
--- a/drivers/frame_provider/decoder/h264/vh264_4k2k.c
+++ b/drivers/frame_provider/decoder/h264/vh264_4k2k.c
@@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/amlogic/media/codec_mm/codec_mm.h>
+#include <linux/amlogic/media/video_sink/video_keeper.h>
#define MEM_NAME "codec_264_4k"
@@ -444,7 +445,7 @@ int init_canvas(int start_addr, long dpb_size, int dpb_number, int mb_width,
pr_err
("CMA not enough free keep buf! %d\n",
i);
- //try_free_keep_video(1);/*mask*/
+ try_free_keep_video(1);
}
if (!codec_mm_enough_for_size(
page_count * PAGE_SIZE, 1)) {
diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c
index 09e5dad..67a3e40 100644
--- a/drivers/frame_provider/decoder/h265/vh265.c
+++ b/drivers/frame_provider/decoder/h265/vh265.c
@@ -1847,7 +1847,7 @@ static void init_buf_list(struct hevc_state_s *hevc)
}
hevc_print(hevc, 0, "allocate begin\n");
- /*get_cma_alloc_ref();*//*mask*/
+ //get_cma_alloc_ref();//DEBUG_TMP
for (i = 0; i < hevc->used_buf_num; i++) {
if (((i + 1) * buf_size) > hevc->mc_buf->buf_size) {
if (use_cma)
@@ -1923,7 +1923,7 @@ static void init_buf_list(struct hevc_state_s *hevc)
}
}
}
- /*put_cma_alloc_ref();*//*mask*/
+ //put_cma_alloc_ref();//DEBUG_TMP
hevc_print(hevc, 0, "allocate end\n");
hevc->buf_num = i;
@@ -2053,7 +2053,8 @@ static int config_pic(struct hevc_state_s *hevc, struct PIC_s *pic,
}
} else
i = pic->index;
- if (i < hevc->buf_num) {
+
+ if (i < hevc->buf_num) {
pic->POC = INVALID_POC;
/*ensure get_pic_by_POC()
not get the buffer not decoded*/
@@ -5054,7 +5055,8 @@ static void hevc_local_uninit(struct hevc_state_s *hevc)
dma_free_coherent(amports_get_dma_device(),
FRAME_MMU_MAP_SIZE, hevc->frame_mmu_map_addr,
hevc->frame_mmu_map_phy_addr);
- hevc->frame_mmu_map_addr = NULL;
+
+ hevc->frame_mmu_map_addr = NULL;
}
diff --git a/drivers/frame_provider/decoder/mpeg12/vmpeg12.c b/drivers/frame_provider/decoder/mpeg12/vmpeg12.c
index 042641a..1cafadc 100644
--- a/drivers/frame_provider/decoder/mpeg12/vmpeg12.c
+++ b/drivers/frame_provider/decoder/mpeg12/vmpeg12.c
@@ -25,7 +25,7 @@
#include <linux/amlogic/media/frame_sync/ptsserv.h>
#include <linux/amlogic/media/utils/amstream.h>
#include <linux/amlogic/media/canvas/canvas.h>
-
+#include <linux/module.h>
#include <linux/amlogic/media/vfm/vframe.h>
#include <linux/amlogic/media/vfm/vframe_provider.h>
#include <linux/amlogic/media/vfm/vframe_receiver.h>
diff --git a/drivers/frame_provider/decoder/utils/decoder_bmmu_box.c b/drivers/frame_provider/decoder/utils/decoder_bmmu_box.c
index b8f6f1a..7a858d5 100644
--- a/drivers/frame_provider/decoder/utils/decoder_bmmu_box.c
+++ b/drivers/frame_provider/decoder/utils/decoder_bmmu_box.c
@@ -403,6 +403,13 @@ int decoder_bmmu_box_init(void)
return r;
}
EXPORT_SYMBOL(decoder_bmmu_box_init);
+
+void decoder_bmmu_box_exit(void)
+{
+ class_unregister(&decoder_bmmu_box_class);
+ pr_info("dec bmmu box exit.\n");
+}
+
#if 0
static int __init decoder_bmmu_box_init(void)
{
diff --git a/drivers/frame_provider/decoder/utils/decoder_bmmu_box.h b/drivers/frame_provider/decoder/utils/decoder_bmmu_box.h
index d4a40ba..99aa89b 100644
--- a/drivers/frame_provider/decoder/utils/decoder_bmmu_box.h
+++ b/drivers/frame_provider/decoder/utils/decoder_bmmu_box.h
@@ -56,6 +56,8 @@ int decoder_bmmu_box_alloc_idx_wait(
int wait_flags);
int decoder_bmmu_box_init(void);
+void decoder_bmmu_box_exit(void);
+
#endif /*
*/
diff --git a/drivers/frame_provider/decoder/utils/decoder_mmu_box.c b/drivers/frame_provider/decoder/utils/decoder_mmu_box.c
index 0f4244b..26440fe 100644
--- a/drivers/frame_provider/decoder/utils/decoder_mmu_box.c
+++ b/drivers/frame_provider/decoder/utils/decoder_mmu_box.c
@@ -360,6 +360,12 @@ int decoder_mmu_box_init(void)
}
EXPORT_SYMBOL(decoder_mmu_box_init);
+void decoder_mmu_box_exit(void)
+{
+ class_unregister(&decoder_mmu_box_class);
+ pr_info("dec mmu box exit.\n");
+}
+
#if 0
static int __init decoder_mmu_box_init(void)
{
diff --git a/drivers/frame_provider/decoder/utils/decoder_mmu_box.h b/drivers/frame_provider/decoder/utils/decoder_mmu_box.h
index 496d3c0..387dd24 100644
--- a/drivers/frame_provider/decoder/utils/decoder_mmu_box.h
+++ b/drivers/frame_provider/decoder/utils/decoder_mmu_box.h
@@ -40,5 +40,6 @@ int decoder_mmu_box_free_keep(int keep_id);
int decoder_mmu_box_free_all_keep(void);
void *decoder_mmu_box_get_mem_handle(void *box_handle, int idx);
int decoder_mmu_box_init(void);
+void decoder_mmu_box_exit(void);
#endif
diff --git a/drivers/frame_provider/decoder/utils/utils.c b/drivers/frame_provider/decoder/utils/utils.c
index e847631..33ab765 100644
--- a/drivers/frame_provider/decoder/utils/utils.c
+++ b/drivers/frame_provider/decoder/utils/utils.c
@@ -57,6 +57,9 @@ static void __exit decoder_common_exit(void)
/*amvdec exit.*/
amvdec_exit();
+
+ decoder_mmu_box_exit();
+ decoder_bmmu_box_exit();
}
module_init(decoder_common_init);
diff --git a/drivers/frame_provider/decoder/utils/vdec.c b/drivers/frame_provider/decoder/utils/vdec.c
index 945ee0e..7c54882 100644
--- a/drivers/frame_provider/decoder/utils/vdec.c
+++ b/drivers/frame_provider/decoder/utils/vdec.c
@@ -54,13 +54,13 @@
#include <linux/amlogic/media/utils/amports_config.h>
#include "../utils/amvdec.h"
-/*#include "../vp9/vvp9.h"*//*mask*/
#include "vdec_input.h"
#include "../../../common/media_clock/clk/clk.h"
#include <linux/reset.h>
#include <linux/amlogic/media/old_cpu_version.h>
#include <linux/amlogic/media/codec_mm/codec_mm.h>
+#include <linux/amlogic/media/video_sink/video_keeper.h>
static DEFINE_MUTEX(vdec_mutex);
@@ -223,7 +223,7 @@ struct device *get_codec_cma_device(void)
static unsigned int get_mmu_mode(void)
{
- return 1;/*mask temp*/
+ return 1;//DEBUG_TMP
}
#ifdef CONFIG_MULTI_DEC
@@ -948,6 +948,26 @@ static const char *get_dev_name(bool use_legacy_vdec, int format)
#endif
}
+void vdec_free_cmabuf(void)
+{
+ mutex_lock(&vdec_mutex);
+
+ if (inited_vcodec_num > 0) {
+ mutex_unlock(&vdec_mutex);
+ return;
+ }
+
+ if (vdec_mem_alloced_from_codec && vdec_core->mem_start) {
+ codec_mm_free_for_dma(MEM_NAME, vdec_core->mem_start);
+ vdec_cma_page = NULL;
+ vdec_core->mem_start = reserved_mem_start;
+ vdec_core->mem_end = reserved_mem_end;
+ pr_info("force free vdec memory\n");
+ }
+
+ mutex_unlock(&vdec_mutex);
+}
+
/*
*register vdec_device
* create output, vfm or create ionvideo output
@@ -995,7 +1015,7 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
if (vdec_single(vdec) &&
((vdec->format == VFORMAT_H264_4K2K) ||
(vdec->format == VFORMAT_HEVC && is_4k))) {
- //try_free_keep_video(0);/*mask*/
+ try_free_keep_video(0);
}
/*
@@ -1018,8 +1038,8 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
vdec->format,
vdec_default_buf_size[vdec->format] * SZ_1M);
#endif
- //try_free_keep_video(0);/*mask*/
- //vdec_free_cmabuf();/*mask*/
+ try_free_keep_video(0);
+ vdec_free_cmabuf();
}
mutex_lock(&vdec_mutex);
@@ -1133,7 +1153,7 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
if (retry_num < 1) {
pr_err("vdec base CMA allocation failed,try again\\n");
retry_num++;
- //try_free_keep_video(0);/*mask*/
+ try_free_keep_video(0);
continue;/*retry alloc*/
}
pr_err("vdec base CMA allocation failed.\n");
@@ -1191,7 +1211,7 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
goto error;
}
-#if 0
+
if (p->use_vfm_path) {
vdec->vf_receiver_inst = -1;
} else if (!vdec_dual(vdec)) {
@@ -1210,8 +1230,8 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
}
if (p->frame_base_video_path == FRAME_BASE_PATH_IONVIDEO) {
#if 1
- r = ionvideo_alloc_map(&vdec->vf_receiver_name,
- &vdec->vf_receiver_inst);
+ //r = ionvideo_alloc_map(&vdec->vf_receiver_name,
+ //&vdec->vf_receiver_inst);//DEBUG_TMP
#else
/*
* temporarily just use decoder instance ID as iondriver ID
@@ -1292,7 +1312,6 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
}
-#endif/*mask*/
if (!vdec_single(vdec)) {
vf_reg_provider(&p->vframe_provider);
@@ -1322,7 +1341,7 @@ void vdec_release(struct vdec_s *vdec)
if (vdec_core->vfm_vdec == vdec)
vdec_core->vfm_vdec = NULL;
-#if 0
+
if (vdec->vf_receiver_inst >= 0) {
if (vdec->vfm_map_id[0]) {
vfm_map_remove(vdec->vfm_map_id);
@@ -1334,9 +1353,9 @@ void vdec_release(struct vdec_s *vdec)
* for either un-initialized vdec or a ionvideo
* instance reserved for legacy path.
*/
- ionvideo_release_map(vdec->vf_receiver_inst);
+ //ionvideo_release_map(vdec->vf_receiver_inst);//DEBUG_TMP
}
-#endif/*mask*/
+
platform_device_unregister(vdec->dev);
if (!vdec->use_vfm_path) {
@@ -1348,8 +1367,8 @@ void vdec_release(struct vdec_s *vdec)
} else if (delay_release-- <= 0 &&
!keep_vdec_mem &&
vdec_mem_alloced_from_codec &&
- vdec_core->mem_start /*&&
- get_blackout_policy()*//*mask*/) {
+ vdec_core->mem_start &&
+ get_blackout_policy()) {
codec_mm_free_for_dma(MEM_NAME, vdec_core->mem_start);
vdec_cma_page = NULL;
vdec_core->mem_start = reserved_mem_start;
@@ -1398,27 +1417,6 @@ int vdec_reset(struct vdec_s *vdec)
}
EXPORT_SYMBOL(vdec_reset);
-void vdec_free_cmabuf(void)
-{
- mutex_lock(&vdec_mutex);
-
- if (inited_vcodec_num > 0) {
- mutex_unlock(&vdec_mutex);
- return;
- }
-
- if (vdec_mem_alloced_from_codec && vdec_core->mem_start) {
- codec_mm_free_for_dma(MEM_NAME, vdec_core->mem_start);
- vdec_cma_page = NULL;
- vdec_core->mem_start = reserved_mem_start;
- vdec_core->mem_end = reserved_mem_end;
- pr_info("force free vdec memory\n");
- }
-
- mutex_unlock(&vdec_mutex);
-}
-EXPORT_SYMBOL(vdec_free_cmabuf);
-
static struct vdec_s *active_vdec(struct vdec_core_s *core)
{
struct vdec_s *vdec;
diff --git a/drivers/frame_provider/decoder/utils/vdec.h b/drivers/frame_provider/decoder/utils/vdec.h
index 855dbfe..cb63f8d 100644
--- a/drivers/frame_provider/decoder/utils/vdec.h
+++ b/drivers/frame_provider/decoder/utils/vdec.h
@@ -102,7 +102,7 @@ extern enum vdec2_usage_e get_vdec2_usage(void);
extern void dma_contiguous_early_fixup(phys_addr_t base, unsigned long size);
unsigned int get_vdec_clk_config_settings(void);
void update_vdec_clk_config_settings(unsigned int config);
-/*unsigned int get_mmu_mode(void);*//*mask*/
+//unsigned int get_mmu_mode(void);//DEBUG_TMP
struct vdec_s;
enum vformat_t;
diff --git a/drivers/frame_provider/decoder/vp9/vvp9.c b/drivers/frame_provider/decoder/vp9/vvp9.c
index 91f1b5d..594b29f 100644
--- a/drivers/frame_provider/decoder/vp9/vvp9.c
+++ b/drivers/frame_provider/decoder/vp9/vvp9.c
@@ -47,7 +47,7 @@
#include "../utils/vdec.h"
#include "../utils/amvdec.h"
-//#include "video.h"
+#include <linux/amlogic/media/video_sink/video.h>
#define MIX_STREAM_SUPPORT
#define SUPPORT_4K2K
@@ -3694,9 +3694,9 @@ static void init_pic_list(struct VP9Decoder_s *pbi)
int i;
struct VP9_Common_s *cm = &pbi->common;
struct PIC_BUFFER_CONFIG_s *pic_config;
- //struct vframe_s vf;
+ struct vframe_s vf;
unsigned long disp_addr = 0;
-#if 0
+
if (!get_video0_frame_info(&vf)) {
if (vf.type & VIDTYPE_SCATTER) {
/*sc only used header.*/
@@ -3710,7 +3710,7 @@ static void init_pic_list(struct VP9Decoder_s *pbi)
disp_addr = cur_canvas.addr;
}
}
-#endif/*mask*/
+
for (i = 0; i < FRAME_BUFFERS; i++) {
pic_config = &cm->buffer_pool->frame_bufs[i].buf;
pic_config->index = i;
@@ -4686,21 +4686,24 @@ static void vp9_local_uninit(struct VP9Decoder_s *pbi)
dma_free_coherent(amports_get_dma_device(),
LMEM_BUF_SIZE, pbi->lmem_addr,
pbi->lmem_phy_addr);
- pbi->lmem_addr = NULL;
+
+ pbi->lmem_addr = NULL;
}
if (pbi->prob_buffer_addr) {
if (pbi->prob_buffer_phy_addr)
dma_free_coherent(amports_get_dma_device(),
PROB_BUF_SIZE, pbi->prob_buffer_addr,
pbi->prob_buffer_phy_addr);
- pbi->prob_buffer_addr = NULL;
+
+ pbi->prob_buffer_addr = NULL;
}
if (pbi->count_buffer_addr) {
if (pbi->count_buffer_phy_addr)
dma_free_coherent(amports_get_dma_device(),
COUNT_BUF_SIZE, pbi->count_buffer_addr,
pbi->count_buffer_phy_addr);
- pbi->count_buffer_addr = NULL;
+
+ pbi->count_buffer_addr = NULL;
}
#ifdef VP9_10B_MMU
if (pbi->frame_mmu_map_addr) {
@@ -4708,7 +4711,8 @@ static void vp9_local_uninit(struct VP9Decoder_s *pbi)
dma_free_coherent(amports_get_dma_device(),
FRAME_MMU_MAP_SIZE, pbi->frame_mmu_map_addr,
pbi->frame_mmu_map_phy_addr);
- pbi->frame_mmu_map_addr = NULL;
+
+ pbi->frame_mmu_map_addr = NULL;
}
#endif
@@ -5466,7 +5470,8 @@ static irqreturn_t vvp9_isr_thread_fn(int irq, void *data)
for (i = 0; i < MAX_SEGMENTS; i++)
seg_4lf->feature_mask[i] = (vp9_param.p.seg_lf_info[i] &
0x8000) ? (1 << SEG_LVL_ALT_LF) : 0;
- for (i = 0; i < MAX_SEGMENTS; i++)
+
+ for (i = 0; i < MAX_SEGMENTS; i++)
seg_4lf->feature_data[i][SEG_LVL_ALT_LF]
= (vp9_param.p.seg_lf_info[i]
& 0x100) ? -(vp9_param.p.seg_lf_info[i]
diff --git a/drivers/stream_input/amports/amstream.c b/drivers/stream_input/amports/amstream.c
index 7312a69..9545755 100644
--- a/drivers/stream_input/amports/amstream.c
+++ b/drivers/stream_input/amports/amstream.c
@@ -81,7 +81,7 @@
#endif
#include <linux/amlogic/media/codec_mm/codec_mm.h>
-#define CONFIG_AM_VDEC_REAL /*mask*/
+#define CONFIG_AM_VDEC_REAL //DEBUG_TMP
#define DEVICE_NAME "amstream-dev"
#define DRIVER_NAME "amstream"
@@ -1282,8 +1282,8 @@ static ssize_t amstream_sub_read(struct file *file, char __user *buf,
(void *)(codec_mm_phys_to_virt(sub_rp)),
data_size);
- if (res >= 0)
- stbuf_sub_rp_set(sub_rp + data_size - res);
+ if (res >= 0)
+ stbuf_sub_rp_set(sub_rp + data_size - res);
return data_size - res;
}
@@ -1607,10 +1607,10 @@ static int amstream_release(struct inode *inode, struct file *file)
if (port->type & PORT_TYPE_VIDEO) {
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_M8) {
#ifndef CONFIG_MULTI_DEC
- if (has_hevc_vdec())
+ /*if (has_hevc_vdec())
vdec_poweroff(VDEC_HEVC);
- vdec_poweroff(VDEC_1);
+ vdec_poweroff(VDEC_1);*/
#else
if ((port->type & PORT_TYPE_MPTS) &&
((port->flag & PORT_FLAG_VFORMAT) == 0)) {
@@ -3573,7 +3573,9 @@ static int amstream_remove(struct platform_device *pdev)
class_destroy(amstream_dev_class);
- unregister_chrdev(AMSTREAM_MAJOR, DEVICE_NAME);
+ unregister_chrdev(AMSTREAM_MAJOR, "amstream");
+
+ class_unregister(&amstream_class);
astream_dev_unregister();
diff --git a/drivers/stream_input/parser/rmparser.c b/drivers/stream_input/parser/rmparser.c
index 257c00d..63d7a63 100644
--- a/drivers/stream_input/parser/rmparser.c
+++ b/drivers/stream_input/parser/rmparser.c
@@ -26,7 +26,6 @@
#include <linux/platform_device.h>
#include <linux/amlogic/media/utils/amstream.h>
#include <linux/amlogic/media/frame_sync/ptsserv.h>
-/* #include <mach/am_regs.h> */
#include <linux/uaccess.h>
#include <linux/amlogic/media/utils/vdec_reg.h>
@@ -208,7 +207,7 @@ static ssize_t _rmparser_write(const char __user *buf, size_t count)
("write timeout,retry,halt_count=%d parse_control=%x\n",
parse_halt, READ_MPEG_REG(PARSER_CONTROL));
- //vreal_set_fatal_flag(1);/*mask*/
+ //vreal_set_fatal_flag(1);//DEBUG_TMP
if (parse_halt > 10) {
WRITE_MPEG_REG(PARSER_CONTROL,