Commit Graph

223 Commits

Author SHA1 Message Date
Herman Chen
6cc2ef5f75 [mpp_list]: Add list_mode and list_move_tail
Change-Id: I7be6f69a073eeedef1b0d9ff7e9a47b48df8a8fa
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-09-17 11:11:43 +08:00
Herman Chen
16ce9d1f6b [mpp_server]: Add mpp_server module for batch mode
Batch mode will send multiple task to kernel at one time. And its
non-block poll is triggered by timer and looper.

This mode will reduce the ioctl overhead on ultra multi-instance case.

Main features and some notes:
1. Each client type has independence batch server.
2. Each mpp_device can attach or not attach to server independently.
3. When a device is attached to server all its tasks will be sent to
kernel through the server session not original client session.
4. The tasks are sent non-block and wait in block or non-block.
5. The batch mode can only be switch on/off when hardware is not
working.

Change-Id: I07462d852cb002259d2873e13c12f6f8a489ba8e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-04 09:02:30 +08:00
Herman Chen
b6c914a74d [osal]: Add osal_2str function
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I4f97a0938baa5d62c405f79c326a18b3ff6478f0
2021-06-03 10:26:06 +08:00
Herman Chen
bbae9e98a7 [mpp_thread]: Add broadcast function
Change-Id: I33ad9e3b3a657f21d23dfd6f04abd864b4a883d6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-17 11:26:50 +08:00
Herman Chen
53a5653cc8 [mpp_list]: Update C macro
Change-Id: I05813bdc0f6047617d10654579949226900b781f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-17 11:26:50 +08:00
Herman Chen
d1366a4801 [mpp_mem_pool]: Move mpp_mem_pool to osal
Change-Id: I124f38bc58f791993515544af2c59169ee2c2402
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-12 20:47:36 +08:00
sayon.chen
891a416961 [mpp_thread]: Rewrite Autolock function
Add extra flag to disable Autolock

Change-Id: Ibbaf4b7a011f830728401facd49ac30ab0c7c9ad
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-05-11 10:00:33 +08:00
Herman Chen
f86fcc7663 [osal]: Add mpp_trace using ftrace
Change-Id: I6c6597d722f574524f1b993a18f6cd868b20fbab
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-10 09:15:41 +08:00
Yandong Lin
ed69e9077f [mpp_mem_pool]: Add common module MppMemPool
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Id778f4395f457a773812db78164ecad4038b2ff4
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-01 16:27:00 +08:00
Herman Chen
f026a238de [osal]: Add hash table implement
Change-Id: I190282e2236797f1b452176a82e72117b93cd64f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-04-21 14:39:38 +08:00
Herman Chen
a91439bef4 [mpp_buffer]: Add mem and buffer usage function
Change-Id: I356ef9311802868fe8d234dbff178ad8463985d0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-04-20 14:39:52 +08:00
Yandong Lin
5be47f31f0 [hal_vdpu]: Support fd and offset to be set separately
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I38214c5d692fce76b60fe71536fab9863605e64e
2021-03-05 14:22:35 +08:00
Ding Wei
27a8f219d3 [mpp_service]: add msg flag for offset alone
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Change-Id: Ifba9f4da888e2229e3c36b7f6de0d35be4179e95
2021-03-03 13:46:27 +08:00
Herman Chen
4ecb7de25c [mpp_platform]: Add kernel version detection
Change-Id: Id2110213daeaca606bafe288a6d4cd970c112d4f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-02-02 20:21:29 +08:00
Herman Chen
0ce3ed3048 [mpp_list]: Use class inheritance
Change-Id: I3ef33ca9bdcfea80a6c05a8c69db2d4938a5d0eb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-01-19 17:06:16 +08:00
Ding Wei
0d6a0e28d5 [mpp_device]: add MPP_DEV_RCB_INFO for rkvdec34x
Change-Id: I0fe59f27f74fdd6a5eafd91b91870fdbf1253e33
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2021-01-13 18:25:28 +08:00
Herman Chen
11aa95e52f [mpp_log]: Update mpp_log macro
Change-Id: I0e46e93a9a8fa0a7cb7a0e86cec1748503bddcfb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-17 16:07:28 +08:00
Herman Chen
5f26c80d95 [hal_dec]: Remove old MppDeviceId
Change-Id: I8285a3f998bb3360dce4c71d0108411dd8bc6f21
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-08 19:42:53 +08:00
Herman Chen
c106a5bdd0 [mpp_soc]: Add mpp_soc with more detail feature
1. Add soc definition structure to replace old one.
2. Use mpp_soc.h to replace soc detection in mpp_platform.h.
3. Add vcodec_type to each device definition.
4. Add check on soc info init.

Change-Id: Iecc44bd79e6fd09c58afbc1b5c526ecf31acc663
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-08 19:42:53 +08:00
Herman Chen
3be3d97054 [mpp_device]: Add regs offset helper function
This helper function is for address register setup its offset.

