diff options
| author | Ken Chang <kenc@nvidia.com> | 2021-12-13 00:04:12 -0500 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2022-01-07 09:10:42 -0500 |
| commit | 643a51e0eb2b3eb2c3cecc6777e20ff040e2483b (patch) | |
| tree | 54d0e8d0218b09d170a843a817bb25e8e3adbbb1 /scripts | |
| parent | aead036da110062df01a7a4f92592e95f3970a18 (diff) | |
media: tegra: camera: vi2: refactor low-latency mode code
A frame capture may fail somewhere between the frame start and the frame
end,e.g., the below error prints:
2021-11-04T10:11:31.561+00:00 kernel: [ 794.777229] tc358840 1-001f: event: resolution change (EQ_BYPS=1): 3840x2160p29.94 (4400x2250)
2021-11-04T10:11:32.167+00:00 kernel: [ 795.379917] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.167+00:00 kernel: [ 795.386292] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.191+00:00 kernel: [ 795.404274] vi 54080000.vi: tegra_channel_error_status:error 20022 frame 0
This means checking SOF in the capture thread doesn't help avoid a failure
in the release thread. Hence we can simplify the capture thread to program only
the capture released settings, skip the checking of SOF and leave the checking
of vi/csi status and the recovery process to be done in the release thread.
Also simplify vi2_channel_stop_streaming() to not invoke tegra_channel_capture_done()
as the buffers shall be well handled in tegra_channel_queued_buf_done() with
VB2_BUF_STATE_ERROR state.
In the original implementation, chan->syncpt[index][] will be re-allocated for
every single stop_streaming()/start_streaming() pair, so the syncpt IDs may
change. This is causing the problem: the syncpt IDs armed for the previous
failing capture are still queued in the FIFO and will be used for the next
successfull frame capture, however new syncpt IDs are allocated for the new
coming frames, e.g, the below error prints:
2021-11-23T08:12:59.038+00:00 kernel: [ 590.029312] tegra_channel_capture_frame_multi_thread[570]: rv 4, cv 3, stm Y
2021-11-23T08:12:59.038+00:00 kernel: [ 590.036865] tegra_channel_enable_stream[212] -- begin
2021-11-23T08:12:59.044+00:00 kernel: [ 590.042437] tegra_channel_enable_stream[221] -- end
2021-11-23T08:12:59.263+00:00 kernel: [ 590.251676] video4linux video0: frame start syncpt timeout!0
2021-11-23T08:12:59.263+00:00 kernel: [ 590.257419] tegra_channel_ec_recover[337] -- begin
2021-12-03T11:14:36.763+00:00 kernel: [ 1049.109289] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:14:36.763+00:00 kernel: [ 1049.115121] vi2_channel_start_streaming[949]: syncpt id 24, max 5064, min 5064
2021-12-03T11:14:36.771+00:00 kernel: [ 1049.123116] vi2_channel_start_streaming[949]: syncpt id 28, max 1614, min 1614
--> the syncpt id being used for this streaming are 24/28, these two syncpts are used since the first streaming
...
2021-12-03T11:14:39.244+00:00 kernel: [ 1051.597885] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 5101
2021-12-03T11:14:39.303+00:00 kernel: [ 1051.663550] tegra_channel_release_frame[701] -- end: buf->thresh 5101
2021-12-03T11:14:39.350+00:00 kernel: [ 1051.703617] vi2_channel_stop_streaming[1065] -- end
--> no problem observed, and capture cancelled due to stop_streaming
...
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.871259] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.876860] vi2_channel_start_streaming[949]: syncpt id 36, max 0, min 0
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.884187] vi2_channel_start_streaming[949]: syncpt id 38, max 0, min 0
--> the syncpt id being used now are changed to 36/38
...
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891728] tegra_channel_capture_frame_multi_thread[514] -- begin
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891771] vi2_channel_start_streaming[992] -- end
2021-12-03T11:15:09.552+00:00 kernel: [ 1081.904384] tegra_channel_capture_frame_multi_thread[569]: rv 119, cv 119, stm N
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958030] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 1
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958086] tegra_channel_release_frame[669] -- begin
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.162133] video4linux video0: tegra_channel_release_frame: MW_ACK_DONE syncpoint time out!0
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.170683] tegra_channel_release_frame[680]: buf->thresh[0] 1
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.176972] tegra_channel_release_frame[683]: syncpt 36, hw val 0
2021-12-03T11:15:09.829+00:00 kernel: [ 1082.183715] tegra_channel_ec_recover[337] -- begin
Given Hw doesn't support SYNCPT FIFO reset per stream, reuse the same syncpt IDs
until the channel is powered off.
Also skip invoking tegra_channel_capture_done() from vi2_channel_stop_streaming()
and tegra_channel_release_frame() from tegra_channel_stop_kthreads() as streaming
shall be stoped immediately and the queued buffers shall be well handled in
tegra_channel_queued_buf_done() with the VB2_BUF_STATE_ERROR state.
Bug 3423623
Change-Id: I53280bc9b1b3c33054d766aa920eb082b3311d92
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645502
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Jerry Chang <jerchang@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
