1. Refactor osal cpp files to c.
2. Update osal license to Apache-2.0 OR MIT.
3. Remove windows support.
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ic5545d861676880f7a6247515404d585cd4fcef5
The default misc buffer group do not have the flag. We need to seperate
the default misc group with different flag.
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I14941eedfe9c06ec978a12061ba33e12495aa038
The GKI kernel does not allow non-render thread to open /dev/dri/card0
and alloc drm buffer from it. So we need to use /dev/dri/renderD128
instead.
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I0fad306c6eeadd8da5507883f4f4915c11946761
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>