Commit Graph

1046 Commits

Author SHA1 Message Date
Akshata Sahukar
fb2e2c5715 video: driver: Align hfi files to pick ring buffer changes
Align hfi property and memory file to pick interface changes
for encoder ring buffer support

Change-Id: Icde4cdffe5275d416c51c36e562bb832027b0fa1
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2023-03-07 17:13:09 -08:00
qctecmdr
5dcf0adb92 Merge "video: driver: move DPB_TAG_LIST to input meta port" 2023-03-07 13:42:19 -08:00
Zhongbo Shi
33ec7e400e video: driver: move DPB_TAG_LIST to input meta port
1. Move DPB_TAG_LIST from ouput meta port to
input meta port;
2. Remove meta_max_reorder_num_frame;

Change-Id: I1783ee9cdb1092f90706dc485d247c51f36a9a65
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2023-03-06 23:26:00 -08:00
Zhongbo Shi
133bfb56ea video: driver: move DPB_LIST to input port
1. Move DPB_LIST subscription on input
port instead of output port.

2. Move decoder port PSC and properties
to platform data.

Change-Id: I5711e0ba915ebe4136f64d1440ae331b787f4d61
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2023-03-07 15:23:23 +08:00
qctecmdr
56057e9964 Merge "video: driver: Take avg bitrate for clk scaling" 2023-03-06 20:16:33 -08:00
Akshata Sahukar
2b974f7ad0 video: driver: Align hfi files to pick synx fence changes
Align hfi property and registers file with to pick synx fence
related interface changes

Change-Id: I19e5cce4d67f2f1eeacf917f9e688d2bb20f6585
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2023-03-03 16:59:49 -08:00
qctecmdr
c8feb57898 Merge "video: driver: handle uninitialized variables in open" 2023-03-03 10:14:49 -08:00
qctecmdr
8cf45cdbc1 Merge "video: driver: resolve skip unmap in system error cases" 2023-03-03 10:14:49 -08:00
Govindaraj Rajagopal
db80783d41 video: driver: handle uninitialized variables in open
In msm_vidc_open() create_singlethread_workqueue() is failing,
so msm_vidc_close() is called and i.e attempting to de-initialize
some uninitialized structures and resulting into stability issues.

So handle msm_vidc_open() failure with in same api, instead of
calling msm_vidc_close() and re-organize deinit sequence.

Change-Id: I843cf07eaf18f4ea764842fd1c87b78d115580d3
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-03-03 16:47:01 +05:30
Ankush Mitra
f90831dc93 video: driver: Take avg bitrate for clk scaling
In case of decode batch IDR frame can impact
the bitrate based clk scaling.
To tackle this use avg filled len in case
of decode batching.

Change-Id: I1b2701857118bfa1f1a4fd0c0498ee016c02e8d5
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
2023-03-03 16:09:35 +05:30
qctecmdr
936f37d8ba Merge "video: driver: Move adjust/set control_ext API's to common/platform_ext.h/.c" 2023-03-01 16:35:56 -08:00
Maheshwar Ajja
28c761d7bf video: driver: resolve skip unmap in system error cases
If there is any system error from firmware then driver will
remove instance from core->instances.list.
msm_vb2_detach(unmap)_dmabuf() returning failure because
get_inst_ref() returning NULL as the instance was removed from
in core->instances.list, but instance is still alive and buffers
can still be detached(unmapped). Skipping detach(unmap)
buffers resulting in below warning when the buffer's final
dma reference is removed by v4l2 framework (dma_buf_put(fd))
after msm_vb2_detach(unmap)_dmabuf() functions.

msm_dma_buf_freed: DMA buffer ffffff8884ebe600 destroyed with
                   outstanding iommu mappings
Call trace:
    msm_dma_buf_freed+0x130/0x334 [msm_dma_iommu_mapping]
    qcom_sg_release+0x30/0x50 [qcom_dma_heaps]
    dma_buf_release+0x48/0xa8
    __dentry_kill+0x178/0x268
    dentry_kill+0xc4/0x110
    dput+0xa4/0x110
    __fput+0x170/0x260
    ____fput+0x18/0x28
    task_work_run+0xc0/0xe8

