Commit Graph

227 Commits

Author SHA1 Message Date
Yandong Lin
05b809393c fix[h265d_vdpu383]: fix dec err when ps_update_flag=0
The ps_update_flag=0 case is not handled properly here,
and follow commit exposes this problem.
233940: fix[h265d]: fix infochange loss when two sps continuous

Change-Id: I54dcea6c31483257b4b771a8bd4994cc75ed41f5
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
2024-09-11 15:40:04 +08:00
Herman Chen
295aa22639 chore[mpp_mem]: Add mpp_realloc_size
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I896b4132e0fded153ee4d932b9c011bf3ba41c16
2024-08-29 17:53:01 +08:00
Herman Chen
8108bf58ea fix[osal]: Fix mpp_mem single instance issue
When another C++ static global object init before the mpp_mem service
the MppService service will be inited twice. Then on object destroy will
deinit service twice and cause mutex double delete issue.

On init

E mpp_mem : MppMemService start 0 0x7c536619e8
I mpp_mem : MppMemService mpp_mem_debug enabled 3 max node 1024
E mpp_mem : MppMemService start 1 0x5e8d724230
I mpp_mem : MppMemService mpp_mem_debug enabled 3 max node 1024

On destory

05-17 09:58:04.743  2576  2576 E mpp_mem : ~MppMemService enter 0 0x5e8d724230
05-17 09:58:04.743  2576  2576 E mpp_mem : ~MppMemService enter 1 0x7c536619e8
05-17 09:58:04.743  2576  2576 E mpp_mem : mpp_osal_free

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'rockchip/rk3576_t/rk3576_t:13/TQ3C.230805.001.B2/eng.kenjc.20240510.161710:userdebug/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-05-17 09:58:04.800905936+0000
Process uptime: 1s
Cmdline: mpp_trie_test
pid: 2576, tid: 2576, name: mpp_trie_test  >>> mpp_trie_test <<<
uid: 0
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x5e8d724230)'
    x0  0000000000000000  x1  0000000000000a10  x2  0000000000000006  x3  0000007fd26f05d0
    x4  0000000000008080  x5  0000000000008080  x6  0000000000008080  x7  8080000000000000
    x8  00000000000000f0  x9  0000007c50d22a00  x10 0000000000000001  x11 0000007c50d60de4
    x12 0101010101010101  x13 000000007fffffff  x14 000000000001ffea  x15 0000000000000078
    x16 0000007c50dc5d58  x17 0000007c50da2c70  x18 0000007c55b38000  x19 0000000000000a10
    x20 0000000000000a10  x21 00000000ffffffff  x22 0000000000001000  x23 0000005e8d724230
    x24 0000007c5489e010  x25 0000005e8d70c060  x26 0000000000000002  x27 0000007c513226e8
    x28 0000000000000000  x29 0000007fd26f0650
    lr  0000007c50d52968  sp  0000007fd26f05b0  pc  0000007c50d52994  pst 0000000000000000
backtrace:
      #00 pc 0000000000051994  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #01 pc 000000000005363c  /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+124) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #02 pc 00000000000b74cc  /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+60) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #03 pc 00000000000b735c  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+240) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #04 pc 0000000000048290  /system/bin/mpp_trie_test (mpp_osal_free+108) (BuildId: 55dca41ecc701b3ad16f0ef02270a45ce40533ff)
      #05 pc 0000000000041080  /system/bin/mpp_trie_test (MppMemPoolService::~MppMemPoolService()+32) (BuildId: 55dca41ecc701b3ad16f0ef02270a45ce40533ff)
      #06 pc 00000000000b9ca4  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+280) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #07 pc 00000000000ac944  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #08 pc 000000000004a1f8  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100) (BuildId: 4e07915368c859b1910c68c84a8de75f)

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I81ead0f796ba6e26b520a87ae69cc8f7f6e816f4
2024-08-16 09:53:55 +08:00
Yandong Lin
b739b13594 fix[mpp_common]: fix compile err on F_DUPFD_CLOEXEC not defined
Change-Id: I5e258a13be331af7a4d11d6ab2e4a8afb12418dd
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
2024-07-31 18:18:32 +08:00
Johnson Ding
45f2fcbcf0 fix[osal]: rv1109/rv1126 vcodec_type mismatch problem
RV1126/RV1109 JPEG decoder has no PP. This will be conflict with
vcodec_type queried from kernel. Also VPU_CLIENT_VEPU2_JPEG is defined
and used only for multi-core JPEG encoder at kernel. So the following
changes is made to fix this problem:

1. This reverts commit 9b860cd250.
2. Define a new MppDecHwCap to distinguish normal VPU with only JPEG
   supported from multi-core JPEG encoder.
3. Correct vcodec_type queried from kernel when there is no PP for
   VDPU2.

Change-Id: I58a1abe708721f725a9cf487e8f870dd5820844f
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2024-06-06 18:07:06 +08:00
Johnson Ding
ccf8f46e78 refactor[dec]: get deocder capability via common routine
Change-Id: I9700a2418653a6d5a9a00b4c4c13f33022d2159b
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2024-05-10 15:57:47 +08:00
Chandler Chen
8759039d5f feat[vdpu383]: align hor stride to 128 odds + 64 byte
for better performance

Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: I312c6b22f0c189b0674b0a667c20f68ac83315d6
2024-04-01 16:08:32 +08:00
Herman Chen
8d27cb798e feat[mpp_dev]: Add fd attach/detach operation
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I4ef09ee8d866eccbbaf3f5668ceefe81e3dc26c0
2024-03-29 10:02:00 +08:00
xueman.ruan
677b2a877e feat[vdpp]: Add vdpp module and vdpp_test
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Change-Id: I8bd74ad9b4404864ea3d88c7f2e57eecc4c0e35d
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
2024-02-27 18:00:54 +08:00
Yanjun Liao
3cbb906673 feat[mpp_soc]: support rk3576 soc
Change-Id: I49bd3ccbc643b3c95db5ba3ca692f365c9425440
Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2024-02-20 09:45:25 +08:00
Yandong Lin
0e03d3bc70 fix[mpp_dmabuf]: fix align cache line size calculate err
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ide7daa58b12b22dc115acbbb7a9b8e305a167d57
2024-01-12 10:37:24 +08:00
Herman Chen
8db63d761a fix[common]: Add mpp_dup function
mpp_dup function use fnctl F_DUPFD_CLOEXEC for fd dup with CLOEXEC flag.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Idd82eb935b06d2885685aeb696b95e910981539d
2024-01-10 18:15:45 +08:00
Herman Chen
6ce3007994 refactor[allocator]: Refactor allocator flow
1. Allocator api is determined by buffer type.
2. Allocator ctx is determined by both buffer type and buffer flags.
3. All allocator dma_heap / drm / ion / ext_dma should support different
buffer flags.
4. The buffer flag supports cacheable / 32-bit / contig options.
5. Add flags update flow on allocator create process.
6. Add mpp_dmabuf_has_partial_ops to disable dmabuf partial ops when the
kernel driver has bug.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: If36a05c6704112cad3ab46861023597ff02bf14c
2023-11-29 09:54:36 +08:00
Herman Chen
d4913c1b88 chore[mpp_dmabuf]: Add dmabuf ioctl unit test
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ice181f6d8cf312d68c79d6e6a33cddcbf65ef5f6
2023-11-16 16:33:40 +08:00
xueman.ruan
e15972e9af feat[mpp_dmabuf]: Add dmabuf sync operation
sync_begin - cache invalidate, should be called before cpu read
sync_end   - cache flush, should be called after cpu write

MppBuffer sync flow:
1. hw access
2. sync_begin
3. cpu access (read / write)
4. sync_end
5. hw access

NOTE: readonly option is faster for read only buffer.

Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I253a6139e9bb30808c07075d64f17b5cfad8519a
2023-11-16 14:27:02 +08:00
Herman Chen
12aefae5b1 feat[mpp_lock]: Add spinlock timing statistic
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Id63e28605853f07c3e557f01d8edffd67d7d1541
2023-10-13 11:06:53 +08:00
Herman Chen
fa9998fd37 feat[mpp_thread]: Add simple thread
The simple thread has the thread group feature.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ife367ecc3b5a46d2b50037e8d21cc8ce665a4c02
2023-10-13 10:49:50 +08:00
Chen Jinsen
4b45330c50 [mpp_soc]: Add rk3567 soc support
Change-Id: I6d02f021544a9ba4d7ff96e5aad47f5fe1f87fb3
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
2023-10-13 09:30:04 +08:00
Hery Xu
f377c2ae70 fix[vp9d]: Fix AFBC to non-FBC mode switch issue
When vp9 decoder switches from FBC mode to non-FBC mode it requires
resetting the alignment function in buf_slot.

