Commit Graph

198 Commitit

Tekijä SHA1 Viesti Päivämäärä
Akshata Sahukar
50a00f8265 video: driver: Avoid device crash after fence usecase execution
Since spin lock for fence is per session based and stored in instance
memory, by the time fence consumer released the fence, driver close
might be called and instance memory might be cleared. So, when fence
consumer released the fence, at the time of fence release callback,
this spin lock might nt be available. This race condition is resulting
into device crash after fence playback session ends. Avoid this by
using per fence based spin lock, which decouples it from instance
memory.

Change-Id: I12d6976c0bac3f0211bb16e24009603b37471ef3
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-08-01 17:19:38 -07:00
Mihir Ganu
1e87ceec2b video: driver: Introduce a property to set COMV bufcount
Certain codecs/use cases require larger COMV buffer sizes to achieve
performance. Introduce a property to set COMV bufcount and calculate
COMV buffer size based on the bufcount.

Change-Id: Ib0ed8afe77708dc453cbcc121bcd8606db637152
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-08-01 17:19:20 -07:00
Darshana Patil
10794c2968 video: driver: initial state machine changes
- hierarchical state model which comprises of
  top level states and sub states
- top level states include OPEN, CLOSE, ERROR,
  INPUT_STREAMING, OUTPUT_STREAMING, STREAMING.
- sub states include DRAIN, DRC, DRAIN_LAST_BUFFER,
  DRC_LAST_BUFFER, INPUT_PAUSE, OUTPUT_PAUSE.
- follows deterministic approach for key sequences
  like DRC, DRAIN and last flag handling i.e none
  of these events are ignored or discarded.
- removal of auto start of firmware input port as
  part of ipsc handling.
- introduction of hfi commands for host controlled
  PAUSE and RESUME of firmware ports.
- introduction of information last flag packets
  for DRC and DRAIN when FW has insufficient
  output buffers.

Change-Id: Ie8c8f44af464d06f5a7bb76822f749c9874f869a
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-06-29 10:47:54 -07:00
qctecmdr
c7360bccc3 Merge "video: driver: Modify Min QP in CAP_TO_8BIT_QP macro" 2022-06-26 01:20:54 -07:00
qctecmdr
be6dd00dcf Merge "video: driver: buffer tracing changes" 2022-06-23 17:00:03 -07:00
Vedang Nagar
2eacac6058 video: driver: Modify Min QP in CAP_TO_8BIT_QP macro
For HEVC 8 bit usecase, QP values are being capped
from [-11,51] to [1,51]. Modifying the same in
CAP_TO_8BIT_QP macro.

Change-Id: Id17fab4c62770140131f0f8454fc480090732d0b
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
2022-06-24 00:38:18 +05:30
Govindaraj Rajagopal
cd4ea5b043 video: driver: fix possible memory corruption issue
__flush_debug_queue() currently uses core->response_packet
or core->packet for flushing debug queue. So these were
allocated only 4096 bytes, but in read_queue(), boundaries
were checked against VIDC_IFACEQ_VAR_HUGE_PKT_SIZE macro
which is of size 1024 * 12 bytes.

So if FW log packet size is in between 4 KB to 12 KB then
read_queue() allows memcpy() into core->response_packet
or core->packet that will lead to redzone corruption issue
with adjacent alive/valid allocations i.e futher lead to
kernel panic at kfree() sequence(during object validation).

Uploaded change to use same sizes during allocation and
read_queue() validation.

Change-Id: If82766c1479d7589605386f3e314ff2ccd97f6d0
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-06-23 19:45:09 +05:30
Akshata Sahukar
1e7edf5b98 video: driver: buffer tracing changes
1. Introduce new v4l2 control to get HAL session id and
   print the same in driver to have unqiue session id
   between HAL and driver
2. Copy input buffer timestamp into input meta buffer
   to track input meta buffer done at HAL side. Required
   specially for fence use case.

Change-Id: I146b153fa0baea3b684a482de5da19e736df3736
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-06-22 16:41:08 -07:00
qctecmdr
12c5ef4768 Merge "video-driver: add to support DolbyVision metadata" 2022-06-01 23:48:24 -07:00
qctecmdr
395e8686ec Merge "video: driver: Use max bitrate depending upon session" 2022-06-01 21:40:44 -07:00
Deepa Guthyappa Madivalara
0160053f46 video: driver: Use max bitrate depending upon session
1. Host will use HQ quality mode for all INTRA encoding case
2. Cap bitarate and bit rate boost to max bitrate of current
   session config