Eventually when client closed the session, driver will try to
cleanup the missing buffers and hence driver calls unmap buffers
which is resulting in below list_del corruption issue as dma_buf
including sg_list was already removed for it

msm_dma_unmap_sg_attrs: (ffffff8916a92c00) was never mapped
WARNING: CPU: 2 PID: 2258 at drivers/iommu/msm_dma_iommu_mapping.c:377
         msm_dma_unmap_sg_attrs+0x9c/0x1e4 [msm_dma_iommu_mapping]
Call trace:
    msm_dma_unmap_sg_attrs+0x9c/0x1e4 [msm_dma_iommu_mapping]
    qcom_sg_unmap_dma_buf+0xc0/0xf0 [qcom_dma_heaps]
    dma_buf_unmap_attachment+0x48/0xa0
    msm_vidc_dma_buf_unmap_attachment+0x2c/0x80 [msm_video]
    msm_vidc_destroy_buffers+0x510/0xb74 [msm_video]
    put_inst+0x158/0x3fc [msm_video]
    msm_vidc_close+0xe4/0x16c [msm_video]
    v4l2_release+0x7c/0x108
    __fput+0xe4/0x260
    ____fput+0x18/0x28
    task_work_run+0xc0/0xe8

list_del corruption. prev->next should be ffffff8891db3c90,
          but was ffffff8916a92c10. (prev=ffffff8916a92c10)

As we know instance will always be alive in
msm_vb2_detach(unmap)_dmabuf() function, we can safely
remove get_inst_ref() to avoid skipping detach(unmap)
calls to avoid list_del corruption issues.

Change-Id: If292a39ab1cde17da3cbb634370b6ff6692e496a
Signed-off-by: Maheshwar Ajja <quic_majja@quicinc.com>
2023-02-28 23:37:39 -08:00
Vedang Nagar
17bc01b78f video: driver: Move clk/qcom.h to external reseource file
Move qcom.h header file from resources.h to resources_ext file.

Change-Id: I81735461f093fe724a51d66538be1cc562fc0e24
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
2023-02-26 22:26:16 +05:30
qctecmdr
a7db37426e Merge "video: driver: Add new hfi buffer flags" 2023-02-24 21:15:31 -08:00
Megha Byahatti
4a578d26fd video: driver: Move adjust/set control_ext API's to common/platform_ext.h/.c
Remove msm_vidc_control_ext.h/.c

Change-Id: I5636705b38b7c5613baf8761953ae31963e6ffd3
Signed-off-by: Megha Byahatti <quic_mbyahatt@quicinc.com>
2023-02-24 15:37:21 +05:30
qctecmdr
95eccc81e8 Merge "video: driver: add stop cmd allow checks inside state handler" 2023-02-23 18:24:11 -08:00
Chinmay Sawarkar
ed46ad9aec video: driver: Add new hfi buffer flags
New hfi buffer flags to send memory region information to firmware.

Change-Id: I3a320622d0ed01a5e583dbeceb2648a57f618a66
Signed-off-by: Chinmay Sawarkar <quic_chinmays@quicinc.com>
2023-02-23 12:01:25 -08:00
qctecmdr
8df204443f Merge "video: driver: remove config dependencies" 2023-02-23 08:10:06 -08:00
qctecmdr
e613fa6855 Merge "video: driver: set PM_SUSPEND in power collapsed state" 2023-02-22 18:33:42 -08:00
qctecmdr
37f24ba2cc Merge "video: driver: Revise encoder port configs" 2023-02-22 13:29:31 -08:00
Govindaraj Rajagopal
ab6770c11f video: driver: add stop cmd allow checks inside state handler
use state specific checks inside state_handler instead of
relying global msm_vidc_allow_stop function.

Change-Id: I83d81aa0f840412a4c61f15673a6246f0f84be7f
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-22 21:05:18 +05:30
Govindaraj Rajagopal
a6e521d629 video: driver: add start cmd allow checks inside state handler
use state specific checks inside state_handler instead of
relying global msm_vidc_allow_start function.

Change-Id: I04182ee3b63fa9044acf4f40adc47ea97eaa7538
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-22 20:52:07 +05:30
Govindaraj Rajagopal
4afdecc4fd video: driver: add streamon allow checks inside state handler
use state specific checks inside state_handler instead of
relying global msm_vidc_allow_streamon function.

