Commit graph

642 commits

Author SHA1 Message Date
Vikash Garodia
76cae5a345 msm: vidc: Amend DCVS handling for encoder
For DCVS, there are mainly 3 buffer count watermarks
i.e low, normal, high. When the buffers held with firmware
goes above high or below low, DCVS changes the clock to
high or low respectively.
At this state, to come back to normal clock, it needs the buffer
in firmware to come back to normal count. For cases, when DCVS
decides to decrease the clock, the clock remains lowered till
the buffer count in firmware is back to normal. During this
phase, the clock remains low and impacts performance. Since
encode usecase always desire more clock, keeping low for them
leads to measurable impact.
The fix considers a case for encoder to bring back to normal
clock when the buffer count is more than low watermark.

CRs-Fixed: 2845570
Change-Id: I426a17f7b16db544ea09ec072c77e95198634c84
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2021-01-07 12:53:48 +05:30
qctecmdr
0dee8c8f6b Merge "msm: vidc: yupik: Add platform data" 2021-01-03 02:48:05 -08:00
Priyanka Gujjula
66265b505b msm: vidc: yupik: Add platform data
Add driver platform data for yupik
yupik_v0: 4k@60 Dec, 4k@30 Enc
Concurrency: 4k@30 Dec + 1080p@30 Enc
yupik_v1: 4k@30 Dec/Enc
Concurrency: UHD@30 Dec + 1080p@30 Enc
DDR5 UBWC3.0 HBB value: 15
DDR4 UBWC3.0 HBB value: 14

Change-Id: Ia33befb5eb9694fe7eded7b0bed662c0c406c6e9
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
2020-12-22 20:37:24 +05:30
qctecmdr
bb47cc0740 Merge "msm: vdec: update clock data frame rate" 2020-12-21 19:34:24 -08:00
qctecmdr
1fdde7ec26 Merge "msm: vidc: Update encoder o/p buffer size calc" 2020-12-21 19:34:24 -08:00
Shi Zhongbo
cf15569f3d msm: vdec: update clock data frame rate
Update clock data frame rate to client's set value
for mbps calculation so as to reject sessions out of
mbps capability.

Change-Id: I62559172b71fb4d2e911c16be7f07110e53f23a1
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
2020-12-17 22:24:10 -08:00
Priyanka Gujjula
e8004219db msm: vidc: Fix criteria for hierp num_ref calc
[1] num_ref for hierp has to be calculated only if
    max_layer value is > 1. Since max_layer value
    0/1 indicates absence of layer encoding.
[2] Fix hybrid_hp num_ref calculation inline with
    FW calc.

Change-Id: I507d58c33529e5976974cc2d5a6e2d3fd8c55026
2020-12-15 18:39:02 +05:30
qctecmdr
9fa40378bf Merge "msm: vidc: Fix mbpf calculation for active session" 2020-12-11 05:41:14 -08:00
Priyanka Gujjula
9aa7ae0ed1 msm: vidc: Update encoder o/p buffer size calc
Update enc o/p buffer size calc inline with
FW calculations.

Change-Id: Ie5aae40cb51909446430b7b8d5ff9405bbcd7f8b
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
2020-12-10 20:44:17 +05:30
Shi Zhongbo
8929fa4bcc msm: vidc: limit max and min auto frame rate
Limit auto frame rate to [1,platform frame rate capability]
before sending to firmware.

Change-Id: I96dc4b8d76b7752a76f6c15dcb6b20817857372f
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
2020-12-09 10:32:15 +08:00
qctecmdr
08a5f090b1 Merge "msm: vidc: update all intra to allow more than 30 fps" 2020-12-05 23:36:53 -08:00
qctecmdr
434d01ee17 Merge "msm: vidc: avoid access to unwanted register" 2020-12-05 15:12:18 -08:00
qctecmdr
bf4ebfcb5b Merge "msm: vidc: Update num_ref calc and limit max_layer" 2020-12-05 10:32:17 -08:00
Vikash Garodia
a30dfea155 msm: vidc: avoid access to unwanted register
While processing the response from video hardware, video
driver is accessing a register which does not exist. It
is even not needed for functionality purpose. Removing
the access for the same.

