Commit Graph

858 Commits

Author SHA1 Message Date
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
d10f2f9108 Merge "video: driver: utilize v4l2_m2m_ioctl_streamon helper function" 2022-02-11 18:19:50 -08:00
Deepa Guthyappa Madivalara
e5189157f1 video: driver: utilize v4l2_m2m_ioctl_streamon helper function
Use v4l2_m2m_ioctl_streamon helper function for input and output ports

Change-Id: I20375259321cc5925ccaf7f8eab95a94f55d2821
Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
2022-02-11 16:49:44 -08:00
qctecmdr
dde62fecf8 Merge "video: driver: check whether meta buffers dequeued from FW" 2022-02-10 22:35:17 -08:00
qctecmdr
528845d245 Merge "video: driver: propagate i/p port color info to o/p port" 2022-02-10 22:35:17 -08:00
qctecmdr
8a7f66a9f4 Merge "video: driver: handle invalid format in s_fmt" 2022-02-10 22:35:17 -08:00
Akshata Sahukar
71f8dcf2f2 video: driver: Align hfi property file with CL: 35116137
Align driver hfi property file with fw file of CL: 35116137

Change-Id: Ic5abbb9212b664b55f16afa4c79e00fb0d76ae89
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-02-10 15:01:22 -08:00
Darshana Patil
18e6df6689 video: driver: check whether meta buffers dequeued from FW
when metadata is enabled check if the meta buffers are dequeued
from FW before sending vb2 buffer done on corresponding input
or output buffers.

Change-Id: Icabeaf08b398b9be0159d5db68c94734351b3a5a
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-02-09 11:53:54 -08:00
qctecmdr
fe6594bcce Merge "video: driver: add support to send input meta buffer via request" 2022-02-07 20:52:22 -08:00
Dikshita Agarwal
4d8dedc066 video: driver: handle invalid format in s_fmt
Handle invalid format 0xfffff by invoking try_fmt in
s_fmt. It is expected from driver to return EINVAL for only
unsupported buf type and if color format is unsupported,
driver should fill the fmt structure with valid values.

Partially Fixes: v4l2-compliance:
			TestSetFormat(VIDIOC_S_FMT)

Change-Id: I27e82866e8ad4a13661431f2a38a66ac3ef7dd80
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-02-07 11:20:13 +05:30
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
Akshata Sahukar
9df792a982 video: driver: propagate i/p port color info to o/p port
Client may do g_fmt on output port to fetch output port
color info. Hence, update output port color info with
client set input port color info.

Change-Id: Ifa3b16763d7389cd063493e25ce8b266ce1cb8c6
Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
2022-02-04 10:33:43 -08:00
Darshana Patil
7c4952934b video: driver: packetize dynamic controls with buffer
packetize dynamic controls set via request api along
with corresponding input buffer under the same hfi header
and queue to FW.

Change-Id: I8bf82f7ccb1ab16c42ce02189a208f5f7cb8dc70
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-02-03 15:08:02 -08:00
qctecmdr
dc71b3eaf1 Merge "video: driver: misc video changes" 2022-02-03 14:48:53 -08:00
Maheshwar Ajja
ef829ce44f video: driver: add fence support
Add fence support for decoder output buffers for
the consumer to use it to improve latency.

Change-Id: I7384b4a9793248988a2d2d546a535f26636d5bb3
Signed-off-by: Maheshwar Ajja <quic_majja@quicinc.com>
2022-02-02 21:43:52 -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
qctecmdr
c8b7a6830a Merge "video-driver: prepare conflict free dependency list" 2022-02-02 14:09:20 -08:00
qctecmdr
7f8fc5be92 Merge "video-driver: disable dynamic low latency" 2022-02-02 14:09:20 -08:00
qctecmdr
1f3a7188cb Merge "video: driver: add support for create buf" 2022-02-02 13:53:27 -08:00
qctecmdr
8f0905c717 Merge "video: driver: Add HFI and internal buffer changes for AV1 DRAP" 2022-02-02 13:53:27 -08:00
qctecmdr
444d66c792 Merge "video: driver: update OP port setting if rotation is enabled" 2022-02-02 13:53:27 -08:00
Govindaraj Rajagopal
d9debeed9e video-driver: prepare conflict free dependency list
Convert multi-parent, multi-child based dependency tree
into flattened list. It is organized in such a way that
all parents willbe present before self or any child node.