When offset is less than 4M (20bit) the offset and buffer fd (10bit) can
be filled in 32bit word.

When offset is larger than 4M the full offset should be sent by ioctl
MPP_DEV_REG_OFFSET.

Change-Id: I5f59f3c941e41cf85fa2ab8895d2a177f4412e64
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-08 17:48:09 +08:00
Herman Chen
2f2e4224b9 [mpp_platform]: Move codec_type detection
1. Move codec_type detection code to vcodec_service.
   Only vcodec_service needs to detect vcodec_type. Mpp_service will
   report this flag from kernel.

2. Remove kernel device detection code when soc type not detected.

3. Add mpp_soc.h for soc definition.

Change-Id: Ic83897bddbcf0fceb0c5d19a05491f75231092c1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-25 15:11:28 +08:00
Herman Chen
9956bdb1ac [mpp_service]: Add mpp_service device detection
Change-Id: Ie63d0dc9964801b1f85b3d0e289c84f89798ffb1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-25 14:11:49 +08:00
Herman Chen
5967c22284 [mpp_platform]: Add rk3566/rk3568 SOC definition
Change-Id: Ia1972cb95d5497cf95daab46504cfea9522b79e7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-10 14:19:41 +08:00
Herman Chen
ce7101f88c [mpp_device]: Add mpp_device_debug and set_info
1. Add mpp_device_debug.h
2. Add set_info handler in mpp_service.

Change-Id: I1ec83feadd4df79d5934182a35e0ed66f0f831ac
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-06 17:58:20 +08:00
Herman Chen
af6938b235 [mpp_device]: Move mpp_device to osal
Change-Id: Ia196f01945d47c24e821da8935f3694834afa839
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-06 11:47:53 +08:00
Herman Chen
3f8e880a39 [hal]: Use new mpp_device interface in hal
Switch all hal module to new api.

Change-Id: I066da7e06c999a01b80ee193365c5752e9bb19aa
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-06 11:47:53 +08:00
Herman Chen
44443dd7ee [mpp_device]: Add new mpp_device for kernel driver
1. Change mpp_device into a new layer for kernel drvier.
2. Separate mpp_service driver and vcodec_service driver.
3. Add mpp_service.c for /dev/mpp_service driver support.
4. Add global mpp_service info query interface.
5. Remove unused function in mpp_device.c

Change-Id: I3f53bba3aef525ad3b1f450bb55830d1eeaf29a6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-03 16:09:19 +08:00
Herman Chen
b845d7740d [mpp_device]: Fix cmd_butt check error
Change-Id: I247bb3573812903c6bc478cdad17c9e21f515104
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-10-28 15:41:41 +08:00
Herman Chen
6d2128f9f7 [mpp_device]: Separate kernel interface define
Move vcodec_service and mpp_service kernel ioctl interface definition
into different headers.

Change-Id: I1aa77d1073e7c51b48d18cf8d16fd76644d23d38
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-10-28 15:20:06 +08:00
Herman Chen
96e86a6f19 [mpp_time]: Add stopwatch for object timing trace
Work flow and usage:
1. mpp_stopwatch_get
2. mpp_stopwatch_set_show_on_exit
3. mpp_stopwatch_record
   ...
   mpp_stopwatch_record
4. mpp_stopwatch_put    - (show timing here)

Change-Id: Ib07c925e6c27b94842507dba71992725b3ff5db8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-09-08 09:05:59 +08:00
Herman Chen
9e77264edc [oasl]: Add eventfd support
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I46614e90abb132111105720f1cc7d4e2ec71e8c3
2020-09-08 09:05:59 +08:00
Herman Chen
16047eb224 [mpp_time]: Add AUTO_TIMING for C++ function
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I1ec9f6307dce44f7aa086911477b27e523904cdc
2020-04-29 16:06:47 +08:00
Herman Chen
ed9d04e760 [mpp_time]: Add loop timer with callback
This function is mainly for frame rate statistic.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I1ab790bd655dc0945ad958d104ff178f4ffabdbe
2020-04-09 16:47:50 +08:00
Herman Chen
b83158b23b [mpp_time]: Change old timer to clock
The MppClock is used to record and sum the time only.
The MppTimer will have new implement.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I6cace6968d50db611e7493b69b14b46853070d78
2020-04-04 16:06:01 +08:00
Herman Chen
22aef2ccd3 [mpp_common]: Add container_of macro
Include <stddef.h> and add container_of macro.

Change-Id: Ie439b7683e026be9336e618c605b3b934e4fde38
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-03-12 15:53:18 +08:00
Herman Chen
e04f0e83e7 [mpp_platform]: Improve ioctl version detection
Move kernel ioctl api version detection to library loading stage.