Change-Id: Ib4fec718d2f057860878bf8928b96fb46be47b13
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2020-12-03 14:11:43 +05:30
Vikash Garodia
ae4c88ee64 msm: vidc: update all intra to allow more than 30 fps
Certain clients enables all intra tests for 720p @42 fps.
To allow such configuration, which is within the allowed
specification, extend the capability.

Change-Id: I0a0247e95bb040635c92404c5a342c92c340154c
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2020-12-03 13:51:24 +05:30
Govindaraj Rajagopal
3cd260e651 msm: vidc: return appropriate error code for overload errors
Return -ENOMEM instead of -EBUSY for hardware overload errors.

Change-Id: I3b1c54e2035969c929bb2fdaea9e981e9c43ab32
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-12-02 20:09:40 +05:30
qctecmdr
1eddbdadbd Merge "msm: vidc: move inline functions into header file" 2020-11-30 23:46:57 -08:00
qctecmdr
ec1453ba71 Merge "msm: vidc: print only memory usage" 2020-11-30 07:31:20 -08:00
Govindaraj Rajagopal
395da1fe6e msm: vidc: move inline functions into header file
It's better to put inline function in header files
If not, gcc would complain "function body not available".

Change-Id: I81c363dc96bb4135593087e726d7a872b1bc3451
Signed-off-by: Jean Xiao <jianxiao@codeaurora.org>
2020-11-27 16:56:38 +05:30
Govindaraj Rajagopal
48fc0fe3e9 msm: vidc: update menu_skip_mask for menu type controls
Need to pass menu_skip_mask instead of step_size to
v4l2_ctrl_modify_range for menu type controls. Otherwise
step_size will override skip mask. Mostly step size value
is 1. So any menu_item with ctrl.val == 1, will not be
allowed at runtime.

Change-Id: If33f340a6e85335f80e3cf0a0b13266263e318ed
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-27 16:21:39 +05:30
Govindaraj Rajagopal
9e7171650a msm: vidc: print only memory usage
To avoid overlogging issue, print only memory usage
during session rejection.

Change-Id: Ie155d5611a998b8e32c8cc5700f4e0a7fbd558ae
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-25 17:15:17 +05:30
Govindaraj Rajagopal
1e662d20c0 msm: vidc: handle qbuf failure in batch_handler
if msm_comm_qbuf_to_hfi is failed at msm_vidc_batch_handler
path, then vb2_buffer refcount is still held at v4l2 layer.
So added error handling for qbuf failure at batch timeout 
sequence.

Change-Id: I61b14210ae382944e456df5c11790dc115ab2a15
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-23 18:10:28 +05:30
Govindaraj Rajagopal
7e5c67e9b0 Revert "msm: vidc: handle qbuf failure in decode batching usecase"
This reverts commit eb19e74fe0.
2020-11-23 18:10:28 +05:30
Chandrakant I Viraktamath
1fc8b2829c msm: vidc: Fix mbpf calculation for active session
Fix macro block per frame calculation by not
considering sessions which have state greater
than or equal to MSM_VIDC_STOP_DONE.

Change-Id: Ie25e52e946386fcf226b0f9c073c1b022cf1ac0c
Signed-off-by: Chandrakant I Viraktamath <civirakt@codeaurora.org>
2020-11-18 06:50:02 -08:00
qctecmdr
5796124eca Merge "msm: vidc: do not update inst state for map failure" 2020-11-11 18:12:30 -08:00
Govindaraj Rajagopal
eb19e74fe0 msm: vidc: handle qbuf failure in decode batching usecase
if msm_comm_qbuf_to_hfi is failed at msm_vidc_batch_handler
path, then vb2_buffer refcount is still held at v4l2 layer.
So added error handling for qbuf failure at decode_batching
sequence.

