Commit Graph

858 Commits

Author SHA1 Message Date
qctecmdr
1dafcfd11a Merge "video: driver: fix enable_bugon debugfs property for WD timeout" 2021-10-22 14:37:00 -07:00
Maheshwar Ajja
5ec009352f video: driver: update decoder load calculation
Calculate video decoder load based on max of crop and
input port resolution as few clients might not set
resolution on input port in which case load is not
proper before streaming started.

Change-Id: Id95d42e4cb3d992f759ce3388a8aeb55fadf16d7
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2021-10-22 12:45:32 -07:00
qctecmdr
ae93550604 Merge "video: driver: add dpb buffer handling for b2b ipsc cases" 2021-10-22 12:42:52 -07:00
qctecmdr
554cadb057 Merge "video: driver: Cancel batch work in case of pm_suspend" 2021-10-21 17:23:51 -07:00
Darshana Patil
f257df52e0 video: driver: update resolution check for max session support
Treat resolutions above (4K + half 4k) as 8k session instead of
simply treating above 4k resolutions as 8k sessions. Similar update
for 1080p and 720p resolutions as well.Based on above conditions,
support or reject a session.

Change-Id: I7be70b4c2b6e96ced6da2443f85e440c45fb616c
Signed-off-by: Darshana Patil <darshana@quicinc.com>
2021-10-21 10:59:18 -07:00
Priyanka Gujjula
4970193ad1 video-driver: add mmrm query support
[1] Disable MMRM if platform feature
    does not support.
[2] Query for scaling support from
    mmrm driver and enable/disable
    based on queried support
    accordingly.

Change-Id: I34cf9a9e150b0823828507e3f5d680aae6eb14d4
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
2021-10-21 23:16:13 +05:30
Govindaraj Rajagopal
1de4ced523 video: driver: fix enable_bugon debugfs property for WD timeout
Currently enable_bugon debugfs feature not working for WD timeout
cases. So added change to support that usecase.

Change-Id: I0cb3e6ed34d58c7969c727dea77f4fa695923c25
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-10-21 19:05:32 +05:30
Priyanka Gujjula
0a135fec38 video: driver: Cancel batch work in case of pm_suspend
Cancel batch work when core is suspended due to
pm suspend.

Change-Id: I5c6e4f0eb0883a9c3cd2711f65e0d74a6cced310
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
2021-10-21 14:37:00 +05:30
Govindaraj Rajagopal
839a329864 video: driver: add dpb buffer handling for b2b ipsc cases
Currently MSM_VIDC_BUF_DPB buffer allocated and queued to firmware
as part of output port streamon. Sometimes firmware raises b2b ipsc
with only change in fw_min_count. So client will not follow port
reconfig sequence and calls directly HFI_CMD_RESUME on output port.
So firmware holds only prev set of DPB buffers, which is not sufficient
and it continues to wait for further DPB buffers and that is leading
to stall and testcase fails. So added change to requeue new set of
DPB buffers, incase of b2b ipsc(with only change in count).

Change-Id: I213c752be4ca9dc16f838ab2990c996c4d78e95f
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-10-21 14:16:57 +05:30
qctecmdr
376bf106de Merge "video: driver: acquire and release wakelock during fw_load" 2021-10-19 15:11:41 -07:00
Darshana Patil
784a4c9280 video: driver: add power suspend and resume
add power suspend and resume implementations.

Change-Id: I785b5b05f37ed5ed656d2cbc04f5d429ff543260
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-10-18 12:27:48 -07:00
qctecmdr
2f0f48f55e Merge "video: driver: fix race issues with msm_vidc_stats_handler api" 2021-10-17 23:23:27 -07:00
Govindaraj Rajagopal
38da39c7ee video: driver: acquire and release wakelock during fw_load
Acquire wakelock to prevent system suspend during firmware load
sequence to avoid firmware load request failure.

Change-Id: I320db4a02b310acf5b5d9dd9a4f304b94e1c2f5b
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-10-14 11:00:20 +05:30
Govindaraj Rajagopal
d11e238157 video: driver: alter stage, pipe setting sequence to avoid vcodec hung
Currently stage and pipe is configured from output port start/resume
sequence. During VSP processing FW has no clue about stage, so default
it picked 2 stage. Later host sets 1(due to < 720p) stage at output
port. VSP is already started operating on input frames. So this
mismatch in stage settings was leading to vcodec HW hung issues.

