Commit Graph

863 Commits

Author SHA1 Message Date
Darshana Patil
e4360dc18e video: driver: misc fixes for venv project
Change-Id: I4b5495ac4669a1e4519ac855d6b995e9d259f335
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-08-01 17:21:24 -07:00
Govindaraj Rajagopal
12adb66124 video: driver: add asynchronous probe support
Added async probe for video driver to reduce bootup latency.

In insmod/probe sequence, registered all video sub-devices with
component_model framework, so that once all sub-device probe
completes master/vidc node bind() callback willbe called. So as
part of bind, video driver will do core_init sequence. Due to
async probe all sub-device probe willbe called asynchronously
from different threads.

During rmmod/remove sequence master/vidc node may not be called
first and instead child node remove might be called, which will
intern calls component_del() api. 1st call to this api will
internally invoke unbind() callback of master. So as part of
unbind() video driver will do core_deinit() sequence.

of_platform_depopulate() will act as sync point on master node.
Which will make sure all residual sub-device removal completion.
So it will guarantee video device/master cleanup happens only
after all sub-devices removal.

Change-Id: Ia40d4b1aa54633ef26fff2c207da78f15e305363
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-08-01 17:21:04 -07:00
Mihir Ganu
34c527a939 video: driver: Subscribe to output metadata in both ports
Subscribe output metadatas in both input and output ports
so that metadatas which are detected in bitstream before
output port is started are not missed.
Example: AV1 HDR metadata which can be part of first ETB
(sequence header OBU + metadata OBU)

Change-Id: I77d75b42dcee79e0258ba96e6ab86d06ead2eaf4
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-08-01 17:19:58 -07:00
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
Dikshita Agarwal
ea38b901b7 video: driver: update msm_media_info to use vidc colorformat
Update all functions in msm_media_info.h to use vidc color formats
instead of v4l2 color formats macros to restrict the usage of private
color format defines in only helper functions.

Change-Id: Ib308c76af7b16ddac93023202191a47b21d68f5c
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-27 15:40:05 +05:30
Dikshita Agarwal
39623d261e video: driver: use cap id for v4l2 ctrl to hfi value mapping
Use cap_id instead of ctrl_id while assigning the respective
hfi values for a v4l2 control and vice versa.

Change-Id: I42f3733a28b4b00ca04605dfc1d2ef0a6fb7833d
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-27 15:08:12 +05:30
Dikshita Agarwal
e5bc8371ea video: driver: use cap_id instead of v4l2_id for control handling
Instead of using private v4l2 ids, use cap_id while handling
different caps in s_ctrl and g_ctrl ops.

Change-Id: I4d5dbb151ef5bc2dd348a06663e0beae0756d761
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-21 23:38:32 +05:30
Dikshita Agarwal
fd5d2c059b video: driver: use CAP_FLAG_DYNAMIC_ALLOWED flag to allow ctrls
Currently ctrl_id is being used to decide whether to allow or not
certain control dynamically i.e. after stream on.
Use CAP_FLAG_DYNAMIC_ALLOWED to do the same instead.

Change-Id: I56bf5e725ae7bd4ece8aa2bde0aa84c42e759c17
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-21 23:37:14 +05:30
Dikshita Agarwal
69d0c83f55 video: driver: split control code
Split control code into msm_vidc_control.c and
msm_vidc_control_ext.c files.

Change-Id: I95f13d66f33fb75da4ebaa08e24bf31fe5de55b4
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-12 12:15:54 +05:30
qctecmdr
2567eb16d3 Merge "video: driver: release internal buffer as part of start/resume" 2022-07-01 23:37:58 -07:00
qctecmdr
b0513bcda8 Merge "video: driver: check for drain last flag for decoder only" 2022-07-01 23:37:56 -07:00
Darshana Patil
fb1ecb69d0 video: driver: release internal buffer as part of start/resume
Change-Id: I45469c0a569fbc282aa1dbd217654e49eb50f54f
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-06-30 15:18:08 -07:00
Zhongbo Shi
cd799e6c31 video-driver: fix encoder output buffer size
Fix encoder output buffer size for CQ mode
to YUVSizex2x1.25.

Change-Id: Ib4581a0dc7fbb99fee827c676106806d4ea89157
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2022-06-30 00:29:22 -07:00
Darshana Patil
c5a62d98a4 video: driver: check for drain last flag for decoder only
As part of stop done, check if firmware has returned drain
last flag only for decoder.

Change-Id: I9738fe316b4e3081a8ab9c8066ef5f59ac0720f0
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-06-29 16:47:56 -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
Govindaraj Rajagopal
06643c1de9 video: driver: fix use-after-free issues with __read_queue() api
Incase of synchronous cmd(HFI_CMD_INIT, HFI_CMD_STOP, HFI_CMD_CLOSE)
timeout cases, video driver will attempt to do core_deinit sequence
and will free all interface queues mappings as part of core_deinit.

If at same time ISR handler is fired then reverse thread will attempt
to dequeue packets from message and debug queue. Reverse thread will
not acquire core->lock for performance reasone. Dequeueing packets
without acquiring core->lock might lead to use-after-free issues.

Uploaded change to address above mentioned issue.

Change-Id: I2047b28d69611129c4fdefcfb8a843c895e11dbb
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-06-29 09:17:02 +05:30
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
qctecmdr
71b6839128 Merge "video: driver: fix possible memory corruption issue" 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
Manikanta Kanamarlapudi
1f2238abb9 video: Allow slice configuration for VBR
Allow slice configuration for VBR

