Commit Graph

456 Commits

Author SHA1 Message Date
Govindaraj Rajagopal
2c0d2faefa video: driver: limit vp9 max spec to 4K@60
Added change to limit VP9 decode max spec is upto 4K@60.

Change-Id: I5939a8cf6cd227d2cced5adb3628b36493b7b1fc
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-09 21:07:54 +05:30
qctecmdr
16a8c42091 Merge "video: driver: encoder default level as HFI_LEVEL_NONE" 2021-06-08 23:29:45 -07:00
qctecmdr
21da327efe Merge "video: driver: do core_deinit for power_collapse failure" 2021-06-08 23:29:45 -07:00
Darshana Patil
87452bbf17 video: driver: encoder default level as HFI_LEVEL_NONE
set encoder default level as HFI_LEVEL_NONE

Change-Id: Ibe566a50c9c09a337fdf75f80bd3c37c7a5d0d4e
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-06-08 17:21:08 -07:00
Darshana Patil
5ace31f6b8 video: driver: modify rgba scanlines alignment to 32
modify scanlines alignment for linear rgba color
format to 32.

Change-Id: Ide64322bc872bfda64d8f48474ef2d37a4f314b7
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-06-08 11:02:12 -07:00
Govindaraj Rajagopal
e5a2546752 video: driver: do core_deinit for power_collapse failure
if skip_pc_count reaches VIDC_MAX_PC_SKIP_COUNT, that means
something wrong with hardware. So call core_deinit to reset
the hardware, so that atleast next session willbe proper.

Change-Id: I320fcc2917825a2ff79889b8183e2842257f3569
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-08 14:46:52 +05:30
qctecmdr
8818dd8215 Merge "video: driver: Set secure mode in encoder" 2021-06-07 22:18:03 -07:00
Chinmay Sawarkar
83f9b26441 video: driver: Set secure mode in encoder
Enable HFI_PROP_SECURE when secure session is enabled
in encoder. Same behaviour as Decoder.

Change-Id: I5edfe3d735fda8edea9e491ae17546945b4431a1
Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
2021-06-07 13:45:43 -07:00
qctecmdr
c67713f34e Merge "video: driver: Update session admission and work modes" 2021-06-05 11:13:10 -07:00
Linux Build Service Account
420c0336e4 Merge "video: driver: print more info on debug logs" into video-kernel-waipio.lnx.1.0 2021-06-04 18:19:00 -07:00
Mihir Ganu
3a7632ca4d video: driver: Update session admission and work modes
- To determine if session is admissible, check only the
  decoder input width/height and encoder crop width/height.
- Update session MBPF Calculations.
- Amend work mode setting to consider decoder input width,
  height and GOP size.

Change-Id: If4053c222de2a55ad5b85a8ab96c12c47b145aa3
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
2021-06-04 17:08:23 -07:00
qctecmdr
78ef4bc839 Merge "msm: vidc: Fix priority level determination" 2021-06-04 15:08:00 -07:00
Vikash Garodia
e923948da6 msm: vidc: Fix priority level determination
Priority level was not determined at few sequences.
Determine the priority level and set to firmware, if
there is a change in driver and firmware priority.

Change-Id: I97861fd4ce8cfb7cf828a8da9a5ce8ba900280ef
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2021-06-04 21:04:58 +05:30
Govindaraj Rajagopal
1f46168b9f video: driver: print more info on debug logs
Currently driver prints hex values for codec type, pixel
format and port number. So added change to print strings
instead of hex values.

Removed unnecessary logs to avoid overlogging timeout
issues.

Change-Id: Ia44401990797dc20eae0a35631e9ed6a0b094c20
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-04 19:26:34 +05:30
qctecmdr
f87aa7d05d Merge "video: driver: encoder fix for frame qp and level" 2021-06-04 01:58:55 -07:00
Darshana Patil
5b276d076e video: driver: encoder fix for frame qp and level
- misc fix for setting frame qp, min qp, max qp.
- seperate LEVEL database entry for encoder and
  decoder as max level supported by encoder is 6_0,
  but decoder supports upto 6_2.