Setting STAGE, PIPE settings at input port start/resume to avoid
above mentioned issues.

Change-Id: I7febe46d45c8e30a29b58d725d5298220fdbd8b2
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-10-12 18:54:36 +05:30
Govindaraj Rajagopal
2eb5672463 video: driver: fix race issues with msm_vidc_stats_handler api
There are 2 possible race issues with msm_vidc_stats_handler.

[1] msm_vidc_close acquired inst->lock and called cancel_delayed_work,
by that time stats_handler already fired and incremented inst->kref
via get_inst_ref. Close sequence releases the lock and called
put_inst().
So now inst strong ref is held by stats_handler, which will acquire
inst->lock and schedules new stats_work and does put_inst. inst->kref
count reaches zero and it will free inst struct(using close_helper).
So that will lead to use-after-free crash at core kernel side.

[2] msm_vidc_close acquired inst->lock and called cancel_delayed_work,
by that time stats_handler is scheduled. So process_one_work() from
workqueue is ready to call stats_handler api. But before it invokes
stats handler(context switch), msm_vidc_close sequence continued to
run and completed the close sequence and called put_inst. So inst
struct got freed up(because inst->kref count reached to zero). Now if
core kernel(workqueue) attempts to invoke stats_handler by calling
worker->current_func(work), will lead to again use-after-free crash.

Added changes to avoid above mentioned issues.

Change-Id: I55bc33a753f4dbae4a8cdc6373b5465d183da3bc
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-10-12 17:31:39 +05:30
qctecmdr
b1c38f2133 Merge "video: driver: add all intra encoding support" 2021-10-06 13:26:49 -07:00
qctecmdr
7a9bf3b45c Merge "video: driver: modify FW i/p o/p buffers starve condition" 2021-10-06 11:34:52 -07:00
qctecmdr
0dfacae794 Merge "video: driver: add error handling in print_vidc_buffer api" 2021-10-06 11:34:52 -07:00
qctecmdr
3fd62947ac Merge "video: driver: enable lossless encoding via debuf fs property" 2021-10-06 09:20:20 -07:00
Gaviraju Doddabettahalli Bettegowda
10990e39f9 video: driver: add error handling in print_vidc_buffer api
Possiblity of invalid ptr dereference in release_buffer_done
sequence. So added changes to handle this scenario.

Change-Id: I0f45e07d709d0fd300a172b564031e40eb07ff00
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <gdoddabe@codeaurora.org>
2021-10-06 21:27:21 +05:30
Akshata Sahukar
f6a9744ff2 video: driver: modify FW i/p o/p buffers starve condition
Host needs to ensure FW atleast have 2 buffers available always,
one for HW processing and another for fw processing in parallel
to avoid FW starving for buffers.

Change-Id: I244e0170944b0b7ec342aa9b1b141b30af5bf606
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-10-05 13:14:01 -07:00
Manikanta Kanamarlapudi
1763bbebca video: driver: Error handling for HW overload scenarios
- send error '-EAGAIN' when there are no inactive sessions,
  HAL will retry with low priority.
- send error '-ENOMEM' when there are inactive sessions,
  Frameworks will close the inactive sessions

Change-Id: Id28a6f3c5f9d537a2789ef1522505b6ebedccc0b
Signed-off-by: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
2021-10-04 13:18:08 -07:00
Darshana Patil
fc6c35e8de video: driver: add all intra encoding support
add ALL_INTRA database entry and its dependencies.
implement adjust functions.

Change-Id: Ib4522666b6c2ef7dcb5adf9110a2fd5d2daf4654
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-10-04 10:40:32 -07:00
Akshata Sahukar
6df2a1bfcd video: driver: enable lossless encoding via debuf fs property
enable lossless encoding via debuf fs property "lossless_encoding".

Change-Id: Ic7f7341ecf3ad07e55434339a0c5789334bf7929
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-10-01 11:54:06 -07:00
qctecmdr
4d51b2ba26 Merge "video: driver: bump clockrate and bandwidth for 960FPS" 2021-09-30 18:43:44 -07:00
qctecmdr
0d2b06cc98 Merge "video: driver: fix null pointer dereference issues" 2021-09-30 11:01:34 -07:00
qctecmdr
812db715a2 Merge "video: driver: debugfs update for clockrate,bandwidth setting" 2021-09-30 11:01:34 -07:00
Gaviraju Doddabettahalli Bettegowda
11c3efeb47 video: driver: Power collapse Log level change
Currently, the below info printing as a error.
"msm_vidc: err : ffffffff: codec: power collapse already scheduled"

