提交線圖

101 次程式碼提交

作者 SHA1 備註 日期
Akshata Sahukar
22cc24de7f video: driver: Enhance fence support
- Introduce V4L2_EVENT_VIDC_METADATA to post fence fd returned in
  ETB metadata done buffer.
- V4L2_CID_MPEG_VIDC_SW_FENCE_FD g_ctrl support for client to get
  fence fd for requested fence id.
- Addition of fence delivery and subscribtion support.
- Fence property packetization to send to firmware via FTB buffer.

Change-Id: Ifb289849e352af2c4729aa95040bd83753979970
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-02-17 13:16:53 -08:00
Darshana Patil
9978dc376e video: driver: add support to send input meta buffer via request
Client can enable V4L2_CID_MPEG_VIDC_INPUT_METADATA_VIA_REQUEST_ENABLE
control and send input metadata buffer via request.

Change-Id: Icccdada8253d1d0291c01e2e539968141f7ddd2c
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-02-04 13:47:34 -08:00
Govindaraj Rajagopal
0ba80e3956 video: driver: misc video changes
[1] Remove CAP_FLAG_ROOT flag. Root willbe identified
    with has_parents() api.
[2] Replace field(struct msm_vidc_inst_cap) cap -> cap_id.
[3] Rename below pool apis.
    msm_memory_alloc    -> msm_memory_pool_alloc
	msm_memory_free     -> msm_memory_pool_free
[4] Remove struct msm_vidc_inst_cap_entry usage in inst.
	inst->firmware.list -> inst->firmware_list
	inst->children.list -> inst->children_list
[5] Organize msm_vidc_inst_capability_type enums in such
    a way that all parents placed first then children. It
	will save CPU cycles while preparing caps_list.

Change-Id: I376f4e6ddec37ce326c393fba133e19ba70bab09
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-02-03 09:58:19 +05:30
Govindaraj Rajagopal
9ae3c7b5ac video: driver: alter core_init and deinit sequence
Added changes to call do msm_vidc_core_init() inside
msm_vidc_probe_video_device() itself. It will uniform
core init and deinit as part of insmod and rmmod.

follow core_init and core_init_wait for all new session
open sequence.

Change-Id: I081d5ff3632296b5d2086992e6f3388daedfd1d7
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-20 20:12:32 +05:30
Govindaraj Rajagopal
1e55de3d4a video: driver: add support for timestamp reorder
Added support for timestamp reorder. It is default
disabled.

Change-Id: I51a6fc785860081b651fc67f443132cb2675b9fd
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
60c04ed08d video: driver: enable session stability testing
Enable session stability test support.

Clients can trigger session stability through debugfs as follows:
echo <trigger_val> > /d/msm_vidc/core/trigger_stability
u64 trigger_val provides:
    <payload><sub_client_id><stability_type>
    stability_type : 0-3 bits(one of the HFI_STABILITY_TYPE_*)
    sub_client_id  : 4-7 bits(1 - CCE, 2 - VSP, 3 - VPP, 4 - CPUSS)
    reserved       : 8-31 bits(Not used)
    payload        : 32-63 bits(depends on stability_type)

For e.x, to VCODEC_HUNG on CCE hardware module for 5 consequtive frames.
adb shell "echo 0x500000011 > /d/msm_vidc/core/trigger_stability".

Change-Id: I604f0430e3ab905504c4f0b7c84b157a5d464958
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
aeabb39378 video: driver: Change format specifier and API clean-up
-Removed unwanted functions
-Removed unwanted part of code from function definitions
-Added proper format specifier according to the data type.

Change-Id: I700202f1cf588506b329d202ce3e2729c027dcae
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Mihir Ganu
1b5a6b1d6f video: driver: Add support for AV1 dynamic frame resolution change
AV1 bitstream frames can have different resolutions than
sequence resolutions. Subscribe to BITSTREAM_RESOLUTION and
CROP_OFFSETS metadatas and exopose them to clients so that
clients can receive per-frame resolution and crop.

Change-Id: I7c0503f25ddde201979d13ff18028681f685d649
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2021-12-17 10:58:35 -08:00
Manikanta Kanamarlapudi
f84053a13b video-driver: check max mbpf
check max mbpf as well while allowing
the real time session.

Change-Id: I1091582a02e01a4daa9c58ec5b50400b7d856610
Signed-off-by: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
2021-11-04 21:46:37 -07:00
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
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
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
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
Chandrakant I Viraktamath
a626d5c731 video: driver: Add checks for fw configured session params
Query final values of session params like stage,
pipe and quality mode from FW and check if they
are the same intended values as configured by
the driver.