Change-Id: I8e8d19998ebeff992c290fbd18c072b2b93ffef2
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-06-01 11:36:14 -07:00
Zhongbo Shi
f781c619a9 video-driver: add to support DolbyVision metadata
1. add DolbyVision metadata cap and V4L2 id;
2. Increase decoder persist buffer size;
3. Increase decoder output meta buffer size;
4. Increase encoder input meta buffer size;
5. Parse buffer overflow flag and set buffer flag
   accordingly;

Change-Id: I8fa5e89068dd479033d28f627e585edc3a1c58bb
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2022-06-01 16:29:30 +08:00
qctecmdr
5dc3050cce Merge "video-driver: Add support for subframe_input" 2022-05-27 13:07:50 -07:00
qctecmdr
80ff8d2af2 Merge "video: driver: enable transcode stat for decoder" 2022-05-27 00:44:21 -07:00
Vedang Nagar
078aebf73a video-driver: Add support for subframe_input
Add support for 'HFI_PROP_SUBFRAME_INPUT'.
Payload '1' indicates that input buffer is
processed. However, FW expects more inputs
to construct a full YUV output buffer.
Overloading 'MSM_VIDC_BUF_FLAG_ERROR' code to
ensure HAL work completion

Change-Id: I05b24a50e587dfd96457af508267843ac3840fbf
Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
2022-05-26 20:36:45 +05:30
Mahesh Kumar Sharma
8d0a217984 video: driver: enable transcode stat for decoder
Subscribe and enable HFI_PROP_TRANSCODING_STAT_INFO property
in order to enable transcoding stat for decoder.
This stat is used further by encoder to improve encoder quality
decision for transcode case.
Ideally we want to avoid CAC-BRS multiple times for same encoded bitstream.

When user does recording (1st encode), So we have CAC enabled bitstream.
Now, if user wants to send it via some app.
So, it will be decode -> (optional GPU) -> (2nd) encode

For 2nd encode -> we would like to not apply same CAC. It needs either tuning.
But we don't have a way from bitstream to know whether it went via CAC.

This feature enables to use the stat info received from decoder to fine tune encoding.

Change-Id: Iaf640878f5554b16aad3314ba4e26f99638c43af
Signed-off-by: Mahesh Kumar Sharma <quic_smahesh@quicinc.com>
2022-05-18 19:27:42 -07:00
Akshata Sahukar
3964fa9159 video: driver: Create and use single spin lock for dma fence
Create and use single spin lock per session (per fence context)
rather than creating spin locks per dma fence to possibly
resolve flickering in video playback.

Change-Id: I01286ae375dfedc0da26a1be4ded1bd1e02767ba
Signed-off-by: Akshata Sahukar <asahukar@quicinc.com>
2022-05-18 14:23:17 -07:00
Vikash Garodia
5a7898589e video: driver: keep default complexity as 50
Complexity parameter defines the encoding tools used
during an encode session. Higher the complexity implies
more quality with advance encoding tools used.
Keeping the default value as moderate or acceptable
range.

Change-Id: I3ee66d3a6612d5d60cd63a0698a4248f48ee8e2d
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
2022-05-13 09:55:40 +05:30
Vikash Garodia
e3da5c43e2 driver: video: Add critical priority and reserve duration
Critical priority - A video session which is prioritized above
all concurrent sessions. Such sessions have low latencies and
at the same time they cannot be rejected due to overload.
Reserve duration - Duration by which a session reserves the
video hardware for processing frames from that session.
Both the above aspects are implemented with these changes.

Change-Id: I58aef5f239e5ee106201d6819d2228784f0f0ad0
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
2022-05-02 11:17:18 +05:30
qctecmdr
57b55c5c22 Merge "video: driver: Add support for slice encode delivery" 2022-04-29 15:44:27 -07:00
qctecmdr
cf5a48074b Merge "video: driver: introduce metadata size macro" 2022-04-29 13:19:19 -07:00
Chandrakant I Viraktamath
308499361d video: driver: Add support for slice encode delivery
Add support to enable slice encode delivery for
HEVC and AVC codec. Basically in this mode, each
encoded slice is given as a separate FBD to the client.

Change-Id: Ia30fde9abaf2b38fb486113807fbb7f19110225c
Signed-off-by: Chandrakant I Viraktamath <quic_civirakt@quicinc.com>
2022-04-29 22:18:06 +05:30
Mahesh Kumar Sharma
a079cc43f3 video: driver: preprocessing pass required additional cycles and bw
Encoder preprocessing feature requires additional cycles
and bw to support this feature if it is enabled.

Change-Id: I46de42dd0cb0d5a7cd9fdf00beeaefd50e40798e
Signed-off-by: Mahesh Kumar Sharma <quic_smahesh@quicinc.com>
2022-04-28 17:02:55 -07:00
Darshana Patil
808cebd0b4 video: driver: introduce metadata size macro
introduce encode input and output metadata
size macro in the interface file.

