summaryrefslogtreecommitdiff
authorshihong.zheng <shihong.zheng@amlogic.com>2020-08-14 06:47:00 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2020-09-02 10:45:23 (GMT)
commite67ceb4a83c200379a518c5c726a4bec1224c251 (patch)
treeeb56757b46341f838379219d3c62897c0b566110
parent7ffa5fea516d59be571233349d59376d37194a19 (diff)
downloadmedia_modules-e67ceb4a83c200379a518c5c726a4bec1224c251.zip
media_modules-e67ceb4a83c200379a518c5c726a4bec1224c251.tar.gz
media_modules-e67ceb4a83c200379a518c5c726a4bec1224c251.tar.bz2
decoder: pass dummy vf to notify eos. [1/1]
PD#SWPL-31618 Problem: decoder pass a dummy vf with eos flag to backend. Solution: pass a dummy vf with eos flag when eos recieved. Verify: S905Y2 Change-Id: I775678ee94eeb6db3d304f3e44bf0a3f5def70de Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
Diffstat
-rw-r--r--drivers/frame_provider/decoder/h264_multi/vmh264.c29
-rw-r--r--drivers/frame_provider/decoder/h265/vh265.c31
-rw-r--r--drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c20
-rw-r--r--drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c21
-rw-r--r--drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c23
-rw-r--r--drivers/frame_provider/decoder/vav1/vav1.c29
-rw-r--r--drivers/frame_provider/decoder/vp9/vvp9.c29
7 files changed, 93 insertions, 89 deletions
diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c
index f60aee2..186b577 100644
--- a/drivers/frame_provider/decoder/h264_multi/vmh264.c
+++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c
@@ -3029,18 +3029,20 @@ int notify_v4l_eos(struct vdec_s *vdec)
int index = INVALID_IDX;
ulong expires;
- if (hw->is_used_v4l && hw->eos) {
- expires = jiffies + msecs_to_jiffies(2000);
- while (INVALID_IDX == (index = v4l_get_free_buf_idx(vdec))) {
- if (time_after(jiffies, expires) ||
- v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
- break;
- }
+ if (hw->eos) {
+ if (hw->is_used_v4l) {
+ expires = jiffies + msecs_to_jiffies(2000);
+ while (INVALID_IDX == (index = v4l_get_free_buf_idx(vdec))) {
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
+ break;
+ }
- if (index == INVALID_IDX) {
- if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
- pr_err("[%d] EOS get free buff fail.\n", ctx->id);
- return -1;
+ if (index == INVALID_IDX) {
+ if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
+ pr_err("[%d] EOS get free buff fail.\n", ctx->id);
+ return -1;
+ }
}
}
@@ -3056,7 +3058,7 @@ int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] H264 EOS notify.\n", ctx->id);
+ pr_info("[%d] H264 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -8795,8 +8797,7 @@ result_done:
amhevc_stop();
hw->eos = 1;
flush_dpb(p_H264_Dpb);
- if (hw->is_used_v4l)
- notify_v4l_eos(hw_to_vdec(hw));
+ notify_v4l_eos(hw_to_vdec(hw));
mutex_lock(&hw->chunks_mutex);
vdec_vframe_dirty(hw_to_vdec(hw), hw->chunk);
hw->chunk = NULL;
diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c
index 33164ec..2389d8f 100644
--- a/drivers/frame_provider/decoder/h265/vh265.c
+++ b/drivers/frame_provider/decoder/h265/vh265.c
@@ -9384,18 +9384,20 @@ static int notify_v4l_eos(struct vdec_s *vdec)
int index = INVALID_IDX;
ulong expires;
- if (hw->is_used_v4l && hw->eos) {
- expires = jiffies + msecs_to_jiffies(2000);
- while (INVALID_IDX == (index = get_free_buf_idx(hw))) {
- if (time_after(jiffies, expires) ||
- v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
- break;
- }
+ if (hw->eos) {
+ if (hw->is_used_v4l) {
+ expires = jiffies + msecs_to_jiffies(2000);
+ while (INVALID_IDX == (index = get_free_buf_idx(hw))) {
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
+ break;
+ }
- if (index == INVALID_IDX) {
- if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
- pr_err("[%d] EOS get free buff fail.\n", ctx->id);
- return -1;
+ if (index == INVALID_IDX) {
+ if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
+ pr_err("[%d] EOS get free buff fail.\n", ctx->id);
+ return -1;
+ }
}
}
@@ -9408,7 +9410,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] H265 EOS notify.\n", ctx->id);
+ pr_info("[%d] H265 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -12565,9 +12567,8 @@ static void vh265_work_implement(struct hevc_state_s *hevc,
"%s: end of stream, last dec poc %d => 0x%pf\n",
__func__, hevc->curr_POC, pic);
flush_output(hevc, pic);
-
- if (hevc->is_used_v4l)
- notify_v4l_eos(hw_to_vdec(hevc));
+ /* dummy vf with eos flag to backend */
+ notify_v4l_eos(hw_to_vdec(hevc));
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
hevc->shift_byte_count_lo
= READ_VREG(HEVC_SHIFT_BYTE_COUNT);
diff --git a/drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c b/drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c
index 8f413df..ac69159 100644
--- a/drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c
+++ b/drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c
@@ -1424,9 +1424,9 @@ static int notify_v4l_eos(struct vdec_s *vdec)
struct aml_vcodec_ctx *ctx = (struct aml_vcodec_ctx *)(hw->v4l2_ctx);
struct vframe_s *vf = NULL;
struct vdec_v4l2_buffer *fb = NULL;
- int index;
+ int index = -1;
- if (hw->is_used_v4l && hw->eos) {
+ if (hw->eos) {
if (kfifo_get(&hw->newframe_q, &vf) == 0 || vf == NULL) {
mmjpeg_debug_print(DECODE_ID(hw), PRINT_FLAG_ERROR,
"%s fatal error, no available buffer slot.\n",
@@ -1434,11 +1434,12 @@ static int notify_v4l_eos(struct vdec_s *vdec)
return -1;
}
- index = find_free_buffer(hw);
-
- if ((index == -1) && vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
- pr_err("[%d] get fb fail.\n", ctx->id);
- return -1;
+ if (hw->is_used_v4l) {
+ index = find_free_buffer(hw);
+ if ((index == -1) && vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
+ pr_err("[%d] get fb fail.\n", ctx->id);
+ return -1;
+ }
}
vf->type |= VIDTYPE_V4L_EOS;
@@ -1451,7 +1452,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] mpeg12 EOS notify.\n", ctx->id);
+ pr_info("[%d] mpeg12 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -1497,8 +1498,7 @@ static void vmjpeg_work(struct work_struct *work)
hw->stat &= ~STAT_VDEC_RUN;
}
hw->eos = 1;
- if (hw->is_used_v4l)
- notify_v4l_eos(vdec);
+ notify_v4l_eos(vdec);
vdec_vframe_dirty(hw_to_vdec(hw), hw->chunk);
hw->chunk = NULL;
diff --git a/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c b/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c
index ef45eb8..cf45504 100644
--- a/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c
+++ b/drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c
@@ -2124,20 +2124,22 @@ static int notify_v4l_eos(struct vdec_s *vdec)
struct aml_vcodec_ctx *ctx = (struct aml_vcodec_ctx *)(hw->v4l2_ctx);
struct vframe_s *vf = NULL;
struct vdec_v4l2_buffer *fb = NULL;
- int index;
+ int index = -1;
- if (hw->is_used_v4l && hw->eos) {
+ if (hw->eos) {
if (kfifo_get(&hw->newframe_q, &vf) == 0 || vf == NULL) {
debug_print(DECODE_ID(hw), PRINT_FLAG_ERROR,
"%s fatal error, no available buffer slot.\n",
__func__);
return -1;
}
- index = find_free_buffer(hw);
- if ((index == -1) &&
- vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
- pr_err("[%d] get fb fail.\n", ctx->id);
- return -1;
+ if (hw->is_used_v4l) {
+ index = find_free_buffer(hw);
+ if ((index == -1) &&
+ vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
+ pr_err("[%d] get fb fail.\n", ctx->id);
+ return -1;
+ }
}
vf->type |= VIDTYPE_V4L_EOS;
@@ -2150,7 +2152,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] mpeg12 EOS notify.\n", ctx->id);
+ pr_info("[%d] mpeg12 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -2251,8 +2253,7 @@ static void vmpeg12_work_implement(struct vdec_mpeg12_hw_s *hw,
hw->chunk = NULL;
vdec_clean_input(vdec);
flush_output(hw);
- if (hw->is_used_v4l)
- notify_v4l_eos(vdec);
+ notify_v4l_eos(vdec);
debug_print(DECODE_ID(hw), 0,
"%s: end of stream, num %d(%d)\n",
diff --git a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
index 0bb416c..6d27c7d 100644
--- a/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
+++ b/drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
@@ -1398,9 +1398,9 @@ static int notify_v4l_eos(struct vdec_s *vdec)
struct aml_vcodec_ctx *ctx = (struct aml_vcodec_ctx *)(hw->v4l2_ctx);
struct vframe_s *vf = NULL;
struct vdec_v4l2_buffer *fb = NULL;
- int index;
+ int index = -1;
- if (hw->is_used_v4l && hw->eos) {
+ if (hw->eos) {
if (kfifo_get(&hw->newframe_q, &vf) == 0 || vf == NULL) {
mmpeg4_debug_print(DECODE_ID(hw), PRINT_FLAG_ERROR,
"%s fatal error, no available buffer slot.\n",
@@ -1408,12 +1408,13 @@ static int notify_v4l_eos(struct vdec_s *vdec)
return -1;
}
- index = find_free_buffer(hw);
-
- if ((index == -1) &&
- vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
- pr_err("[%d] get fb fail.\n", ctx->id);
- return -1;
+ if (hw->is_used_v4l) {
+ index = find_free_buffer(hw);
+ if ((index == -1) &&
+ vdec_v4l_get_buffer(hw->v4l2_ctx, &fb)) {
+ pr_err("[%d] get fb fail.\n", ctx->id);
+ return -1;
+ }
}
vf->type |= VIDTYPE_V4L_EOS;
@@ -1426,7 +1427,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] mpeg4 EOS notify.\n", ctx->id);
+ pr_info("[%d] mpeg4 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -1486,9 +1487,7 @@ static void vmpeg4_work(struct work_struct *work)
hw->chunk = NULL;
vdec_clean_input(vdec);
flush_output(hw);
-
- if (hw->is_used_v4l)
- notify_v4l_eos(vdec);
+ notify_v4l_eos(vdec);
mmpeg4_debug_print(DECODE_ID(hw), 0,
"%s: eos flushed, frame_num %d\n",
diff --git a/drivers/frame_provider/decoder/vav1/vav1.c b/drivers/frame_provider/decoder/vav1/vav1.c
index 4a8e2eb..41caa45 100644
--- a/drivers/frame_provider/decoder/vav1/vav1.c
+++ b/drivers/frame_provider/decoder/vav1/vav1.c
@@ -6306,18 +6306,20 @@ static int notify_v4l_eos(struct vdec_s *vdec)
int index = INVALID_IDX;
ulong expires;
- if (hw->is_used_v4l && hw->eos) {
- expires = jiffies + msecs_to_jiffies(2000);
- while (INVALID_IDX == (index = v4l_get_free_fb(hw))) {
- if (time_after(jiffies, expires) ||
- v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
- break;
- }
+ if (hw->eos) {
+ if (hw->is_used_v4l) {
+ expires = jiffies + msecs_to_jiffies(2000);
+ while (INVALID_IDX == (index = v4l_get_free_fb(hw))) {
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
+ break;
+ }
- if (index == INVALID_IDX) {
- if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
- pr_err("[%d] EOS get free buff fail.\n", ctx->id);
- return -1;
+ if (index == INVALID_IDX) {
+ if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
+ pr_err("[%d] EOS get free buff fail.\n", ctx->id);
+ return -1;
+ }
}
}
@@ -6332,7 +6334,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
av1_print(hw, PRINT_FLAG_V4L_DETAIL,
- "[%d] AV1 EOS notify.\n", ctx->id);
+ "[%d] AV1 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -9485,8 +9487,7 @@ static void av1_work(struct work_struct *work)
hw->eos = 1;
av1_postproc(hw);
- if (hw->is_used_v4l)
- notify_v4l_eos(hw_to_vdec(hw));
+ notify_v4l_eos(hw_to_vdec(hw));
vdec_vframe_dirty(hw_to_vdec(hw), hw->chunk);
} else if (hw->dec_result == DEC_RESULT_FORCE_EXIT) {
diff --git a/drivers/frame_provider/decoder/vp9/vvp9.c b/drivers/frame_provider/decoder/vp9/vvp9.c
index 282bba7..2e0b5a7 100644
--- a/drivers/frame_provider/decoder/vp9/vvp9.c
+++ b/drivers/frame_provider/decoder/vp9/vvp9.c
@@ -7478,18 +7478,20 @@ static int notify_v4l_eos(struct vdec_s *vdec)
int index = INVALID_IDX;
ulong expires;
- if (hw->is_used_v4l && hw->eos) {
- expires = jiffies + msecs_to_jiffies(2000);
- while (INVALID_IDX == (index = v4l_get_free_fb(hw))) {
- if (time_after(jiffies, expires) ||
- v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
- break;
- }
+ if (hw->eos) {
+ if (hw->is_used_v4l) {
+ expires = jiffies + msecs_to_jiffies(2000);
+ while (INVALID_IDX == (index = v4l_get_free_fb(hw))) {
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
+ break;
+ }
- if (index == INVALID_IDX) {
- if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
- pr_err("[%d] EOS get free buff fail.\n", ctx->id);
- return -1;
+ if (index == INVALID_IDX) {
+ if (vdec_v4l_get_buffer(hw->v4l2_ctx, &fb) < 0) {
+ pr_err("[%d] EOS get free buff fail.\n", ctx->id);
+ return -1;
+ }
}
}
@@ -7503,7 +7505,7 @@ static int notify_v4l_eos(struct vdec_s *vdec)
vf_notify_receiver(vdec->vf_provider_name,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
- pr_info("[%d] VP9 EOS notify.\n", ctx->id);
+ pr_info("[%d] VP9 EOS notify.\n", (hw->is_used_v4l)?ctx->id:vdec->id);
}
return 0;
@@ -9984,8 +9986,7 @@ static void vp9_work(struct work_struct *work)
pbi->eos = 1;
vp9_bufmgr_postproc(pbi);
- if (pbi->is_used_v4l)
- notify_v4l_eos(hw_to_vdec(pbi));
+ notify_v4l_eos(hw_to_vdec(pbi));
vdec_vframe_dirty(hw_to_vdec(pbi), pbi->chunk);
} else if (pbi->dec_result == DEC_RESULT_FORCE_EXIT) {