Commit graph

198 commits

Author SHA1 Message Date
Herman Chen
288bf1e5aa [mpp_dec]: Fix error on last empty eos frame
When last stream packet is send with eos flag but without valid task or
not output is set just output an empty eos frame.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I18a4ea004479820d4dcfe30aa75d935b15a188cf
2020-02-27 15:37:42 +08:00
Xingwen Fang
736f6199b5 [mpp]: use mpp_list to store timestamps
MppQueue does not support concurrent access, and there
are defect in the design, which need to be improved in
the future.

Signed-off-by: Xingwen Fang <fxw@rock-chips.com>
Change-Id: I50db4bcf520bbf4115c6f40d7a759652087965ec
2019-12-23 14:28:43 +08:00
Chen Jinsen
fdc8ef19cb [mpp]: Fix output slot index assertion failure while get parse error
Change-Id: I06a9897bad7edbcd96b171faaecdab38a08d46eb
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
2019-11-10 10:10:54 +08:00
Herman Chen
585b187b18 [misc]: Use MppDeviceId to replace HalDeviceId
Change-Id: I3fd2f6a673f4f8d05420bfccb78e8b103f2ca26d
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-10-14 17:18:13 +08:00
Herman Chen
6cf33e998b [mpp]: Remove extra signal and thread in mpp
1. Only use notify to communicated between mpp and codec.
2. Remove mpp_enc_impl.h

Change-Id: Ia62757240efa7d245b5215ad79539fa9bbbd1550
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-09-20 15:57:17 +08:00
Herman Chen
5271f581cd [mpp_dec]: Change mjpeg decoder loop flow
Change-Id: Ifa8577f2490df3eb31e410caaada1eb333119819
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-09-19 18:07:54 +08:00
Herman Chen
205ba6dc31 [mpp_dec]: Move thread into MppDec
Change-Id: Ifab2773a1aa5405ffeb155ce8fd8e5f21e5a6b45
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-09-19 17:46:58 +08:00
Herman Chen
14076644ea [mpp_dec]: Add MppDecImpl layer
Add MppDecImpl layer for separate encoder and decoder.

Change-Id: I02e04acddf617ae5188572af89312ab20fbf21b6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-09-19 14:54:24 +08:00
Herman Chen
003f8806af [vproc]: Pass HalTask between hal and vproc
Use HalTask to communicate between hal thread and vproc thread.

Change-Id: I4e87b7ca63bdf86e46045e31296ffa69958ae719
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-08-19 15:02:13 +08:00
Herman Chen
cd9a1cca3f [misc]: Change interface header file dependency
Move MppCtx, MppParam, MppFrame, MppPacket, MppBuffer, MppBufferGroup,
MppTask and MppMeta to rk_type.h.

Later development need to bring in cross reference between these
objects. So we choose to move these declaration together.

Change-Id: I7ea39138ca87d6ca4cb86556464a5de89d172846
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-06-14 10:15:12 +08:00
Johnson Ding
a711528671 [dec]: fix info_changed property setting error
After info_change is encountered by paser thread, HalDecTaskFlag will
have info_change flag set. Although mpp_dec_flush is called there may be
some frame still remaining in display queue and waiting to be output. So
these frames shouldn't have info_change set since their resolution and
bit depth are the same as before. What's more, the info_change flag has
nothing to do with frames need to be output.

Change-Id: Ia01d1ecca5a6deb1a5d2914c34147d5c46c21684
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-05-30 11:46:14 +08:00
Rimon Xu
35019b7d37 [mpp_dec]: Add wait condition with buffer mismatch.
When the buffer does not match, frame group needs to modify
the buffer size before it can be used properly, so it needs
to wake up the wait.dec_buf_match condition after info changed
ready.

Change-Id: I3ef7b2bf59d7649cf0e05731a2e51f40fd082535
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2019-04-01 11:37:55 +08:00
Herman Chen
fecf31621c [vproc]: Add iep open check to avoid noisy log
Change-Id: I2d2aa49ce4ba9fe2b80dd72b60c286ffd2115195
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-03-19 16:00:07 +08:00
Herman Chen
056e17df92 [hal_jpegd]: Improve address setup
1. Use mpp_device_patch_add to setup address offset patch
2. Disable slot size check in mpp_dec