Change-Id: I40776018c5c3278d40a426c2afde4d56e90066e2
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-04-28 14:36:19 -07:00
Akshata Sahukar
047ed11bf7 video: driver: add restrictions for dec fence enablement
- Allow dec sw fence enablement only if decode order is set and
 non interlace type session.
- Enable low latency mode if sw fence is enabled.
- Signal fence if FBD length > 0.

Change-Id: Ib59c2de51f621b796e68fe2aba68d9fca3ff4272
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-04-26 13:28:13 -07:00
Deepa Guthyappa Madivalara
59b8019b9d video: driver: amend priorities to allow more sessions
1. adjust client set non-realtime priroty with NRT_PRIORITY_OFFSET (2)
2. if total mbps is more than max_mbps
    a. allow encode session by reducing decoder sessions priority by 1
    b. allow decode session by moving it to non-realtime session
        in order to not disturb the ongoing sessions

Change-Id: I96fd2ac75c123d681982fb9a2c06ac51d15bd59a
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-04-22 11:55:29 -07:00
Akshata Sahukar
ae362a4130 video: driver: Set 1 stage for Byte based Slice mode
Set 1 stage for Byte based Slice mode.

Change-Id: I9924535234e202e83d6f33b03ebc7de578e7aa48
Signed-off-by: Akshata Sahukar <asahukar@quicinc.com>
2022-04-08 22:02:14 -07:00
Mahesh Kumar Sharma
508f4a0282 video: driver: inline preprocessing improvement
For VPSS, FW requests more bandwidth from HW.
In order to support inline processing, FW introduced
request preprcess property.

Enble this property only when following conditions are met:
- CAC-BRS is required
- don't have EVA stats.
- Upto 4k@60 fps, max( frame rate, operating rate) <= 60

Change-Id: I3cf83483d9320e5dfe20617b37a54b9d5fbcffd8
Signed-off-by: Mahesh Kumar Sharma <quic_smahesh@quicinc.com>
2022-04-08 18:52:52 -07:00
Deepa Guthyappa Madivalara
fdef18ef50 video driver: remove session priority handling
1. Removes depenceny of priority from frame rate
    and operating rate.
2. Removes changing priority from s_param

Change-Id: Iec51173eab5a3d59b841315549d1420df422d37f
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-04-06 09:22:38 -07:00
Dikshita Agarwal
8f0e12cc93 video: driver: add support for cyclic intra refresh
Currently driver supports only random intra refresh, extend
it to support cyclic intra refresh too.
Cyclic intra refresh is supported dynamically as well.
- If intra refresh type is set and num of LCU’s to be refreshed
  are non-zero before session start, intra refresh will be enabled
  throughout the session.
  Any further dynamic settings in the number of LCU’s including 0
  will be honored accordingly.
- If intra refresh type is set and num of LCU’s to be refreshed are zero
  before session start, intra refresh will be disabled.
  When client sets it to non-zero value dynamically, driver will set
  HFI_PROP_REQUEST_SYNC_FRAME with
  HFI_SYNC_FRAME_REQUEST_WITH_PREFIX_SEQ_HDR.
  Driver needs to send HFI_PROP_REQUEST_SYNC_FRAME only at time of
  CIR Enable, no need to send at time of disable/enable again.

Change-Id: I10a2fb22d131353721ee658213ed807ce0794009
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-04-01 11:08:19 +05:30
Akshata Sahukar
0abd877e95 video: driver: fix for fence support
- Add METADATA_PICTURE_TYPE support.
- some fixes for fence support.

Change-Id: Icd2285aa9fef57775122e9d2433f1e5d708ccdd3
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-03-31 16:43:00 -07:00
Deepa Guthyappa Madivalara
ab684e15f6 video driver: calculate power based on max rate
1. Remove load based admission control for decoder.
2. For decoder, use max of frame rate, operating rate,
    timestamp rate and input rate for power calculations.
3. For encoder, use max of frame rate and operating rate
    for power calculations.

Change-Id: Ibdb2d4b29438d7f656a27771953d10e0a0e72edd
2022-03-30 13:03:24 -07:00
Darshana Patil
accb365696 video: driver: v4l2 compliance fixes for test formats
v4l2 compliance fixes for test formats

fixes:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK

Change-Id: I23c193ab5785bb10d070fa3085678d9669f53a92
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-03-28 11:58:06 -07:00
Manikanta Kanamarlapudi
ab51846ea0 video-driver: Add support for saliency metadata
Add support for saliency metadata control.

