From: qianqian.cai Date: Mon, 23 Dec 2019 01:51:11 +0000 (+0800) Subject: deintlace: add recycle buffer q after unreg [1/2] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f449c07f30ca55d811b008b18093ccc64475e99;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git deintlace: add recycle buffer q after unreg [1/2] PD#SWPL-18786 Problem: keep the buffer from DI need release Solution: modify the recycle flow Verify: newton Change-Id: I2f7647468964236ac087704f60ef975c43549776 Signed-off-by: qianqian.cai --- diff --git a/MAINTAINERS b/MAINTAINERS index f48ad1eed56e..58c25232ed47 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15161,6 +15161,10 @@ M: Jihong Sui F: drivers/amlogic/media/deinterlace/di_pqa.h F: drivers/amlogic/media/di_local/* +AMLOGIC DEINTERLACE DRIVER +M: qianqian cai +F: include/linux/amlogic/media/di/di.h + AMLOGIC ADD DI_MULTI DRIVER M: Jihong Sui F: drivers/amlogic/media/di_multi/* diff --git a/drivers/amlogic/media/deinterlace/deinterlace.c b/drivers/amlogic/media/deinterlace/deinterlace.c index 9e3acb8300be..fb2bf42a4967 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.c +++ b/drivers/amlogic/media/deinterlace/deinterlace.c @@ -570,6 +570,9 @@ int get_di_dump_state_flag(void) ********************************************/ void di_trig_free_mirror_mem(void) { + if (dil_get_diffver_flag()) + return; + if (atomic_read(&di_flag_unreg) && de_devp->flag_cma != 2 && de_devp->flag_cma != 0 @@ -8841,6 +8844,8 @@ static int di_probe(struct platform_device *pdev) dil_attach_ext_api(&di_ext); di_patch_mov_ini(); + dil_set_diffver_flag(0); + di_pr_info("%s:ok\n", __func__); return ret; diff --git a/drivers/amlogic/media/deinterlace/deinterlace.h b/drivers/amlogic/media/deinterlace/deinterlace.h index d93e31283797..ad805ba44c5f 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.h +++ b/drivers/amlogic/media/deinterlace/deinterlace.h @@ -486,8 +486,11 @@ extern bool di_wr_cue_int(void); extern int reg_cue_int_show(struct seq_file *seq, void *v); bool dil_attach_ext_api(const struct di_ext_ops *di_api); -/*---------------------*/ +/*--Different DI versions flag---*/ +void dil_set_diffver_flag(unsigned int para); +unsigned int dil_get_diffver_flag(void); +/*-------------------------*/ struct di_buf_s *get_di_buf(int queue_idx, int *start_pos); #define queue_for_each_entry(di_buf, ptm, queue_idx, list) \ diff --git a/drivers/amlogic/media/di_local/di_local.c b/drivers/amlogic/media/di_local/di_local.c index 3d86532d8dc0..e7cee1ef9544 100644 --- a/drivers/amlogic/media/di_local/di_local.c +++ b/drivers/amlogic/media/di_local/di_local.c @@ -68,6 +68,22 @@ static struct dil_dev_s *pdv; static const struct di_ext_ops *dil_api; //temp +static unsigned int diffver_flag; + +/*************************************** + * dil api for make a distinction between old/new DI function * + **************************************/ +void dil_set_diffver_flag(unsigned int para) +{ + diffver_flag = para; +} +EXPORT_SYMBOL(dil_set_diffver_flag); +unsigned int dil_get_diffver_flag(void) +{ + return diffver_flag; +} +EXPORT_SYMBOL(dil_get_diffver_flag); + /*************************************** * di api for other module * **************************************/ diff --git a/drivers/amlogic/media/di_multi/deinterlace.c b/drivers/amlogic/media/di_multi/deinterlace.c index 0ee47671def4..6bac4fb09f9f 100644 --- a/drivers/amlogic/media/di_multi/deinterlace.c +++ b/drivers/amlogic/media/di_multi/deinterlace.c @@ -2105,7 +2105,14 @@ bool dim_post_keep_release_one(unsigned int ch, unsigned int di_buf_index) di_buf = &pbuf_post[di_buf_index]; if (!di_que_is_in_que(ch, QUE_POST_KEEP, di_buf)) { - PR_ERR("%s:buf[%d] is not in keep\n", __func__, di_buf_index); + if (is_in_queue(ch, di_buf, QUEUE_DISPLAY)) { + di_buf->queue_index = -1; + di_que_in(ch, QUE_POST_BACK, di_buf); + dbg_keep("%s:to back[%d]\n", __func__, di_buf_index); + } else { + PR_ERR("%s:buf[%d] is not in keep or display\n", + __func__, di_buf_index); + } return false; } di_que_out_not_fifo(ch, QUE_POST_KEEP, di_buf); @@ -2168,12 +2175,14 @@ void dim_post_keep_cmd_release(unsigned int ch, struct vframe_s *vframe) di_buf->index); task_send_cmd(LCMD2(ECMD_RL_KEEP, di_buf->channel, di_buf->index)); } -EXPORT_SYMBOL(dim_post_keep_cmd_release); void dim_post_keep_cmd_release2(struct vframe_s *vframe) { struct di_buf_s *di_buf; + if (!dil_get_diffver_flag()) + return; + if (!vframe) return; @@ -2189,15 +2198,11 @@ void dim_post_keep_cmd_release2(struct vframe_s *vframe) return; } - if (!di_que_is_in_que(di_buf->channel, QUE_POST_KEEP, di_buf)) { - PR_ERR("%s:not keep buf %d\n", __func__, di_buf->index); - } else { - dbg_keep("release keep ch[%d],index[%d]\n", - di_buf->channel, - di_buf->index); - task_send_cmd(LCMD2(ECMD_RL_KEEP, di_buf->channel, - di_buf->index)); - } + dbg_keep("release keep ch[%d],index[%d]\n", + di_buf->channel, + di_buf->index); + task_send_cmd(LCMD2(ECMD_RL_KEEP, di_buf->channel, + di_buf->index)); } EXPORT_SYMBOL(dim_post_keep_cmd_release2); @@ -2255,6 +2260,7 @@ void dim_post_keep_cmd_proc(unsigned int ch, unsigned int index) chst = dip_chst_get(ch); switch (chst) { case EDI_TOP_STATE_READY: + case eDI_TOP_STATE_UNREG_STEP2: dim_post_keep_release_one(ch, index); break; case EDI_TOP_STATE_IDLE: @@ -2299,8 +2305,14 @@ void dim_post_keep_cmd_proc(unsigned int ch, unsigned int index) } di_buf = &pbuf_post[index]; - di_buf->queue_index = -1; - di_que_in(ch, QUE_POST_KEEP_BACK, di_buf); + if (is_in_queue(ch, di_buf, QUEUE_DISPLAY)) { + di_buf->queue_index = -1; + di_que_in(ch, QUE_POST_BACK, di_buf); + dbg_keep("%s:to back[%d]\n", __func__, index); + } else { + PR_ERR("%s:buf[%d] is not in display\n", + __func__, index); + } break; default: PR_ERR("%s:do nothing? %s:%d\n", diff --git a/drivers/amlogic/media/di_multi/di_sys.c b/drivers/amlogic/media/di_multi/di_sys.c index 4e92430818d7..fbd0a40ec8ff 100644 --- a/drivers/amlogic/media/di_multi/di_sys.c +++ b/drivers/amlogic/media/di_multi/di_sys.c @@ -972,6 +972,8 @@ static int dim_probe(struct platform_device *pdev) dimh_patch_post_update_mc_sw(DI_MC_SW_IC, true); + dil_set_diffver_flag(1); + pr_info("%s:ok\n", __func__); return ret; diff --git a/drivers/amlogic/media/di_multi/di_sys.h b/drivers/amlogic/media/di_multi/di_sys.h index 3bbb4f7fbed8..85ca73a3de6e 100644 --- a/drivers/amlogic/media/di_multi/di_sys.h +++ b/drivers/amlogic/media/di_multi/di_sys.h @@ -38,5 +38,9 @@ bool dim_mm_release_api(int cma_mode, bool dim_cma_top_alloc(unsigned int ch); bool dim_cma_top_release(unsigned int ch); bool dim_rev_mem_check(void); +/*--Different DI versions flag---*/ +void dil_set_diffver_flag(unsigned int para); +unsigned int dil_get_diffver_flag(void); +/*-------------------------*/ #endif /*__DI_SYS_H__*/ diff --git a/include/linux/amlogic/media/di/di.h b/include/linux/amlogic/media/di/di.h new file mode 100644 index 000000000000..eafae3815425 --- /dev/null +++ b/include/linux/amlogic/media/di/di.h @@ -0,0 +1,23 @@ +/* + * include/linux/amlogic/media/di/di.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef DI_H +#define DI_H + +void dim_post_keep_cmd_release2(struct vframe_s *vframe); + +#endif /* VIDEO_H */