Commit Graph

2797 Commits

Author SHA1 Message Date
Herman Chen
17a872e4b9 [mpp_buffer]: Fix error on releasing leaked buffer
The static lock maybe release before mpp_buffer_service. So we should
not used the lock on finalizing stage.

Change-Id: Ibf207e02e4fcdc2b5280ea58bd68372a7888a60a
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-25 11:17:38 +08:00
Herman Chen
5b05a3c5e9 [misc]: Add O_CLOEXEC flag on file open
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>
2021-06-25 10:32:04 +08:00
aaron.sun
a748e54e88 [drm]: Fix drm handle issue
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>
2021-06-25 08:58:10 +08:00
Yandong Lin
ad3d2bb696 [h264d_vdpu]: Fix ref list err issue
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I688b90f34dc08521cbaa0f0cdcfe149665882179
2021-06-24 08:36:01 +08:00
Johnson Ding
f891449b80 [jpegd]: reset syntax struct before parsing
Incase of some application not reinit Mpp Context for the next JPEG
decoding, some of syntax info will not be overwrite and it will leads to
hardware decoder error. So syntax struct should be cleaned before
parsing.

Change-Id: Iea8d76f0086fe7675d463f497c7a9dc106bdb546
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-23 16:26:51 +08:00
sayon.chen
17a7c77ee3 [hevc_vepu541]: Fix non_ref frame reg cfg issue
Change-Id: I10d79b5c270c90059a274be36bb77d778ece2d73
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-23 14:45:00 +08:00
sayon.chen
e3e2c2d6b0 [h265d]: Fix scaling_list address set issue
Change-Id: I228981e9c0ca55fb57d61f6d8f0fa170cc7966e3
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-23 14:12:23 +08:00
sayon.chen
4753cbc4e0 [h265d]: Fix error on split with redundant data
When split_nal_units found valid nal to decode just return success and
let hardware try to decode the valid nal with redundant data.

Change-Id: I7afb4bd55181d583f46dfc0192c622fc88445d6d
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-23 14:00:55 +08:00
Herman Chen
221d939485 [mpp_enc_refs]: Fix error on mark LTR on IDR frame
When mark IDR frame as longterm reference frame the longterm reference
frame index must be zero. So when user marked IDR frame to be non-zero
lt_idx just reset it to zero lt_idx.

Change-Id: Iec994f6891269ac47137ec68c2c82db5f33f40da
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-22 14:04:15 +08:00
sayon.chen
b86aa171f3 [h265d]: Support hw resolution capability check
Add hw capability to parser and check resolustion based on
hardware capability.

Change-Id: I6f7ff7a56d0e46d6ca9cb0dcd547e74fd15d7bc1
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-18 10:23:29 +08:00
sayon.chen
9eb347a5ae [h264d]: Support hw resolution capability check
Add hw capability to parser and check resolustion based on hardware
capability.

Change-Id: Id9b719b238c74d6b77f78fd8d583a3de854a94f4
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-18 08:56:57 +08:00
Siyong Chen
0383d8258d [vproc]: Expose hw feedback information to vproc
Return hw detection result from iep2 hal to vproc.

Change-Id: I53acb5260b5806abb6ba9085b81c967f30ea3f13
Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
Signed-off-by: Siyong Chen <sayon.chen@rock-chips.com>
2021-06-11 10:50:20 +08:00
Siyong Chen
250a890f96 [vproc]: Fix confliction of detection and config
Field order detected by hw will be covered by outside config
in previous commit, and cause video jarring when video field
order provided by video header information is incorrection.

Change-Id: I2d76ff5dc544026acd6450965294998bf9ecc06a
Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
Signed-off-by: Siyong Chen <sayon.chen@rock-chips.com>
2021-06-11 10:49:54 +08:00
Yandong Lin
e6d4d6969b [h264d_dpb]: Fix mismatch the num of dpb_mark and fs issue
When fail in store_picture_in_dpb, the dpb_mark and fs binding failed,
the num of dpb_mark and fs does not match, so should flush cur dpb_mark.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I03acc107de655297857fbe56a0f4434576cca49e
2021-06-11 09:54:30 +08:00
Johnson Ding
23c086c88a [jpegd]: Fix marker parsing
When a new start code is not right after the last marker section, parser
will go wrong.

Change-Id: I84a06ed697ccb5900fb76044f36a00f4ea7566f5
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-07 10:21:30 +08:00
Johnson Ding
559b030bcb [jpegd]: Fix timeout problem
When decoding a YUV444 picture with format convertion, it may encounter
timeout error.

Change-Id: I9a9f6eda6c9ee92e029530c0dbbb8ad7f48d9d18
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 18:02:30 +08:00
Johnson Ding
f1c2d025b4 [jpegd]: Suport RGB32 format output
Change-Id: I2eed0a16895196a1270ba3d8e1ec6074be533f4f
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 18:00:17 +08:00
Johnson Ding
b582fd8e2c [jpegd]: Fix parser error handling
Abort decoding when parser found corrupt stream

