Commit Graph

478 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
Chandler Chen
abf0c5f574 fix[osal]: fix 128 odd plus 64 bytes alignment
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: Ibd5ebf31b17b63e9604b271b8dd23a48590d0c46
2024-07-06 16:29:49 +08:00
Herman Chen
9c92ab9e20 fix[drm]: Fix permission check issue on GKI kernel
The GKI kernel does not allow non-render thread to open /dev/dri/card0
and alloc drm buffer from it. So we need to use /dev/dri/renderD128
instead.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I0fad306c6eeadd8da5507883f4f4915c11946761
2024-06-07 14:48:51 +08:00
Johnson Ding
53abf03bf2 fix[hal_jpeg_vdpu1]: fix dec failed on RK3036 problem
For kernel 4.4 and before, if VPU only has decoder, register size is
101. Thus extra size append at offset of 164*4 will be ignored by
kernel.

Change-Id: Idf4524099615b8ffd46766f55c9c0ea481f7cb76
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2024-06-06 18:13:00 +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
Yandong Lin
678db389ee chore[mpp_service]: fix typo err
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ifa31c12ce535fd7a74f7a04bee3f9401370182ac
2024-06-04 09:12:45 +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
leo
4cc3fb25f7 fix[allocator]: fix on invalid DMA heap allocator
fallback to DRM/ION buffer when DMA heap allocator is invalid

Signed-off-by: leo <8252892+leokvw@users.noreply.github.com>
Change-Id: Ib2cd5669e6c9b41ceed7f4dd87f8fc33de88aa1c
2024-04-26 15:05:38 +08:00
Chandler Chen
2c2c3c4d53 fix[mpp_common]: fix 128 odd plus 64 alignment
former commit:https://10.10.10.29/c/rk/mpp/+/213571

Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: If09095891c1dfaa0663c01776ca4cb046ed4b24a
2024-04-24 09:59:50 +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
Yanjun Liao
423ebb1da1 fix[ext_dma]: fix mmap permission error
Change-Id: Ic7ae7c8de978752f8437f2d0b700014ea6817c56
Signed-off-by: Yanjun Liao <yanjun.liao@rock-chips.com>
2024-03-18 18:05:13 +08:00
Yandong Lin
467d6088eb fix[mpp_service]: fix rcb info env config
Change-Id: I9cd8749f50d4ffb26c87229f079c0228fce770f8
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
2024-02-28 16:52:29 +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
c06d3b4a71 fix[dmabuf]: Disable dmabuf partial sync function
For kernel dmabuf driver has bug on partial sync function we deside to
disable partial sync to reduce user's error.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I2c69c407eb5b0056ad0377699fef6ef31e1d79cd
2024-01-11 16:17:44 +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
Yandong Lin
35a99b5d50 fix[dmabuf]: align offset/len to cache line for partial sync
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib6b0f6714bc4d98daa83f02d17c7659c00df570a
2023-12-27 14:56:46 +08:00
Herman Chen
d9fb399576 fix[dma-buf]: Add dma-buf.h for old ndk compiling
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Id1188a945aa56af165c5957b88aa1a7453f5799b
2023-12-06 14:44:23 +08:00
Herman Chen
318bfc1b78 fix[cmake]: Remove HAVE_DRM option
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I6ce230a7e85472acca5feafc9ad84effb222f57a
2023-11-30 09:22:44 +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
Yandong Lin
e155a7eac7 fix[dma_heap]: add dma heap uncached node checking
Currently only support uncached dma heap node access,
because of the cache processing is not yet complete.

So if there are no uncached node in /dev/dma_heap/ path,
mpp will not use dma_heap allocator.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ic33fca9c445c7668a86454f01f9d7577668de32b
2023-11-29 09:54:36 +08:00
Herman Chen
dbdccc6818 fix[mpp_mem]: Fix MEM_ALIGNED macro error
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I08d403f7e1d67b7d80655278255f31d4c0c6784e
2023-11-27 14:59:04 +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
Xinhuang Li
c14ef0f774 fix[allocator]: dma_heap allocator has the highest priority
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
Change-Id: Ic81a84a8335f0ed08dc9cac79d3e46a869095823
2023-10-07 17:18:21 +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
6ac268dfea fix[mpp_soc]: fix rk356x vepu2 capability
Not support vp8 enc

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I6080b5377a0c3615d922bb6ddcc677a736cb2b10
2023-08-03 10:29:14 +08:00
Chandler Chen
4fe51a6c29 feat: Add rk3528a support
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: Iff9f9f11bcda78476f8753c5f7c922953c243b25
2023-07-28 17:31:09 +08:00
Herman Chen
44996a76ce [cmake]: Fix ndk r10d compile error
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I64fcf77e7adf13702f98d5d7735338846faff843
2023-07-25 14:59:11 +08:00
Herman Chen
78a6ca648e [cmake]: Adapt to Android 14 requirement
1. Android 14 required to use libc++ instead of libstdc++
2. Add ndk search path and options for ndk switch.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I07595fc0290daaaf6518eca18d7b318be89fc6ae
2023-06-25 10:08:43 +08:00
Yandong Lin
f1734a1737 [mpp_service]: remove get disable_rcb_info env runtime
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I3886482cd10ac8cc02d35d7b89c8cc8f88c1a600
2023-06-08 18:27:13 +08:00
Herman Chen
feab136f1a [allocator_dma_heap]: Add error log
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I06af727713e1c096eada8a40795f42668fdaff6d
2023-06-06 15:48:43 +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
Yandong Lin
d86f0fc707 [mpp_service]: fix query_cfg name issue
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ib594f7e892fdd8831fd49fa8fa4aeb8ac0dd533e
2023-05-09 18:12:49 +08:00
xueman.ruan
c794d353c5 [allocator_dma_heap]: add file permission check.
Change-Id: Icfffaf3594f029b87e3a87f17de408a681c49dfb
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
2023-05-04 08:57:02 +08:00
Yandong Lin
13794992d9 [mpp_mem_pool]: fix MppMemPoolNode double put issue
When a object is double put by mpp_mem_pool_put,
it will destroy the info of MppMemPoolImpl.

So set node->check = NULL when mpp_mem_pool_put, and it will check
failed adn return when double mpp_mem_pool_put.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I54be2eae3a1d7e81579f89d3e80304abface3049
2023-04-27 17:45:28 +08:00
xueman.ruan
f387c6dac2 [mpp_allocator]: disable std allocator.
Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: I27441d49c2072176b848b5d80d408ebcb50926df
2023-04-07 09:06:37 +08:00
Yandong Lin
8bbb9045c3 [mpp_soc]: fix enc cap for rk3562
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I9166ae8288c1c7d4fb4c691779b5a37bcd87318e
2023-03-24 14:54:28 +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
726840336e [mpp_soc] add hw cap for rk3528
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com>
Change-Id: Iadd4e3b99789a52f24a8da1dc96896ffc59a0266
2023-01-13 14:20:00 +08:00