Commit Graph

56 Commits

Author SHA1 Message Date
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
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
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
Herman Chen
60f5fc234a [allocator]: Add dma_heap allocator
The dma_heap is introduced in kernel 5.10.

Change-Id: Id3c116d996da461467fe380a79434ba5ea875033
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-06-24 15:52:06 +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
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
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
b6c914a74d [osal]: Add osal_2str function
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I4f97a0938baa5d62c405f79c326a18b3ff6478f0
2021-06-03 10:26:06 +08:00
Herman Chen
d1366a4801 [mpp_mem_pool]: Move mpp_mem_pool to osal
Change-Id: I124f38bc58f791993515544af2c59169ee2c2402
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-12 20:47:36 +08:00
Herman Chen
f86fcc7663 [osal]: Add mpp_trace using ftrace
Change-Id: I6c6597d722f574524f1b993a18f6cd868b20fbab
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-10 09:15:41 +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
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
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
Herman Chen
9e77264edc [oasl]: Add eventfd support
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I46614e90abb132111105720f1cc7d4e2ec71e8c3
2020-09-08 09:05:59 +08:00
Herman Chen
a225238d0c [osal]: Add syslog on linux
Change-Id: I484ed12194e2e772326018e7cb1503ab761b2e71
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2020-03-19 17:32:01 +08:00
Herman Chen
6debebebce [osal]: Add large file support for drm allocator
Change-Id: I9bfe995935bca3419a8f75376af23a446b7eea03
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-05-16 15:02:07 +08:00
Randy Li
a78598dab5 [osal]: add new buffer type for DMA import buffer
This buffer type is used for the buffer coming from the
application, the application should make sure those
buffers are the dma buffer.

Change-Id: I2c8491f4dea77e5d7ae8d9157b0a1eda204f4bd6
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2018-04-27 17:20:32 +08:00
Herman Chen
7b7b509847 [runtime]: Add more runtime detection
As we found that simple ion / drm device detectioin can not cover all the
case. For example on some 3368 platform kernel provide both ion and drm
device. We have better to use allocator chosen in dts.

But later kernel patch from Randy will bring unified dma-fd translation in
kernel then this detection will be removed.

Change-Id: I2746142d1c3d0f36791bacaadb231dc2001a5aa7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-01-03 16:48:56 +08:00
Randy Li
6e471a0d14 [osal]: add queue data type
Only the src port supports blocking operation. Please
notice the sink port is neither block nor atomic.

Change-Id: Ib710eaca9fe1b5d5aada8e56481102589b52fc52
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-11-20 11:54:58 +08:00
Randy Li
f49475dfc3 [osal]: fixup for build in linux
Change-Id: I9535c66997f299c9d37f5b3c12b1b73fff5997d6
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-09-13 10:05:14 +08:00
Randy Li
5504570c3d Revert "[osal]: linux: add -ldl -lct to link relative library"
This reverts commit 8d42511773.

It will cause a problem in the platform skipping those library.
since those libraries are not necessary for any platform,
I think don't link with them would be better.

Change-Id: I33f48750f70838e393c02eb55971d5ebe0d3df31
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-07-25 17:13:32 +08:00
leo.ding
8d42511773 [osal]: linux: add -ldl -lct to link relative library
Change-Id: I4058c948a93f6e615843bcafd31bbf8568305b0c
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-07-04 19:27:26 +08:00
Randy Li
7990b52e8d [osal]: update the build system
The cross toolchains in Linux distributions are more prefer to
auto conf way, move those detecting from build system to toolchain
itself would be more welcome.

Change-Id: Ib42d9a0c65646b679ed14c96d16d1845c596f741
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-06-06 08:38:31 +08:00
Randy Li
428a6bec57 [osal]: rename the directory of windows allocator
A typo fixup.

