Commit Graph

73 Commits

Author SHA1 Message Date
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
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
Mihir Ganu
113c10c489 video: driver: Enable Subsystem Restart (SSR) testing
Enable Subsystem Restart test support.
Clients can trigger SSR through debugfs as follows:

echo <trigger_val> > /d/msm_vidc/core/trigger_ssr

u64 trigger_val provides:
  /* <test_addr><sub_client_id><ssr_type>
   * ssr_type: 0-3 bits
   * sub_client_id: 4-7 bits
   * reserved: 8-31 bits
   * test_addr: 32-63 bits */

Change-Id: If23fce3084de00461f1e5cc57884e10d15ad66a9
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
2021-03-29 10:21:27 -07:00
Vikash Garodia
0017afac21 video: driver: Add handling for session priority
Following changes are added with this:
1. Handle and adjust session priority.
2. Session addmission based on priority.
3. Power (clock and bus) scaling based on priority.
4. Handle s_parm influence on priority.

Change-Id: I12dec5fb03d733f07b0b0a24b4d74d1ccd4bf791
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2021-03-29 22:47:28 +05:30
Govindaraj Rajagopal
1524ddc445 video: driver: remove smmu_fault_work_handler
Remove separate fault_work_handler and print all needed
debug info as part of smmu_fault_handler callback itself,
to avoid race between fault handler invocation and core
deinit sequence.

Change-Id: Ib47e3d457a5a3e33497c71d5920382cb43baed79
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-26 16:37:52 +05:30
Darshana Patil
48912aee84 video: driver: add RGBA format support
add RGBA and RGBA_UBWC color format support
for encoder.

Change-Id: I3e179ae9769d851afc5a6f11e1afb14d96e92073
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-03-22 18:12:16 -07:00
Akshata Sahukar
7a9d3462dd video: driver: fix colorspace subscribe params initialization
Initialize subscribe params for colorspace using OUTPUT
port params and use right mapper function

Change-Id: Ie6be50c1de20e351bad0fc4b015bcc4d72d1711b
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-03-19 17:32:12 -07:00
Darshana Patil
3dc0696b1d video: driver: enable thumbnail mode
enable thumbnail mode depending upon
the thumbnail capability in database.

Change-Id: I2f3a36ae0ee785e73a009cfc385290c983a43e29
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-03-16 22:25:02 -07:00
Govindaraj Rajagopal
f4045ecbd6 video: driver: enable image encode and decode support
Added change to enable image encode and decode support.

Decoder:
    - codec: hevc
    - input buffer size: yuv size
    - run as turbo session
    - all intra session
    - disable dcvs & batching
    - ignore admission control(skip mbps, mbpf check)

Encoder:
    - codec: hevc
    - rc mode: CQ
    - profile: MainStillPic
    - all intra session
    - output buffer size: 2 * yuv size
    - output dimension: 512 x 512
    - disable dcvs & batching
    - ignore admission control(skip mbps, mbpf check)
    - skip scaling check
    - hfi: set grid enable & disable time_delta based rc.

Change-Id: I0af47de1406a53d8d8bf1969a65b3a390b0aacb5
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-13 18:44:11 +05:30
Mihir Ganu
ccb6da7567 video: driver: Add support for non-secure pix context bank
- Add support for a new non-secure pix context bank.
- Remove usage of deprecated 'buffer-types' in context banks.

Change-Id: I3a21eb8ce1d9aff277568d54aadb54193ad0ce75
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
2021-03-10 11:18:12 -08:00
Govindaraj Rajagopal
6d97dd3795 video: driver: refine queue work functionality
[1] remove unwanted switch cases to reduce code complexity
[2] refine queue_response_work functionality.

Change-Id: I91aabb2eb4c64caea09a26895358544972a7d427
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-09 23:41:35 +05:30
qctecmdr
9800ae3f27 Merge "video: driver: update sizeimage during set ctrl" 2021-03-04 16:11:41 -08:00
Darshana Patil
3f9d032aa1 video: driver: update sizeimage during set ctrl
update input port sizeimage for a decode session
during set control of bitsream size overwrite
control.

Change-Id: I4cb7d6c8d416f187e1ac557d3b423acfdbcb7a60
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-03-04 12:06:27 -08:00
Govindaraj Rajagopal
a7670d7f42 video: driver: enable decoder batching support
Added change to enable decoder batching feature.

Batching willbe enabled only when below conditions were met.

[1] platform supports batching
[2] decode session
[3] realtime session
[4] non-thumbnail session
[5] non-heif session
[6] 2-stage decode only(low_latency not supported).

Change-Id: I54b601814c3b5fa2077dc41c5b0ac84964c2674a
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-04 09:38:55 +05:30
Darshana Patil
596ca194de video: driver: add thumbnail and priority support
- add thumbnail mode and priority in database.
- modify output min count for thumbnail session
- deprecate is_turbo_session.
- deprecate flags variable in instance structure and
  use database entries.

Change-Id: I04a3386f1e2eb9fb97bd550d6f169f9510f462c8
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-03-03 18:13:09 -08:00
Darshana Patil
481a6117d8 video: driver: update license year
update license year to 2020-2021

