Commit Graph

402 Commits

Author SHA1 Message Date
Yandong Lin
d1fbc475fa [allocator_dma_heap]: fix compile err for linux/aarch64
Err notes:
    mpp/osal/allocator/allocator_dma_heap.c:26:27: fatal error:linux/dma-buf.h: No such file or directory

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib5f0aa77f36adfd3bea98ff16de8000a82f49720
2022-07-01 08:57:18 +08:00
xueman.ruan
9093217206 [mpp_service]: Remove extra ";"
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: I63bdaccd5e3b6318a69373e89f32da98acf1f331
2022-06-30 14:09:36 +08:00
Herman Chen
60f5fc234a [allocator]: Add dma_heap allocator
The dma_heap is introduced in kernel 5.10.

Change-Id: Id3c116d996da461467fe380a79434ba5ea875033
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-06-24 15:52:06 +08:00
Herman Chen
e2072abcb8 [drm]: Remove drm_fd_to_handle on import
Remove drm handle to reduce iova usage.

Change-Id: Ie5000cb594806c9c7cc97f8ff7e25a4ba61f721a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-06-23 09:25:16 +08:00
Herman Chen
811e468f5a [mpp_device]: Add last flag to PollCfg slice info
Change-Id: I262f6a032015e1ce7a05db3dc4db6d01e14d81a7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-06-02 08:44:30 +08:00
Jeffy Chen
0f0d28c2ec Fix compile errors with musl
Tested on RK3588 EVB with musl-1.2.2 and gcc-10.2.

Change-Id: I10574446f46964bad5e67ab45c76060a193b8335
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2022-05-26 11:19:59 +08:00
Herman Chen
2b35cee0ce [mpp_log]: Add more log helper function
1. Move mpp_log.h to inc for external user.
2. Add mpp_debug.h for mpp internal logging.
3. Fix some warning.
4. Add log level setup function.
5. Check env log_level value in mpp_get_log_level call.

NOTE:
1. mpp internal module should use mpp_debug.h and mpp external user
should use mpp_log.h
2. Use mpp_get_log_level to update mpp_log_level when the env changed.

Change-Id: I90a55a02a72db177533013280dfe111ca3479229
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-05-20 11:42:10 +08:00
Herman Chen
5d7a4724af [linux]: Add env detect for syslog flags
Change-Id: I70746562aee7131ef25a55db0cae3b7ad0c17164
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-05-12 11:32:24 +08:00
Herman Chen
da3fc7c4a8 [mpp_list]: Add more wait functions
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Icc8457ce1bff75eee7e5b8b8cc34360a339571a8
2022-04-29 09:52:22 +08:00
Herman Chen
f1324e29a2 [mpp_compat]: Add mpp compatible spec module
This module is for backward / forward compatiblity with external users.
1. Support compatible feature query.
2. Support update user program compatible feature update.

Change-Id: I7661f17c442eca0a0d0d57d2a35efdb5fd88be72
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-04-19 08:29:41 +08:00
Herman Chen
275705e088 [mpp_list]: Add wait function
NOTE: The wait function MUST be used with lock protection.

Change-Id: I14f48795d5833c9aedc311c56139775bf07f0e79
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-04-01 18:08:11 +08:00
Herman Chen
664d3346bd [mpp_service]: Add hw irq capacity check
Change-Id: I06788771ee1085433a35e90d63335f5c0ba168b9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-31 11:11:22 +08:00
Herman Chen
a2e81ef4a8 [mpp_runtime]: Reduce allocator log
Change-Id: I28ed5a1bdde5bda96379e14a2cbd36ca607c4b88
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-24 11:43:31 +08:00
Herman Chen
392ef8b8c2 [mpp_thread]: Add trylock return value
Change-Id: I3e5ac1e651535e247845f44c3730ea8dbb098c17
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-22 15:11:57 +08:00
Herman Chen
03e1d86b08 [mpp_device]: Add MppDevPollCfg to poll function
Change-Id: I53ded32c3ebd70ba3842459b507782f3bd50105b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-21 09:59:14 +08:00
Fenrir Lin
04a6811127 [osal]: syslog remove LOG_PERROR
Signed-off-by: Fenrir Lin <fenrir.lin@rock-chips.com>
Change-Id: I592b76a1d5f6fb0bbd8b36d2d5857ac29d16dc4d
2022-03-17 18:15:21 +08:00
Jeffy Chen
c07169d533 [misc]: Fix a few compile warnings and errors
Reported by llvm-clang.