Change-Id: Ic900ff95faec075620323c989430dea7ce34f26b
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-11 22:45:40 +05:30
Malathi Gottam
a69feaa568 msm: vidc: Modify allocated buffer size for lower resolution
For targets that doesn't support 4k, current buffer size
of 3MB is modified for FWVGA and below resolution to 6 MB.

Change-Id: Id9152bf4b88a1b86d790bc061cd7265896c62a98
Signed-off-by: Malathi Gottam <mgottam@codeaurora.org>
2020-11-09 17:15:23 +05:30
qctecmdr
1380c1373c Merge "msm: vidc: change default step size" 2020-11-09 00:39:36 -08:00
qctecmdr
a25b3ff7e8 Merge "msm: vidc: optimize HEIC output buffer calc for encoder" 2020-11-08 22:32:30 -08:00
Govindaraj Rajagopal
b689990576 msm: vidc: do not update inst state for map failure
Currently for map failure inst->state updated to
MSM_VIDC_CORE_INVALID. So during flush driver issues
session_abort to firmware. So firmware asserts and
sends sys_error back. So added change to avoid
updating inst->state.

Change-Id: I30f90726d21cb13bf5a27dd3d259a8d026260746
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-09 11:42:28 +05:30
qctecmdr
c8b1d08726 Merge "msm: vidc: print inode and refcount for all dma_buffers" 2020-11-06 19:26:34 -08:00
qctecmdr
907f95adab Merge "msm: vidc: fix msm_vidc_err_recovery_disable for non_noc_err" 2020-11-06 16:58:39 -08:00
qctecmdr
110459ccf0 Merge "msm: vidc: fix format string mismatch" 2020-11-06 14:50:48 -08:00
Govindaraj Rajagopal
66e18fb51e msm: vidc: print inode and refcount for all dma_buffers
Print dma_buffer inode and file refcount details for all
dma buffers including dpb and driver internal buffers.

Change-Id: I3c22ccc1aaba555a3748d4607617737bd24adb12
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-06 02:53:56 -08:00
Govindaraj Rajagopal
f607704b44 msm: vidc: fix msm_vidc_err_recovery_disable for non_noc_err
disable error_recovery for non-NOC error if VIDC_DISABLE_NON_NOC_ERR_RECOV
is set. but error_recovery is getting disabled even for type NOC error
when VIDC_DISABLE_NON_NOC_ERR_RECOV is set.

[1] Only NOC error
    adb shell "echo 1 > /d/msm_vidc/disable_err_recovery"

[2] Only non-NOC error
    adb shell "echo 2 > /d/msm_vidc/disable_err_recovery"

[3] Both NOC & non-NOC error
    adb shell "echo 3 > /d/msm_vidc/disable_err_recovery"

Change-Id: Ia09ca23708d41a77f1d77cf6ed57506a16b32c73
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-06 12:52:00 +05:30
Priyanka Gujjula
90477015a6 msm: vidc: optimize HEIC output buffer calc for encoder
For HEIC encode, output buffer dimension is 512 x 512.
Updating total output buffer size as twice the frame
size of 512 x 512 for image sessions.

Change-Id: I69311b485072ef7f43afd23da690e77eecee180d
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2020-11-06 12:48:57 +05:30
Govindaraj Rajagopal
fe6842e274 msm: vidc: fix format string mismatch
Some debug prints doesn't contain proper args.
So added proper args.

Change-Id: I36fe3e967b3bf600b3a948cb88f556a4d93c02d1
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-11-06 11:19:22 +05:30
qctecmdr
0e572d9975 Merge "msm: vidc: Enable Average QP extradata" 2020-11-05 21:15:22 -08:00
Priyanka Gujjula
5bf834b78e msm: vidc: Update num_ref calc and limit max_layer
Limit max number of temporal layers to 4 if hybrid_hp
is not enabled as per POR. Also, inline num_ref
calculations with FW.