Change-Id: I5a67bf49c386e86337bc7449ded08d186fc9a280
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-03-01 18:07:35 -08:00
Govindaraj Rajagopal
f25d5c7078 video: driver: handle race between streamoff and qbuf sequence
Currently stramoff releases inst->lock and waits for response from
firmware i.e race issue. Streamoff released int->lock and that got
acquired by qbuf. So 2 FTB's were queued to firmware after streamoff
request.

Receiving qbuf after streamoff is treated as fatal at firmware side
and it sends session error as response to host. Added change to
avoid such issues.

Change-Id: I6da8ac0d3d30b540784e3c03c423270cb5212af2
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-03-01 09:17:24 +05:30
Akshata Sahukar
20d30c5dd2 video: driver: amend colorspace info setting
v4l2 enums for color space info are not one to one
mappings with hevc spec values. Hence, introduce and
use corresponding mapper functions.

Change-Id: I37a79a9b34b66184ece9a284ae98c9fa4efd248f
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-02-26 12:52:14 -08:00
Govindaraj Rajagopal
e743f5dd48 video: driver: use char array for printing vidc logs
Instead of formulating session_id, codec_type, domain at
each log print, used pre-formatted char array to print
the vidc logs.

Change-Id: If7a93ecb25a7b1b98ebca6f39e3990079c00b5dd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-02-26 22:10:16 +05:30
Govindaraj Rajagopal
4055a23255 video: driver: enable smmu_fault_handler support
Added smmu_fault_handler support and printing all buffers,
allocations, mappings list details as part of smmu fault
handling.

Change-Id: Idb5d28357f9fb885adf7ae16f328b4963c56aa8c
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-02-25 12:26:46 +05:30
Chinmay Sawarkar
92a5583706 video: driver: fix video driver remove
While removing driver fw should be unloaded.
Also improved error handling.

Change-Id: Ia9f224da6f176c8a50c153f67fe8a77a92b7b08f
Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
2021-02-24 16:29:41 -08:00
Darshana Patil
d4b5661567 video: driver: modify msm_media_info.h to fix 10bit
- introduce STRIDE_BYTES and STRIDE_PIX to
  calculate size is bytes and pxls respectively.
- DEPRECATE VENUS_BUFFER_SIZE and introduce
  VIDEO_RAW_BUFFER_SIZE. All buffer sizes are
  calculated by using STRIDE_BYTES.
- For s_fmt, use STRIDE_PIX to calculate size.
- For v4l2 bytesperline, use STRIDE_IN_BYTES to
  calculates size in bytes

Change-Id: I3db4d843d1834b25c6160ebc318572ac67e22806
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-02-23 20:02:29 -08:00
Govindaraj Rajagopal
f02bbaf836 video: driver: enable encoder superframe batching support
Added HFR/HSR superframe handling support for encoder.

Change-Id: I28ced3f223cd78d00b1a654a79bcac3b02f378dc
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-02-22 11:52:43 +05:30
Darshana Patil
52e7bb2213 video: driver: set default_header property at session level
set default header property once per session for decoder.

Change-Id: I5ca9088b8bed09907f2c9f829acec3db23e65a7c
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-02-19 11:46:38 -08:00
Maheshwar Ajja
2719badd2b video: driver: amend stop and last flag processing
- do not ignore last flag buffer in last flag not allowed
  case also
- ignore stop command if input port is not streaming
  instead of returning -EBUSY error.
- defer input port settings change in few states instead of
  ignoring it.

Change-Id: I705f0c8ae2da899a5d262f6246aa65de5591ac26
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2021-01-29 12:41:44 -08:00
Akshata Sahukar
18f496a511 video: driver: handle enc internal buffers returned from fw
- destroy enc internal buffers when firmware returns these
 buffers after its usage.
- fix some incorrect log masks that result in false error
 logs.

Change-Id: I4707e915b725769bbbaa0a2c4c4e0d9cd10805a4
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-01-26 17:44:21 -08:00
Darshana Patil
60b7435a4c video: driver: add nv12 format support
add nv12 format support

Change-Id: I6a9f2eb814504e35797fb91053417f16cfdf8b25
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-01-25 16:12:48 -08:00
Chinmay Sawarkar
852608fcc3 waipio: driver: Add support for fw unload and power collapse
If required, Firmware can be unloaded after every session.
Power collapse is enabled by default.

Change-Id: Ie014a26ae600816d8713cd34826f1f9a77088e4a
Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
2021-01-22 16:55:57 -08:00
Mihir Ganu
9ec3d72b48 video: driver: Update metadata port settings
- Set correct metadata buffer sizes/counts in initialization.
- Update metadata buffer sizes/count when a metadata control is set.

Change-Id: Ib695b267efac26caa5858cdcdec1868d85182b90
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
2021-01-19 18:39:48 -08:00
Maheshwar Ajja
39e830e7e3 video: driver: kill session and core deinit support
Add below support
- kill session in case of errors
- core deinit in case of timeout errors
- flush buffers in streamoff
- decide supported colorformats based on
  bitdepth and interlace info
- print level based logs

Change-Id: I45b9b0eae4220a818de23308da8802a9e12ae255
Signed-off-by: Maheshwar Ajja <majja@quicinc.com>
2021-01-19 12:03:09 -08:00