Change-Id: Ia0a0a717e73e55a8b6933421e3eb55c3831524b2
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-06-03 13:57:49 -07:00
Govindaraj Rajagopal
7cf3193b10 video: driver: check for session_error at ioctl entry point
Currently session_error check is scattered at multiple places,
So check for session error at ioctl entry point itself(for set
type controls only).

Cleanup &inst->response_works.list as part of session close to
avoid leaks and remove unused variables from inst struct.

Change-Id: I349ec845cc71814b33a94ac07c7628304ddae564
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-03 15:08:31 +05:30
qctecmdr
1f8bf0bd92 Merge "video: driver: modify priority level enum" 2021-06-02 15:31:22 -07:00
qctecmdr
4ab25dd749 Merge "video: driver: update metadata buffer size" 2021-06-02 15:31:22 -07:00
qctecmdr
07514525c7 Merge "video: driver: fix race between driver fd close and ioctl calls" 2021-06-02 14:03:01 -07:00
Darshana Patil
8d33375a96 video: driver: modify priority level enum
modify priority level enum values to set
correct values to fw.

Change-Id: Ifd33b17db58b06d281ad930f7629d9a4575d0956
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-06-02 12:57:06 -07:00
qctecmdr
e61914fe82 Merge "video: driver: queue pending buffers at streamon" 2021-06-02 12:25:50 -07:00
qctecmdr
be42c3ec08 Merge "video: driver: add error handling at event_queue_deinit sequence" 2021-06-02 12:25:49 -07:00
qctecmdr
04805a2b55 Merge "video: driver: add error handling for lend failure" 2021-06-02 12:25:49 -07:00
Govindaraj Rajagopal
58207fc7d8 video: driver: add error handling at event_queue_deinit sequence
If msm_vidc_open() sequence fails before calling event_queue_init()
then it calls msm_vidc_close as part of cleanup.

So event_queue_deinit will attempt to call v4l2_fh_del without
completing v4l2_fh_init & v4l2_fh_add. So i.e leading to NULL ptr
dereferrence issue at v4l2_fh_del api.

Added change to avoid calling event_queue_deinit() sequence, if
event_queue_init is not completed.

Change-Id: Ia2732c39be819247379d955d40dddccaba7c00eb
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 17:55:36 +05:30
Govindaraj Rajagopal
d0267842f1 video: driver: add error handling for lend failure
Added error handling for mem_buf_lend failure.

Change-Id: I6ca0a575f8324e3f6eaf1cd114e9bf96608eff3d
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 16:54:47 +05:30
Govindaraj Rajagopal
5996ceb8d2 video: driver: fix race between driver fd close and ioctl calls
Userspace is allowed to close driver fd at anytime, even in middle
of ongoing session. So it will create a problem, if multiple ioctls
were waiting for &inst->lock() and msm_vidc_close() acquired the
&inst->lock and cleaned up all session specific resources including
vb2 queues, v4l2_fh file handles and all buffers and finally frees
inst itself, as part of put_inst(). So once that is done, other
enties waiting on &inst->lock will get chance, but by that time,
everything is freed. So proceeding that cmd will completely lead to
undefined behaviour and target reset will happen.

Added change to avoid above mentioned scenario by Incrementing inst
refcount everytime before proceeding any ioctls and acquired &inst->lock
to avoid concurrent access between ioctls.

Currently &inst->lock was not acquired except for reqbuf, qbuf, dqbuf
ioctls. But it is good to acquire lock at every ioctl types. This will
help avoid corner cases, such as during ipsc, all port setting were
updated to inst structure, So if userspace attempts any ioctl(like
g_ctrl) without lock, it might get intermittent value, which is wrong.