Change-Id: Ie828ed61b12cf6dc0817a8e96fddc9940e4f4efe
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 17:54:50 +08:00
Johnson Ding
0b506c18b9 [jpegd]: Do not parse Comment segment
Change-Id: Ie04056cbe255c772f4486d6ca80162c6618c1fa4
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 17:44:15 +08:00
Johnson Ding
1f76ce416d [jpegd]: handle extra JPEG header case
In case of some JPEG file with multiple stream header, continue to
search all markers even SOS is found.

Change-Id: Ic13c2d43f97a4b52ec5233db2de362d83ccb86a9
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 17:35:38 +08:00
Johnson Ding
7b680e6e6f [jpege]: Support writing EXIF and MPF data
EXIF and MPF data can be write by send user data via KEY_USER_DATAS.

Change-Id: Ib9b5a117433437c202bf354d59dc404c76a4db5f
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-06-04 16:54:52 +08:00
Herman Chen
ecf7531cf8 [mpp_dec]: Add batch_mode config to MppDecBaseCfg
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Id0c247609e14a7f8d4042404783a6a5044d0a1c6
2021-06-04 09:43:40 +08:00
Herman Chen
16ce9d1f6b [mpp_server]: Add mpp_server module for batch mode
Batch mode will send multiple task to kernel at one time. And its
non-block poll is triggered by timer and looper.

This mode will reduce the ioctl overhead on ultra multi-instance case.

Main features and some notes:
1. Each client type has independence batch server.
2. Each mpp_device can attach or not attach to server independently.
3. When a device is attached to server all its tasks will be sent to
kernel through the server session not original client session.
4. The tasks are sent non-block and wait in block or non-block.
5. The batch mode can only be switch on/off when hardware is not
working.

Change-Id: I07462d852cb002259d2873e13c12f6f8a489ba8e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-04 09:02:30 +08:00
sayon.chen
7bf5ddae98 [rc_v2]: Fix struct read overflow
Change-Id: I53a1440b7921b7a6f656b936669131a9418549f0
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-04 08:49:05 +08:00
Herman Chen
a010011064 [osal]: Use strof_ function in mpp_service
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I059e79326f994fa9b172074a9f12f9f0a8c12c6b
2021-06-03 10:41:33 +08:00
Herman Chen
b6c914a74d [osal]: Add osal_2str function
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I4f97a0938baa5d62c405f79c326a18b3ff6478f0
2021-06-03 10:26:06 +08:00
Herman Chen
3084d79375 [license]: Add apache license file
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I58c6e7bce3c906f5383082085a7c7f8f4985394b
2021-06-03 10:04:30 +08:00
Herman Chen
dc6e82f146 Move implement define to new header
Change-Id: Ic8bde5aa6ea9faf25793bb91a420bfeba0e9e9f7
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-06-02 15:55:25 +08:00
sayon.chen
f53dfac47c [rc_v2]: Support hierarchical QP cfg
Change-Id: I0827689ee27a7007cb157b2990089e3c34c6ad50
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-06-02 15:24:24 +08:00
Yandong Lin
2a93497b33 [hal_vdpu34x]: Set hurry mode
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: If71e58971663edbcdb004382b58ad0fc99d67543
2021-06-01 16:30:54 +08:00
Herman Chen
587aebf97c [rc]: Fix gop frame count update error
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Ia1231605c48e6ca504a90ebb2fcf7afe38a632ed
2021-06-01 11:01:35 +08:00
sayon.chen
aa57abeb40 [vpu_api_legacy]: Support format stride setup
Change-Id: I8d166fda19b8ed01c2824164a8ad3d5229f4b5ea
Signed-off-by: sayon.chen <sayon.chen@rock-chips.com>
2021-05-31 14:05:30 +08:00
Herman Chen
9ba242bb9c [mpp_enc]: Change thread name rule
Change-Id: Iddaa528e83828057de428e0076c253a0c7efae97
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-22 16:17:04 +08:00
Yandong Lin
33784aca30 [rkv_enc_cmd]: Fix check info err when enc_cfg_set
Fix issue frome github:
https://github.com/rockchip-linux/mpp/issues/201
Err message:
mpp_cfg: cfg h264:max_tid expect RK_S32 input NOT RK_S32
mpp_cfg: cfg h264:max_ltr expect RK_S32 input NOT RK_S32
mpp_cfg: cfg h264:prefix_mode expect RK_S32 input NOT RK_S32
mpp_cfg: cfg h264:base_layer_pid expect RK_S32 input NOT RK_S32

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I9dbd49a6ce04807455d1a7dc090cad96ae0f2c83
2021-05-21 15:41:11 +08:00
Yandong Lin
a0ec1ba235 [rkv_enc_cmd]: Fix check info err when mpp_enc_cfg_set
Err message:
mpp[16915]: mpp_cfg: cfg h264:poc_type expect RK_U32 input NOT RK_U32
mpp[16915]: mpp_cfg: cfg h264:log2_max_poc_lsb expect RK_U32 input NOT
RK_U32
mpp[16915]: mpp_cfg: cfg h264:log2_max_frm_num expect RK_U32 input NOT
RK_U32

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ide77867beed2ee4e94df1179882713e600d3448b
2021-05-21 11:39:00 +08:00
Herman Chen
dbd2e2a77b [mpi]: Add mpp_start and mpp_stop
The purpose of mpp_start and mpp_stop is to break mpp_init_into two
stage.

