Revert "Revert "msm: vidc: Remove kernel mapping on input/output buffers""

This reverts commit a5d471fd7137b13573f0ae72c47671686fd887a5.
msm: vidc: Fix metadata buffer size issue

- Metadata buffer size is being set to zero when
  client calls set buffer requirements to video driver.
  This change fix it by properly assigning the
  metadata buffer size to video driver.
- When continuous mode enabled, do not get min_dpb
  from resource tracker for non-H264 codecs,
  for H264 codec get min_dpb from resource tracker.

Change-Id: Ie16bc47605edc6f67dbf3ae77290d4d764c5c613
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Reset stop_called state when START is called

The driver needs to reset the stop_called field once START called.
Otherwise in START, STOP, START, STOP sequences the secondary STOP will
be treated as a duplicate STOP and ignored.

Change-Id: I8b7d069236027a01103c80b7deeb19c331ede05a
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Allow client to set turbo mode

- Allow client to set TURBO performance level
  to video driver.
- Update max performance level to TURBO perf level
  on supported targets.

Change-Id: I0b3b38140d777984ba5062ddd614c07a002389ba
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: vidc: Get the current performance level

This change supports client to get the current
performance level of the video driver via
IOCTL_GET_PERF_LEVEL. The current performance
level indicate the number of MBs per second
is being processed by video hardware.

Change-Id: Ic6f5b2b14e0d77bf801c4f857f8a0e20339c199f
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Fix compilation errors

This change removes the compilation error in kernel
if ddl logs are enabled.

CRs-Fixed: 483776
Change-Id: Iffc37fcdd4e5ce7ddcd8560d432af5c3f3e6c433
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
msm: vidc: Optimize IOMMU map size for H264 decoder

IOMMU map size is not required to be double the actual
buffer size for H264 decoder. So reducing IOMMU map
size for H264 format which will enable support for
two H264 decoder instances in parallel in smooth streamig
mode where the number of output buffers equal to 18 with
each buffer size equal to 1080p buffer size.

CRs-fixed: 491718
Change-Id: Ie6782b2ff58667000213f25482eea151b849762b
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Don't free shared memory on channel close

The driver already frees the memory in vcd_ddl.c at ddl_close().
No need to prematurely free the memory here.

Change-Id: If1ddacf68770113423d4aeb2b72e79caf5ca07ce
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
vidc: Fix EOS handling if video h/w has a frame in transaction

In case of video hardware is encoding a frame and EOS buffer with
with zero data length arrived, set the EOS flag to the transaction
available in the transaction table which will be passed to the
client in frame done callback from the video hardware.

Change-Id: I03862906be603ff769fb6aa0a2191a9ea87529ca
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: set EOS on output buffer pending transaction

If EOS is signalled while an output buffer is in transaction,
mark EOS when that buffer is returned.
This is observed in case client sends an empty buffer with EOS

Change-Id: I9b4ce6331eb7a70886c1802d1f99e1d77d65fa64
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: vidc: Remove unncessary unmap function calls

Calling unncessary unmap function resulting in
target reset. This change resolves the issue by
removing unncessary unmap functions in video driver.

Change-Id: I0b501f0a7115bba085b067a5e78172df210da8f1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: vidc: Handle mgen2maxi interrupt in video driver

Handle interrupt generated by mgen2maxi h/w and
avoid unknown interrupts storm which results in
target reset issues.

Change-Id: Ida24cb2dde15c9cd4a4c1d9ca336b1a4b662c4d1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: vidc: Amend error check conditions on ION APIs

Amend error check conditions appropriately to return
properly from video applications in case of ION API
failures.

Change-Id: Ibe95a8438a66e88b35dbff0af8842ff4b038c5e1
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Add LTR feature for H264 encoder

This change adds Long Term Reference picture
selection feature for H264 video encoder.

Change-Id: Ida957df244d8715c955afe8d809708123a94e999
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: free the recon buffers in cleanup function

- The recon buffers were not released when video recording
  was killed abruptly leading to memory leak.

- Fix provided to release the recon buffers when media
  server killed abruptly.

Change-Id: I48ac1a592719446b7e4bf87bbd707d09351d1e61
Signed-off-by: srikarri <sridur@codeaurora.org>
msm: vidc: return error in case of init failure

Return error if error comes in video driver
initialization.

Change-Id: I54c516808587fb7d94c3d517f8c72c6c9aa9d91d
CRs-fixed: 542535
Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
msm: vidc: Validate input data before processing

User controlled data needs to be validated before
processing, otherwise it may corrupt existing data
and other programming variables which may further
lead to crash in kernel space.
This change validates user specified buffer's data,
such as offset and data length, before performing
any operations in kernel.

Change-Id: Idb2a5c4c270cdbb55adfc0c22b9296b7dd359de9
CRs-fixed: 547695
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
video: msm: Maintain histogram LUT state through suspend resume

Make sure LUT state is maintained after suspend resume. Required to ensure
HistLUT and backlight scale are in sync

CRs-Fixed: 476491
Change-Id: Icc999aa0b04cad93ceed334426f61b71cbdd0a13
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
video: msm: Initialize HistLUT with last saved LUT

Set HistLUT to last value written to LUT when MDP is turned on. Assumes
that last LUT corresponds to last BL scale value sent

CRs-Fixed: 475149
Change-Id: I7383666c2d1f3d8800c5f25e2ef648568eb33a74
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: Correct R and G offsets for correct mapping

R and G colors are swapped when ARGC test cases are executed.
Correct the color mapping to right register offset to fix
the color swapping issue

CRs-Fixed: 491215
Change-Id: I4997acce577bdbbdf39e22502a678dbecf0bfc37
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>