When mpp_mem debug is enabled there is limit for recording mpp_mem
usage. But there is NO obvious log when this limit is reached.
This case will easily happen on multi-instance decoding in one process.
We add obvious log when this case happen.
Change-Id: Ic9160766d4499d442c25fdefae00231d15d71359
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change time function from gettimeofday to clock_gettime.
Output of mpp_time() is still in us.
Change-Id: I7f961bb7bb4007e8e42ae5358bd7f568edf6c3d0
Signed-off-by: Herman Chen <herman.chen@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>
1. Add memory node record.
2. Add runtime log with memory count and total size.
3. Add extra room for overflow detection.
4. Add memory poison after free to detect write after free.
Change-Id: I4f0fe7295f18a746c3b4c135681127a18337585e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
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>
There is case that Android 7.1+3.10 kernel without drm and also
Android 7.1+4.4 kernel with both drm and ion.
Use the runtime function to support both of them.
This patch needs more test.
Change-Id: I53f0a30abf057f8e0e6e122e09782896d4789168
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Due to complexity of different kernel and usespace combination
we have to detect drm and ion allocator on runtime. The HAVE_DRM
flag may not be trust at all time. So we add a simple detection
function on first run.
Change-Id: Id4f6b2278ee0fe50ffc9806fffc5b01267f723da
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
I think those information are very anxious and useless
in daily usage.
Change-Id: I946418a476a332588b1d9b9722bbd5e93213e8dc
Signed-off-by: Randy Li <randy.li@rock-chips.com>
The applcatiion thread is still blocking on the output port.
Change-Id: I4693125362a250e5d2f28af8226d608b3040f138
Signed-off-by: Randy Li <randy.li@rock-chips.com>
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>
Force allocator use drm buffer,otherwise user will get a tuntime error
when they use kernel without /dev/ion.
Change-Id: I8151b743a9b19a03716dec3bdb909ce91b6af0b6
Signed-off-by: sliver.chen <sliver.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 "[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>
It would be more easy to look into those code next time.
The functions in mpp_time.c have removed the internal debug
flag checking.
Change-Id: I6392190896f74e86a8407f06fa3621dd92371e56
Signed-off-by: Randy Li <randy.li@rock-chips.com>
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>
The buffer management system still have a problem with different
memory type, I have to fake the drm buffer as the ion buffer this
time.
Change-Id: I57d972d45419caeaf0f086372d1ecd0c8dd9b9f5
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
Add pthread lock / unlock and condition wait / signal performance test
Change-Id: Ia0b9ae968d3bbe0b8f802b36afb93c6b564d91dc
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. 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>
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>
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>
It would make the build system more simple, and the cross
toolchains would do the rest to you.
Toolchains like buildroot default not enable the __gnu_linux__
marco in the pre-processor will surfure from the systsm unknown
problem. You should enable the marco in building toolchains
or have a look on those scripts in build directory.
Change-Id: I8f6af3391aa3d94d602ec8d84ba5e43839859169
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Please notice that clock source is only confirm to work
on the currently Rockchip ARMv7/ARMv8 SoC.
You may meet problem with the other platform.
The time granularities is miliseconds level.
Change-Id: Icf56f88dd15045d7c899bdcfaf3637fab159b35a
Signed-off-by: ayaka <ayaka@soulik.info>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Reviewed-by: timkingh.huang <timkingh.huang@rock-chips.com>
The build system may store those files into a package.
Change-Id: I2ab54da5880d1979a19430520d36324629b8a7d8
Signed-off-by: Randy Li <randy.li@rock-chips.com>
When retrieving frames current API only allows to define wether
the API should block without any timeout or not block at all.
This allows to specify a block timeout via the
MPP_SET_OUTPUT_BLOCK_TIMEOUT control operation.
Change-Id: Id35ad3d48f72881184009f830c406c3a655e1a90
Signed-off-by: LongChair <LongChair@hotmail.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
The thread status may be changed before mpp_port_dequeue,
so it is necessary to check it.
Change-Id: Ibe6f33cb7a5ac88bd93da3b0a15d9e0a271d825b
Signed-off-by: timkingh.huang <timkingh.huang@rock-chips.com>
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>
if outside doesn't set init qp value, mpp will estimate one init qp
according to resolution and bitrate.
Change-Id: If5415f6a3bfa3f2981ffd4eb044614bf9b035d2f
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>