Commit Graph

23 Commits

Author SHA1 Message Date
Herman Chen
e04f0e83e7 [mpp_platform]: Improve ioctl version detection
Move kernel ioctl api version detection to library loading stage.

Change-Id: If8ee750e1eaefb99924fd622d03270ef5032d1be
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-02-25 09:35:00 +08:00
Ding Wei
c5a9228e4b [mpp_platform]: Add RV1109 and RV1126 detection
Change-Id: I7281f4284891cf3ba9ebf24a2ff025827d4a0a2b
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2020-02-20 11:33:25 +08:00
Ding Wei
7d05e33de8 [mpp]: add /dev/mpp_service support
Add a new ioctl mode for kernel-4.19 or later.
Tips:
    1. There will be only one device /dev/mpp_service in kernel.
       User should use client type to distinguish different device.
    2. Each codec use the same function as before.
    3. Ioctl magic changes from VPU_IOC to MPP_IOC.
    4. Update structure for ioctl argument.
	Original structure:
	    data_ptr | size
	In this mode has many sortcommings:
	a) Need many ioctl cmd for different requirements.
	b) Data_ptr not to differ library for 32 or 64 system.
	c) Contain only one info ioctl once.

    New data structure:
        cmd_type | flags | size | offset | data_ptr
    a) Cmd_type works like previous ioctl cmd.
    b) Flags is extend to mark current data for any purpose.
    c) Size is the same as before.
    d) Data_ptr use 32 bits build in 32 system while 64 bits in 64 system.

kernel-4.19 related commit:
ib94ac0df876dfcc786b25ed3de6a68d861d2ef1e
cda9d27c62017309519bcbf8fe91057dfdc21076

Change-Id: I13d54a2e4823b7378265f100540916a22f62b9d4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2019-12-10 20:12:50 +08:00
Herman Chen
47011cd647 [platform]: Add RK1808 support
Change-Id: Id8d1bdd61888cc0fedb324f9c63be184edf3e6d0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-29 15:48:48 +08:00
Herman Chen
67e80ebfe4 [mpp]: Remove RKPLATFORM macro
Mpp will only run under Linux environment. Windows support will be
removed.

Change-Id: I52de4bd69f6d7b34507edeb6642668e225fcbd38
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-11 10:31:08 +08:00
Herman Chen
b03cad1c4f [platform]: Add 3128H capability description
rk3128H can support 1080p@60fps H.264/H.265 decoding. While it
do NOT have jpeg encoder nor VP9 decoder.

Change-Id: Id1b9583831036e2a43361b11f963be3599bfa7f8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-09-05 10:23:05 +08:00
Yann Dirson
621dd8592f Fix buffer overflow scanning soc_name.
The soc_name we read from device-tree is NUL-separated so we need to
replace intervening NUL chars, but we don't want to replace the last
one, or the next call to strstr() will overflow the buffer.

Detected with address-sanitizer:

    ==3271==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f940026a0 at pc 0x7f97df7160 bp 0x7fee1fa8e0 sp 0x7fee1fa958
    READ of size 97 at 0x7f940026a0 thread T0
        #0 0x7f97df715f  (/usr/lib/libasan.so.3+0x4215f)
        #1 0x7f97df745b in __interceptor_strstr (/usr/lib/libasan.so.3+0x4245b)
        #2 0x7f97d6b27b in MppPlatformService::MppPlatformService() (/usr/lib/librockchip_mpp.so.1+0x8727b)
        #3 0x7f97d6b64f in mpp_get_vcodec_type (/usr/lib/librockchip_mpp.so.1+0x8764f)
        #4 0x7f97d38da3 in hal_h264d_init (/usr/lib/librockchip_mpp.so.1+0x54da3)

    0x7f940026a0 is located 0 bytes to the right of 96-byte region [0x7f94002640,0x7f940026a0)
    allocated by thread T0 here:
        #0 0x7f97e6445b in __interceptor_posix_memalign (/usr/lib/libasan.so.3+0xaf45b)
        #1 0x7f97d6ed13 in os_malloc (/usr/lib/librockchip_mpp.so.1+0x8ad13)
        #2 0x7f97d6e54b in mpp_osal_malloc (/usr/lib/librockchip_mpp.so.1+0x8a54b)
        #3 0x7f97d6b1d7 in MppPlatformService::MppPlatformService() (/usr/lib/librockchip_mpp.so.1+0x871d7)
        #4 0x7f97d6b64f in mpp_get_vcodec_type (/usr/lib/librockchip_mpp.so.1+0x8764f)
        #5 0x7f97d38da3 in hal_h264d_init (/usr/lib/librockchip_mpp.so.1+0x54da3)
        #6 0x7f97d387c7 in mpp_hal_init (/usr/lib/librockchip_mpp.so.1+0x547c7)
        #7 0x7f97d02ad3 in mpp_dec_init (/usr/lib/librockchip_mpp.so.1+0x1ead3)
        #8 0x7f97cfda3f in Mpp::init(MppCtxType, MppCodingType) (/usr/lib/librockchip_mpp.so.1+0x19a3f)
        #9 0x7f97d0056f in mpp_init (/usr/lib/librockchip_mpp.so.1+0x1c56f)
        #10 0x404347 in mpi_dec_test_decode (/home/root/rockchip-mpp-test/mpi_dec_test+0x404347)
        #11 0x4057b3 in main (/home/root/rockchip-mpp-test/mpi_dec_test+0x4057b3)
        #12 0x7f97bba563 in __libc_start_main (/lib/libc.so.6+0x1f563)
        #13 0x402217  (/home/root/rockchip-mpp-test/mpi_dec_test+0x402217)

    SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/libasan.so.3+0x4215f)
    Shadow bytes around the buggy address:
      0x1ff2800480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800490: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff28004c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
    =>0x1ff28004d0: 00 00 00 00[fa]fa fa fa fa fa fa fa 00 00 00 00
      0x1ff28004e0: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
      0x1ff28004f0: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
      0x1ff2800500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800510: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x1ff2800520: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa

Change-Id: Ia529035847cc23c612e4039e3d445db9d014d31f
Signed-off-by: Yann Dirson <yann@blade-group.com>
2018-09-05 09:02:22 +08:00
Herman Chen
c87119b698 [platform]: Update some SOC's codec support
rk3228 do NOT have jpeg encoder and rk3036 do NOT have all encoder. we
update the device name in mpp_get_vcodec_dev_name function.

Change-Id: If80d864543761572645928e59e1e09fc906fec31
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-09 15:50:57 +08:00
Rimon Xu
ed620a310b [mpp_device]: move dev_fd in mppDevCtx
In order to separate the hardware and decoding protocols
more clearly, all API must be implemented in context.

Change-Id: I9f8128c5399149699b2e0a03bfa72ff902c25b87
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-05-03 16:52:41 +08:00
james.lin
bbc3cfe7a9 [mpp_platform]: add rk3128h support
Change-Id: I9d14872ab1537f9aa23c747f4b3319a284c88c81
Signed-off-by: james.lin <james.lin@rock-chips.com>
2018-05-03 16:02:53 +08:00
Ding Wei
0a87e905a2 [mpp_platform]: add px30 && rk3326 support
Change-Id: If4f69842c9468faee3d6f598e2e2453cb9d8511c
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-01-24 14:14:18 +08:00
Randy Li
97907dc549 [osal]: add rk3036 platform
Change-Id: I82029e8345d3c8e2a9a3baf4be55b7f4c9b284f0
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-12-01 14:07:53 +08:00
leo.ding
b7cbd8a9c0 [mpp_device]: add MppDevCtx for control device status
1. add Mppdevctx to store some infos in every codec.
reason:each codec has its own unique characteristics.
2. add mpp_device_control interface for get or set ctx values.
reason:it simplity interface, which flexible, easy to use and versatile.

Change-Id: I56c9332768c86f62a3ca248ad254fba9e798c577
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-06-07 15:14:30 +08:00
leo.ding
8cd076afae [mpp_platform]: rename HAVE_265E to HAVE_265ENC for buid warnnig
H265E had defined in Cmakelist.txt to choose whether build
h265 encode module, so it here is redefined.

Change-Id: I54e9704d396d0a8a0e6d0f2ae8595d033131d81b
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-05-15 17:28:16 +08:00
Randy Li
1b0d5bc016 [platform]: fixup for reading compatible
Change-Id: Ia0ff40644daaaec90a32d173675fadca7327d79b
Reported-by: Jacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-04-27 15:49:32 +08:00
leo.ding
4a1e6c3671 [platform]: Add default case for known compatible
Change-Id: Icaaa6b72a395248f53a8f902fa8d62e48bcd351f
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-04-06 16:26:35 +08:00
Randy Li
d99cc7f2ff [osal]: fixup for reading system compatible
The kernel uses termination character to divisive compatible.

Change-Id: I5db14e22aefa1ea54b8d32a4af7b112f22358dfb
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-04-06 14:40:23 +08:00
Herman Chen
8900385917 [platform]: Update chipset name and feature case
3228/3229 3228H/3328 support feature list:
3228 : dec vpu2 + 4K H.264/H.265       + enc vpu2
3229 : dec vpu2 + 4K H.264/H.265/VP9   + enc vpu2
3228H: dec vpu2 + 4K H.264/H.265 + avs + enc vpu2 + H.265
3328 : dec vpu2 + 4K H.264/H.265/VP9   + enc vpu2 + H.265

Change-Id: Ia4f63e764f12f8117757ea05645ffb9b65dc6b12
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-04-05 14:42:58 +08:00
Herman Chen
4b41fdd8bc [mpp_platform]: Modify chip vcodec detection
1. Add video codec information and kernel driver device detection code for all
supported chips.
2. Add video codec type and device name detection test

Change-Id: I275c0e616acd80c9a4ad2fee00588479e47a92db
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-03-03 16:12:36 +08:00
Herman Chen
51a7f82285 [osal]: Fix compiling error on Linux
Change-Id: Ia8daa63718fd8912093e5197fcfe823e378d1972
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-01-06 16:41:53 +08:00
leo.ding
b0902117fc [osal]: Add hardware platform detection
Change-Id: I0223b79608a9ea8346dbf194805c2536a90beb3b
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-01-06 09:06:54 +08:00
Herman Chen
e2ba112070 [osal]: Fix compile error on windows
Change-Id: Id908c592aaee3b8f16f7529c8c3995b3f4af78f8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-12-16 11:22:31 +08:00
Herman Chen
2fc024529e [osal]: add environment detection function
1. add software runtime detection
2. add hardware platform detection

Change-Id: I75736ae85130325029023d948e4d756e27953af8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-11-08 18:22:29 +08:00