Change-Id: Ic4bdf562f7036f3796019fe45d1cdc392045878a
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 15:24:37 +05:30
Shi Zhongbo
5a9c41e69d video: driver: update metadata buffer size
Update metadata buffer size after port resolution
changes.

Change-Id: Ieb9ce986500b4f06b5b0a324b4cd42ebae5c4d9e
Signed-off-by: Shi Zhongbo <zhongbos@codeaurora.org>
2021-06-02 00:21:53 -07:00
Govindaraj Rajagopal
31012cd79e video: driver: queue pending buffers at streamon
qbuf will be deferred on all ports before streamon,
So explicitly queue pending buffers at the time of
streamon.

Change-Id: I673a14f0d43563184aac887f5f23b63ed13d59df
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 11:55:28 +05:30
Govindaraj Rajagopal
a33041f799 video: driver: add scaling checks for encode session
Encoder supports downscale with scaling ratio upto 1/8 of width
and 1/8 of height. So added necessary scaling checks at streamon.

Change-Id: I3a29b43c79cf4e693ba2c0d9f98ec24410d50fbd
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-06-02 11:26:12 +05:30
Darshana Patil
65636fd2ad Revert "video: driver: always caliberate gop size"
This reverts commit b35579ad54.

Change-Id: I5ba0b244f53068ae6f0d3225b278e1ddafc360c5
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-06-01 11:12:02 -07:00
Govindaraj Rajagopal
b2e9fada31 video: driver: restrict image load to 16K x 16K
Add strict check in msm_vidc_check_mbpf_supported() to
reject image session, if total image load exceeds 16K.
Added msm_vidc_print_insts_info() support to print all
running instance info, if new session is rejected due
to mbpf/mbps checks.

Change-Id: I98bab985fcf4f4d20c6f263c48e0c701ec86ab6f
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-31 17:11:46 +05:30
Vikash Garodia
c1bf1d2bc9 video: driver: Set proper HFI during low latency for decoder
Decoder supports dynamic low latency. When client configures the
video session in low latency mode, driver would configure the
firmware such that HFI_CMD_SETTINGS_CHANGE is triggerred on
sync frame boundary.

Change-Id: Ie70eaaeb8ad420db926f0d99f77723476deee400
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2021-05-28 21:38:05 +05:30
Govindaraj Rajagopal
69e6b8c0ca video: driver: fix race between streamoff and ipsc
During input port streamoff, state is changed from START_INPUT
to OPEN and then sent CMD_STOP to firmware. So reverse thread
acquired the lock and trying to process IPSC. Since IPSC is
not allowed in OPEN state, driver treats that as a fatal issue
and moves inst->state to ERROR state. Added change to avoid
above mentioned issue.

Change-Id: If0e18f01b6ecac3c810c0dab878ae392c48ffc27
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-28 11:24:52 +05:30
Govindaraj Rajagopal
8d81cd480b video: driver: tune clock and bus vote calculation
Use bitstream fps in clock and bus vote calculation, if
bitstream detected fps is higher than client set rate.

Change-Id: I58fa1a8725086c112796b3ce5172a39f322e178e
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-27 14:32:05 +05:30
qctecmdr
23336229ec Merge "video: driver: Update stage & pipe before sending resume" 2021-05-26 22:06:37 -07:00
qctecmdr
6e3277082c Merge "video: driver: allow main and main 10 profiles for heic enc" 2021-05-26 22:06:37 -07:00
qctecmdr
f7485924fd Merge "video: driver: reject unsupported resolution in output streamon" 2021-05-26 22:06:37 -07:00
qctecmdr
6229c69253 Merge "video: driver: deinit core from a valid session only" 2021-05-26 20:51:39 -07:00
Akshata Sahukar
b4b2a856e3 video: driver: allow main and main 10 profiles for heic enc
allow main and main 10 profiles for heic enc.