Change-Id: I289aa22fa9c97260b32dc34a1f95ad8b1b500287
2022-06-23 13:00:27 +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
9808a535b5 Merge "video: driver: fix order of fence node delete and put" 2022-06-21 16:08:17 -07:00
Darshana Patil
c6472ffcfb video: driver: fix order of fence node delete and put
delete fence node from the list and then call
fence_put(). This fixes random crashes in fence
testcase

Change-Id: Ib2cdc3a4046a6065bff991fdebe178dddc8847b2
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-06-21 12:56:58 -07:00
Govindaraj Rajagopal
e433d223a6 video: driver: fix faulty msm_vidc_vmem_alloc() failures
Sometimes uninitialized local pointer variables were passed to
msm_vidc_vmem_alloc() call for allocating memory. Uninitialized
variables might garbage value, so msm_vidc_vmem_alloc() is
treating that double alloc request and returning error. So i.e
leading to undefined behaviour.

For e.x, msm_vidc_update_input_cr() call will never add any
entries into &inst->enc_input_crs(due to above mentioned issue),
So i.e leading to populate invalid input compression ratio in
encoder usecase.

Change-Id: I4507b343bee8eec7252cf946ad8d3120efd7bacb
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-06-21 19:29:12 +05:30
qctecmdr
585ef29ef8 Merge "video: driver: initialize local variables" 2022-06-20 16:50:00 -07:00
qctecmdr
e90c0c454a Merge "video: driver: update bitstream buffer size calculation" 2022-06-20 16:50:00 -07:00
Deepa Guthyappa Madivalara
197328a67e video: driver: update bitstream buffer size calculation
calculate bitstream buffer size using firware macro

Change-Id: I1a06007ae8cd2852d70a426ba57119563813ebc5
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-06-15 11:52:56 -07:00
Deepa Guthyappa Madivalara
0c87473d7b video: driver: initialize local variables
initialize local vairables to avoid errors

Change-Id: I768f3da15870ec3151cbe4eb37299c44609ebddb
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-06-14 15:28:06 -07:00
Deepa Guthyappa Madivalara
ea5082d827 video: driver: fix for initial input_rate calculation
1. do not update input_rate until 30 inputs are
   received.
2. Fixes unwated downgrade from RT to NRT in UHD cases

Change-Id: I8d38a64829b44a0e335b69329ac5279a7b8a782d
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-06-08 16:05:08 -07:00
Mihir Ganu
84e39edbcf video: driver: Adjust bandwidth votes for AV1 film grain
For AV1 bitstreams with film grain, split mode is used for
UBWC colorformats as well. Consider split mode to calculate
bandwidth votes.

Change-Id: I98bf07b8be7f0e829af5e55ed6d0c3659ae099f2
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-06-03 14:42:20 -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
9ee0638b20 Merge "video: driver: fix slice mode support" 2022-05-31 19:39:44 -07:00
Akshata Sahukar
5713e9a303 video: driver: fix slice mode support
Allow client to set slice mode control to slice off for
HEIC codec.

Change-Id: Iffc8be23990a5dad451550cccb8236cc32951b2a
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-05-31 14:36:04 -07:00
Darshana Patil
e39962d028 video: driver: introduce lock for set & get volatile controls
Acquire client and inst lock for s_ctrl and g_volatile_ctrl

Change-Id: I97341b69ea5390133c46711c38be51326c80b224
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-05-31 11:20:03 -07:00
Akshata Sahukar
93742170e9 video: driver: fix incorrect crop resolution
Store unaligned resolution in driver inst formats
to avoid crop resolution getting updated to aligned
resolution whenever client did g_fmt and s_fmt again
after setting raw input resolution.

Change-Id: Ic2b6cf6e7d418d2bf0c35270199b914648e933d4
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-05-27 16:44:02 -07: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
qctecmdr
ccb76eb0e9 Merge "video: driver: Use vzalloc instead of kzalloc" 2022-05-26 19:19:15 -07:00
qctecmdr
5689776c4e Merge "video: driver: introduce client lock" 2022-05-26 18:57:44 -07:00
qctecmdr
ae681247a3 Merge "driver: video: Remove calls to power features during priority handling" 2022-05-26 16:19:46 -07:00
Deepa Guthyappa Madivalara
13d203ba7f video: driver: Use vzalloc instead of kzalloc
kzalloc might fail to allocate physically contiguous
memory which may not be available always and hence use
vzalloc to allocate virtually contiguous memory

Change-Id: I8ad89ef107da301217f3d1ec307b9b27b4edd2de
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-05-26 15:25:26 -07:00
Darshana Patil
2a687b2750 video: driver: introduce client lock
Acquire client lock for every entry point
in driver. This is needed especially for
streamoff and close calls where inst lock
is released while driver is waiting for
stop_done and close_done responses from fw.
When inst lock is released, client can send
a new ioctl call and driver state machine
can get updated leading to unexpected behaviour.

Change-Id: Ibb62c3431c88e2f1d9088d54fe7c9e53b1c284fd
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-05-26 14:34:36 -07:00
qctecmdr
e95d1dcf89 Merge "video: driver: Create and use single spin lock for dma fence" 2022-05-26 09:47:25 -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