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
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>
When multi thread calls scandir, crash may occur, so
the operation needs to be synchronized.
Change-Id: Idbdf539208259313d36c4acd17934af0e4dcf911
Signed-off-by: Rimon Xu <rimon.xu@rock-chips.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>
1. fix the header protection
2. the incorrect offset in ion memory mapping
3. the commentment of the buffer type in a header file
Change-Id: If9d1db90d41131750a341ab6177f947f7b966317
Signed-off-by: Randy Li <randy.li@rock-chips.com>
When in multi-codecs cases, the check_sysfs_iommu function reenters
with high probability, so some codec instances may fail to obtain
the correct memory type.
The root cause is scandir call in find_dir_in_path function. For
efficiency consideration it is better to lock ion_heap_id value.
Change-Id: I60a0eb27c3ac35bc022aa00b2cffc4e26e54bf24
Signed-off-by: Chengmc <Martin.Cheng@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
The imported buffer may be released from its origin allocator,
I would suggest to use the new file descriptor from new ion
handle.
The ion only has map_user() to export buffer to userspace,
There is no unmap_user() because the mapping is represented as
a file descriptor in user space. The closing of that file
descriptor will cause the memory to be unmapped from
the calling process.
Change-Id: Ief855aab11793238b40b73da92af853ca3b58349
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: ayaka <ayaka@soulik.info>
New kernel use u32 as a fix length ioctl parameter then mpp should keep
compatible to all kernel driver case.
Change-Id: I73afe00971d7b73d6c4695254bc5fdf82422b1f5
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
The imported buffer may be released from its origin allocator,
I would suggest to use the new file descriptor from new ion
handle.
NOTE: User may use file descriptor outside mpp as buffer index.
If mpp chooses new map fd as its output user may lost the
connection between user external buffer and mpp output buffer.
Change-Id: Ie0f42cd3268dfd08ddcbd5148a68406ff4b66b7a
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: ayaka <ayaka@soulik.info>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
1. Do not do map when MppBuffer alloc or import. Only map when user requires a
user pointer. This will save a lot of vma resource especially when buffer is
very large.
2. Fix error in mpp_dec thread which use info.ptr directly.
3. Use external fd on import (have risk of external user close fd on hw work)
Change-Id: I28225f6ba28afa3e9475e605bf971348dcef185a
Signed-off-by: Herman Chen <herman.chen@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>
Add new dts node 'vpu_combo' for rk312x,rk3368 video codec devices
compatibility.
Change-Id: I81326d478788ddddfb42e9fe0f4596ab84183934
Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
Ion file handle can have a fd_flag equal to 0. So we need to remove the
condition fd_flag == 0 in funciton os_allocator_ion_import.
Change-Id: I0393cf1f69d358308903fc7461efc36158f42358
Signed-off-by: hh <hh@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
1. check input fd is valid
2. dup new fd while imported fd is 0
Change-Id: Ic20d070d1a29e7d37c4f1e75cbef89263c5bc3a9
Signed-off-by: Lin Kesheng <lks@rock-chips.com>
In order to avoid misunderstanding change mpp_err to mpp_log
Change-Id: Id4a0591a0eeb7975fcdf1979b9d45c9b8d076370
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
use fromdos to change file type, remove ^M in code.
Change-Id: I000202dc51fcff57cc0771455baebea595115b1d
Signed-off-by: Lin Kesheng <lks@rock-chips.com>