mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
media: keep last normal frame before reset [2/2]
PD#OTT-71 Problem: google cast display green lump when seek. reset after seek opration. Solution: keep last normal frame before reset and buf free. Verify: U211, Atom Change-Id: I02304998c9434f1055de1138700510f4c19f466f Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
This commit is contained in:
committed by
Jianxin Pan
parent
7ef827f5a8
commit
d288cd6fc4
@@ -729,6 +729,38 @@ void codec_mm_dma_flush(void *vaddr,
|
||||
}
|
||||
EXPORT_SYMBOL(codec_mm_dma_flush);
|
||||
|
||||
int codec_mm_has_owner(struct codec_mm_s *mem, const char *owner)
|
||||
{
|
||||
int index;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
int is_owner = 0;
|
||||
|
||||
struct codec_mm_mgt_s *mgt = get_mem_mgt();
|
||||
|
||||
if (mem) {
|
||||
spin_lock_irqsave(&mgt->lock, flags);
|
||||
if (!codec_mm_valid_mm_locked(mem)) {
|
||||
spin_unlock_irqrestore(&mgt->lock, flags);
|
||||
pr_err("codec mm %p not valied!\n", mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
index = atomic_read(&mem->use_cnt);
|
||||
|
||||
for (i = 0; i < index; i++) {
|
||||
if (mem->owner[i] &&
|
||||
strcmp(owner, mem->owner[i]) == 0) {
|
||||
is_owner = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&mgt->lock, flags);
|
||||
}
|
||||
|
||||
return is_owner;
|
||||
}
|
||||
|
||||
int codec_mm_request_shared_mem(struct codec_mm_s *mem, const char *owner)
|
||||
{
|
||||
struct codec_mm_mgt_s *mgt = get_mem_mgt();
|
||||
|
||||
@@ -56,6 +56,11 @@ static struct codec_mm_keeper_mgr *get_codec_mm_keeper_mgr(void)
|
||||
return &codec_keeper_mgr_private;
|
||||
}
|
||||
|
||||
int is_codec_mm_keeped(void *mem_handle)
|
||||
{
|
||||
return codec_mm_has_owner(mem_handle, KEEP_NAME);
|
||||
}
|
||||
EXPORT_SYMBOL(is_codec_mm_keeped);
|
||||
/*
|
||||
*not call in interrupt;
|
||||
*/
|
||||
|
||||
@@ -6451,6 +6451,13 @@ static int di_receiver_event_fun(int type, void *data, void *arg)
|
||||
di_blocking = 1;
|
||||
|
||||
pr_dbg("%s: VFRAME_EVENT_PROVIDER_RESET\n", __func__);
|
||||
if (is_bypass(NULL)
|
||||
|| bypass_state
|
||||
|| di_pre_stru.bypass_flag) {
|
||||
vf_notify_receiver(VFM_NAME,
|
||||
VFRAME_EVENT_PROVIDER_RESET,
|
||||
NULL);
|
||||
}
|
||||
|
||||
goto light_unreg;
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG) {
|
||||
|
||||
@@ -530,6 +530,10 @@ static int ppmgr_receiver_event_fun(int type, void *data, void *private_data)
|
||||
break;
|
||||
case VFRAME_EVENT_PROVIDER_RESET:
|
||||
vf_ppmgr_reset(0);
|
||||
vf_notify_receiver(
|
||||
PROVIDER_NAME,
|
||||
VFRAME_EVENT_PROVIDER_RESET,
|
||||
NULL);
|
||||
break;
|
||||
case VFRAME_EVENT_PROVIDER_FR_HINT:
|
||||
case VFRAME_EVENT_PROVIDER_FR_END_HINT:
|
||||
|
||||
@@ -282,6 +282,13 @@ static int video_receiver_event_fun(int type, void *data, void *private_data)
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_FR_END_HINT) {
|
||||
vf_notify_receiver(dev->vf_provider_name,
|
||||
VFRAME_EVENT_PROVIDER_FR_END_HINT, data);
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_RESET) {
|
||||
dev->first_frame = 0;
|
||||
vfq_init(&dev->q_ready, AMLVIDEO_POOL_SIZE + 1,
|
||||
&dev->amlvideo_pool_ready[0]);
|
||||
|
||||
vf_notify_receiver(dev->vf_provider_name,
|
||||
VFRAME_EVENT_PROVIDER_RESET, data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -541,6 +548,12 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
|
||||
mutex_unlock(&dev->vfpMutex);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (dev->vf->index == 0xFFFFFFFF) {
|
||||
pr_info("vidioc_dqbuf: Invalid vf\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
dev->vf->omx_index = dev->frame_num;
|
||||
dev->am_parm.signal_type = dev->vf->signal_type;
|
||||
dev->am_parm.master_display_colour
|
||||
|
||||
@@ -6780,10 +6780,17 @@ static void video_vf_unreg_provider(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void video_vf_light_unreg_provider(void)
|
||||
static void video_vf_light_unreg_provider(int need_keep_frame)
|
||||
{
|
||||
ulong flags;
|
||||
|
||||
if (need_keep_frame) {
|
||||
/* wait for the end of the last toggled frame*/
|
||||
atomic_set(&video_unreg_flag, 1);
|
||||
while (atomic_read(&video_inirq_flag) > 0)
|
||||
schedule();
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
|
||||
dispbuf_to_put_num = DISPBUF_TO_PUT_MAX;
|
||||
@@ -6799,6 +6806,19 @@ static void video_vf_light_unreg_provider(void)
|
||||
cur_dispbuf = &vf_local;
|
||||
}
|
||||
spin_unlock_irqrestore(&lock, flags);
|
||||
|
||||
if (need_keep_frame) {
|
||||
/* keep the last toggled frame*/
|
||||
if (cur_dispbuf) {
|
||||
unsigned int result;
|
||||
|
||||
result = vf_keep_current(cur_dispbuf, NULL);
|
||||
if (result == 0)
|
||||
pr_info("%s: keep cur_disbuf failed\n",
|
||||
__func__);
|
||||
}
|
||||
atomic_set(&video_unreg_flag, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static int get_display_info(void *data)
|
||||
@@ -6864,9 +6884,9 @@ static int video_receiver_event_fun(int type, void *data, void *private_data)
|
||||
//init_hdr_info();
|
||||
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_RESET) {
|
||||
video_vf_light_unreg_provider();
|
||||
video_vf_light_unreg_provider(1);
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG)
|
||||
video_vf_light_unreg_provider();
|
||||
video_vf_light_unreg_provider(0);
|
||||
else if (type == VFRAME_EVENT_PROVIDER_REG) {
|
||||
enable_video_discontinue_report = 1;
|
||||
drop_frame_count = 0;
|
||||
@@ -6900,7 +6920,7 @@ static int video_receiver_event_fun(int type, void *data, void *private_data)
|
||||
(void *)1);
|
||||
}
|
||||
|
||||
video_vf_light_unreg_provider();
|
||||
video_vf_light_unreg_provider(0);
|
||||
} else if (type == VFRAME_EVENT_PROVIDER_FORCE_BLACKOUT) {
|
||||
force_blackout = 1;
|
||||
if (debug_flag & DEBUG_FLAG_BLACKOUT) {
|
||||
|
||||
@@ -835,6 +835,7 @@ static unsigned int vf_keep_current_locked(
|
||||
cur_dispbuf_el);
|
||||
if (ret) {
|
||||
/*keeped ok with codec keeper!*/
|
||||
keep_video_on = 1;
|
||||
return 1;
|
||||
}
|
||||
#ifdef CONFIG_AMLOGIC_MEDIA_MULTI_DEC
|
||||
|
||||
@@ -121,6 +121,7 @@ unsigned long codec_mm_alloc_for_dma_ex(
|
||||
int buffer_id);
|
||||
|
||||
void codec_mm_release(struct codec_mm_s *mem, const char *owner);
|
||||
int codec_mm_has_owner(struct codec_mm_s *mem, const char *owner);
|
||||
int codec_mm_request_shared_mem(struct codec_mm_s *mem, const char *owner);
|
||||
/*call if not make sure valid data.*/
|
||||
void codec_mm_release_with_check(struct codec_mm_s *mem, const char *owner);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
int codec_mm_keeper_mask_keep_mem(void *mem_handle, int type);
|
||||
|
||||
int is_codec_mm_keeped(void *mem_handle);
|
||||
/*
|
||||
*can call in irq
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user