vidc: 1080p: Handle flush for interlaced clips.

Video core expects one field per buffer for interlaced
clip playback.If a flush is issued we should reset the
need next field flag, so that new bitstream is processed
after flush is completed.
Reconfig flag shouldn't be reset in case of EOS.

Change-Id: Idf50a24c29e904a958b0b1e850813e2d9fc4346d
CRs-fixed: 382368
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
(cherry picked from commit f19f4d27088015842f9bd0945f62b34e90fd784d)
vidc: Increase size of h264 encoder's mv buffer

Corruption is seen in the output bitstream in hfr recording
mode.

The output corruption is avoided by increasing the size
of the mv buffer.

Change-Id: I6fed4329a9be772cb680e268cf0c618d8a350f14
CRs-Fixed: 340590
Signed-off-by: Luis GarciaCalderon <luisgc@codeaurora.org>
(cherry picked from commit 8cd67fa36db83b5757c61de4b3bed567bc800b14)
vidc: 1080p : Add support for skip frame in slice delivery mode

Slice delivery mode for H264 encoder will deliver constant number of
output slice buffers for each frame. In case of CBR rate control method,
core will skip frames to maintain the output quality, in which case
driver need to send out the output buffers with data length as zero
for skipped frame output type from the core.

Change-Id: Id81330b28f1f17b97eb2c79c86558bd072b62c4e
CRs-fixed: 362356
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: suppress non-fatal error messages.

These messages are non-fatal and appear frequently
during video session. Hence suppressing them.

CRs-fixed: 389408
Signed-off-by: Arun Menon <menon@codeaurora.org>
(cherry picked from commit 24631e349a3f306cc3b06fb411d5fb1f7ac8f0ae)

Conflicts:

	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_shared_mem.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_utils.c

Change-Id: Ifb874912ac79c863ed8fc531272d3822d8aebebe
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
vidc: 1080p: IDR picture type support for H264 format

Read IDR picture type from 1080p core register set
and propagate it to user space using IDR frame type
enumeration in api header file. The IDR frame type
info is used in SYNCFRAME logic for H264 format in
userspace.

Change-Id: Ic677eb4d28469f6712832b7e09050467420eb70b
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit b2295e885966a000cceedcfd4a6462113fe3be4a)
vidc: Handle EOS with Codec config buffer.

Change will handle codec config buffer with EOS.
Video driver will make sure that the codec config buffer with
EOS will be requeued in case of reconfig and non-reconfig paths.

(cherry picked from commit 43b203869814fe5f0ddcb265a8f859aebdaa652f)

Change-Id: I424df5628aaededcbd65c36d369410909e46c515
CRs-fixed: 399347
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
vidc: 1080p: Reset meta data offset to zero

For multi-resolution clips, the meta data offset used while
doing cache clean of meta data buffer is from the previous
resolution & resulting in kernel panic. Resetting the offset
to zero during meta data buffer initialization for new
resolution fixes the issue.

CRs-fixed: 386245
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit 16145bcbd6af8db0eebc0eedec1f01ee1b0b3635)

Change-Id: I249c0cd220f8fa4f815488a9a321a398752329e4
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: vidc: Avoid memset of list elements in the buffer entry.

- Due to race condition between free buffer and flush output buffers,
  invalid buffer is getting accessed sometimes.
- Reset all the members in buffer entry except list elements.

Change-Id: Ia2a3bc4343fc557a6e6d7d9ad93a29a7ab3dfb81
CRs-Fixed: 411197
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
(cherry picked from commit 8105df366cf6b9f1ddbc15d561fb6a5f12540416)
msm:vidc: add support for pause in eos state

This commit will add support for pause command in
eos state along with run state of the video driver.

(cherry picked from commit da817ebe8a4dea682b2cc9beaa582e0f0f0f0112)

Change-Id: Ia75c7ee43fb13cab5898ded69459469ddec4be54
CRs-fixed: 387562
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
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>
(cherry picked from commit c4cee17571e07afd6c0fe0c50c8934ccfef50ae2)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
vidc: Check for proper buffer handle before free.

Check for proper buffer handle and client handle
before unmapping and freeing the buffer.

CRs-Fixed: 351100
Change-Id: I88f5e142839f12cc19360dbe26a8d4e6a7ec99de
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit 974a96c1634659213f7d226fa5092398ddd46398)
(cherry picked from commit 222e467f121840d69ff2701682bc7ece7420a502)

Conflicts:

	drivers/video/msm/vidc/common/dec/vdec.c
	drivers/video/msm/vidc/common/init/vidc_init.c

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
(cherry picked from commit a46d7d966ce99a55a5806f48de50d407c1dbb77a)
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)
(cherry picked from commit 572e147402717bb0c77ecc807659d05a617e370f)
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)
(cherry picked from commit efb9b72a643d6e499e5e5b94c5cc1fe32b652851)

Signed-off-by: Zhoulu Luo <zluo@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: Zhoulu Luo <zluo@codeaurora.org>
msm: vidc: Remove vcd restriction of duplicate input buffer queue

VCD previously had a limitation of not allowing two consecutive
encode_frame calls with the same buffer. This was primarily due to the
handling of buffer_entry elements in the buffer pool.  This commit
removes this restriction by maintaining an internal buffer_entry element
that VCD keep track of.

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

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