Commit Graph

39 Commits

Author SHA1 Message Date
Herman Chen
8108bf58ea fix[osal]: Fix mpp_mem single instance issue
When another C++ static global object init before the mpp_mem service
the MppService service will be inited twice. Then on object destroy will
deinit service twice and cause mutex double delete issue.

On init

E mpp_mem : MppMemService start 0 0x7c536619e8
I mpp_mem : MppMemService mpp_mem_debug enabled 3 max node 1024
E mpp_mem : MppMemService start 1 0x5e8d724230
I mpp_mem : MppMemService mpp_mem_debug enabled 3 max node 1024

On destory

05-17 09:58:04.743  2576  2576 E mpp_mem : ~MppMemService enter 0 0x5e8d724230
05-17 09:58:04.743  2576  2576 E mpp_mem : ~MppMemService enter 1 0x7c536619e8
05-17 09:58:04.743  2576  2576 E mpp_mem : mpp_osal_free

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'rockchip/rk3576_t/rk3576_t:13/TQ3C.230805.001.B2/eng.kenjc.20240510.161710:userdebug/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-05-17 09:58:04.800905936+0000
Process uptime: 1s
Cmdline: mpp_trie_test
pid: 2576, tid: 2576, name: mpp_trie_test  >>> mpp_trie_test <<<
uid: 0
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x5e8d724230)'
    x0  0000000000000000  x1  0000000000000a10  x2  0000000000000006  x3  0000007fd26f05d0
    x4  0000000000008080  x5  0000000000008080  x6  0000000000008080  x7  8080000000000000
    x8  00000000000000f0  x9  0000007c50d22a00  x10 0000000000000001  x11 0000007c50d60de4
    x12 0101010101010101  x13 000000007fffffff  x14 000000000001ffea  x15 0000000000000078
    x16 0000007c50dc5d58  x17 0000007c50da2c70  x18 0000007c55b38000  x19 0000000000000a10
    x20 0000000000000a10  x21 00000000ffffffff  x22 0000000000001000  x23 0000005e8d724230
    x24 0000007c5489e010  x25 0000005e8d70c060  x26 0000000000000002  x27 0000007c513226e8
    x28 0000000000000000  x29 0000007fd26f0650
    lr  0000007c50d52968  sp  0000007fd26f05b0  pc  0000007c50d52994  pst 0000000000000000
backtrace:
      #00 pc 0000000000051994  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #01 pc 000000000005363c  /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+124) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #02 pc 00000000000b74cc  /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+60) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #03 pc 00000000000b735c  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+240) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #04 pc 0000000000048290  /system/bin/mpp_trie_test (mpp_osal_free+108) (BuildId: 55dca41ecc701b3ad16f0ef02270a45ce40533ff)
      #05 pc 0000000000041080  /system/bin/mpp_trie_test (MppMemPoolService::~MppMemPoolService()+32) (BuildId: 55dca41ecc701b3ad16f0ef02270a45ce40533ff)
      #06 pc 00000000000b9ca4  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+280) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #07 pc 00000000000ac944  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24) (BuildId: 4e07915368c859b1910c68c84a8de75f)
      #08 pc 000000000004a1f8  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100) (BuildId: 4e07915368c859b1910c68c84a8de75f)

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I81ead0f796ba6e26b520a87ae69cc8f7f6e816f4
2024-08-16 09:53:55 +08:00
Herman Chen
fa9998fd37 feat[mpp_thread]: Add simple thread
The simple thread has the thread group feature.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ife367ecc3b5a46d2b50037e8d21cc8ce665a4c02
2023-10-13 10:49:50 +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
Herman Chen
392ef8b8c2 [mpp_thread]: Add trylock return value
Change-Id: I3e5ac1e651535e247845f44c3730ea8dbb098c17
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2022-03-22 15:11:57 +08:00
Herman Chen
bbae9e98a7 [mpp_thread]: Add broadcast function
Change-Id: I33ad9e3b3a657f21d23dfd6f04abd864b4a883d6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-17 11:26:50 +08:00
sayon.chen
891a416961 [mpp_thread]: Rewrite Autolock function
Add extra flag to disable Autolock

Change-Id: Ibbaf4b7a011f830728401facd49ac30ab0c7c9ad
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-05-11 10:00:33 +08:00
Herman Chen
0ce3ed3048 [mpp_list]: Use class inheritance
Change-Id: I3ef33ca9bdcfea80a6c05a8c69db2d4938a5d0eb
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-01-19 17:06:16 +08:00
Herman Chen
bed754e33f [osal]: Use multiple status in MppThread
One thread May have multiple lock/wait/signal source:

Input  : signal source from input.
Output : signal source from output.
Control: signal source from async control operation.

Then the main working loop may stop on these lock/wait/signal points.

