minimal revition

Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Amend calculation of buffer sizes in VENUS_BUFFER_SIZE

Add 8KB worth of padding for extradata. This is required to accommodate
some of the larger extradata types that didn't fit into the residual
space between the actual buffer size and its aligned size.

CRs-Fixed: 647378
Change-Id: I550f806079dfbdece229f68ffdfc5c0e20b3c9e1
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Expose extradata size to userspace

Previously, the extradata size was included within VENUS_BUFFER_SIZE
and callers (primarily in userspace) wouldn't know how much extra
padding was added to the buffer size. Exposing it allows userspace to
query directly instead of doing guesswork.

Change-Id: I7f9701a4adfe364d757028514bdd4fa84402a995
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Add support for different errors

When hardware is overloaded or when max number of clients are
reached in driver or firmware, hardware error is sent to video
client. This change is to replace hardware error with actual
errors.

CRs-fixed: 575852
Change-Id: I07e599f894a3716a3dc4fed5eb7c987311f5bdde
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: configure and set hier-p layers

Firmware requires the max number of hier-p layers
to be used during the encode session to be set
in load resources state. Without this change,
firmware will not enable hier-p encoding. Also
switch to using HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER
to set the number of hier-p layers.

Change-Id: I1fbf835acdb7d0a06d33cf9c2d038fb87c10010d
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Print out the proper height and width in debugfs

The driver was printing out the width and height from the OUTPUT port by
default, which is controlled from the client.  If the client doesn't
know any better and sets a bogus width and height, we would mirror that
in debugfs.  The width and height on the CAPTURE port is something we
receive from Venus and is guaranteed to be correct.

Change-Id: Ic5762cd63377aaef19ca488a2f9a31304ae0eafe
Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: do not check for session supported in executing state

The v4l2 video driver should check if the video session is supported
only prior to entering the executing state. Once video session is
in executing state, the session should be always honored.

Change-Id: Iaa59089ef05f03bbc821af8c7fd4fbc342067b3a
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
 msm-vidc: Modify HFI not to alter VP8 max supported width

Modify HFI not to alter firmware returned max supported width
and height and make generic both for Venus and Q6. Remove
creation of debugfs file for VP8 mode.

Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: handle dynamic buffers in pendingq during flush

In dynamic buffer mode, if flush was received before
stream-on, driver would have incremented the ref count
for output buffers, but not yet sent to firmware. So,
after flush done, there would be no fbd from firmware
and the reference to these buffers would not be removed.
So when the buffers are dequeued, driver fails to
unmap and free the output buffers.
Subsequently, after flush done, when client queues
the same output buffers again to driver, the ref
count is increased and becomes 2. This results in
the driver holding the buffers with itself, thereby
entering in to a deadlock situation and starving the
firmware of output buffers. This results in a video
freeze.

Change-Id: I0c3d13124bd48b900e56e14666eaed2f0e7ee9d6
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Bug fix in instance clean-up

When close is called directly without proper state operations,
then driver tries to clean all V4L2 framework memory. When driver
calls queue_release, it tries to call stream_off again. This
causes driver to re-enter the state operations. This change
prevents driver to re-enter the state diagram.

Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: remove non fatal error messages

V4L2 core fails reqbufs ioctl if file IO is in
progress. This message is non fatal, so avoid
logging it as a error message in the video driver.

Change-Id: Ie5ea22925f9c698c82cfaeb6e77b66cf77e5e866
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Add support for setting initial qp

Adds support to set initial qp, thereby allowing the client to set
initial qp for I,P, and B frames.

Change-Id: Ie956651bde85e800d97a0007769af9aec8ca16a4
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/msm_venc.c
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
athe same as last patch

Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: disable Hier-P when LTR is enabled

Hier-P and LTR are mutually exclusive in firmware. Disable Hier-P
using HFI_PROPERTY_PARAM_VENC_HIER_P_MAX_NUM_ENH_LAYER
instead of HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER.

Change-Id: Ib4eb053a0ccef94c1996392eba19c5b83f7c9971
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Increase I-frame period to INT_MAX

There is no restriction on I-frame and IDR period
values, so set them to INT_MAX.

Change-Id: I364ead16c3b8b8463fc8180159e5ee1f9fa10f37
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: Advertise extradata size in queue_setup()

If extradata is enabled, the correct size must be advertised as part of
queue_setup().  Prior to this commit, the output buffer size was taken
to be the extradata size.

In order to make sure that we aren't advertising stale buffer sizes,
query the core for both CAPTURE and OUTPUT planes.

Change-Id: I300e0e1d852caab208fd4cfc6df7cf3152f52431
Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm: vidc: fix failure to set LTR with index value

When MARKLTR/USELTR was set with a index value the value never
propagated to firmware resulting in failure to set the property.

Change-Id: I37536e1662c2d1092477fddde6838d4239805ac5
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
Update Kernel to match Lollipop references

Change-Id: I15750e6ee21d431eb8aa016c98fb063d62faac72
Signed-off-by: Alberto97 <albertop2197@gmail.com>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm_bam_rmnet: Fix packet corruption due to QoS

Remove the QoS header added at the beginning of the
SKB (If QoS is enabled) in case of a failure to send
a packet to bam_dmux in order to avoid a possible loop
that adds QoS headers on each failure which will cause
a packet corruption.

CRs-Fixed: 599456
Change-Id: I5cda4db1f49638b37998d2502ff07b1e82518db1
Acked-by: David Arinzon <darinzon@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>
msm_bam_rmnet: Fix potential memory corruption

Usage of legacy string manipulation function sprintf could lead to
memory corruption as the number of bytes to be written to the
destination is not bounded. Replace sprintf with snprintf where the
number of bytes to be written is explicitly specified.

CRs-fixed: 672202
Change-Id: Iab7516ad0e2540eb619fe96e26a3516c7adf86cc
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: klozz <xxx.reptar.rawrr.xxx@gmail.com>