Change-Id: I1a504401a599860ab971e34e1e184e67631d6120
Signed-off-by: Chandrakant I Viraktamath <civirakt@codeaurora.org>
2021-08-13 13:17:56 +05:30
Darshana Patil
05270719fb video: driver: add max num reorder frames support
add support for HFI_PROP_MAX_NUM_REORDER_FRAMES.
add ctrl for this metadata for avc and hevc.

Change-Id: I9a7b95f130e58f810255aff23e9b605304841072
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-08-09 11:39:57 -07:00
Govindaraj Rajagopal
5c297b7d26 video: driver: print buffer statistics once at every sec
- Added change to print buffer statistics like total and avg
etb, ebd, ftb, fbd counts, client set fps, actual fps,
bitrate values in 1 sec window and these stats currently
configured to print at every 1sec boundary.
- Convert meta buffer prints to low level logs.

Change-Id: I1c93eea90fbd5460eb51bbf133c513157003d51e
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-07-22 19:13:19 +05:30
Akshata Sahukar
7616a6bdad video: driver: ignore input/output port streamoff if already streamed off
Ignore input port or output port streamoff if corresponding port is already
streamed off.

Change-Id: I708126b24758ee0f76bc2646527d1baee59e5178
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-07-07 14:06:04 -07:00
qctecmdr
0df7a874b9 Merge "video: driver: Add support for enc auto framerate" 2021-06-18 10:32:00 -07:00
Priyanka Gujjula
e61b55879b video: driver: Add support for enc auto framerate
1. Calculate framerate based on buffer timestamp
2. If framerate changed and stable for 2 frames,
   update it to firmware and in driver internally.

Change-Id: I7feda86dec8fcfc1dff6defac8c15a97c1b8393e
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
2021-06-17 22:54:34 +05:30
Govindaraj Rajagopal
3e4248dfb0 video: driver: optimize buffer pool implementation
- Maintain free & busy pool to track buffers separately
- track double-free cases during msm_memory_free()
- track memory leak, by checking busy pool buffer count.
  it is expected to be zero at the end of a session.
- maintain common api's to init, alloc, free, destroy
  for all below buffer types.
    - struct msm_vidc_buffer
    - struct msm_vidc_alloc
    - struct msm_vidc_map
    - struct msm_vidc_timestamp.

Change-Id: Ib8655047c3883ea6601344661058d7a629ffd5bd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-17 17:22:06 +05:30
Akshata Sahukar
36a4971392 video: driver: Add enc vbr min quality restrictions
Do not support vbr min quality with below configs:
- HEVC 10bit
- Bitstream fps > 60
- ROI enabled/support
- HP encoding
- External Blur
- Resolution beyond 1080P.

Change-Id: I5e4a420abdd0c6fee4342c3c097684ef69bb0597
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-06-15 18:23:36 -07:00
qctecmdr
8818dd8215 Merge "video: driver: Set secure mode in encoder" 2021-06-07 22:18:03 -07:00
Chinmay Sawarkar
83f9b26441 video: driver: Set secure mode in encoder
Enable HFI_PROP_SECURE when secure session is enabled
in encoder. Same behaviour as Decoder.

Change-Id: I5edfe3d735fda8edea9e491ae17546945b4431a1
Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
2021-06-07 13:45:43 -07:00
qctecmdr
c67713f34e Merge "video: driver: Update session admission and work modes" 2021-06-05 11:13:10 -07:00
Mihir Ganu
3a7632ca4d video: driver: Update session admission and work modes
- To determine if session is admissible, check only the
  decoder input width/height and encoder crop width/height.
- Update session MBPF Calculations.
- Amend work mode setting to consider decoder input width,
  height and GOP size.

Change-Id: If4053c222de2a55ad5b85a8ab96c12c47b145aa3
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
2021-06-04 17:08:23 -07:00
Govindaraj Rajagopal
1f46168b9f video: driver: print more info on debug logs
Currently driver prints hex values for codec type, pixel
format and port number. So added change to print strings
instead of hex values.

Removed unnecessary logs to avoid overlogging timeout
issues.

Change-Id: Ia44401990797dc20eae0a35631e9ed6a0b094c20
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-04 19:26:34 +05:30
qctecmdr
e61914fe82 Merge "video: driver: queue pending buffers at streamon" 2021-06-02 12:25:50 -07:00
Govindaraj Rajagopal
31012cd79e video: driver: queue pending buffers at streamon
qbuf will be deferred on all ports before streamon,
So explicitly queue pending buffers at the time of
streamon.

