set_vframe_pts(hw, decode_pic_count, vf);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = offset;
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) & 0xffffffff00000000) | offset;
vf->pts = 0;
}
set_vframe_pts(hw, decode_pic_count, vf);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = offset;
+ vf->pts_us64 = (u64)-1;
vf->pts = 0;
}
debug_print(hw, PRINT_FLAG_PTS,
set_vframe_pts(hw, decode_pic_count, vf);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = offset;
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) & 0xffffffff00000000) | offset;
vf->pts = 0;
}
vdec_vframe_ready(hw_to_vdec(hw), vf);
vf->sar_width = hw->width_aspect_ratio;
vf->sar_height = hw->height_aspect_ratio;
if (!vdec->vbuf.use_ptsserv && vdec_stream_based(vdec)) {
- vf->pts_us64 = frame->offset_delimiter;
- vf->pts = 0;
+ /* offset for tsplayer pts lookup */
+ if (i == 0) {
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) &
+ 0xffffffff00000000) | frame->offset_delimiter;
+ vf->pts = 0;
+ } else {
+ vf->pts_us64 = (u64)-1;
+ vf->pts = 0;
+ }
}
kfifo_put(&hw->display_q, (const struct vframe_s *)vf);
ATRACE_COUNTER(MODULE_NAME, vf->pts);
decoder_bmmu_box_get_mem_handle(
hw->mm_blk_handle, index);
if (!vdec->vbuf.use_ptsserv && vdec_stream_based(vdec)) {
- vf->pts_us64 = pic->offset;
- vf->pts = 0;
+ /* offset for tsplayer pts lookup */
+ if (i == 0) {
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) &
+ 0xffffffff00000000) | pic->offset;
+ vf->pts = 0;
+ } else {
+ vf->pts_us64 = (u64)-1;
+ vf->pts = 0;
+ }
}
kfifo_put(&hw->display_q,
(const struct vframe_s *)vf);
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = pic->offset;
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) &
+ 0xffffffff00000000) | pic->offset;
vf->pts = 0;
}
if (((hw->first_i_frame_ready == 0) || pb_skip)
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = pic->offset;
+ vf->pts_us64 = (u64)-1;
vf->pts = 0;
}
vf->pts, vf->pts_us64, vf->width, vf->height, vf->duration);
if (vdec_stream_based(vdec) && (!vdec->vbuf.use_ptsserv)) {
- vf->pts_us64 = pic->offset;
+ vf->pts_us64 =
+ (((u64)vf->duration << 32) &
+ 0xffffffff00000000) | pic->offset;
vf->pts = 0;
}
} else {
/* stream based */
- u32 rp = 0, wp = 0, fifo_len = 0;
+ u32 rp = 0, wp = 0, fifo_len = 0, first_set_rp = 0;
int size;
bool swap_valid = input->swap_valid;
unsigned long swap_page_phys = input->swap_page_phys;
}
} else {
+ if (vdec->vbuf.ext_buf_addr) {
+ first_set_rp =
+ STBUF_READ(&vdec->vbuf, get_rp);
+ first_set_rp =
+ round_down(first_set_rp, VDEC_FIFO_ALIGN);
+ } else
+ first_set_rp = input->start;
+
if (input->target == VDEC_INPUT_TARGET_VLD) {
WRITE_VREG(VLD_MEM_VIFIFO_START_PTR,
input->start);
WRITE_VREG(VLD_MEM_VIFIFO_END_PTR,
input->start + input->size - 8);
WRITE_VREG(VLD_MEM_VIFIFO_CURR_PTR,
- input->start);
+ first_set_rp);
WRITE_VREG(VLD_MEM_VIFIFO_CONTROL, 1);
WRITE_VREG(VLD_MEM_VIFIFO_CONTROL, 0);
/* set to manual mode */
WRITE_VREG(VLD_MEM_VIFIFO_BUF_CNTL, 2);
- WRITE_VREG(VLD_MEM_VIFIFO_RP, input->start);
+ WRITE_VREG(VLD_MEM_VIFIFO_RP, first_set_rp);
WRITE_VREG(VLD_MEM_VIFIFO_WP,
STBUF_READ(&vdec->vbuf, get_wp));
rp = READ_VREG(VLD_MEM_VIFIFO_RP);
WRITE_VREG(HEVC_STREAM_END_ADDR,
input->start + input->size);
WRITE_VREG(HEVC_STREAM_RD_PTR,
- input->start);
+ first_set_rp);
WRITE_VREG(HEVC_STREAM_WR_PTR,
STBUF_READ(&vdec->vbuf, get_wp));
rp = READ_VREG(HEVC_STREAM_RD_PTR);
if ((stbuf->stream_offset == 0) &&
(wp == stbuf->ext_buf_addr) &&
(meta->stbuf_pktaddr > stbuf->ext_buf_addr)) {
- struct stream_buffer_metainfo self_meta;
+ struct vdec_s *vdec = container_of(stbuf, struct vdec_s, vbuf);
pr_info("warn: first packet_wp(%x) is not stbuf start addr(%lx)\n",
meta->stbuf_pktaddr, stbuf->ext_buf_addr);
- self_meta.stbuf_pktaddr = stbuf->ext_buf_addr;
- self_meta.stbuf_pktsize = meta->stbuf_pktaddr - stbuf->ext_buf_addr;
- stream_buffer_meta_write(stbuf, &self_meta);
+ stbuf->ops->set_wp(stbuf, meta->stbuf_pktaddr);
+ stbuf->ops->set_rp(stbuf, meta->stbuf_pktaddr);
+ vdec->input.swap_rp = meta->stbuf_pktaddr;
+ if (vdec->slave)
+ vdec->slave->input.swap_rp = meta->stbuf_pktaddr;
+ stbuf->stream_offset += (meta->stbuf_pktaddr - stbuf->ext_buf_addr);
}
if (meta->stbuf_pktaddr + meta->stbuf_pktsize < stbuf->buf_start + stbuf->buf_size)
pr_debug("%s, update wp 0x%x + sz 0x%x --> 0x%x, stream_offset 0x%x\n",
__func__, meta->stbuf_pktaddr, meta->stbuf_pktsize, wp, stbuf->stream_offset);
*/
+
}
EXPORT_SYMBOL(stream_buffer_meta_write);