When multiple session is running, the above log will print multiple times &
this is not an error, so added change to print above log as info.

Change-Id: Iad961c29212579ee46a4cea47f7762f714c5e7ba
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <gdoddabe@codeaurora.org>
2021-09-30 13:39:42 +05:30
Darshana Patil
535dba47c0 video: driver: debugfs update for clockrate,bandwidth setting
/d/msm_vidc/core_clock_voting will modify only clock rate
and not ddr and llc bandwidth.
example usage:
adb shell "echo 444000000 > /d/msm_vidc/core_clock_voting".

introduction of /d/msm_vidc/ddr_bw and /d/msm_vidc/llcc_bw
which will modify ddr and llc bandwidth respectively.
example usage:
adb shell "echo 5000000 > /d/msm_vidc/ddr_bw_kbps".
adb shell "echo 7000000 > /d/msm_vidc/llc_bw_kbps".

Change-Id: If4aca728cae212630928dda69a38310d8268b5e1
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-09-29 16:16:15 -07:00
Darshana Patil
9f22d1b8bc video: driver: bump clockrate and bandwidth for 960FPS
increase clockrate and bandwidth by 25percent for
960fps decode session and disable dcvs.

Change-Id: I40aef0a9b8f0950b559ee301549869e20e881a40
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-09-29 15:00:20 -07:00
Akshata Sahukar
ffc21eaaf0 video: driver: fix null pointer dereference issues
fix null pointer dereference issues causing KW issues.

Change-Id: I7d9bb05d77d632b3ff479940ecb2163e6e68fd56
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-09-29 14:29:34 -07:00
Govindaraj Rajagopal
caeaca6ccd video: driver: disable and unprepare clock source to update MMRM count
[1] Currently enable/disable clock(video_cc_mvs0_clk_src) not called. So
updating clock reset value to MMRM is getting skipped. So MMRM has high
projection
[2] __scale_clocks() api is not considering scaling factor, while
setting clock rate.

Added change to address above 2 issues.

Change-Id: I4e96556f9b9d659c436e77d03f8d0dd471a50226
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-09-28 19:06:14 +05:30
qctecmdr
68c66ecacf Merge "video: driver: Enable msm_vidc_events trace" 2021-09-27 14:17:33 -07:00
Akshata Sahukar
7e75edbeeb video: driver: Avoid setting same GOP size to fw dynamically
Avoid setting same GOP size to fw dynamically to avoid unnecessary
generation of IDR frame from firmware.

Change-Id: I50c61e9f86ebc9c8a3834fbceb525666b7b194bb
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-09-27 11:53:44 -07:00
Gaviraju Doddabettahalli Bettegowda
91c6dccf94 video: driver: Enable msm_vidc_events trace
Enable tracing by adding trace function definitions.

Commands for collecting msm_vidc_events traces:
- adb shell "echo 10240 > /sys/kernel/tracing/buffer_size_kb"
- adb shell "echo 0 > /sys/kernel/tracing/tracing_on"
- adb shell "echo nop > /sys/kernel/tracing/current_tracer"
- adb shell "echo > /sys/kernel/tracing/set_event"
- adb shell "echo 1 > /sys/kernel/tracing/events/msm_vidc_events/enable"
- adb shell "echo 1 > /sys/kernel/tracing/tracing_on"
- adb shell "cat /sys/kernel/tracing/trace_pipe > /data/trace_log.txt"
- adb pull /data/trace_log.txt

Events:
- msm_v4l2_vidc_fw_load
- msm_v4l2_vidc_open
- msm_v4l2_vidc_close
- msm_vidc_dma_buffer
- msm_v4l2_vidc_buffer_event_log
- msm_vidc_perf_power_scale
- msm_vidc_common_state_change
- venus_hfi_var_done

These are the events registered.

Change-Id: Iab6952bb84df102f36a2776fdf9ef5133034c5a0
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <gdoddabe@codeaurora.org>
2021-09-26 22:18:42 -07:00
Akshata Sahukar
e2ec45b2e0 video: driver: reject 7th VP9 decoder session
reject 7th VP9 decoder session.

