msm: vidc: update max P frames num for encode

Remove the restriction on the max number of
P frame interval.

Change-Id: I637372d7b0d409602df251bad4a135b25514dc95
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
media: msm: Freeze H camera code

 * Freeze camera code to avoid userspace breakage.

Change-Id: Id5137389249019e42087f0e2e1a959ac18e36cc8
media: msm: Additional changes for H camera freeze

Change-Id: I8adb8b6672b855061585e9175d8d04776fb9f6a6

Conflicts:
	include/media/msmb_isp.h
msm: vidc: Bail out if ocmem allocation failed

We shouldn't need to call venus_hfi_set_ocmem if the allocation of ocmem
failed.

Change-Id: I805f914af4d340fd50beecdb63b87c4cbda19fb0
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: add LTR support for video encoder

Enable LTR support for VP8 codec to add robust error resilience.

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

Conflicts:
	drivers/media/platform/msm/vidc/hfi_packetization.c
	drivers/media/platform/msm/vidc/vidc_hfi_api.h
msm: vidc: Add generic LTR mode support

Use generic LTR HFI APIs for h264 and vp8 formats.

Change-Id: I9f307046d7ec6de4eb6d43704686be902356882a
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
msm: vidc: Add support to request frame level QP information

The resulting QP information for H264 is the slice level
QP averaged over whole frame; for all other codecs its
frame level QP.

Change-Id: I288904b05d886c1e94fc113b8bd3fba5b13b48f3
Signed-off-by: Jorge Solano Altamirano <jsolano@codeaurora.org>

Conflicts:
	include/media/msm_vidc.h
msm: vidc: Add support to request frame bits info as extra-data

Provides information regarding number of bits in the frame (i.e frame
size expressed in bits) & also the number of bits in frame header (i.e
frame header size expressed in bits).
Number of bits in header is reported as:
For H264, sum of all slice headers bits for all the slices in the frame.
For all other codecs, number of bits in the frame header.

Change-Id: I6caeca025ff0ce059a20891a6d657b47c4b452b3
Signed-off-by: Jorge Solano Altamirano <jsolano@codeaurora.org>
msm: vidc: Return meaningful information for extra-data plane

Sending meaningful information in the extra-data plane structure
instead of trashy values for some uninitialized fields.

Change-Id: I6d1a5debb801836f48e4cdbd6129b5086ec18a63
Signed-off-by: Jorge Solano Altamirano <jsolano@codeaurora.org>
msm: vidc: Add support for MBI extradata

Macro Block Information extradata (if enabled) allows interested
clients to query for metadata about each macroblock.

Change-Id: Icfee32770018338e28ae149e1ccb654f5a48cbec
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>

Conflicts:
	include/linux/videodev2.h
msm: vidc: add control to enable Hierarchical P num layers

This change will enable firmware to perform Hierarchical
video encoding for P frames. Hierarchical video encoding is
used to improve error resilience and temporal scalability.
The encoded frames are logically organized in to multiple
layers with frames in one layer referencing only frames
from lower layers. The lowest layer, i.e. base layer, is
the only exception.

Change-Id: Ie30e6d075b76b3337ec895584cf1f3be9f4bb6c6
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Add description of LTR Extradata

The missing string descriptor caused a mismatch in array sizes
causing the v4l2 control framework make an out of bounds access.

Change-Id: I9a9f64e16ca95163d800702d94528833f5892537
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Query the core on VIDIOC_G_FMT

Previously we only queried the core for buffer requirements in
VIDIOC_REQBUFS, and relied on that information in _G_FMT.  However,
there's no expectation that the client calls _REQBUFS before _G_FMT,
which leads to stale information being returned as part of _G_FMT.

As such, always retreive fresh info from the core for either ioctl.

Change-Id: Ife94343f4bd4f62da7f2bef4266076ceed409bca
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: detect mbaff information from firmware

Firmware will set the FBD flags if mbaff interface
is detected for decoded video bitstream. Previously
the mbaff information was parsed in the v4l2 video
client, but now firmware parses and sends the information.

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

Conflicts:
	drivers/media/platform/msm/vidc/vidc_hfi_api.h
	include/linux/videodev2.h
msm: vidc: initialize venus hfi locks during hfi creation

Venus hfi locks were initialized during core init,
which is invoked when the first video instance is
created. If a debugfs command is executed before
starting the first video instance, then video driver
crashes trying to lock an uninitialized mutex.

Change-Id: I472e9de91dada94a2728dd02c747e7fde63e3e4f
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Add entry to scale buses for True 4k @ 24 fps

We weren't asking for enough bandwidth for 4k (3840x2160) @ 30 fps
sessions because we were missing an entry for True 4k @ 24 fps (which
requires less bandwith).  Now sessions of the former type are mapped to
the right ab-ib values.

Also get rid of some unused macros in msm_vidc_common.c

Change-Id: I40d3f8d079ffba586d96e8042b40bb0648ba7ae2
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Update vb2q buffer sizes

Currenttly is updating vb2q buffer size on CAPTURE port.
only.This change will update the buffer size on OUTPORT port
along with CAPTURE port.

Change-Id: Ieb0a898ae5b012f3bf1a1073d2ddf5ce72647252
CRs-Fixed: 621134
Signed-off-by: Prasad Nallani <pnalla@codeaurora.org>
msm: vidc: send release buffers cmd during instance clean up

During instance cleanup, if internal or output buffer
list is not empty, respective buffers are unmapped.
Modify the cleanup instance to send release buffers to
video core if internal or output buffer list is not
empty and then unmap the respective buffers.

CRs-Fixed: 619239
Change-Id: I56bd4248173992dedfb36098dfa9ddf35fc12a4e
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
msm: vidc: change error msg for max sessions condition

When the max sessions condition is reached, the firmware
sends session init to the driver. Change the error message
from 'core is in a bad state' to reflect the actual
behavior.

CRs-fixed: 625684
Change-Id: Iddf7d3fc72c1c2696200789954c1e69fd0419dca
Signed-off-by: Pushkaraj Patil <ppatil@codeaurora.org>
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>

Conflicts:
	drivers/media/platform/msm/vidc/msm_vdec.c