Change-Id: I5ce6f24fede3d7b2267a97a0aaf01e19e9894ba3
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-05-26 18:57:55 -07:00
Maheshwar Ajja
d0af60e008 video: driver: deinit core from a valid session only
Occationally when multiple sessions are waiting for firmware
response and at the same time if there was a system error
received which will deinitalize the core and remove all sessions
from core list. If client opened new session which will initialize
the core and start the new session. As there will be no response
for old sessions, eventually, they will timeout and try to deinitialize
the core which will reset new session also which is not correct.
So check if timed out session is valid (present in core list) before
deintializing the core from timeout session.

This change also addresses below race condition issue -

If client is opening multiple new sessions and multiple old sessions
are also timedout at the same time and all are waiting for core lock
to be acquired. The new session does init_completion(&core->init_done);
and release core lock before waiting for completion event. As core lock
was released the timed out session will acquire the core lock and deinit
the core and release core lock. As core was deinited, another new session
will do init_completion(&core->init_done); on which the previous session
was waiting for completion event. doing init_completion again on an
already waiting completion event will result in list corruption issues.

Change-Id: I94766ead8b3ecad7d0b87f4b999608f435d0cee2
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
2021-05-26 18:18:44 -07:00
Mahesh Kumar Sharma
75597419c8 video: driver: Update stage & pipe before sending resume
Before sending HFI_CMD_RESUME to firmware ensure to update
stage & pipe.

Change-Id: I279aaf387076a8355d73480c6b02cc79df112306
Signed-off-by: Mahesh Kumar Sharma<smahesh@codeaurora.org>
2021-05-26 17:34:47 -07:00
Darshana Patil
4e5c57950d video: driver: reject unsupported resolution in output streamon
For decoder, reject unsupported session during output
port streamon.

Change-Id: I048bf86cce1357a8db6c4ed5fc15508db1382916
Signed-off-by: Darshana Patil <darshana@codeaurora.org>
2021-05-26 16:02:11 -07:00
Akshata Sahukar
6e9150c232 video: driver: Enable low latency mode for CBR rc type
Enable low latency mode for CBR rc type.

Change-Id: I80230e5d2acab94820b1401ffa6e6fe372398397
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-05-26 13:42:17 -07:00
Akshata Sahukar
b35579ad54 video: driver: always caliberate gop size
[1] Irrespective of layer encoding type P or B, always
    caliberate gop size to have gop size multiple
    of sub gop size.
[2] Do not cap enh layer count value to max 1 value when
    cvp is disabled.

Change-Id: I10f602202ce007707c0fee76d9f847db70798754
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
2021-05-26 11:47:40 -07:00
qctecmdr
a71714eae3 Merge "video: driver: tune dcvs and batching buffer count" 2021-05-26 10:07:11 -07:00
Govindaraj Rajagopal
63a42011b2 video: driver: tune dcvs and batching buffer count
[1] add dcvs cushion buffers, only if core supports dcvs
[2] update buffer_count for dcvs & batching for priority
    static control.
[3] add max_fps & max_mbpf checks to disable decode_batching.
[4] add low_latency check in msm_vidc_allow_dcvs api.

Change-Id: Iafb7ad4aa601a0a3753e30475a8709f261719b0c
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-26 20:59:13 +05:30
Govindaraj Rajagopal
b0e9eab96d video: driver: treat sesion_open and session_close failure as fatal
do core_deinit for sesion_open and session_close failures, to
handle recurring clock prepare failure.

Change-Id: I1c305f9e6269f7176b8283dbe91712f9e31448f5
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
2021-05-26 12:12:32 +05:30
qctecmdr
6bd6a4e1b8 Merge "driver: waipio: set static priority configuration to firmware" 2021-05-25 21:01:15 -07:00
Vikash Garodia
252625c6d0 driver: waipio: set static priority configuration to firmware
Existing video driver expects session priority to be set
explicitly during static configuration. CAP_ROOT is not
enabled for decoders, hence explicit setting is needed.

Change-Id: Id754b38f15e9e045d31797557a4a7aa7a296346e
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
2021-05-25 16:59:26 +05:30