Change-Id: I2b739be0aff5492bd10d00c3068aa44e0895ee09
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-09-16 16:06:59 -07:00
qctecmdr
7b01c24a8d Merge "video: driver: print frame-number for each ETB, EBD, FTB, FBD" 2021-09-16 13:23:11 -07:00
Gaviraju Doddabettahalli Bettegowda
566791bd82 video: driver: print frame-number for each ETB, EBD, FTB, FBD
- Added changes to print frame-number for each ETB, EBD, FTB, FBD.
- framenumber will be helpful to detect logdrop in perf analysis.

Change-Id: I1b6c8fdbeb2f2003e69d02cd5d871535e8e73c42
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <gdoddabe@codeaurora.org>
2021-09-16 21:15:15 +05:30
Akshata Sahukar
9d5ba49ad0 video: driver: reject opening 17th video instance
Reject opening 17th video instance.

Change-Id: Iebc6f8c915c2594e218acbabf4f8e6b70a5ce11d
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-09-15 16:52:20 -07:00
Gaviraju Doddabettahalli Bettegowda
9110a87846 video: driver: Update msm_vidc statistics delay from command-line
Currently, statistics is printing for every 2 second
And these delay is hardcoded.
So changes added to update the statistics delay from the command-line.

- adb shell "echo 200 > /d/msm_vidc/core/stats_delay_ms"
- adb shell cat /d/msm_vidc/core/stats_delay_ms

Use above command to update & read statistics delay.

Change-Id: I523a870203ee460d1dba8208b798f28253407e73
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <gdoddabe@codeaurora.org>
2021-09-09 11:24:23 +05:30
Govindaraj Rajagopal
03471f2f11 video: driver: set clk_rate to zero before clk_disable
Video driver clk scaling is through mmrm. So without informing
to mmrm if we disable_clk, then mmrm will hold stale peak_current
values and that will lead to incorrect calculations at mmrm side.
So always request to set lowest clk corner to mmrm before calling
clk_disable_unprepare() api.

Change-Id: I3e54249430ec4e886afb42f5af6863c7e40686c4
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-09-06 18:10:01 +05:30
qctecmdr
00630500c4 Merge "video: driver: remove unsupported ioctls from ioctls ops" 2021-09-03 18:00:54 -07:00
Maheshwar Ajja
7af8e29f9e video: driver: discard ipsc after stop input port
Driver is discarding input port settings change (ipsc) event
before sending stop input to firmware and also in case of
input port is still in streamoff state while processing
pending events. There is a chance that driver may not discard
ipsc event if firmware raised ipsc after sending stop input and
also driver may not discard the pending ipsc if client quickly
streamon the input port before pending events processing scheduled.
So discard pending ipsc in the streamoff input port after stop input
to firmware and wait for stop done is successful.

Change-Id: I518cebe1142235463b1ccd851ac151ad80036f95
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-08-27 10:21:04 -07:00
qctecmdr
404bc1d0cb Merge "video: driver: allow two 8k sessions support" 2021-08-27 10:01:26 -07:00
Darshana Patil
e17abd45c1 video: driver: limit max number of sessions based on resolution
add checks to limit max number of sessions supported based on
resolution.
max number of 720P sessions: 16
max number of 1080P sessions: 8
max number of 4K sessions: 4
max number of 8K sessions: 2

Change-Id: I2a784a0d28ba050923bdc7f42a21ee9801d01d86
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-08-26 15:51:34 -07:00
Darshana Patil
b965b9307f video: driver: allow two 8k sessions support
Allow one 8k + one 4k realtime sessions.
Maximum allow two 8K sessions which includes RT and NRT sessions.

Change-Id: I68acfc4942c5c930bed7d9584cd82f2667010136
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-08-26 15:51:23 -07:00
Darshana Patil
8e1ba950f0 video: driver: fix bus vote data with correct color format
Fill correct opb color format for bus voting.

Change-Id: I219172492563d10582233c54578115ab48b9b1ff
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-08-20 11:42:20 -07:00
qctecmdr
304f637541 Merge "video: driver: fix to allow 16 concurrent video instances" 2021-08-19 20:40:54 -07:00
qctecmdr
e902db01fa Merge "video: driver: improve error handling on read_register" 2021-08-19 18:32:27 -07:00
Akshata Sahukar
871b8812ef video: driver: fix to allow 16 concurrent video instances
Currently allowing 15 concurrent video instances instead of 16.
Fix this to allow 16 instances.

Change-Id: I515625e47e324cd1c7ba5a83c1363705bca64721
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-08-19 18:08:16 -07:00