Graphe des révisions

695 Révisions

Auteur SHA1 Message Date
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
Govindaraj Rajagopal
aeabb39378 video: driver: Change format specifier and API clean-up
-Removed unwanted functions
-Removed unwanted part of code from function definitions
-Added proper format specifier according to the data type.

Change-Id: I700202f1cf588506b329d202ce3e2729c027dcae
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
6e916441fc video: driver: Removed unused macro and variable
- Removed unused macro
- Removed unsed constant variable.

Change-Id: I43ff39d498637fb0aa721660fae0ca3dd7073e88
Signed-off-by: Gaviraju Doddabettahalli Bettegowda <quic_gdoddabe@quicinc.com>
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
c9f4e6c3c0 video: driver: fix race issue with seek after EOS
HAL received lastflag FBD(for EOS) from reverse(polling) thread,
and before it sends SessionContinue(START_CMD) to driver, component
thread initiated streamoff on input port. So driver statemachine
got changed from DRAIN_LAST_FLAG to START_OUTPUT state.

After Streamoff sequence, reverse thread attempting START_CMD will
fail due to driver statemachine check. So q->last_buffer_dequeued
was never getting reset at v4l2 layer. As a result all subsequent
dqbuf ioctl calls will fail and leading to session hung issue.

Added change to call vb2_clear_last_buffer_dequeued() before
START_CMD rejection at driver side to avoid above mentioned issue.

Change-Id: Ic06f555f0c4deaa05c526ba9c0a19396d5a6f289
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
Zhongbo Shi
25c72537e8 Video: Driver: fix crash issue when dumping packet
Using session id instead of session debug string when
dumping packet for a given session, in case of the
instance objest released in the other thread.

Change-Id: I1b91c051d510b8beea9d37de87f63f346efda050
Signed-off-by: Zhongbo Shi <quic_zhongbos@quicinc.com>
2022-01-13 17:29:22 +05:30
Priyanka Gujjula
a646e75752 video-driver: Optimize enc o/p buffer size
Allocate YUV_size * 2 for <=360p

Change-Id: I5c7b4ad2d2accf40943e880562f96af2d7c81509
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
2022-01-13 17:29:22 +05:30
Priyanka Gujjula
0dec23c1bd video-driver: diwali: Sort clock corners
Sort allowed clock corners for diwali
v1 & v2 variants.

Change-Id: Ic561cd4a0e7abcb0f239b294fa81807621f3ebdb
Signed-off-by: Priyanka Gujjula <quic_pgujjula@quicinc.com>
2022-01-13 17:29:22 +05:30
Govindaraj Rajagopal
58a111c212 video: driver: fix invalid ptr dereference issue with struct v4l2_buffer
qbuf call for actual bitstream and yuv buffer 'struct v4l2_buffer'
length field indicates numplanes and for metadata buffers, length field
indicates capacity. So always check length field before accessing/
dereferencing b->m.planes or b->m.fd.

Change-Id: I409b28e0a66bd5c031b2c98c6d7614da99164a6c
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
2022-01-13 17:29:22 +05:30
qctecmdr
ae4f5ce1c5 Merge "video: driver: flush pending last flag buffers in streamoff" 2022-01-09 22:09:05 -08:00
qctecmdr
a0a3d7275f Merge "video: driver: Add support for AV1 dynamic frame resolution change" 2022-01-07 19:28:35 -08:00
Maheshwar Ajja
2d5a106e01 video: driver: flush pending last flag buffers in streamoff
When client called streamoff on capture port, driver needs
to flush out pending last flag buffers, if any, to avoid
session errors.

Change-Id: I733ba1a39374f38a1d63a876fb4d2fc06aa6daf7
Signed-off-by: Maheshwar Ajja <quic_majja@quicinc.com>
2022-01-04 16:56:05 -08:00
qctecmdr
d827fc1e83 Merge "video: driver: fix usage of v4l2_fh" 2021-12-21 19:52:14 -08:00
qctecmdr
d7ed637174 Merge "video: driver: add support for VIDIOC_TRY_DECODER/ENCODER_CMD" 2021-12-21 19:38:53 -08:00
qctecmdr
e10072e7a9 Merge "video: driver: handle drain in open state" 2021-12-21 19:38:53 -08:00