Commit Graph

259 Commits

Author SHA1 Message Date
Herman Chen
e4d6d81287 [mpp_mem]: Add error log for mpp mem debug
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>
2018-03-26 15:41:29 +08:00
Herman Chen
a00b980a71 [mpp_mem]: Fix print error on mpp_mem leak check
Change-Id: I97d7c34034084aed4dfda064b113386d6dede8a8
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-03-26 10:22:06 +08:00
Xingwen Fang
702ccb4a9d [osal]: Reject multiple call mpp queue flush
Change-Id: I31622b38c93e86113ed9a4189d82acadc140e834
Signed-off-by: Xingwen Fang <fxw@rock-chips.com>
2018-03-23 17:34:53 +08:00
Herman Chen
ed4151e245 [osal]: Change time function
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>
2018-03-23 09:20:56 +08:00
Chengmc
e648d65af8 [allocator] lock ion heap detection operation
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>
2018-03-22 17:00:49 +08:00
Herman Chen
82bc016bbb [oasl]: Add debug function to mpp_mem
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>
2018-01-29 11:47:31 +08:00
Ding Wei
0a87e905a2 [mpp_platform]: add px30 && rk3326 support
Change-Id: If4f69842c9468faee3d6f598e2e2453cb9d8511c
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2018-01-24 14:14:18 +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
Herman Chen
321b95ad4d [allocator]: Use auto detect on Android and Linux
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>
2017-12-18 15:15:07 +08:00
Herman Chen
7d29f32280 [osal]: Add runtime allocator detection function
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>
2017-12-18 15:15:07 +08:00
Randy Li
97907dc549 [osal]: add rk3036 platform
Change-Id: I82029e8345d3c8e2a9a3baf4be55b7f4c9b284f0
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-12-01 14:07:53 +08:00
Randy Li
50bdc4de6a [mpp]: turn off a lots of message
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>
2017-11-30 11:32:17 +08:00
Randy Li
c157afe9db [mpp_list]: release the blocked thread at reset
The applcatiion thread is still blocking on the output port.

Change-Id: I4693125362a250e5d2f28af8226d608b3040f138
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-11-20 14:34:44 +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
sliver.chen
5a830697a8 [osal]: force mpp use drm buffer when HAVE_DRM are defined.
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>
2017-11-08 17:13:36 +08:00
Randy Li
c56a9365f6 [ion]: file descriptor for the external buffer
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>
2017-11-02 17:55:23 +08:00
Herman Chen
ba4b1db7ce [ioctl]: Add compatible patch for different kernel
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>
2017-11-01 17:23:13 +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
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
e6ade9b712 [mpp_dec]: remove obsoleted code and format comments
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>
2017-08-03 16:21:13 +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
Randy Li
0aa2191f26 [allocator]: force using drm allocator in Linux platform
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>
2017-07-11 11:49:28 +08:00
Herman Chen
75660ca37b [oasl]: Add lock timing test
Add pthread lock / unlock and condition wait / signal performance test

Change-Id: Ia0b9ae968d3bbe0b8f802b36afb93c6b564d91dc
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-07-05 11:27:22 +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
Herman Chen
2c3c72a815 [osal]: Change mpp time print to us
Change-Id: Ifd73aad1e3b65b44a8d7e284647c065fde66ca98
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-06-27 09:44:40 +08:00
Randy Li
19c0237886 [ion]: file descriptor for the external buffer
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>
2017-06-14 11:38:32 +08:00
leo.ding
b7cbd8a9c0 [mpp_device]: add MppDevCtx for control device status
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>
2017-06-07 15:14:30 +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
leo.ding
8cd076afae [mpp_platform]: rename HAVE_265E to HAVE_265ENC for buid warnnig
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>
2017-05-15 17:28:16 +08:00
Randy Li
5fa4ff0d48 [osal]: match system implementation with compiler marco
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>
2017-05-04 14:29:29 +08:00
Randy Li
1b0d5bc016 [platform]: fixup for reading compatible
Change-Id: Ia0ff40644daaaec90a32d173675fadca7327d79b
Reported-by: Jacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-04-27 15:49:32 +08:00
ayaka
8bde251d54 [osal]: fix the timeout function
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>
2017-04-14 11:25:58 +08:00
Randy Li
0de5e0599c [osal]: don't install unit test
The build system may store those files into a package.

Change-Id: I2ab54da5880d1979a19430520d36324629b8a7d8
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-04-07 10:13:44 +08:00
leo.ding
4a1e6c3671 [platform]: Add default case for known compatible
Change-Id: Icaaa6b72a395248f53a8f902fa8d62e48bcd351f
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-04-06 16:26:35 +08:00
Randy Li
d99cc7f2ff [osal]: fixup for reading system compatible
The kernel uses termination character to divisive compatible.

Change-Id: I5db14e22aefa1ea54b8d32a4af7b112f22358dfb
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-04-06 14:40:23 +08:00
Herman Chen
8900385917 [platform]: Update chipset name and feature case
3228/3229 3228H/3328 support feature list:
3228 : dec vpu2 + 4K H.264/H.265       + enc vpu2
3229 : dec vpu2 + 4K H.264/H.265/VP9   + enc vpu2
3228H: dec vpu2 + 4K H.264/H.265 + avs + enc vpu2 + H.265
3328 : dec vpu2 + 4K H.264/H.265/VP9   + enc vpu2 + H.265

Change-Id: Ia4f63e764f12f8117757ea05645ffb9b65dc6b12
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-04-05 14:42:58 +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
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
Randy Li
e709b1b621 [alloactor]: fix the compiler warnings in ion
Change-Id: I73a7d4dae08f18aa2c61d1b3766ea94b7d9eea21
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-03-24 14:03:21 +08:00
Randy Li
d0b76f9703 [alloactor]: fix the compiler warnings in std
Change-Id: I6613d51cae9633f4048d65de9d23a295e70f5626
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-03-24 14:03:20 +08:00
Randy Li
6e32081214 [allocator]: Fix compiler warnings
Change-Id: I52554a3ca45747c13a7821a04bb1c01e45d9d44c
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-03-24 12:08:20 +08:00
Randy Li
ee41717331 [mpp_log]: Fix compile warning
Change-Id: I482df8722b111df7981f1bd4d7f337f497eadfee
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-03-24 12:06:55 +08:00
LongChair
a3f463f9ce [mpi] : Add a block timeout control command.
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>
2017-03-24 11:43:08 +08:00
timkingh.huang
700b7fc875 [jpegd]: check thread status before mpp_port_dequeue
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>
2017-03-09 15:00:10 +08:00
Herman Chen
4b41fdd8bc [mpp_platform]: Modify chip vcodec detection
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>
2017-03-03 16:12:36 +08:00
Jung Zhao
038a3bd665 [rc]: add init qp estimation
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>
2017-01-17 09:20:05 +08:00
Herman Chen
444e8b429f [mpp]: Fix compile warning for strict-prototypes
Change-Id: Ia430a5d157dc2d19c92a43ca15eab83f1ac540c6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-01-11 10:43:27 +08:00
Herman Chen
51a7f82285 [osal]: Fix compiling error on Linux
Change-Id: Ia8daa63718fd8912093e5197fcfe823e378d1972
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2017-01-06 16:41:53 +08:00
leo.ding
b0902117fc [osal]: Add hardware platform detection
Change-Id: I0223b79608a9ea8346dbf194805c2536a90beb3b
Signed-off-by: leo.ding <leo.ding@rock-chips.com>
2017-01-06 09:06:54 +08:00