Change-Id: Ia6270b865cfb7087567fc21f07feb9248b929d7a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-28 09:48:35 +08:00
Herman Chen
2098ea9de1 [Thread]: Rename thread lock / signal type
Rename thread lock / signal type by its source.

Change-Id: I426cb9490dd05183badffa36f0a861c439c5f23b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2018-05-14 14:49:59 +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
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
d16a83fae4 [osal]: Add return value to condition wait
Change-Id: I4955ae98a714c227da4b2aacc9da063e05a64139
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-12-20 15:07:33 +08:00
Herman Chen
6a4c890291 [osal]: Add more function to Condition class
Change-Id: I31c5a2645a79576b6f1fe22285a9dfcf4b001293
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2016-12-20 09:56:07 +08:00
Lin Kesheng
60373a6973 [all]: format code
use fromdos to change file type, remove ^M in code.

Change-Id: I000202dc51fcff57cc0771455baebea595115b1d
Signed-off-by: Lin Kesheng <lks@rock-chips.com>
2016-09-08 15:21:02 +08:00
ChenHengming
1a2551ec3e [mpp_enc]: fix crash in vpu_api_legacy.cpp
[mpi]: use new control macro system

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1050 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-20 07:54:31 +00:00
GaoZhili
3fafb0fe4f commit the avc encode code, now avc encode process is ok
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1048 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-20 07:22:25 +00:00
GaoZhili
3249378118 only format the unformated code to standard style
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1020 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-07-14 09:34:04 +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
ChenHengming
c0866a76f9 [comment]: fix company name hand writing error
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@906 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-13 09:42:31 +00:00
ChenHengming
74bdf736f0 [mpp_thread]: add mpp_log.h for mpp_assert in thread class
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@903 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-06-12 02:59:24 +00:00
ChenHengming
50277780fc [mpp_thread]: fix compile error on windows and linux
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@774 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-05-19 06:35:22 +00:00
ChenHengming
7bd7a300e6 [osal]: better way to set thread name on android/linux
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@771 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-05-19 03:08:50 +00:00
ChenHengming
8199200963 [astyle]: format coding style on linux and remove warning
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@592 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-03-18 06:15:42 +00:00
ChenSiyong
5cf3dcb2dd [mpp_dec] add que display mux for frame que fixed thread async cause push frame que error
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@580 6e48237b-75ef-9749-8fc9-41990f28c85a
2016-03-02 02:33:00 +00:00
ChenHengming
cdac24a654 [mpp_thread]: remove warning of timedwait
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@497 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-12-02 23:08:05 +00:00
ChenHengming
3f7ef46a14 [osal]: add timedwait
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@493 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-12-02 22:49:45 +00:00
ChenHengming
107e40bf82 [astyle]: coding style formating
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@438 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-11-01 20:10:35 +00:00
ChenHengming
23652564dc [mpp_thread]: improve reset lock/condition implement
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@428 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-10-25 16:50:57 +00:00
ChenSiyong
838659a23c [mpp]: add seek reset flow
[h265d]:add seek part code

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@381 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-10-15 15:38:34 +00:00
ChenHengming
241f6865ad [osal]: add trylock to mutex class
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@230 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-09-07 15:29:49 +00:00
ChenHengming
8249f27074 [astyle]: format coding style
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@170 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-27 08:05:56 +00:00
ChenHengming
3612ed5876 [mpp/osal]: add codec thread and hal thread
1. add MppThread / Mutex / Condition class
2. add internal flag to MppBuffer
3. change MppBufferService from structure to class
4. add mpp_buffer_put on mpp_frame_put
5. add coding type to Mpp initial function
6. mpp codec / hal thread basic flow done, but reset is not added

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@168 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-26 12:46:38 +00:00
ChenHengming
3064dc36e5 [mpp]: add two thread to mpp
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@164 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-26 03:53:12 +00:00
ChenHengming
027f647eb8 [mpp]: add mpp_thread.cpp, add mutex_destroy to mpp_allocator, add codec thread and hal thread prototype
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@163 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-26 03:19:32 +00:00
ChenHengming
81d5c94884 [misc]: move PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP macro
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@125 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-18 13:11:45 +00:00
ChenHengming
a2e889937b [osal]: add semaphore.h to mpp_thread.h
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@112 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-17 07:42:22 +00:00
ChenHengming
52d5ffb332 [vpu_api_test]: add vpu_api_demo for testing and add msleep to mpp_time.h
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@73 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-12 03:34:28 +00:00
ChenHengming
848f7d93fe [all]: rename function names
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@60 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 09:14:00 +00:00
ChenHengming
1b5d44e56e [all]: rename file and macro from RK to MPP
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@59 6e48237b-75ef-9749-8fc9-41990f28c85a
2015-08-07 09:00:27 +00:00