msm: vidc: Supress non fatal Session errors

FW sends SESSION_ERROR for various reasons. The session error
might not be fatal always. This is conveyed using event_data1.
Driver needs to process this message and supress non fatal
errors and reports only fatal errors to clients.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: avoid usage of output_tag to get session_id

The firmware will send session_id as part of
struct hfi_msg_event_notify_packet. The driver should use
the session_id in this structure rather than from output_tag.
Without this change release reference event will not be
handled correctly by driver.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: allow clients to set buffer size on OUTPUT plane

Accept the size set by clients for buffers on decoder's OUTPUT
plane. Limit the size based on the max width and height
supported by fw.

Signed-off-by: Shalaj Jain <shalajj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add correct enum session_type instead of core_id

- Initial setup_event_queue is using core_id enum instead of
  session_type for msm_video_device parameter
- Fix the issue by using session_type instead of core_id

Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for encoder rotation

Venus FW supports rotation. Driver sets the rotation
angle and updated height and width. Rotation support
added for Venus based chips.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: flush dynamic output buffers in reconfig

In dynamic buffer mode, if driver receives a
flush during reconfig, it should release all
buffers held in the kernel and not queued to
firmware. Without this change, the buffers held in
the kernel do not get flushed and video client
hangs waiting for release of output buffer.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for encoder scaling

Venus FW supports upscaling and downscaling for encoder.
The supported scaling ratios are returned from Venus FW
as part of session_init_done message. Driver needs to
make sure that the scaling ratios are within the range.
This change adds the scaling support for encoder.

Change-Id: Ibf158cf35e93c45dd89715845a549871146a8eea
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for encoder deinterlacing

Venus FW supports deinterlacing for encoder. FW doesn't
support deinterlacing along rotation. Driver needs to
make sure that rotation and deinterlacing are not called
together. This change adds encoder deinterlacing support.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Implement CAF Dynamic Buffer modes

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for FW version check

Encoder VPE and decoder DS features need to be supported
on targets which are using Venus 1.4 FW. FW sends version
as part of system property message. Driver needs to process
the version and reject VPE and DS features accordingly.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Don't keep flushing dynamic output buffers

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Add support for decoder downscaling

Venus FW supports downscaling for decoder. Venus
FW sends the supported downscaled ratios. Driver
needs to make sure that the scaling is inside the
supported range. This change adds support for decoder
downscaling.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Fix issue with picture type property

Wrong picture type is being passed to FW resulting in
SESSION error. Fix the issue by parsing and passing
correct picture type value.

Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Set default values for plane and image sizes

G_FMT shall return a valid non-zero value to client.
plane_sizes are set in REQBUFS but G_FMT is not necesary
call after REQBUFS.

Signed-off-by: Jorge Solano Altamirano <jsolano@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: correct tz-usage-tables in DTSI files.

Update TZ usage table to match expected values in TZ.  Incorrect values
caused secure buffers to be hinted incorrectly to TZ.

Signed-off-by: Cullum Baldwin <cullumb@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Fix issue in IOMMU mapping for QDSS address

The partition value for QDSS IOMMU mapping is hard coded to 1. This
value should be dynamically calculated using device tree memory map.
This change fixes the same.

Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Amend Q6 HFI session id entry to session list

Add session id to the session list before sending the
APR packet to avoid race conditions in APR.

Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Fix image version sys property processing

Venus image version is now reported through sys
property message which has different packet
structure and requires new processing.

Signed-off-by: Sachin Shah <sachins@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Fix a race condition in core instances list access

While checking the supported load, we are accessing core
instance list and there are chances that it can be
modified else where. Add a mutex lock while accessing
the core instances list to avoid such scenarios.

Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: expose smem apis through msm vidc

The v4l2 video driver exposes two disjoint set of apis - vidc
and smem. Incorporate smem in to vidc apis.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>