Commit Graph

41 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
dc6e82f146 Move implement define to new header
Change-Id: Ic8bde5aa6ea9faf25793bb91a420bfeba0e9e9f7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-02 15:55:25 +08:00
Yandong Lin
5b1156a47b [vcodec_service]: Fix array out of bounds issue
Note:
1. In kernel 4.4 and previous version, the array may cross the boundary
and cover an unknown memory address
2. The array is out of bounds caused by the following submission:

 commit 5be47f31f0
  Author: Yandong Lin <yandong.lin@rock-chips.com>
  Date:   Wed Feb 24 19:44:32 2021 +0800

      [hal_vdpu]: Support fd and offset to be set separately

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ie3fc4324dde497732424cf3023ce81997401fd96
2021-04-09 11:12:56 +08:00
Yandong Lin
f2231d1473 [mpp/vcodec service]: Check whether the offset is configured repeatedly
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I217a138b62a7a17f7f371d76a591a02852950a10
2021-03-12 11:39:27 +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
22e73ba651 [mpp_dec]: Add decoder hal_info (with 403 kmsg)
NOTE: When MppDev is not output to mpp_dec the codec info update is
disabled.

This patch may cause kernel show the following log on old kernel:
mpp_process_request:1078: unknown mpp ioctl cmd 403

This log has no harm at all and new kernel will disable this log.

Change-Id: I26c8d78e279b5809bb2d1e51baf2c48e7f6e5a33
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-02-25 08:42:46 +08:00
Ding Wei
1dbcadd0fb [mpp_service]: Fix error when cap hw info
Tips: User should close fd before changing the client_type. Otherwise
the kernel will leak one info structure.

Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Change-Id: I2f99e4840d1e9a3805306be50e4afa3653f43c0c
2021-02-17 15:32:45 +08:00
Ding Wei
b3ce4085f7 [vdpu34x]: add rcb_info for rkvdec
tips:
    according to rcb_size descending, and sent rcb_info to the kernel.

Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
Change-Id: I85e951d9cc1c15962e702ab9781df35e6739bb6a
2021-01-14 14:53:37 +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
Johnson Ding
873f509da9 [osal]: Fix encoder not working problem at vepu2
For vepu2, kernel 4.4 and previous version, '/dev/vepu' should be used
rather than '/dev/vpu_service'.

Change-Id: I2efd4a219bbd7dd3cebf226c8ebcede9bcff9823
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2020-12-23 10:10:11 +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
8c91fa0cbf [mpp_service]: Fix supports-cmd path
New kernel use /proc/mpp_service/supports-cmd

Change-Id: I7c1d258c3652ecf5346c2e19383b90975a30a629
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-12-01 17:25:25 +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
e51c592daa [mpp_service]: Add cap check on invalid query
Change-Id: Ia89e06f13cdf00d2eddc6e6b8a6c18be86c04d2f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-16 10:15:31 +08:00
Herman Chen
eb6811fec5 [mpp_service]: Enlarge max register offset count
Change-Id: I65ab110dcba5cf1d7c90c6996f12872c833b7c93
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-16 09:46:53 +08:00
Herman Chen
776df2757a [mpp_service]: Add rk jpeg decoder name support
Change-Id: I9cbc693e7aedcfff635b9811f90d84e3a799923b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-11 11:14:36 +08:00
Herman Chen
855b45e041 [mpp_device]: Add mpp_device_debug env read
Change-Id: I691cc21a1316fbbe4b2c2a0d3ff50e96d7a5bed9
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-11-10 21:33:46 +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