Commit Graph

223 Commits

Author SHA1 Message Date
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
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
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