Change-Id: I673a14f0d43563184aac887f5f23b63ed13d59df
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 11:55:28 +05:30
Govindaraj Rajagopal
a33041f799 video: driver: add scaling checks for encode session
Encoder supports downscale with scaling ratio upto 1/8 of width
and 1/8 of height. So added necessary scaling checks at streamon.

Change-Id: I3a29b43c79cf4e693ba2c0d9f98ec24410d50fbd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 11:26:12 +05:30
Govindaraj Rajagopal
b2e9fada31 video: driver: restrict image load to 16K x 16K
Add strict check in msm_vidc_check_mbpf_supported() to
reject image session, if total image load exceeds 16K.
Added msm_vidc_print_insts_info() support to print all
running instance info, if new session is rejected due
to mbpf/mbps checks.

Change-Id: I98bab985fcf4f4d20c6f263c48e0c701ec86ab6f
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-31 17:11:46 +05:30
Maheshwar Ajja
d0af60e008 video: driver: deinit core from a valid session only
Occationally when multiple sessions are waiting for firmware
response and at the same time if there was a system error
received which will deinitalize the core and remove all sessions
from core list. If client opened new session which will initialize
the core and start the new session. As there will be no response
for old sessions, eventually, they will timeout and try to deinitialize
the core which will reset new session also which is not correct.
So check if timed out session is valid (present in core list) before
deintializing the core from timeout session.

This change also addresses below race condition issue -

If client is opening multiple new sessions and multiple old sessions
are also timedout at the same time and all are waiting for core lock
to be acquired. The new session does init_completion(&core->init_done);
and release core lock before waiting for completion event. As core lock
was released the timed out session will acquire the core lock and deinit
the core and release core lock. As core was deinited, another new session
will do init_completion(&core->init_done); on which the previous session
was waiting for completion event. doing init_completion again on an
already waiting completion event will result in list corruption issues.

Change-Id: I94766ead8b3ecad7d0b87f4b999608f435d0cee2
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2021-05-26 18:18:44 -07:00
Darshana Patil
e5ec6843e8 video: driver: modify max mapped output count
adjust MAX_MAP_OUTPUT_COUNT based on resolution
to enhance performance and reduce memory pressure.
- For 8K session: count = 20
- For 4K session: count = 32
- For 1080p session: count = 48
- For all remaining sessions: count = 64

reduce MAX_DPB_COUNT to 32.
reduce DEFAULT_MAX_HOST_BUF_COUNT to 64.

Change-Id: I0e6d25121947524b843e9cce96b75871aba174af
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-05-24 16:58:19 -07:00
qctecmdr
288887b59d Merge "video: driver: hb layer buf count and hfi buffer macro CL:30683524 changes" 2021-05-15 14:39:13 -07:00
Akshata Sahukar
724e5f525e video: driver: hb layer buf count and hfi buffer macro CL:30683524 changes
[1] Update enc input min count buffers count when HB layer encoding
    is enabled.
[2] Also align hfi buffer macro file with CL: 30683524.
[3] This change also fixes VPSS buffer size mismatch issue.

Change-Id: I63d91ff204f1e11e71e3c0633b582c47c5e9b102
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-05-14 21:40:28 -07:00
Govindaraj Rajagopal
003d8a79fa msm: vidc: Add support of timestamps based frame rate
Add timestamp based frame rate detection.

Change-Id: Id0c522e01769ea6cf214c7b84c11faae6049e2ef
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-12 21:50:05 +05:30
Akshata Sahukar
ce09f77e44 video: driver: free children and firmware list memory
To avoid memory leakage, clean children and firmware lists
at session close, error cases, and at the end of each usage.

Change-Id: I1eadbf81da207bd987c50428c0c7cf4967a8885f
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-04-30 18:42:34 -07:00
Mihir Ganu
cf3fd457b3 video: driver: Enable flip and rotation
Enable encoder flip and rotation preprocessing features.

Change-Id: Icb0448c2d09fbe9504e3f58701cd2653dc4559b0
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-04-23 16:44:42 -07:00
Maheshwar Ajja
09356ed279 video: driver: amend delayed unmap feature
Due to delayed unmap feature on decoder output buffers,
refcount will become one when no one uses the buffer
in driver. In release done functonality, remove the
buffer from maps list only if refcount equal to one.
If refcount is more than one indicates the buffer is
being used, so do not remove from maps list. There are
chances that same decoder output buffer might be queued
by the client in which case we are not supposed to
unmap it from maps list in release done.