For some caps, adjust sequence is called without preparing
parent nodes. So that is leading to undefined behaviour.

Added change to address these problems.

Change-Id: Ib28cae8a4ed7e019c80ecfc06519ef78ffa4dc08
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-02-02 14:59:48 +05:30
Mihir Ganu
9bacc5d124 video: driver: Add HFI and internal buffer changes for AV1 DRAP
Add changes for AV1 DRAP (Delayed Random Access Point) handling:
1) Add config in kalama database to control DRAP and the HFI property
to set DRAP config.
2) Update buffer calculations:
- When DRAP is disabled, COMV buffer must be allocated
and PERSIST buffer must be allocated with total_ref_count = 0
- When DRAP is enabled, COMV buffer must not be allocated -
it is part of PERSIST buffer. Persist buffer must be allocated with
the max_width, max_height and total_ref_count configured for DRAP.

Change-Id: I2d2e8fd3f63ea8f9fc2845acd0b4e16ba4776a6b
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-02-01 15:32:01 -08:00
qctecmdr
8d6bee38b3 Merge "video: driver: fix msm_vidc_remove sequence" 2022-02-01 15:21:17 -08:00
Zhongbo Shi
afa424d529 video-driver: disable dynamic low latency
Dynamic low latency causes decoder input PSC triggered
for every IDR frame, leading to clock increasing.
And this also causes power higher
for VT call. Thus, need the following changes:

1. Disable dynamic low latency when low latency mode
is enabled;
2. DO NOT allow config low latency mode after
stream on.

Change-Id: Ia57f4c75617214b0352b263425ad9b445ff95524
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2022-02-01 13:54:45 -08:00
Govindaraj Rajagopal
eee7bd1a5e video: driver: fix msm_vidc_remove sequence
of_platform_depopulate() will attempt to call
msm_vidc_remove for each sub device(contextbank)
individually. So added support for sub device
remove sequence.

Change-Id: I74806e30355d69f7d6080db820bad739b556366f
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-02-01 18:41:36 +05:30
Dikshita Agarwal
58e4fd1d8f video: driver: update OP port setting if rotation is enabled
Update the output port setting when set control is called for
rotation irrespective of the value of rotation angle.

Partially Fixes: v4l2-compliance: encoder:
			TestSetFormat(VIDIOC_S_FMT)

Change-Id: Ic5dce8089820f69fd38ac3b394e1c139d5d76f1b
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-02-01 15:13:18 +05:30
Dikshita Agarwal
365d8650f2 video: driver: add support for create buf
Add handling for VIDIOC_CREATE_BUFS ioctl in driver.
    This ioctl is used to create buffers for memory mapped
    or DMA buffer I/O.
    It can be used as an alternative or in addition to the
    ioctl VIDIOC_REQBUFS ioctl, when a tighter control over
    buffers is required.
    This ioctl can be called multiple times to create buffers
    of different sizes.

    Partially Fixes: v4l2-compliance:
                    test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF.

Change-Id: I9dd6c3f48e48e297b3e56fd4c8062869c8b55bee
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-02-01 13:49:53 +05:30
Dikshita Agarwal
bf0e8166d8 video: driver: add support for query buf
Add handling for VIDIOC_QUERYBUF ioctl in driver.
This can be used to query the status of a buffer
at any time after buffers have been allocated with
the VIDIOC_REQBUFS ioctl.

Partially Fixes: v4l2-compliance:
                test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF.

Change-Id: Ifd014bd8a8b02ce9fa15c62d7583bc8bcfb6756a
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-02-01 08:43:40 +05:30
qctecmdr
0c0981b43c Merge "video: driver: allow five 4K resolution video sessions" 2022-01-28 19:01:20 -08:00
qctecmdr
e37a49f7f2 Merge "video: driver: add input metadata fd control" 2022-01-28 16:46:27 -08:00
qctecmdr
1dcad3ea8c Merge "video: driver: fix subscribe event handling" 2022-01-28 14:25:03 -08:00
Darshana Patil
dce0ce7996 video: driver: add input metadata fd control
Added an extension to allow client to send
input metadata buffer fd via request api.