Change-Id: I67948831612ebb33cdd12a2e9f8561b6095e9433
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-22 20:03:52 +05:30
Govindaraj Rajagopal
3ba2cb9ed1 video: driver: add reqbuf allow checks inside state handler
use state specific checks inside state_handler instead of
relying global msm_vidc_allow_reqbufs function.

Change-Id: Iaf7f23e4e2ef9b714e3d4c2900c2753d74150fd1
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-22 20:01:03 +05:30
Govindaraj Rajagopal
373880e521 video: driver: add s_fmt allow checks inside state handler
use state specific checks inside state_handler instead of
relying global msm_vidc_allow_s_fmt function.

Change-Id: I92af08e4cd5d49f763c5a2d381af86eb10a4c061
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-22 20:00:01 +05:30
Govindaraj Rajagopal
c3c85e9653 video: driver: remove config dependencies
remove all conditional compilation in video driver.
With this change, all files willbe always compiled
and will be available in final kernel object file.

Change-Id: I9843c246e23bd1ee4fb8918e5cfa840e2defd432
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-21 14:33:41 +05:30
Ankush Mitra
e96ab4ac79 video: driver: set PM_SUSPEND in power collapsed state
Set substate PM_SUSPEND even if
video core was already power collapsed.

Change-Id: I15740d8e44fe89c6b34c0412dca1064539cdac35
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
2023-02-17 19:57:04 +05:30
Vedang Nagar
3e353fd5ff video: driver: Move _clock_set_flag() implementation
Move _clock_set_flag() function implementation from
resource.c to resource_ext.c file.

Change-Id: I4b977c7f840b94da578fcaac53b8fdc4bba86fca
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
2023-02-17 19:51:24 +05:30
qctecmdr
6b5255c60d Merge "video: driver: introduction of new debug print" 2023-02-16 12:30:49 -08:00
qctecmdr
f48a9e7429 Merge "video: driver: add sanity check for iommu domain" 2023-02-16 12:21:31 -08:00
qctecmdr
e30350da93 Merge "video: driver: introduce substate allow table to populate allow_mask" 2023-02-16 12:21:31 -08:00
Ankush Mitra
908ab6358b video: driver: introduction of new debug print
Introduce d_vpr_hs to print both VIDC_HIGH or
VIDC_STAT log.

Change-Id: Ie7bfa8df033b30689eca6ad6a4637978730eadf7
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
2023-02-16 11:26:25 +05:30
Govindaraj Rajagopal
9e5429a77d video: driver: introduce substate allow table to populate allow_mask
get allow_mask from substate allow table and decide to update/ignore
based on that mask.

Change-Id: I1cd465069717561aeadeeba7241128bd450d4933
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-15 10:24:06 +05:30
Dikshita Agarwal
c1d99709ca video: driver: fix __set_clk_rate for upstream
In downstream, driver vote for VIDEO_CC_MVS0_CLK_SRC which
needs a multiplication factor of 3 to be applied to
required freq while on upstream we vote for branch clk
i.e. VIDEO_CC_MVS0_CLK hence this multiplication factor is
not needed.

Change-Id: I43131558b3882da303cfaa9bdb5d76080a83fc42
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2023-02-13 15:56:36 +05:30
qctecmdr
f0b5f5dd65 Merge "video: driver: disable 5 LTR support" 2023-02-11 12:13:30 -08:00
qctecmdr
99d3bd665c Merge "msm: vidc: enable DCVS for non realtime sessions" 2023-02-09 17:47:32 -08:00
qctecmdr
a7d368d03f Merge "video: driver: fix video node open before probe issue" 2023-02-09 17:47:32 -08:00
Zhongbo Shi
e65a251443 video: driver: Revise encoder port configs
1. Revise to config encoder RAW port with buffer actual
aligned width and height in pixels to firmware;
2. Client also needs to config aligned input port
width and height to driver;
3. Driver must config encoder RAW port crops;
4. Client also needs to config encoder input port crops;

Change-Id: Idb85036df9a72e50239ddb46039ef1995b7f0689
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2023-02-08 15:14:06 +08:00
Darshana Patil
f123b6eece video: driver: fix incorrect initialization of dmabuf
Reinitialize dmabuf pointer to NULL only after
dma_buf_put has been called on that buffer.

