video_keeper: use ge2d keep last frame. [1/1]

PD#SWPL-17670

Problem:
can't keep last frame with ge2d.

Solution:
Use the address of the vframe to make a judgment.

Verify:
on w400

Change-Id: Id652500d77d5b70837f29606b6336c592580d466
Signed-off-by: renjiang.han <renjiang.han@amlogic.com>
This commit is contained in:
renjiang.han
2019-11-19 20:11:22 +08:00
committed by Chris KIM
parent 6bc70d79c0
commit cc9016c91e

View File

@@ -796,7 +796,7 @@ void try_free_keep_video(int flags)
if (vd_layer[0].dispbuf_mapping
== &cur_dispbuf)
layer1_used = true;
else if (vd_layer[1].dispbuf_mapping
if (vd_layer[1].dispbuf_mapping
== &cur_dispbuf)
layer2_used = true;
@@ -841,7 +841,7 @@ void try_free_keep_videopip(int flags)
if (vd_layer[0].dispbuf_mapping
== &cur_pipbuf)
layer1_used = true;
else if (vd_layer[1].dispbuf_mapping
if (vd_layer[1].dispbuf_mapping
== &cur_pipbuf)
layer2_used = true;
@@ -896,31 +896,32 @@ static void video_keeper_update_keeper_mem(
}
static int video_keeper_frame_keep_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
struct vframe_s *cur_buf,
struct vframe_s *cur_buf_el)
{
int type = MEM_TYPE_CODEC_MM;
if (cur_dispbuf->type & VIDTYPE_SCATTER)
if (cur_buf->type & VIDTYPE_SCATTER)
type = MEM_TYPE_CODEC_MM_SCATTER;
video_keeper_update_keeper_mem(
cur_dispbuf->mem_handle,
cur_buf->mem_handle,
type,
&keep_id);
video_keeper_update_keeper_mem(
cur_dispbuf->mem_head_handle,
cur_buf->mem_head_handle,
MEM_TYPE_CODEC_MM,
&keep_head_id);
if (cur_dispbuf_el) {
if (cur_dispbuf->type & VIDTYPE_SCATTER)
if (cur_buf_el) {
if (cur_buf->type & VIDTYPE_SCATTER)
type = MEM_TYPE_CODEC_MM_SCATTER;
else
type = MEM_TYPE_CODEC_MM;
video_keeper_update_keeper_mem(
cur_dispbuf_el->mem_handle,
cur_buf_el->mem_handle,
type,
&keep_el_id);
video_keeper_update_keeper_mem(
cur_dispbuf_el->mem_head_handle,
cur_buf_el->mem_head_handle,
MEM_TYPE_CODEC_MM,
&keep_el_head_id);
}
@@ -928,34 +929,34 @@ static int video_keeper_frame_keep_locked(
}
static int video_pip_keeper_frame_keep_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
struct vframe_s *cur_buf,
struct vframe_s *cur_buf_el)
{
int type = MEM_TYPE_CODEC_MM;
if (cur_dispbuf) {
if (cur_dispbuf->type & VIDTYPE_SCATTER)
if (cur_buf) {
if (cur_buf->type & VIDTYPE_SCATTER)
type = MEM_TYPE_CODEC_MM_SCATTER;
video_keeper_update_keeper_mem(
cur_dispbuf->mem_handle,
cur_buf->mem_handle,
type,
&keep_pip_id);
video_keeper_update_keeper_mem(
cur_dispbuf->mem_head_handle,
cur_buf->mem_head_handle,
MEM_TYPE_CODEC_MM,
&keep_pip_head_id);
}
if (cur_dispbuf_el) {
if (cur_dispbuf_el->type & VIDTYPE_SCATTER)
if (cur_buf_el) {
if (cur_buf_el->type & VIDTYPE_SCATTER)
type = MEM_TYPE_CODEC_MM_SCATTER;
else
type = MEM_TYPE_CODEC_MM;
video_keeper_update_keeper_mem(
cur_dispbuf_el->mem_handle,
cur_buf_el->mem_handle,
type,
&keep_pip_el_id);
video_keeper_update_keeper_mem(
cur_dispbuf_el->mem_head_handle,
cur_buf_el->mem_head_handle,
MEM_TYPE_CODEC_MM,
&keep_pip_el_head_id);
}
@@ -1026,7 +1027,7 @@ void video_pip_keeper_new_frame_notify(void)
}
#ifdef CONFIG_AMLOGIC_MEDIA_GE2D
static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *ge2d_buf)
{
u32 cur_index;
u32 y_index, u_index, v_index;
@@ -1037,7 +1038,7 @@ static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
if (vd_layer[0].dispbuf_mapping
== &cur_dispbuf)
layer1_used = true;
else if (vd_layer[1].dispbuf_mapping
if (vd_layer[1].dispbuf_mapping
== &cur_dispbuf)
layer2_used = true;
@@ -1048,7 +1049,7 @@ static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
}
#endif
if (cur_dispbuf->type & VIDTYPE_COMPRESS) {
if (ge2d_buf->type & VIDTYPE_COMPRESS) {
/* todo: duplicate compressed video frame */
pr_info("keep exit is skip VIDTYPE_COMPRESS\n");
return 0;
@@ -1086,10 +1087,10 @@ static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
canvas_get_addr(y_index));
}
if ((cur_dispbuf->type & VIDTYPE_VIU_422) == VIDTYPE_VIU_422) {
if ((ge2d_buf->type & VIDTYPE_VIU_422) == VIDTYPE_VIU_422) {
pr_info("%s:no support VIDTYPE_VIU_422\n", __func__);
return 0;
} else if ((cur_dispbuf->type & VIDTYPE_VIU_444) == VIDTYPE_VIU_444) {
} else if ((ge2d_buf->type & VIDTYPE_VIU_444) == VIDTYPE_VIU_444) {
if ((Y_BUFFER_SIZE < (cd.width * cd.height))) {
pr_info
("[%s::%d] error:data>buf size: %x,%x,%x, %x,%x\n",
@@ -1101,7 +1102,7 @@ static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
ge2d_keeplastframe_block(cur_index, GE2D_FORMAT_S24_YUV444);
if (get_video_debug_flags() & DEBUG_FLAG_BLACKOUT)
pr_info("%s: VIDTYPE_VIU_444\n", __func__);
} else if ((cur_dispbuf->type & VIDTYPE_VIU_NV21) == VIDTYPE_VIU_NV21) {
} else if ((ge2d_buf->type & VIDTYPE_VIU_NV21) == VIDTYPE_VIU_NV21) {
canvas_read(y_index, &cs0);
canvas_read(u_index, &cs1);
if ((Y_BUFFER_SIZE < (cs0.width * cs0.height))
@@ -1136,13 +1137,13 @@ static unsigned int vf_ge2d_keep_frame_locked(struct vframe_s *cur_dispbuf)
#endif
static unsigned int vf_keep_current_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
struct vframe_s *cur_buf,
struct vframe_s *cur_buf_el)
{
int ret;
if (!cur_dispbuf) {
pr_info("keep exit without cur_dispbuf\n");
if (!cur_buf) {
pr_info("keep exit without cur_buf\n");
return 0;
}
@@ -1162,7 +1163,7 @@ static unsigned int vf_keep_current_locked(
}
#if 1
if (cur_dispbuf->type & VIDTYPE_PRE_INTERLACE) {
if (cur_buf->type & VIDTYPE_PRE_INTERLACE) {
pr_info("keep exit is di\n");
return 2;
}
@@ -1172,14 +1173,14 @@ static unsigned int vf_keep_current_locked(
return 0;
}
#endif
if (cur_dispbuf->source_type == VFRAME_SOURCE_TYPE_PPMGR) {
if (cur_buf->source_type == VFRAME_SOURCE_TYPE_PPMGR) {
pr_info("ppmgr use ge2d keep frame!\n");
ret = vf_ge2d_keep_frame_locked(cur_dispbuf);
ret = vf_ge2d_keep_frame_locked(cur_buf);
} else {
pr_info("use keep buffer keep frame!\n");
ret = video_keeper_frame_keep_locked(
cur_dispbuf,
cur_dispbuf_el);
cur_buf,
cur_buf_el);
}
if (ret) {
@@ -1193,16 +1194,13 @@ static unsigned int vf_keep_current_locked(
}
unsigned int vf_keep_pip_current_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
struct vframe_s *cur_buf,
struct vframe_s *cur_buf_el)
{
//u32 cur_index;
//u32 y_index, u_index, v_index;
//struct canvas_s cs0, cs1, cs2, cd;
int ret;
if (!cur_dispbuf) {
pr_info("keep pip exit without cur_dispbuf\n");
if (!cur_buf) {
pr_info("keep pip exit without cur_buf\n");
return 0;
}
@@ -1222,8 +1220,8 @@ unsigned int vf_keep_pip_current_locked(
}
ret = video_pip_keeper_frame_keep_locked(
cur_dispbuf,
cur_dispbuf_el);
cur_buf,
cur_buf_el);
if (ret) {
/*keeped ok with codec keeper!*/
@@ -1237,14 +1235,14 @@ unsigned int vf_keep_pip_current_locked(
}
unsigned int vf_keep_current(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf2)
struct vframe_s *cur_buf,
struct vframe_s *cur_buf2)
{
unsigned int ret;
mutex_lock(&video_keeper_mutex);
ret = vf_keep_current_locked(
cur_dispbuf, cur_dispbuf2);
cur_buf, cur_buf2);
mutex_unlock(&video_keeper_mutex);
return ret;
}