Change-Id: Id3c8d94b793cf126040f627c5c67ed0390f0ac86
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-01-21 09:56:13 +08:00
Herman Chen
e350315c34 [mpp_dec]: Fix eos on info change
Eos should not go alone with info change flag.
If input stream is only 1 frame and require info change decoder will
create a info change with eos flag which will cause buf_slot dump log
like this: "can not clr queue_use on slot"

This patch clears eos flag on creating info change task to hal thread.

Change-Id: Ibbb92155ec1d7d0d406c781ebaaa81a98a2fc893
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-12-10 16:21:36 +08:00
Herman Chen
e2b49ac9d4 [mpp_dec]: Fix stuck issue on field source seek
When there is hal_task on PROC_DONE status on reset the reset process
should set these tasks to IDLE status.

Change-Id: I8a9e25fb98e597e22b9b99a6d13f84a4a0e59e3b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-11-19 10:37:34 +08:00
Herman Chen
b9dda0fb95 [mpp_dec]: improve reset process
Use semaphore to protect reset process.

Change-Id: I29b7bb009e38fe3be000663f32748ff7cd3d081f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-24 14:23:50 +08:00
Herman Chen
1a388b0a94 [mpp_dec]: Fix error on random reset call
When decoding is not finish (eos) and user call reset the hal thread
may not clear all the reference frame used in decoder and not clear
frame in display queue. There will be memory leak on this case.

This patch fix this error when user randomly call reset funciton on
decoding by flushing decoder and clearing display queue.

Change-Id: I68a12bd8cfb94a4d56d652a11695ef69f2a78825
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-10-22 15:41:08 +08:00
Ding Wei
93824dc713 [hal_task]: add ref_err flag, use parse_err instead of had_error
tips:
a) when parse syntax error, enable parse_err;
b) when dpb ref error, enable ref_err;
c) when use disable err, only disable ref_err, parse_err cannot.
above all, using these flags, when  parse error, it also can
go ahead to hal thread, and loop all.

Change-Id: I639248dbf4499a8ed473b9f44f1e1332409c5c22
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-21 09:03:12 +08:00
Herman Chen
b018b31a23 [mpp_dec]: Fix handwriting error
This handwriting error will cause larger memory usage when decoder is
too fast.

Change-Id: Iea93fcfd265d81c43206499a09d682da2b6231a1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-20 17:08:04 +08:00
Herman Chen
d2b06f4aa9 [mpp_dec]: Add mpp_dec stage timing statistics
Change-Id: Ib9f8558ea59811caab906fc408dda62854bb8c52
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-07-27 14:46:12 +08:00
Herman Chen
66ff6456b2 [mpp_dec]: Optimize mpp_dec condition wait
Optimize mpp_dec parser thread wait mechanism to reduce cpu overload.

1. Add mpp signal notify flag
2. Add mpp_dec wait status flag
3. Compare the notify flag with wait status flag. When there wait
condition is fulfilled then signal parser thread to process.

This will greatly reduce cpu overload by block wake up with no sense.

Change-Id: I38da718e80d0487e0300e807bc87cdb1aa070471
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-07-27 14:24:58 +08:00
Randy Li
a90f562b39 [mpp]: clear the frame buffers after dec reset
The decoder reset function would push all the reminded
buffers into output queue. It is not necessary and
useless.

A reset order means the application want to be back
to the origin. So we must remove the references
from decoder after a resettting.

Change-Id: Ic4ec5410606ffc815cd6c29e84735a3909b27f62
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2018-07-18 09:38:53 +08:00
Ding Wei
e8d47b6cc8 [mpp_dec]: updated: only when fast_mode, using wait.dec_all_done
tips: when not fast_mode, both wait.dec_all_done and wait.prev_task
are used.

Change-Id: I7397fe1e60cca4a7518d1d4859c4dad554a7b938
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-07-03 14:05:29 +08:00
Ding Wei
13fdedf1fd [mpp_dec]: update control cmd for disable_errinfo
Change-Id: I18a5656cace415654e7becf4e3ae60a5e84a85d8
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-06-27 11:59:00 +08:00
ywj
1bd81bcb53 [mpp_dec]: Fix memory leak on eos
when video quit or eos, mpp allocate a fake frame but not free.