Change-Id: I0c3e35e2c573d003192a2a82d9bdd9c30f42088c
Signed-off-by: Hery Xu <hery.xu@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2023-10-10 09:41:23 +08:00
xueman.ruan
7017dbd1b6 fix[utils]: fix hor_stride 24 aligned error
Change-Id: Ife950bd3ae5fac5faffffa4275222fcc7fb9bbe0
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
2023-09-28 16:24:22 +08:00
Yandong Lin
193309a852 [driver]: add MPP_CMD_SET_ERR_REF_HACK api
support hack for err ref check for decoder

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib61336b50dde626d85f9f6bb25950ea70149ea49
2023-05-10 18:24:13 +08:00
xueman.ruan
062c175265 [hal_jpege]: Add dma heap options for JPEG encode.
use cachable dma buffer to reduce copy time.

Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: I7fcc0fa5942ea5aa4e247b5f10677843d006ff28
2023-02-21 20:57:26 +08:00
Chandler Chen
4c14bb1556 [mpp_soc] dec hw_cap add cap_colmv_compress
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: I13b98c5227f03a235c48cfdb639286e7ee595b3f
2023-01-13 14:20:00 +08:00
Chandler Chen
1756c9a4de [mpp_soc][hal]: Add rk3562 support
add hw_id define for rk3562 & rk3528

Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: Ie32ecec242da6bdcb59a1df3e3f2a3a1a54fd695
2023-01-13 14:20:00 +08:00
Herman Chen
5469f9d08b [misc]: Add compatible for fbc header alignment
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I0ae4ec4b8603648a7186d0cccf63aa3ea3fb29b3
2022-12-23 17:36:34 +08:00
Grey Li
1e1b58d5bd [jpegd]: Fix stream copy_flag by hw cap
Change-Id: Iadcdb46f4828f8e5d9bc8fd77d76bd090a1e602e
Signed-off-by: Grey Li <grey.li@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-12-22 14:28:26 +08:00
Chandler Chen
223e0739f0 [mpp_soc]: Add rk3528 support
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: Ic26260c0987176b785434188625e018ab2c5241c
2022-11-17 17:47:11 +08:00
sayon.chen
2bf30c6f32 [mpp_soc]: Add capability core num set
Change-Id: I76add0b060b2c94914e7b11e8fb42d29c1987384
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2022-09-22 17:32:31 +08:00
sayon.chen
038fecb3da [mpp_soc]: Add capability dec linebuf limit
Change-Id: I6b6d9f0728965ab4b73dc2ece7cd211b6fee190f
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2022-09-22 17:32:21 +08:00
sayon.chen
6b4846bebd [soc_info]: Add cap_down_scale set
Change-Id: Ic0921ce74aea0d71d1629c4d88b5e76b87f294e9
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2022-09-22 17:29:54 +08:00
Yandong Lin
24fea09634 [mpp_platform]: fix get_kernel_version failed on 5.10
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I51fe2311641b4a7a64595e8fc8b4813c6a962303
2022-09-06 18:04:03 +08:00
Rimon Xu
25cbe2ce2e [mpp_dec] Calc FBC buffer size on SET_FRAME_INFO
Determine FBC alignment when set frame info control

Change-Id: Ibc0c6c455029a58875b820c17b7d94cc4e64cdda
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2022-07-08 15:50:41 +08:00
Yandong Lin
def09cb3c2 [jpege]: add new client type for vepu2 jpeg only
Add VPU_CLIENT_VEPU2_JPEG to distinguish vepu2 jpege only device.
And check whether kernel support the client type or not.

rk3588 has 4 jpeg encoder core and we will use VPU_CLIENT_VEPU2_JPEG as
its client type in kernel.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib1c45781ac9c8f504ba7b46f2f0c7aad5d16fa68
2022-07-01 16:43:19 +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
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
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
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
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
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
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
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
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