Change-Id: I6bfe54f58494a8189484bfbb3c2d989010fe3a2b
Signed-off-by: Manikanta Kanamarlapudi <quic_kmanikan@quicinc.com>
2022-03-24 23:35:33 +05:30
Akshata Sahukar
8ac3cc7120 video: driver: Change v4l2 metadata controls to BITMASK type
Change v4l2 metadata controls to V4L2_CTRL_TYPE_BITMASK type

Change-Id: I7f19b5dbf268351d368d9824cb52569e60116ebb
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-03-23 14:54:09 -07:00
qctecmdr
2e1a127d25 Merge "video driver: calculate power based on input queuing rate" 2022-03-22 19:08:47 -07:00
Deepa Guthyappa Madivalara
dc38176276 video driver: calculate power based on input queuing rate
Use client input buffer queuing rate for power
calculations for non-realtime sessions

Change-Id: I498422ba1ae9ae96b782a2096dc0cd0aa7b05798
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-03-22 14:21:35 -07:00
qctecmdr
1cc8fd9df1 Merge "video: driver: Enable bitwise operations for metadata controls" 2022-03-19 21:19:38 -07:00
qctecmdr
b5824aaaa4 Merge "video: driver: Add support for AV1D IBC feature" 2022-03-18 15:47:43 -07:00
Akshata Sahukar
d85f112d92 video: driver: Enable bitwise operations for metadata controls
Enable bitwise operations for metadata controls with below
mentioned bit definitions:
- ENABLE (BIT 0): Enable metadata.
- TX_INP (BIT 1): Client transfers metadata in input port.
- TX_OUT (BIT 2): Client transfers metadata in output port.
- RX_INP (BIT 3): Client receives metadata in input port.
- RX_OUT (BIT 4): Client receives metadata in output port.

Change-Id: Ie3d720528a383632c7766a5ccb09cead0f6b9428
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-03-18 13:26:00 -07:00
Mihir Ganu
96358cee7d video: driver: Add support for AV1D IBC feature
Add support for AV1D Intra-Block Copy (IBC) feature. This requires a
dedicated internal buffer (HFI_BUFFER_IBC_AV1D), which was previously
part of LINE buffer. A new internal buffer type called
HFI_BUFFER_PARTIAL_DATA is introduced, and this buffer type holds
HFI_BUFFER_IBC_AV1D for AV1D. HFI_BUFFER_PARTIAL_DATA is mapped to
NON_SECURE_PIXEL context bank for non-secure and to SECURE_PIXEL
context bank for secure use case.

Change-Id: If7ae22495f9981f275d54acc342c25ccdfc0c7b9
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-03-16 16:48:08 -07:00
Renjiang Han
743df51b4b video: driver: ts_reorder for negative timestamps
The timestamp in the driver is stored in the U64 type, but if there
is a negative value in the timestamp and the timestamp needs to be
sorted, using the timestamp value directly to compare the size is to
use the U64 type, which will turn the negative timestamp value into
a very large positive timestamp value, resulting in the sorting
result of timestamp is incorrect.

Change-Id: I13ccdb2c0c4d7b4e32999c5e88092c636c1f0b69
Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
2022-03-15 19:51:05 +08:00
Govindaraj Rajagopal
4f1180f1a6 video: driver: handle static and dynamic properties for decoder
Added change at decoder side to use adjust/set functions for
static(streamon) and dynamic(s_ctrl) cases.

Change-Id: I3d8c32baaf2fa2c3a077cc936a8ff2159ababfe3
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-03-08 19:46:05 +05:30
Govindaraj Rajagopal
0fde3a9aca video: driver: fix static and dynamic property setting sequence
Added changes to reuse caps_list for setting static properties
and also modified dynamic property setting sequence. Removed
redundant implementations.

Change-Id: I5829d3c98b0159916d7794f43e445a6191050182
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-02-18 18:20:39 +05:30
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
Govindaraj Rajagopal
93b88b9d69 video: driver: re-organize enums and add comments
Re-organized enums(msm_vidc_inst_capability_type) in below
order.

[1] Root(no parents) enums,
[2] Intermittent(having both parents & children) enums,
[3] Leaf(no children) enums.

Also added proper comments in header file.

Change-Id: I2bda51b54b6fa6e190098f16dd60090004cfbecf
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-02-17 10:33:11 -08:00
Akshata Sahukar
0a5549a6a9 video: driver: decouple fence structure from video buffer
Decouple fence structure from video buffer. Also add some
misc fence flow setup support.

Change-Id: Ia4e223a3a288f0dae3238850685f3a73d4b9400a
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-02-14 09:46:11 -08:00
qctecmdr
fe6594bcce Merge "video: driver: add support to send input meta buffer via request" 2022-02-07 20:52:22 -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
qctecmdr
dc71b3eaf1 Merge "video: driver: misc video changes" 2022-02-03 14:48:53 -08:00