Commit Graph

23 Commits

Author SHA1 Message Date
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
Herman Chen
e2072abcb8 [drm]: Remove drm_fd_to_handle on import
Remove drm handle to reduce iova usage.

Change-Id: Ie5000cb594806c9c7cc97f8ff7e25a4ba61f721a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-06-23 09:25:16 +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
Jeffy Chen
49f29006a3 [drm]: Add mmap flag detection
Change-Id: I1099248e40e507d67cf82a5c5dca89ba7c706d52
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-08-04 09:43:19 +08:00
Jeffy Chen
b212aa4d08 [drm]: stop using drm_mmap and drm_munmap
That is no longer needed.

Change-Id: I6ee1efce4be88572200f10bc469904248e799bdc
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-07-29 10:32:53 +08:00
Herman Chen
82aeaebe34 [drm]: Add DRM_CLOEXEC|DRM_RDWR flag on fd import
1. Add drm fd open flag.
2. Remove unused handle process on mmap.

Change-Id: Id0b29b8914c1e8e8ae6af40877df21f73b46346e
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2021-07-15 17:15:21 +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
aaron.sun
a748e54e88 [drm]: Fix drm handle issue
There is a bug when using single drm allocator device for all buffers:

Sample:
1. external fd a is import to mpp_buffer and get handle B / fd b.
2. external fd a is import to mpp_buffer again and get handle B / fd c.
   NOTE: The handle is the same in mpp for drm allocator is the same
   and the handle ref_count is not increased.
4. release fd b and handle B. (NOTE: The handle B is released in kernel)
5. mmap fd c by handle B. (Crash on getting handle B in kernel)

So we should reacquire handle for fd c when it need mmap or free.

Change-Id: Ide0591f97be5e00ca71f6a16e0ff676c4ed206a5
Signed-off-by: aaron.sun <aaron.sun@rockchips-com>
2021-06-25 08:58:10 +08:00
Herman Chen
033b2e9b22 [drm]: allocator drm code clean up
Add more log to allocator drm.

Change-Id: I3c6ec13ee6045fa06eec682b8e9cc933f8a03fe0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-08-21 11:00:31 +08:00
Rimon Xu
fb73f23f53 [alloctor]: add flags for alloctor
Each of the different alloctor has different alloctor modes,
such as allocating physical continuous memory, secure memory,
etc.

Change-Id: Ib032689f0cfd36b494843dcc176a22c6c9587b6a
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.com>
2018-05-07 17:34:34 +08:00
Randy Li
e0a1d6579d [drm]: use mmap() in native way for GNU Linux target
The "[drm]: fix runtime error for 32bit library" is hack way,
it won't work at GNU Linux platform. Also you need to check
_FILE_OFFSET_BITS and _LARGEFILE64_SOURCE before use the
mmap64().

For the normal mmap() with glibc, we only request to
check offset is aligned with page size but not the lenght.
But that doesn't apply for the memory from the drm device,
also the android use a different rule.

I decide not to map all the buffer to cpu at beginning
since most of them won't be access by the cpu.

Change-Id: I74ac7b5b63d45029cae076985a3d0b4526c62bbc
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-10-27 10:06:20 +08:00
Randy Li
8083d5ca60 [drm]: fix a various of bugs in drm allocator
1. The wrong size information;
2. Release the drm buffer when the life of the buffer is ended.

Change-Id: I8a17bf807609dfa940545f2391a62bd0a4f51670
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-10-27 10:05:55 +08:00
Randy Li
42fc9843bc [alloactor]: fix the compiler warnings in drm
Change-Id: I17fd18b6c6be4fb4855e35e5aea0b656e5aeb2d9
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-03-24 14:03:21 +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
Jung Zhao
4273a46252 [drm]: add drm_debug environment support
Change-Id: If31a5ede4460f2147eba126301be39e28e3c0626
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
2016-11-30 17:52:08 +08:00
Herman Chen
3bd7a6e027 [drm]: fix runtime error for 32bit library
1. When run the 32bit library without mmap64 it will fail due to lack of mmap64
symbol. So we do a runtime detection.
2. Fix runtime error of missing getpagesize. Use sysconf(_SC_PAGESIZE) instead.

Change-Id: I6dbeb6d55175a1ebb48d314f3dc691cd029710d1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-11-16 14:28:21 +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
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
ZhaoJun
28745421d5 [sofia-3gr-linux]: add sofia-3gr-linux platform support
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1096 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-25 08:32:27 +00:00
ChenHengming
668393735f [allocator]: fix failed error detection on ion/drm allocator import function
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1016 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-13 09:40:08 +00:00
ChenHengming
4201f689c0 [format]: format coding style
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@907 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-13 09:47:19 +00:00
DingWei
12ee09be3d [h264d] remove warning;
[oasl]  remove warning in linux;
[m2v]   update CMakeLists in vs; remove warning;

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@892 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-08 02:26:01 +00:00
ZhaoJun
3ae8f919c5 [osal]: add drm allocator for linux system
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@857 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-01 10:40:31 +00:00