Change-Id: Iad1deaf757a8aa3715b2dce861b1454faeed7a39
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
2020-11-05 20:51:37 +05:30
Uma Mehta
9e9322b41d msm: vidc: Enable Average QP extradata
Enabling Average QP extradata

Change-Id: I94edb55f57ee0c88554a98688665bf2eb805045e
Signed-off-by: Uma Mehta <umamehta@codeaurora.org>
2020-11-05 04:45:18 -08:00
qctecmdr
34fa9710d1 Merge "msm: vidc: fix ctrl limits update for MENU type" 2020-11-05 01:43:05 -08:00
Vikash Garodia
cc97f61b4b msm: venc: add support for boost for holi
For holi, boost is set as 15%. With the change,
a level of 15% can be set to video firmware.
Also ensure that the boost is set only when client
has set the boost control.

CRs-Fixed: 2810440
Change-Id: Ib4e4c5511c57daa78b405f8a92c2ee924b1cc1bd
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2020-11-04 17:49:31 +05:30
Qiwei Liu
92828b48ee msm: vidc: fix ctrl limits update for MENU type
When update limits for MENU type controls, should keep
original menu_skip_mask, shouldn't replace it with step_size.

Change-Id: I9706f139fd299f7ca931d812e1a95017606a2267
Signed-off-by: Qiwei Liu <qiweil@codeaurora.org>
2020-11-03 21:56:29 -08:00
Uma Mehta
d427f1ffde msm: vidc: change default step size
change default step size for encoders
on different targets to 2.

Change-Id: I0db827920f6c452154296b79e8641e1aba0b03ab
Signed-off-by: Uma Mehta <umamehta@codeaurora.org>
2020-11-03 03:25:15 -08:00
Qiwei Liu
af73385543 msm: vidc: fix BW overvote due to wrong worst_cf in fbd
For worst complexity factor received in fbd, also need
to divide it by frame_size, otherwise will cause
bus BW overvote.

Change-Id: Ibb20103c4ab8e3830eea8cf8a04b32f421b60362
Signed-off-by: Qiwei Liu <qiweil@codeaurora.org>
2020-11-03 13:31:15 +08:00
qctecmdr
a9c461984c Merge "msm: vidc: resolve use-after-free problem" 2020-10-30 16:47:10 -07:00
qctecmdr
101705d250 Merge "msm: vidc: Handle race condition for accessing session head" 2020-10-30 14:19:53 -07:00
Govindaraj Rajagopal
459ecf6ee6 msm: vidc: tune dynamic framerate logic
Some vp9 clips contains alt-ref frames(decode only) at
periodic intervals and that particular frames buffer ts
delta is very low(as low as 1 ms). So dynamic framerate
calculation in driver is going for a toss.

To mitigate above problem, taking avg framerate instead
of max value.

Change-Id: I0f320c6a24199efe28d357d53c7cc9ddf6fc3062
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-10-29 14:41:33 +05:30
Govindaraj Rajagopal
34f376ccdc msm: vidc: Handle race condition for accessing session head
Currently session_end() accesses &dev->sess_head without device->lock.
So there are high chances of use-after-free in &dev->sess_head.

Change-Id: I34593e6507da9bad13c6d92faf40c4d790825d39
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-10-28 13:02:06 +05:30
Govindaraj Rajagopal
4b02c344e1 msm: vidc: resolve use-after-free problem
msm_vidc_open() failure is freeing the inst structure which might have
been under use by other threads and hence use kref_put instead of kfree
instance in msm_vidc_open() to resolve use-after-free problem.

Change-Id: I611aa6347da6c884345890153c7f7e4525a4307c
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2020-10-27 19:04:54 +05:30