Change-Id: I2b08b8debe17cdcbd5512d16cee9272f07151cc9
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-03-29 09:37:00 +08:00
Herman Chen
e2f0da0a89 [allocator]: Transform allocator normal to std
1. Use allocator std to replace default normal allocator on all OS.
2. Use wrapper to simplify mpp_allocator.

Change-Id: I13314a9eec3c5b39bc5ad8ddb3033ac2da79ba8f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-12-15 17:20:14 +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
Jung Zhao
deb649610c [drm]: add macro control in os_allocator.c
1. fix compiling error of previous commit
2. can enable drm on x86 pc linux platform

Change-Id: I06271fe0efcaa7de2531c7fb3e21bf9c75781beb
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-10-07 17:37:05 +08:00
Jung Zhao
e9b7563de2 [drm]: disable drm allocator by default
Change-Id: Id2262b3e7154f17aad93c9304d54fbd0c4dd532f
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
2016-10-07 16:56:40 +08:00
Jung Zhao
70e2ebdb2b [drm]: add android drm allocator support
1. enable drm allocator in android
2. modify size calculating when alloc

Todo: wait for new interface of kernel to decide
use whether drm or ion as allocator

Change-Id: Ia6791d91d113b238be77088ae747012fb786d683
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
2016-08-29 14:26:49 +08:00
ChenHengming
7965f5dfd9 [android]: fix android binary runtime error due to error bionic libc linking
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@992 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-08 07:33:03 +00:00
ChenHengming
b1066150e9 [android]: use static library in android rather than share library
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@898 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-08 08:17:08 +00:00
ChenHengming
838c7e6e41 [linux]: add drm allocator support to linux
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@858 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-01 10:45:04 +00:00
ChenHengming
d4b871ef15 [oasl]: move ion allocator to new directory for linux reuse
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@808 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-05-24 08:41:18 +00:00
DingWei
72251b9c56 [CMakeLists] In all CMakeLists, add properties folder which belonged
[mpi_test.c] Eliminate warning

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@184 6e48237b-75ef-9749-8fc9-41990f28c85a
2008-01-24 21:07:22 +00:00
ChenHengming
027f647eb8 [mpp]: add mpp_thread.cpp, add mutex_destroy to mpp_allocator, add codec thread and hal thread prototype
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@163 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-26 03:19:32 +00:00
ChenHengming
f22f5635ab [osal]: add mpp_allocator and os_allocator for mpp_buffer
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@130 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-19 10:37:38 +00:00
ChenHengming
c0b913d3b9 [mpp_buffer_impl]: add MppBufferGroup module to mpp_buffer_impl
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@122 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-18 12:57:16 +00:00
ChenHengming
5ab2877839 [osal]: add mpp_common.h for macro
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@108 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-14 07:12:50 +00:00
ChenHengming
bb1b5b4796 [cmake]: move pthread on window script to top layer for mpp_thread.h include directory
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@69 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-11 09:28:32 +00:00
ChenHengming
367fa3d4e7 [mpp_mem]: rename os_malloc to os_men
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@64 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 10:17:51 +00:00
ChenHengming
c35cc7d345 [osal]: rename mpp_malloc to mpp_mem, add mpp_time function
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@63 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 10:15:24 +00:00
ChenHengming
8e0e2c3f75 [cmake/android]: fix mpp_info C++ STL compile error on Android
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@61 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 09:20:40 +00:00
ChenHengming
c89c44512f [all]: change osal file name prefix from rk_ to mpp_
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@58 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 08:50:52 +00:00
ChenHengming
d122d27ea8 [misc]: add rk_err.h to rk_type.h, remove osal install script
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@53 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 06:32:40 +00:00
ChenHengming
6d3a322412 [rk_env]: add environment variable function and test case on window
unit test passed on window test case

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@30 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-05 03:25:28 +00:00
ChenHengming
c0c5222152 [rk_malloc]: add malloc function and test case on window
unit test passed

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@27 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-05 02:15:38 +00:00