Change-Id: If8ee750e1eaefb99924fd622d03270ef5032d1be
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-02-25 09:35:00 +08:00
Herman Chen
2797a44932 [mpp_list]: Add list_for_each_entry_reverse
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I0270f5d045434e1a7a9bd25fe35f2a75c1759f2a
2019-12-19 09:02:11 +08:00
Ding Wei
7d05e33de8 [mpp]: add /dev/mpp_service support
Add a new ioctl mode for kernel-4.19 or later.
Tips:
    1. There will be only one device /dev/mpp_service in kernel.
       User should use client type to distinguish different device.
    2. Each codec use the same function as before.
    3. Ioctl magic changes from VPU_IOC to MPP_IOC.
    4. Update structure for ioctl argument.
	Original structure:
	    data_ptr | size
	In this mode has many sortcommings:
	a) Need many ioctl cmd for different requirements.
	b) Data_ptr not to differ library for 32 or 64 system.
	c) Contain only one info ioctl once.

    New data structure:
        cmd_type | flags | size | offset | data_ptr
    a) Cmd_type works like previous ioctl cmd.
    b) Flags is extend to mark current data for any purpose.
    c) Size is the same as before.
    d) Data_ptr use 32 bits build in 32 system while 64 bits in 64 system.

kernel-4.19 related commit:
ib94ac0df876dfcc786b25ed3de6a68d861d2ef1e
cda9d27c62017309519bcbf8fe91057dfdc21076

Change-Id: I13d54a2e4823b7378265f100540916a22f62b9d4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2019-12-10 20:12:50 +08:00
Herman Chen
3a3e110de6 [mpp_platform]: Add device id definition
Change-Id: I108cfa3f4639517eed7ebaaaacf5f482002ea806
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-10-14 16:36:25 +08:00
Herman Chen
666782b834 [mpp_list]: Add fifo function to mpp_list
Add fifo access function to mpp_list class.
NOTE: The interface is different and node contain RK_S32 size data
before real data.

Change-Id: I8875312a7a6247b71be7df71044d2b779c228b0a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-08-19 15:02:13 +08:00
Herman Chen
d17861b67b [rk_mpi.h]: Separate rk_mpi_cmd.h into two headers
1. rk_mpi_cmd.h will contain cmd value only.
2. rk_venc_cmd.h will contain all the encoder command structure.
3. Move MppCtxType and MppCodingType to rk_type.h for better include
dependency.
4. Add MppEncRefCfg to MppEncCfgSet.
5. Remove rk_mpi.h dependency inside mpp.

Change-Id: I6b972738100fb60c0a6a9b7cfe0a012abf4205b7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2019-06-26 10:09:23 +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
sliver.chen
2dc830f071 [vp8e]: add vpu1 and vpu2 vp8e supprt.
commit a base version of vp8 encoder,include vpu1 and vpu2.
encode input raw picture to ivf stream.

Change-Id: I9ac697edf2249a4ca7464fdbfb5fd22a63fd3c34
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2019-02-01 18:26:26 +08:00
Herman Chen
496808002d [mpp_impl]: Add tid to dump file
1. User often use multi-instance decoder. The dump file name should has
some way to avoid overlap file operation.
Also an extra stream length config file is added for decoder. For
decoder issue reproducing should stay the same with the real user input
stream seperation.
2. Add mpp operation record file for issue reproduction.
3. ops format is similiar to Android time log.

Change-Id: I4b3702fcb4ae1601579762a6d1d7cadc10861759
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-30 15:35:31 +08:00
Ding Wei
fc1e2256b7 [mpeg4]: fix bug: add marco MPP_DIV for division
tips: in mpeg4,the divisor named time_pp is likely to be 0.

Change-Id: If9c055cb03139e819fe901009024e3ad4bbe79a5
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-08-30 08:58:33 +08:00
Ding Wei
76b8c229a2 [mpp]: move dump data from vpu_api_legacy to mpp
tips:
add MppDumpInfo for dump input and output.

Change-Id: Ia2416309e0e6b78671c073ae08409d907e3d0e85
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-06 09:10:28 +08:00
Herman Chen
6d059f65bf [osal]: Change mpp_env string interface
Set get environment string parameter to const char to avoid modification.

Change-Id: Ib5308407fcac2fa58b194fb8df33380efc1487f9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-03 17:44:55 +08:00
Herman Chen
26889a7bce [mpp_time]: Add MppTimer for time recording
Change-Id: I3d04e677415ae84bc37703cb63a52be66c973798
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-07-06 16:30:11 +08:00
Herman Chen
c71ed0cb96 [osal]: Make mpp_time_diff string to const char *
Change-Id: I20f3c65ccbea28bb01e1f739a1d31bf3c5ae936e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-07-02 17:29:15 +08:00
Herman Chen
bed754e33f [osal]: Use multiple status in MppThread
One thread May have multiple lock/wait/signal source:

Input  : signal source from input.
Output : signal source from output.
Control: signal source from async control operation.

Then the main working loop may stop on these lock/wait/signal points.

Change-Id: Ia6270b865cfb7087567fc21f07feb9248b929d7a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-28 09:48:35 +08:00