Change-Id: I05e8c1d0901438bc39a9bf9faeed11e228cd7675
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2023-02-07 12:07:33 -08:00
qctecmdr
ff5f9d8998 Merge "video: driver: state handling code movement" 2023-02-07 11:22:13 -08:00
Darshana Patil
ed80204a9e video: driver: add support to configure colorinfo via control
- introduce control to set colorspace. client will use this
  to set private color info.

Change-Id: I0099ef1525f4562d3be3a6e518d046fe5b9ef894
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2023-02-06 13:09:17 -08:00
qctecmdr
49f99eba76 Merge "video: driver: resolve subsystem restart failure" 2023-02-06 10:11:50 -08:00
Manikanta Kanamarlapudi
454e91b014 msm: vidc: enable DCVS for non realtime sessions
- enable dcvs for non-realtime sessions (both encode/decode)
- enable input queuing rate power scaling for non-realtime encoder

Change-Id: Ie0fe2723837dbfc1cb63b693fc657f2d8df7c573
Signed-off-by: Manikanta Kanamarlapudi <quic_kmanikan@quicinc.com>
2023-02-06 10:06:54 +05:30
Govindaraj Rajagopal
e318864d75 video: driver: fix video node open before probe issue
[1] In upstream side, udev is attampting to open video
nodes(video32 & video33) immediately after creation.
But by that time probe might not completed and i.e
resulting to NULL ptr dereference during open() call.

[2] component_match_add_release() must be called only
for video subdevices(contextbanks), but due to OPP table
more entries getting added into component_match table.
So master device bind is never getting invoked and probe
sequence is never getting completed.

Uploaded change to address above mentioned issuses.

Change-Id: I8d2e8fb5644da7076f5f99feda9365629e9130fd
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-02-03 21:03:59 +05:30
tkashyap
faf2b173fe video: driver: disable devm_pm_opp_attach_genpd
Change-Id: Id09b49b3ff2b7b1c960314776dd91360913482d8
Signed-off-by: Tanya Kashyap <quic_tkashyap@quicinc.com>
2023-02-01 16:30:06 -08:00
Ankush Mitra
f1771aae41 video: driver: resolve subsystem restart failure
Allow streamoff from msm_vidc_vb2_queue_deinit after
errors to flush out the pending buffer in driver
in order to avoid v4l2 framework printing below warning.

videobuf2_common: driver bug: stop_streaming operation
is leaving buf in active state.

Call trace
__vb2_queue_cancel+0x214/0x288
vb2_core_queue_release+0x28/0x5c
vb2_queue_release+0x18/0x28
msm_vidc_vb2_queue_deinit+0x40/0x118 [msm_video]
msm_vidc_close+0x7c/0x144 [msm_video]
msm_v4l2_close+0x44/0x164 [msm_video]

There is a deadlock if driver acquires inst lock
in msm_vb2_stop_streaming, because this function
will be called from msm_vidc_close which already
acquired the inst lock. Hence, acquire inst lock
in msm_v4l2_stramoff instead of msm_vb2_stop_streaming.

Change-Id: Iec4c0e416a8a2705af28dbd5138f25d9f3016d12
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
2023-02-01 12:18:42 +05:30
Akshata Sahukar
654e6bb55d video: driver: Add support to allow 5 LTR count
Add support to allow 5 LTR count as per new
requirement.

Change-Id: Ic839ea61ae8dfe21bd8891f0f0dbaf26506d84ec
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2023-01-30 13:08:35 -08:00
Govindaraj Rajagopal
c175e36454 video: driver: state handling code movement
state handling changes were spread across multiple files.
So re-arrange all state related handling changes into
msm_vidc_state.h/.c file.

Change-Id: I3826daa678d1e2b5ce7e74380d465e70b1b824c6
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2023-01-30 10:57:22 +05:30
qctecmdr
0884f5a04a Merge "video: driver: restructure video state machine" 2023-01-28 00:56:41 -08:00
qctecmdr
54c8d7570d Merge "video: driver: add power domain and opp table support for video" 2023-01-28 00:56:41 -08:00