Graphe des révisions

879 Révisions

Auteur SHA1 Message Date
qctecmdr
1ee1d9c8e5 Merge "video: driver: define slice delivery as boolean control." 2022-08-03 10:39:31 -07:00
Dikshita Agarwal
f1a32f5a86 video: driver: define slice delivery as boolean control.
Make slice delivery a boolean control instead of menu.

Change-Id: Iedf8e0df882d61e82661c7f557473d3f7b49215a
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-08-02 12:28:44 +05:30
Gaviraju Doddabettahalli Bettegowda
6fa776708b video: driver: Enable firmware core dump
Currently firmware core dump enabled via debugfs, so
added changes to enable fw core dump from sysfs.

Command to enable and disable fw dump:
adb shell "echo 1 > /sys/module/msm_video/parameters/msm_vidc_fw_dump"
adb shell "echo 0 > /sys/module/msm_video/parameters/msm_vidc_fw_dump"

By default it will be disabled.

Change-Id: I4b24c040e819e257edd26f695a095e254245251c
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
2022-08-01 17:55:43 -07:00
Govindaraj Rajagopal
473e46f0cc video: driver: add buffer statistics logic
Added change to print etb, ebd, ftb, fbd,
(ebd-etb), (fbd - etb), (etb-ftb) wallclock
time in ms.

It will help to debug perf issues.

Change-Id: Ideaecb2d51763711d6628729aa0f9056d05f0d51
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-08-01 17:55:39 -07:00
Govindaraj Rajagopal
912a80b094 video: driver: fix client_lock acquire sequence
Updated client_lock acquire sequence and cleaned
up timer list.

Change-Id: I413f31c8f4622f152598b08c9e107c77c03525cc
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-08-01 17:55:33 -07:00
Govindaraj Rajagopal
04ebbb2c2a video: driver: handle core_init failure in probe sequence
component bind cb is called from last bound subdevice context,
so if core init fails then i.e treated subdevice probe failure
and leading to undefined behaviour in protect_cp_mem() sequence
during fw_load(). So treat core_init failure as non-fatal since
it will be attmepted again during session_open.

Due to async-probe subdevice probe is called in parallel threads
so use core_lock() while populating context-bank entries into
&core->dt->context_banks list.

Change-Id: I45a891dbe589cfd011108365094b543202c0291e
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-08-01 17:55:27 -07:00
Mihir Ganu
525f1f5071 video: driver: Adjust bandwidth calculations for AV1
Consider AV1 LCU sizes and add AV1 considerations
while calculating bandwidth votes.

Change-Id: I0a6bff1bb142fb0eed44d4c3c458a916d11d6f57
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-08-01 17:55:12 -07:00
Gaviraju Doddabettahalli Bettegowda
9789b56a49 video: driver: add change to support slice mode decode
Added new capabilty changes to support slice based decoding.

This feature basically enables to decode the given input in terms of
slices and deliver single output to the higher layers when all slices
decoded in a frame.
When HW receives the slices then it will start decoding the slices,
instead of waiting for all the slices belongs to same frame.
So this will help to achieve lower decode latency.

Change-Id: Id107b34baba6d7b4a88238e232e8bf4a0fd6e58e
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
2022-08-01 17:53:54 -07:00
Akshata Sahukar
a8091c92b9 video: driver: Add queues init in video core init
Call venus_hfi_interface_queues_init() from venus_hfi_core_init()
to initialize the hfi queues if they were not initialized already
in probe sequence.

Change-Id: I855d2b2b6404a1a2af79157576f07e5a0c207fb6
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-08-01 17:26:31 -07:00
Vikash Garodia
9f34254da3 video: iris3: Fix the issue in power collapsing video hardware
During power collapse, video driver would power collapse video
hardware followed by video controller.
While power collapsing video hardware, it may happen that video
firmware has already power collapsed the video hardware, since
it is hardware controlled. For certain cases, like XS WD, it
may happen that video hardware may not be power collapsed by
video firmware. In such scenario, skipping power collapse sequence
of video hardware would lead to unhandled transactions from video
hardware.
There is a power status register which can clearly suggest if the
video hardware is power down or not. Added a check to confirm the
power status of video hardware before skipping or executing the
power collapse sequence for video hardware.

Change-Id: Ibd9cd708a259897262fcc6cab27b26aaf37f1b13
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
2022-08-01 17:22:18 -07:00
Manikanta Kanamarlapudi
2e52eecb78 video: driver: add vui timing info control
Add vui timing info control with default
value as disabled in driver.

Change-Id: Ibaa45303fe389a0120d487fe3b6ff336e721f359
Signed-off-by: Manikanta Kanamarlapudi <quic_kmanikan@quicinc.com>
2022-08-01 17:21:57 -07:00
Deepa Guthyappa Madivalara
267e11c2a4 video: driver: set clock rate to max for DRC or DRAIN substates
Increase clock rate to maximum in case of DRC or
DRAIN substates to speed up DRC or DRAIN sequences.

Change-Id: I0fd63b97267d37c18ad2d05069ab494b1b37fea8
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-08-01 17:21:40 -07:00
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
7d1fbd07cf video: driver: redefine private v4l2 macros in common file
Define vidc macros corresponding to private v4l2 macros
defined in v4l2_vidc_extensions.h file in msm_vidc_internal.h
and use the same wherever applicable for successful
compilation of upstream driver.

Change-Id: I2c7b3741d29996beb35b08b9c6dbd88876bb6ca6
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-08-01 17:59:08 +05:30
Dikshita Agarwal
704a316370 video: driver: replace V4L2_MPEG_MSM_VIDC_DISABLE/ENABLE
Replace V4L2_MPEG_MSM_VIDC_DISABLE/ENABLE macros with
0 & 1 to comply with v4l2 standard.

Change-Id: I5f27bfb8416b5be8caee29fb487916ccba020116
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-08-01 16:00:39 +05:30
Dikshita Agarwal
88dc4a0593 video: driver: handle private codecs defines
Move the usage of v4l2 macros in helper functions to
avoid compilation issues on upstream kernel with private
codec defines.
Use vidc macros defines in code instead of v4l2 defines
wherever applicable.

Change-Id: I43d7deb4f84c502689ceaec3273803444f30f379
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-29 12:37:03 +05:30
Dikshita Agarwal
c5c78e3ba2 video: driver: move v4l2 to vidc mappings to target specific file
Move mapping of v4l2 to vidc macros for codec, color format,
color primaries etc to target specific file to restirct the
usage of private v4l2 defines to target specific file.

Change-Id: Ie83968cb944c756e55b6514c496c0b23c5d16413
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-07-29 12:30:10 +05:30
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