Original mpp_init conbine the init and start for example mpp_dec_init
and mpp_dec_start then the global (or static) config which dominate the
fundamental working way can be only be set before mpp_init. That is
unreasonable. Another example is the encode memory prealloc flow.

The mpp_start is added to end global param receiving and do real
preparation of current operation in mpp_init.
The mpp_stop is the opposite of mpp_start.

Change-Id: I2bdcc29a9ff75777acc5c39c7e7f01477e597bb0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-20 10:24:25 +08:00
Caesar Wang
94a8f7dd95 [debian]: update changelog
Release v1.5.0 mpp for debian.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Change-Id: I5b1677a42dbbf6ac1a4145bd605a27d8f3b1514b
2021-05-20 10:18:50 +08:00
Herman Chen
b696216330 [mpp_enc_impl]: Cleanup hal_task on empty eos task
When empty eos frame input as last frame the hal_task packet len should
be clear.

Change-Id: Id25686a598853d0808105bf6eedb0b7e41247f16
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Signed-off-by: Siyong Chen <sayon.chen@rock-chips.com>
2021-05-19 11:42:05 +08:00
Herman Chen
a8ac97e5a9 [mpp_time_test]: Add timer test case
Change-Id: I65d4da1431fb68d0e8482aafb30dbeb651156d28
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-17 20:04:33 +08:00
Johnson Ding
44e96b5fc0 [mpeg4d]: Fix eos mismatch problem
See https://redmine.rock-chips.com/issues/297503

Change-Id: I601f9161d73bdb499c10391738198f40a6e2b33c
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
2021-05-17 14:40:10 +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
Herman Chen
53a5653cc8 [mpp_list]: Update C macro
Change-Id: I05813bdc0f6047617d10654579949226900b781f
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-17 11:26:50 +08:00
Yandong Lin
bf6a59f67f [jpege]: Support jpeg enc dynamic setting rotation param
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Id93d8f67f0eb7da920c84888f3e3c155107a6d03
2021-05-14 14:25:23 +08:00
Yandong Lin
ffe4ef768b [hal_vp8e]: Fix vp8e not support argb source issue
Configure the input format correctly

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I39317351c8905c28c0fb94d7378ec0615060387c
2021-05-14 10:36:47 +08:00
Yandong Lin
f9ffe330b8 [hal_h264d_vdpu34x]: Reduces the number of calls to mpp_put_bits()
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I9115d8c55dedcbaf097b16df6615d6f46680765b
2021-05-13 17:49:13 +08:00
Ding Wei
7f1b5ab31a [h264d]: Optimize the sps&&pps reference codes
if sps_id&&pps_id has not change,then regards as not need to
refill spspps buffer data.

Change-Id: I7616d913800b1b4865999f11ce6fb7e71fabc41f
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2021-05-13 17:48:37 +08:00
Siyong Chen
3c317fedf3 [rc_v2]: Fix bitalloc size equal 0 cause div 0
1. Add moving_ratio check min value clip to 1
2. Add vi_sacle check min value clip to 16

Change-Id: I463db12610d9b1f97493f5d594e7eaf5c2ed5532
Signed-off-by: Siyong Chen <sayon.chen@rock-chips.com>
2021-05-13 10:33:36 +08:00
Herman Chen
d1366a4801 [mpp_mem_pool]: Move mpp_mem_pool to osal
Change-Id: I124f38bc58f791993515544af2c59169ee2c2402
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-12 20:47:36 +08:00
Herman Chen
2204012fb3 [mpp_buffer]: Fix error on buffer group reset
At buffer create stage and ref_count is still zero if buffer group reset
happens the just created buffer will be marked discard and cause error.

Change-Id: Idc163f81edd055d8cc33ce6d80ca041adc973878
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
2021-05-12 20:31:56 +08:00
Yandong Lin
825467160e [hal_vp9d_rkv]: Fix mv base offset err
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I51dd75670b5a473624b441d49b66e1c071615469
2021-05-11 11:50:27 +08:00