From: shihong.zheng Date: Tue, 24 Nov 2020 09:11:27 +0000 (+0800) Subject: hevc: remove first packet offset for hevc. [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e75f31835a33879ce0ef2b22f29ff18acc342985;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git hevc: remove first packet offset for hevc. [1/1] PD#SWPL-37489 Problem: hevc picture stream offset is not based on streambuf start. it get from shiftbyte count. so it's wrong to add first wp. Solution: remove first packet offset for hevc. Verify: ah212 Change-Id: I51e4fa9a1f8e41fcddfa02531ead11124a9cfccf Signed-off-by: shihong.zheng --- diff --git a/drivers/frame_provider/decoder/utils/vdec.c b/drivers/frame_provider/decoder/utils/vdec.c index a096e30..d8c2c11 100644 --- a/drivers/frame_provider/decoder/utils/vdec.c +++ b/drivers/frame_provider/decoder/utils/vdec.c @@ -1638,12 +1638,9 @@ int vdec_prepare_input(struct vdec_s *vdec, struct vframe_chunk_s **p) } } 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 + if (vdec->vbuf.ext_buf_addr) + first_set_rp = STBUF_READ(&vdec->vbuf, get_rp); + else first_set_rp = input->start; if (input->target == VDEC_INPUT_TARGET_VLD) { diff --git a/drivers/stream_input/amports/stream_buffer_base.c b/drivers/stream_input/amports/stream_buffer_base.c index bc6560a..a7e5259 100644 --- a/drivers/stream_input/amports/stream_buffer_base.c +++ b/drivers/stream_input/amports/stream_buffer_base.c @@ -135,16 +135,32 @@ void stream_buffer_meta_write(struct stream_buf_s *stbuf, (wp == stbuf->ext_buf_addr) && (meta->stbuf_pktaddr > stbuf->ext_buf_addr)) { struct vdec_s *vdec = container_of(stbuf, struct vdec_s, vbuf); + u32 first_ptr; + u32 round_down_size = 0; + + /*RP max alignment requirement*/ + if (vdec->input.target == VDEC_INPUT_TARGET_HEVC) + round_down_size = 0x80; + else if (vdec->input.target == VDEC_INPUT_TARGET_VLD) + round_down_size = 0x100; + + if (stbuf->ext_buf_addr > (meta->stbuf_pktaddr - round_down_size)) + first_ptr = stbuf->ext_buf_addr; + else { + first_ptr = round_down(meta->stbuf_pktaddr, round_down_size); + pr_info("warn: first packet_wp(%x round_down %x) is not stbuf start addr(%lx)\n", + meta->stbuf_pktaddr, first_ptr, stbuf->ext_buf_addr); + } - pr_info("warn: first packet_wp(%x) is not stbuf start addr(%lx)\n", - meta->stbuf_pktaddr, stbuf->ext_buf_addr); - - stbuf->ops->set_wp(stbuf, meta->stbuf_pktaddr); - stbuf->ops->set_rp(stbuf, meta->stbuf_pktaddr); - vdec->input.swap_rp = meta->stbuf_pktaddr; + stbuf->ops->set_wp(stbuf, first_ptr); + stbuf->ops->set_rp(stbuf, first_ptr); + vdec->input.swap_rp = first_ptr; if (vdec->slave) - vdec->slave->input.swap_rp = meta->stbuf_pktaddr; - stbuf->stream_offset += (meta->stbuf_pktaddr - stbuf->ext_buf_addr); + vdec->slave->input.swap_rp = first_ptr; + if (vdec->input.target != VDEC_INPUT_TARGET_HEVC) + stbuf->stream_offset += (meta->stbuf_pktaddr - stbuf->ext_buf_addr); + else + stbuf->stream_offset += (meta->stbuf_pktaddr - first_ptr); } if (meta->stbuf_pktaddr + meta->stbuf_pktsize < stbuf->buf_start + stbuf->buf_size) @@ -159,7 +175,6 @@ void stream_buffer_meta_write(struct stream_buf_s *stbuf, 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);