Change-Id: I69250c3efa89d77055e89770fd441af1fb50b755
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2021-04-19 19:05:36 -07:00
Darshana Patil
2c0cab5146 video: driver: add ROI metadata support
add extra size for input meta buffer
when ROI metadata is enabled.
add dependency of rate control and
color format.

Change-Id: Icefd3f9e319d596f88090cee331417c0b2946180
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-04-15 21:50:00 -07:00
Akshata Sahukar
d0fa618b52 video: driver: Enable META_LTR_MARK_USE for enc o/p port
META_LTR_MARK_USE is enc output metadata. Hence, avoid enabling
encoder input metadata for META_LTR_MARK_USE.

Change-Id: I667f2f1a74e73b753447fc2dc9709cb1983c2249
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-04-15 13:10:43 -07:00
Darshana Patil
23605ffffb video: driver: handle dpb list property
- subscribe for dpb list property in combined
 mode on output port.
- copy dpb list property payload from fw to
 static array.
- using this array, mark read_only list buffers
 as non-reference if not part of array. if count
 of such buffers is greater than output min count,
 send to fw for release.
- once fw returns them, destroy these buffers.
- unmap stale output mappings due to lazy unmap feature.
- unify release internal functions into common function.

Change-Id: Id32f04efb19eecaff453cc4383ee8296a0246263
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-04-09 18:21:34 -07:00
qctecmdr
c2501b7b53 Merge "video: driver: optimize thumbnail input buffer count" 2021-04-05 14:47:48 -07:00
qctecmdr
67c1d2454d Merge "video: driver: enable buffer pool for mostly used structures" 2021-04-05 14:47:48 -07:00
Govindaraj Rajagopal
a13f0e1416 video: driver: enable buffer pool for mostly used structures
Enabled recycling for below structure types.

- struct msm_vidc_buffer
- struct msm_vidc_alloc
- struct msm_vidc_map.

Change-Id: I062abef85db24385745119b821f87e5b72a4e835
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-04-05 19:04:55 +05:30
Govindaraj Rajagopal
d6890cd14a video: driver: print buffer_name instead of hex value
Handled below items as part of this change.

- print buffer_name instead of hex value.
- enable dcvs only for realtime sessions.
- enhanced max_input_data_size handling at
  msm_vidc_scale_power.

Change-Id: If5ac810f4e020bee54364161596c5547af94161a
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-04-03 00:43:18 +05:30
Shi Zhongbo
34ed55ecd1 video: driver: optimize thumbnail input buffer count
Update thumbnail input buffer count to 1 after recieving
thumbnail enable control.

Change-Id: I9341d34d3427c00fd6792f47c947bf4b12966a39
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
2021-04-02 00:35:13 -07:00
Darshana Patil
19cdce1711 video: driver: skip lazy unmap for dec output buffers
- add support to skip lazy unmapping for decoder
  output buffers only. Map twice for these buffers.
- v4l2 client owned RO SMMU mapped buffers are
  maintained separately in read_only list.
- For FBD with RO flag from fw, add buffer to read_only
  list. Else remove from this list.
- During FTB, if buffer present in read_only list,
  add RO flag to hfi buffer and queue to fw.
- During streamoff output, unmap all buffers except
  those present in read_only list.
- During close, unmap completely and clean up read_only
  list, output list.

Change-Id: Iacee7d298dfbff0b9cb6f17dff27ad98574b489b
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-04-01 12:03:21 -07:00
Akshata Sahukar
89e7e48231 video: driver: Add support to deliver HFI_PROP_BUFFER_TAG via FTB
Add support to deliver HFI_PROP_BUFFER_TAG via FTB metadata buffer
to receive HFI_PROP_DPB_TAG_LIST from fw via FBD metadata buffer.

Change-Id: Id9eeee26135379975f55923505d9c91905fa0b9e
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-03-31 19:09:10 -07:00
Govindaraj Rajagopal
78b1491ee1 video: driver: enable dcvs - power feature
Enable/disable dcvs based on below settings.

- core supports dcvs
- core_clock_voting is set: disable
- encode_batching(superframe): disable
- decode_batching: disable
- thumbnail session: disable
- image session: disable

Handle below items as part of dcvs enablement.

- skip clock scaling for inactive session.
- reset dcvs flags to 0, for encoder at dcvs_window.

Change-Id: I84e6710946bca3fa8c83178f29745d4b9afd4697
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-31 02:02:36 +05:30
qctecmdr
57648d98ff Merge "video: driver: Enable Subsystem Restart (SSR) testing" 2021-03-29 11:26:15 -07:00