Change-Id: I3079953ed44c578b6ec7e4fac135039eb00140ad
Signed-off-by: ywj <ywj@rock-chips.com>
2018-06-20 14:31:33 +08:00
Ding Wei
9fc96267a5 [vp9d]: add fast mode for parser
tips: when counts need update, then parser thread wait for hal
thread done, and reset wait flag.

Change-Id: I852c76b672f78e37c3dfdad7761b3b23511ec5ee
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-06-15 17:55:54 +08:00
Herman Chen
982f23b44d [mpp_dec]: Fix dead loop on output frame block
When output frame is not get_frame by user immediately the parser thread
will be stuck in a dead loop can cause high cpu usage.

Thanks to mo123's reporting here:
https://forum.libreelec.tv/thread/12151-feedback-for-test-build-libreelec-rk3328-arm-9-0-devel-box-trn9-img/?postID=93519#post93519

Change-Id: If4209e3cf2d329872f05554282e65f4fdce0f3c9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-06-08 10:40:20 +08:00
Herman Chen
7d74efafc3 [mpp_dec]: Fix crash on reset at info change
When paser thread generate a info change task then user call reset
operation right before hal thread receive this info change task. This
task will be released and hal thread will get a invalid buf_slot.

The patch bring in the async reset / sync reset done mechanism:
User can call reset at anytime. So it is a async reset.
Then parser / hal / vproc thread need to finish all reset operation
before process next loop.
This means decoder thread need to sync at the reset done point.
It will keep reset operation save and clear.

Change-Id: Ia8482fd09d84e5fa6a096f2740ed1319d4cf79a5
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-06-05 15:10:39 +08:00
Herman Chen
35aee9221a [misc]: Add extra log
Add extra log to mpp_dec and vpu_mem_legacy

Change-Id: I27599077093a34a70aa7c590034f100fdc32416b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-06-05 15:10:39 +08:00
Herman Chen
44f0ee0353 [mpp_dec]: Add post-process path to mpp_dec
1. Unify the hal thread output process to mpp_dec_put_frame
2. Add vproc path for field source.
3. Reserve one more buffer when deinterlace is enabled.
4. Default enable for normal mpp path but disable on vpuapi path for the
reason that rk_ffplayer has done deinterlace process internally.

Change-Id: I02e7cece844fde01c2d249dafe6f7ce6a325593f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-06-05 15:10:39 +08:00
Ding Wei
ceb00a4361 [mpp_dec]: adjust decode order: check task before infochange
tips: when task is not valid, and width and height is wrong,
then infochange will be tripper, which is unnecessary.

Change-Id: I45c4ee75a8d1e2928995be0562f032fabe8c95cb
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-06-05 08:48:15 +08:00
Ding Wei
a386893d74 [mpp]: update improble count for mPacketGetCount
Change-Id: If87420cdedea0bc26bcc21c52619d515a2749718
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-05-31 09:28:44 +08:00
Herman Chen
2098ea9de1 [Thread]: Rename thread lock / signal type
Rename thread lock / signal type by its source.

Change-Id: I426cb9490dd05183badffa36f0a861c439c5f23b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-14 14:49:59 +08:00
Herman Chen
dec3c10b1f [base]: Add more queue status to MppBufSlot
Add more function to MppBufSlot:
1. Add used / unused count for querying with corresponding log.
2. Add more queue (deinterlace / color convertion)
3. Add MppFrame generation for slot index.
4. Add post process flag for field image.

Change-Id: I2666d026fc19816d2e32547604228f2a3747211f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-14 14:49:59 +08:00
Herman Chen
331c93682d [mpp_dec]: Fix crash error of rkffplayer control
rkffplayer send MPP_DEC_SET_PRESENT_TIME_ORDER command with NULL
parameter. We need to support NULL parameter.

Change-Id: I0f75810324546bbce24e19daf5eff6e26bd164d8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-11 18:21:23 +08:00
Herman Chen
01c79e3d05 [mpp_dec]: Fix minor error
Fix some small error.

Change-Id: Ifb696fac9138eca67d34cffe835fb28c6089c0c8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-10 16:07:10 +08:00
Herman Chen
c1a44d762a [mpp_dec]: Simplify code
Simplify task sending code in mpp_dec.
Add task put/get count check.

