msm: vidc: support for dynamic buffer mode

Includes changes to process release_frame_reference event
from firmware.

Change-Id: Ie3c014af255e09f6dac9b3b853c9994b97d830b6
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: flush dynamic buffers held in driver

A dynamic buffer whose reference is pending
with f/w and queued back by client, will be
held in the driver. During flush, f/w will
release the reference, but driver should not
queue back the buffer to f/w.

Change-Id: If6fea08645a186691d49beaaf7a51a75f4b3121e
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: add debugfs support for dynamic buffer mode

video driver debugfs will provide the following info
(a) buffer mode for each buffer type
(b) list of pending output dynamic buffers with
firmware and driver along with their ref count, fd
and address.

Change-Id: Idc3816c825dfb0c174e6d01b72e741d14f9299e3
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: query tz for dynamic buffer feature support

Query TZ before returning to video hal whether dynamic buffer
mode is supported or not for secure playback.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Shalaj Jain <shalajj@codeaurora.org>
msm: vidc: send extradata size in ftb for dynamic buffer mode

In dynamic buffer mode, since  set_buffers is not called,
extradata buffer size should be set during ftb.
Without this change, firmware will assert if extra data
is enabled.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: fix setting of client buffer count

The client requested buffer count was not honoured
in specific case - when requested buffer count
was less than actual buffer count, but greater than
min buffer count. It would be set to the min buffer
count, which would fail playback.

Bug: 11067227

Signed-off-by: Arun Menon <avmenon@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/msm_vdec.c
msm: vidc: Remove frame size setting on OUTPUT Port

Currently driver sets frame size to FW on both INPUT and OUTPUT ports.
1.4 FW version doesn't support frame size setting on OUTPUT port.
FW uses the size set on INPUT port for decoding. Hence removing
the frame size setting to FW.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
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

Bug: 10935330

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: fix a race condition in dynamic buffer handling

Fixes a race condition while ftb is queued to the driver
and release reference event for the same has been returned
from the firmware. Without this change, we would end up
having a buffer which is registered in the list but not
queued to firmware. As a result during flush this buffer is
not returned back to client after a flush and results in
video freeze.

b/11021131

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: set ctrl to request sequence header for encoder

The encoder depended on a debug variable i.e. ftb_count, to
request firmware to send sequence header. Remove this
dependency and make the request only when the encoder
client requests using the provided set ctrl.

b/11051201

Change-Id: Iac4104c33eef62da553066c736b7adc87834d2ac
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Revert "msm: vidc: Set error concealment color to FW."

This reverts commit 8fb8d63269b82a6642a89c6f5fb16c4f0c23468d.