msm: vidc: Remove memcpy of sequence header

In secure sessions, we aren't allowed write into secure buffers.  In
these cases, do not copy the sequence header from the internal buffer
into the output buffer. The firmware will prepend the sequence header to
the first I-frame in these cases.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
(cherry picked from commit e39bcd97987388e7e1877efcc895e21c16f27255)

Change-Id: Iafffd9222ed6f96e87f770a280cd84512cd308ed
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm:vidc: update default output buffer requirement

Updated the default output buffer requirement to
match worst case requirements. With this change
reconfig will trigger only if the actual buffer
requirement is less than the estimated requirement.

CRs-fixed: 343812
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
(cherry picked from commit 50f02e2345b8a7503c85696b35c2490b3fc53fb0)

Change-Id: I291333003ff441e7734923b188be89a7944c3482
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
vidc: Add support for sequence header generation

This change supports sequence header generation prior
to the video encoder input & output buffer allocation.
After setting all the required parameters to the core,
client needs to allocate sequence header buffer of
appropriate size and pass it in GET_SEQUENCE_HDR ioctl
to get the sequence header.

CRs-fixed: 353772
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit 44d8b26f0abf78bdfe891667d990ffea4f6a3804)

Change-Id: I380b4226bde69001089d4ea2f33ecfbd3c0f2a7f
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
vidc: send flush done if flush is issued in EoS while encoding

There is a race condition in encoder, when an input buffer
is received with an EoS flag but doesn't have an output
buffer to process that and if simultaneously flush is issued.
This is fixed by sending flush done if flush is issued in EoS.

CRs-Fixed: 353081
Change-Id: I925f49779ed5cb91bfab805ba4b7102c1e3f728b
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit 602d62927c6db96f8d636f7795203b19e8c412c3)
vidc: Add extra cases for error handling in vidc init

Currently error conditions are not handled properly
if failures occur during irq request or while creating
work queue. With this commit these error conditions
are properly handled.

Change-Id: I618ca5c2a4f6bd09a3edd164a7867a90a9ed9f9a
CRs-Fixed: 355753
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit c9a9332a743459e44744e630f3e734e7788c477d)
msm: vidc: Metadata memory release issue.

Metadata memory is not freed when there is
memory allocation failure in ddl open. Fixed
this issue by freeing the metadata memory.

CRs-Fixed: 353109
Change-Id: I3f6fd93498aea0ce78092bd3a28cf08625b0ca77
Signed-off-by: Anil Gahlot <anilg@codeaurora.org>
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
(cherry picked from commit af296715bd5db6c38997d1171d079331c8650287)
msm: vidc: Fixes bug in handling duplicate frames.

Fixes bug while closing encoder which supports
duplicate input frames. This fix decrements
the reference count of original frames
appropriately.

CRs-Fixed: 366268
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
(cherry picked from commit af4a0ef0c6162e89c063b04da0a037246fcc76b9)

Change-Id: Icf36d82e78588bf4b5becf480bdccd4c7cda94a5
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
vidc:720p: Fix first buffer with EOS flag in video decoder

The video driver is throwing error for erronious header
input buffer with EOS flag enabled. This commit will
fix the error case by amending the EOS handling for the
first buffer.

CRs-fixed: 370048
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit ed4b2afe41aa4dec5bf06823da35e33645d558a1)

Change-Id: Ibbd7079347917b7ac84c69789df66dca96a3bdd6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>