Change-Id: Icd7fdeca90604d6d5c278f5ca983ee5b38caee7a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-10 16:01:00 +08:00
Ding Wei
2f5bd0bffb [mpp_dec]: add control to set present time order
tips: when input timestamp has not pts, and set pts=dts,
it should use input timestamp order for output.

Change-Id: I8b3ef9a8d150e5729a3fa94df6c1b448edb8f1fd
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-04-27 17:20:33 +08:00
Herman Chen
1a795b05aa [mpp_dec]: Fix mpp_frame memory leak on reset
When push display mpp_frame will generate a new copy. If it found a
reset flag the whole mpp_frame should be free rather than only
mpp_buffer in the mpp_frame.

Change-Id: I4b784e668167ef9be06a9dd1a02e860a7654a021
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-01-18 09:20:40 +08:00
Ding Wei
9dec5cd14e [mpp_dec]: add flag about display queue whether full
tips: when decode too fast then display queue is full,
that should wait until frame displayed.

Change-Id: Ic8ec18368fdb956cad92b0760a3d4637e46f55bf
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-01-05 08:50:59 +08:00
Ding Wei
55c070ee00 [h264d]: fix frame eos
tips:
a) when eos is empty frame, direct flush and return.
b) when last frame has eos, then decode it and flush.
c) mpp_put_frame must check frame slot whether empty.
d) when eos_frame decode error, mark error in eos_frame

Change-Id: Ia78445b2e568195f411b2f339469f4097e83b570
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-01-02 18:45:05 +08:00
Ding Wei
c6594ae192 [mpi_cmd]: add disable error command
1. Disable error default is not set for normal error detection.
2. On special case like drone streaming the user prefers to ignore
all error and continue decoding. Then disable error flag will be set
to fullfill this requirement.
3. When disable error flag is set H.264/H.265 decoding will ignore
hardware error and mark all output frame as no error.

Signed-off-by: Ding Wei <leo.ding@rock-chips.com>

Change-Id: I8fd619511c53ee744ae973ab3fe015565106dd37
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2017-12-22 11:44:33 +08:00
Randy Li
50bdc4de6a [mpp]: turn off a lots of message
I think those information are very anxious and useless
in daily usage.

Change-Id: I946418a476a332588b1d9b9722bbd5e93213e8dc
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-11-30 11:32:17 +08:00
Randy Li
5de9a6e299 [mpp]: use the blokcing queue on the input
The MppQueue offers an atomic signal mechanism on
the pending data. It could solve the the async problem
with parser thread and input data.

Change-Id: I8201640b28b1d2b4d2186e1bcfbf018bf8f97d32
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-11-20 11:55:51 +08:00
leo.ding
28bdc96b2d [vpu_api_legacy]: disprese MPP_DEC_SET_FRAME_INFO function to
each codec.

Change-Id: I5ac177fbaba6e81db53c7d162a1d81ba3e00c2e4
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-09-06 10:08:31 +08:00
Randy Li
c8394f0203 [mpp]: fixup for the deadlock in decoding
When the input stream is full, it may happen:
1. Both mTheadHal(hal) and mThreadCodec(parser) is waiting
 a signal;
2. The previous task is not ready in parser;
3. A task is in idle and the other is done is the tasks group.

If the parser has finished the checking on the task is done but
has not enter into wait condition state yet, then the hal thread
can't wake the parser later.

Change-Id: I3b30e40bc1de7c5ca6d401084929cfd57ca00546
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-08-03 16:21:34 +08:00
Randy Li
e6ade9b712 [mpp_dec]: remove obsoleted code and format comments
It would be more easy to look into those code next time.

The functions in mpp_time.c have removed the internal debug
flag checking.

Change-Id: I6392190896f74e86a8407f06fa3621dd92371e56
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-08-03 16:21:13 +08:00
Herman Chen
9c7b9efe74 [misc]: Remove source code executable attribute
Change-Id: I1bf4ec5782e30869e971e4c27ef50285d4382233
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-06-06 08:48:50 +08:00
ZhouJing
4c5a22f048 [mpp_parser]: rename the functions of mpp_parser
It will cause conflicts with the gb28181 protocol

Change-Id: Ia4c24c528c88caa3e6f7c1ad20ef309607e04794
Signed-off-by: ZhouJing <tracy.zhou@rock-chips.com>
2017-04-20 08:47:41 +08:00