Change-Id: I62f22fe5754d3e8d77405d213c81fda5d9f5e27d
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2022-03-11 17:45:10 +08:00
zj
3dea9cc46f [mpp_soc]: rk3368 has h264 decoder with vdpu1_2160p
Signed-off-by: zj <zj@rock-chips.com>
Change-Id: I915e9afad67e1de092aae288cb3a141daf0457fa
2022-03-07 10:32:07 +08:00
Herman Chen
881f05c7cf [mpp_soc]: Add avs+ decoder to rk3588
Change-Id: Ia93c70a16c17d1202ae4b133f157c140d8c8668c
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-03 16:38:49 +08:00
Caesar Wang
5c0859c468 [mpp_service]: Fix error on reg offset setup
Fix error in commit fb3390cbdd
Error log:

[   60.923201] rk_vcodec: reg[-2080222496] + offset 127
[   60.923216] Unable to handle kernel paging request at virtual address ffffff83263859f4
[   61.004607] Mem abort info:
[   61.004877]   ESR = 0x96000005
[   61.005154]   EC = 0x25: DABT (current EL), IL = 32 bits
[   61.005623]   SET = 0, FnV = 0
[   61.005898]   EA = 0, S1PTW = 0
[   61.006172] Data abort info:
[   61.006425]   ISV = 0, ISS = 0x00000005
[   61.006764]   CM = 0, WnR = 0
[   61.007031] swapper pgtable: 4k pages, 39-bit VAs, pgdp=00000000017e5000
[   61.007621] [ffffff83263859f4] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
[   61.008407] Internal error: Oops: 96000005 [#1] SMP
[   61.008835] Modules linked in: rk_vcodec
[   61.009194] CPU: 1 PID: 1537 Comm: mpp_dec_parser Not tainted 5.10.66 #10
[   61.009793] Hardware name: Rockchip RK3588 EVB3 LP5 V10 Board (DT)
[   61.010340] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[   61.010900] pc : mpp_translate_reg_offset_info+0xec/0xfc [rk_vcodec]
[   61.011469] lr : mpp_translate_reg_offset_info+0xdc/0xfc [rk_vcodec]
[   61.012025] sp : ffffffc013f33a90

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I023db0c7c930ec54bfbc1141bef3543a295b165a
2022-02-15 09:46:01 +08:00
Herman Chen
fe11f99415 [osal]: Add multi register offset config function
Add new multi config mode function.

Change-Id: I37c9c319e93e96fbd3d2bb5d598aef8d1b8fe2c8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-02-10 16:42:05 +08:00
Herman Chen
fb3390cbdd [osal]: Use SET_SESSION_FD to implement batch cmd
1. Add SET_SESSION_FD cmd.
2. Support new delimit interface to send multi request in one ioctl.

Change-Id: I07980cc9c70b5e31585254d1ffde7bc56a3007e2
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-01-27 18:01:47 +08:00
Herman Chen
cf1c38ca0c [mpp_service]: Fix client type and fd setup error
Change-Id: I9631bb65fbc40ea3baec29fc591d9ee8d7972983
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-01-24 18:14:19 +08:00
Yandong Lin
a4ece5df05 [hal_av1d]: Implement av1 decoder hal module
Change-Id: I9dc410b55cc614e7a4a6353d52a70c806e467b2e
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
2022-01-21 11:20:02 +08:00
Herman Chen
69dfccfd12 [osal]: Add log disable/enable function
Change-Id: Iddd02b7c3d102a65a4c34a8fba89b7a28719e0a9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-12-23 15:53:14 +08:00
Herman Chen
dbd428d570 [mpp_service]: Allow zero size rcb info
rk3588 encoder needs buffer end address so zero size should be allowed.

Change-Id: Ie350f62c77d99f91b2ca1f02e7b4ff7afe0b0dd8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-11-29 11:24:23 +08:00
Herman Chen
5e396e03d5 [mpp_soc]: Add AVS2 type
1. Add AVS2 coding type.
2. Add AVS2 support on rk3588.

Change-Id: Ifa677830d3f8c1625a4c351a6e008c09098f5122
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-11-20 18:34:30 +08:00
Herman Chen
6beec8ce65 [mpp_soc]: Add rk3588 support
Change-Id: I9a8829a1f0910c6de2062cd1c6b95d0c7ef71803
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-11-12 12:29:03 +08:00
Yandong Lin
ea564af5c6 [mpp_list]: Add list_sort func
Porting from kernel lib/list_sort.c

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: If6b0e07a863a8e95b47f2b89a2941d21674c9108
2021-11-10 21:06:49 +08:00
Herman Chen
f0c57cde02 [mpp_lock]: Add gcc atomic macro define
Change-Id: I3e94cc7be9a51f5d674a132c0a2e6f7afba61d34
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-11-03 11:27:35 +08:00
Herman Chen
8ae47457a0 [mpp_server]: Add device callback to mpp_server
Change-Id: I985d48e6625d3656e080614ab958e26dfc54a2c8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-10-21 15:30:56 +08:00
Herman Chen
0aeb6e46b6 [mpp_lock]: Fix compile error on bool type
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: If856cebe92db7e982f9781dfbe12b978e88bfac3
2021-10-18 17:05:41 +08:00
Herman Chen
926e0b7c22 [mpp_lock]: Add nop on lock
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I6290a52939615310c344cafbf90daf28323528d5
2021-10-14 17:07:50 +08:00
Herman Chen
a96e644da8 [osal]: Add spinlock implement
Change-Id: Ib520e6732d007370545508ae18d6c74fa4d9d80f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-10-14 14:47:44 +08:00
Herman Chen
7256403b49 [mpp_callback]: Optimize callback module
1. Move callback module to osal for later mpp_device callback.
2. Make callback command a pre-defined value to avoid include issue.
3. Separate callback cmd and param to separate header.

Change-Id: Ibd5cf11650a1cd2a326baddb82dc60fa1767ac87
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-10-09 17:14:44 +08:00
Herman Chen
5598a015a7 [mpp_mem_pool]: Add debug flag
Change-Id: I562ccfe062546c9f4a20711fa1d3553ab100c7ce
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-09-30 17:29:18 +08:00
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
436209226b [mpp]: Add jpeg hw_type config implement
1. Add dec cfg update before mpp_init.
2. Add hw_type eheck and process on hal_jpegd init.
3. Disable soc cap error log.

Change-Id: Idb5929bf1eace77d4b09205b60d0c1f0e0eb50b5
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-09-15 12:21:03 +08:00
Herman Chen
9036159c76 [jpegd_vdpu2]: Fix error on first jpegd vdpu2 task
The first jpegd vdpu2 will send codec info with normal register access
operation. But some old kernel will not support the codec info cmd 403.
Then kernel will discard the whole ioctl operation and let the first
decoding task failed.

So we separate codec info cmd from the normal register access cmd.

Change-Id: Ic364c90367a0493f132dc78e76fae3d4fd6011ca
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-08-30 16:39:42 +08:00
Yandong Lin
7340076465 [mpp_time]: fix the interval time calculate wrong
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Iabfa5c0cd1f85cbb41e85ef49cd0dd96f4f2d7f9
2021-08-25 10:21:52 +08:00
Yandong Lin
c7c4183f1a [mpp_service]: Adjust the timing of codec info set
Change-Id: I6d21be4506f4c65bfb8717f07b2d55a65fb50cfe
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
2021-08-23 14:05:54 +08:00
Jeffy Chen
49f29006a3 [drm]: Add mmap flag detection
Change-Id: I1099248e40e507d67cf82a5c5dca89ba7c706d52
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-08-04 09:43:19 +08:00
Jeffy Chen
b212aa4d08 [drm]: stop using drm_mmap and drm_munmap
That is no longer needed.

Change-Id: I6ee1efce4be88572200f10bc469904248e799bdc
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-07-29 10:32:53 +08:00
Herman Chen
82aeaebe34 [drm]: Add DRM_CLOEXEC|DRM_RDWR flag on fd import
1. Add drm fd open flag.
2. Remove unused handle process on mmap.

Change-Id: Id0b29b8914c1e8e8ae6af40877df21f73b46346e
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-07-15 17:15:21 +08:00
Herman Chen
5b05a3c5e9 [misc]: Add O_CLOEXEC flag on file open
When /dev/mpp_service is opened and be forked to another thread the
leaked fd will increase file refcnt in kernel.
Then the codec kernel session will be leaked on mpp_destroy.

Change-Id: I5bb682792c8e58591ec3a21af36e3f8a967f77fb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-25 10:32:04 +08:00
aaron.sun
a748e54e88 [drm]: Fix drm handle issue
There is a bug when using single drm allocator device for all buffers:

Sample:
1. external fd a is import to mpp_buffer and get handle B / fd b.
2. external fd a is import to mpp_buffer again and get handle B / fd c.
   NOTE: The handle is the same in mpp for drm allocator is the same
   and the handle ref_count is not increased.
4. release fd b and handle B. (NOTE: The handle B is released in kernel)
5. mmap fd c by handle B. (Crash on getting handle B in kernel)

So we should reacquire handle for fd c when it need mmap or free.

Change-Id: Ide0591f97be5e00ca71f6a16e0ff676c4ed206a5
Signed-off-by: aaron.sun <aaron.sun@rockchips-com>
2021-06-25 08:58:10 +08:00
sayon.chen
9eb347a5ae [h264d]: Support hw resolution capability check
Add hw capability to parser and check resolustion based on hardware
capability.

Change-Id: Id9b719b238c74d6b77f78fd8d583a3de854a94f4
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-18 08:56:57 +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
a010011064 [osal]: Use strof_ function in mpp_service
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I059e79326f994fa9b172074a9f12f9f0a8c12c6b
2021-06-03 10:41:33 +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