Change-Id: I8e05e53512b3f5dd31fa16ea64ee5d97ef2de7b4
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-01-28 13:14:31 -08:00
Dikshita Agarwal
ea681bed4d video: driver: fix subscribe event handling
Invoke correct APIs to handle different types of events.
Fixes: v4l2-compliance:
		test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT.

Change-Id: I442fae3111d65a9612c73f2d16f9ed8031c77ec0
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
2022-01-28 14:43:37 +05:30
Darshana Patil
acc83ca211 video: driver: request api changes for dynamic controls
- Request api allows to synchronize controls along
  with buffers.
- Client allocates a request fd. This request fd is
  associated with control and set using s_ext_ctrls.
  Such controls are stored by the framework and not
  applied immediately.
- Request fd is also associated with input qbuf and
  queued to driver. Following this actual request is
  queued. Buffers do not enter the queue untill the
  request is queued.
- As part of qbuf, driver call request_setup() which
  inturn sets the control to driver.

Change-Id: I316c4dc2a0091b21059230be5ee5fd6379259456
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
2022-01-27 15:02:27 -08:00
Maheshwar Ajja
74c3b1bb63 video: driver: allow five 4K resolution video sessions
Allow five 4K resolution video sessions to support usecases
which needs five 4K sessions.

Change-Id: Iaf0d8f46d85f563fe45d4064baf9e9ec712e9241
Signed-off-by: Maheshwar Ajja <quic_majja@quicinc.com>
2022-01-20 09:35:13 -08:00
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
qctecmdr
960ac904d2 Merge "video: driver: Add support for AV1 film grain" 2022-01-19 18:38:07 -08:00
Mihir Ganu
85730716a8 video: driver: Add support for AV1 film grain
Add support to handle AV1 bitstreams with flim grain
for both UBWC and linear colorformats.

Change-Id: Ica07853d992c566c3471dc007ad8c22aba796dd4
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-01-18 12:43:59 -08:00
Mihir Ganu
6dff43a315 video: driver: Update vb2_mem_ops to match videobuf2 declearations
Update driver vb2_mem_ops function declarations to match
videobuf2 header declarations.

Change-Id: I79cd2cfc42abed2bd659c7a08c3cb1aa3f5cd495
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
2022-01-18 11:22:18 -08:00
Mahesh Kumar Sharma
d1351838e3 video: driver: CBR and Blur handling enhancements
This change is made to support 100ms VBV delay for
aggressive rate control in iris3 hw.
Video buffer verifer helps to ensure that encoded stream
doesn't overflow or underflow the decoder's buffer.
iris3 hw is capable to decode data in 100ms VBV buffer window.

Adaptive Blur (Internal encoder feature): This is other enhancement
which supports adaptive blur feature on iris3 for CBR_VFR
(Constant bit rate_Variable frame rate)/CBR_CFR
(Constant bit rate_Constant frame rate) rc types apart from
already supported VBR_CFR. Unlike iris2, there is no need to enable CAC.

Below are the listed scenarios when it is enabled/disabled on iris3-
- Supported only for 8 bits encoding (H.264 & H.265).
- By default enabled for VBR_CFR/CBR_VFR/CBR_CFR RC without CAC enabled.
- No dependency on CAC to be enabled.
- Adaptive Blur is disabled if minquality_VBR is enabled
- Adaptive Blur is supported for 3 RC types: VBR_CFR, CBR_VFR & CBR_CFR
- If any one of the features (scalar/external blur) enabled, encoder
  disables adaptive-blur.
- Static property available to disable adaptive blur feature

Below are the listed scenarios when it is enabled/disabled on iris2-
- Supported only for 8 bits encoding (H.264 & H.265).
- By default enabled for VBR_CFR RC type with CAC enabled.
- Dependency on CAC to be enabled.
- Adaptive Blur is disabled if CAC is disabled
- Adaptive Blur is disabled if minquality_VBR is enabled
- Adaptive Blur is not supported for any other RC types except: VBR_CFR
- If any one of the features (scalar/external blur) enabled, encoder
  disables adaptive-blur.
- Static property available to disable adaptive blur feature

For backward compatibilty:

- Removed CAC as parent from msm_vidc_kalama.c.
- Removed cac query from msm_vidc_adjust_blur_type in msm_vidc_control.c.

- Moved legacy code to newly created function msm_vidc_adjust_blur_type_iris2().
- Added msm_vidc_adjust_blur_type_iris2 in BLUR_TYPES in msm_vidc_waipio.c

Change-Id: I49dec7e2574496d1b32babde55c0187866ca21d2
Signed-off-by: Mahesh Kumar Sharma <quic_smahesh@quicinc.com>
2022-01-13 19:51:47 -08:00
Govindaraj Rajagopal
fb7d323e1c video-driver: fix invalid ptr dereference with destroy_buffers
read_only and release list does not take dma ref_count
using dma_buf_get(). dma_buf ptr will be obselete when
its ref_count reaches zero. So print the dma_buf info
before releasing the ref count.

Change-Id: I8c145a1107b83c7f3b366834feb37171c8614d15
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
830f916172 video: driver: fix race issue with core_init sequence
New session open followed by system_error will attempt to
core_init again, at the same time client is attempting to
open 2nd session, so core->state is moved to init_wait
atate.

1st session core_init request is getting timedout and i.e
leading to force core_deinit and core->state also moved to
core_deinit state.

At the sametime client is attempting to open 3rd session,
and unfortunately core is in deinit state, so it bypasses
all init_wait check moved ahead and attempted core_init
again and moved core state to init_wait and waits for
core_init_done with timeout.

2nd session got timedout and attempts deinit and moved
&core->state to core_deinit.

Client again attempts 4th session open and that will attempt
to reinitialize &core->init_done completion struct, on which
3rd session is already waiting for. So that is leading to
list corruption failure at core kernel side.

Change-Id: Idaf96355c18f34e4204214b18479f067cfc47165
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
0a59d13e9d video: driver: sort input timestamp for ts_reorder case
For timestamp reorder feature, input ts is propagated to
output as it is. This is to ensure if app queues linear
order ts for bframe enabled case, it will make sure to
avoid jumbled output ts(due to DPB reordering). But looks
like client requirement is to always get sorted output
timestamp. So added change to produce output ts always
in sorted order.

Change-Id: I1f7778c99e7acfb07103ff226f2bdf306a4c2fb9
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Gaviraju Doddabettahalli Bettegowda
91703af2cf video: driver: update stride and scanline for NV21 color format
Added changes to update the proper stride and scanline info to firmware.

Change-Id: Ic8e119a48af8c3203fc21a320255d930f5c8585f
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
2022-01-13 17:29:22 +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
ae4e77ad42 video: driver: fix deadlock issue with response workqueue
Both &inst->stats_work and &inst->response_work both were using
&inst->response_workq for scheduling works. From reverse thread
handle_session_response_work_handler incremented refcount via
get_inst_ref(), at the same time driverfd got closed by HAL.
So strongref is held by handle_session_response_work_handler and
as part of put_inst(refcount is zero), will attempt to destry
&inst->response_workq inside msm_vidc_close_helper.

destroy_workqueue() call will wait until all already fired events
to complete, which will never happen in this case i.e leading to
deadlock situation. It is an attempt to self destruction, which is
not allowed.

Added changes to avoid above mentioned situation.

Change-Id: Ieb26a4b02f87f2bb738027cfd16e4c261b756dc3
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
dd9dfba57a video: driver: fix invalid ptr dereference issue with print_vidc_buffer
Release cmd + RO sent to firmware for entries present in
&inst->buffers.release.list. After issuing release cmd before
getting release done, driver removed excessive mapping entries
which holds mapping refcount as 1. So last refcount on underlying
dmabuf reaches zero.

RO & release list doesnot take dma ref_count using dma_buf_get().
Dmabuf ptr willbe obsolete when its last ref was last. So removed
print_vidc_buffer in msm_vdec_handle_release_buffer() to avoid
NULL ptr dereferrence inside print_vidc_buffer.

Change-Id: I0bdac5e2a398f67b4aac95fa78eaf6f2b816a315
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
87763b734b video-driver: Add sku_version as device attr
Expose sku_version under device attribute.

Change-Id: I6800bf321b5678953a2a616fd3d2e85ad977de44
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30