msm: msm_fb: Do not use ION_IOMMU_UNMAP_DELAYED flag.

Since iommu buffers will be unmapped after two newer commits
had passed, there is no need to request iommu driver to further
delay unmapping an iommu buffer.

Change-Id: I44099054114403fa7ac6a5e3c71a43d6b932f4a3
Signed-off-by: raghavendra ambadas <rambad@codeaurora.org>
msm: vidc: Validate userspace buffer count

Makesure the number of buffers count is less than
the maximum limit to avoid structure overflow errors.

Change-Id: Icf3850de36325637ae43ac95f1c8f0f63e201d31
CRs-fixed: 563694
Signed-off-by: Pachika, Vikas Reddy <vpachi@codeaurora.org>
msm: vidc: Set input buffer size dynamically

This change supports overriding of default input
buffer size using a set parameter call from the
client.

Change-Id: I5225ec53ba16b68aeedd4c30897bd291e81b4b09
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
Revert "msm: display: update non-double-buffered register"

This reverts commit 95679de47a6ee7c3993935e0b13f9879c311b5be.

Change-Id: I3aa1fa5bc958fa24eab77c4e111c980a055b1676
Revert "msm_fb: display: delay commit video tile frame size register"

This reverts commit 7a71e5fdabb38c2bdfc3da56ea30b38450414714.

Change-Id: I90024840845cc508ea2feace2a5e84e6f9f32e89
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Program TILE video frame size in dma ISR

Since, video tile frame size register is single buffered, its
value takes effect as soon as it is programmed. Single buffered
registers like this should be configured very close to the vsync
to prevent issues like flicker or artifacts.
Program this register in dma ISR to prevent flickers and IOMMU
page faults.

Change-Id: Ifa770e4b4f29d6e4070e51388043422cc60e5872
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: update video tile framesize register

The register should not be delayed in the case of
Witeback and command mode pannel

Change-Id: Ia90ccc1bb376ed829bedee131ba600194d471521
Signed-off-by: Justin Philip <jphili@codeaurora.org>
i2c-algo-bit: Don't resched on clock stretching

Clock stretching is not supposed to last long, so asking to be
rescheduled while waiting for the clock line to be released by a slave
makes little sense. Odds are that the clock line will long have been
released when we run again, so we will have lost time and may even
get an SMBus timeout because of this.

So just busy-wait in that case. This also participates in the effort
to make i2c-algo-bit usable in contexts that can't sleep.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
vidc: Enable error concealment in video core

Without error concealment, there is a bug in video core due to which it
goes in to bad state for certain clips and times out. This change fixes
the issue.

Change-Id: I7452794e5901edd116acf22004bb70a7c398deed
CRs-fixed: 336167
Signed-off-by: Arun Menon <menon@codeaurora.org>
vidc: Handle descriptor buffer error as warning

Driver will consider descriptor buffer empty error
as warning and will continue to decode next frame.

Change-Id: Ia89ea520131f9b3e1bbe68727c34fb72685d5af9
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
msm: vidc: Reduce priority of unwanted logs

Change reduces the priority of unwanted logs
which are coming in kernel logs by default
in video driver. Now these logs will come
only when enabled.

Change-Id: I18a534c7aaf8a2819be1b8812fad9e0710c49bd3
CRs-fixed: 454273
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Vidc: Treat Non-IDR frame type error as bit stream error

Hardware error is being generated from driver when video
core returns NON IDR frame type error during thumbnail
decoding. This change handles this error by treating
it as BIT_STREAM_ERR.

Change-Id: I16a19eea679d42a22b336d6ebbd0bd1f57c0a8a4
CRs-fixed: 414858
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
vidc: Adjust core timeout based on input frame size

Video core is dropping certain IDR frames due to timeout.
This is resulting in video corruption. Computing the core
timeout based on input frame size and programming it for
each input frame fixes the issue.

Change-Id: I75d5039bc09f9be6a3028461ee4a2f13064bf53a
CRs-fixed: 370570
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
vidc:1080p: Add check for supported video resolution

1080p core can support max resolution upto 1920x1280.
Some of the video clips have a resolution more than
the supported resolution. Changes were made to check
for the supported resolution and stop the playback if
they exceed

Change-Id: Ia3fa9c38eef60d23644e54873849d528377ff722
CRs-Fixed: 362228
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
vidc: upgrade video core clock rate based on time taken to decode a frame

Currently video clock rate is set based on the resolution
and fps of the given clip. But some clips have a high bit
rate for a given resolution which causes high decode time.
Changes were made to consider frame decode time and upgrade
the clock rate accordingly

CRs-fixed: 346580
Change-Id: Ie89a736eb9f93286486ae7688633a828c7415fd2
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
vidc: Flush the cached buffer only if the buffer is valid.

Before flushing the cached buffer check for the following
- When buffer allocation fails, do not flush the buffer
  report error and return.
- Check if the buffer handle is valid, before flushing the
  buffer.

CRs-Fixed: 358873
Change-Id: I58b869d2d2eb72f991649d62a5186c7b0f5adcf4
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
msm:vidc: Add the support for MPEG-2 extension and user data

Support is added for MPEG-2 extension and user data. With this
changes Core returns extension and user data as an extradata.

Change-Id: I66a230aa651dabafa883625ce9f687d5c35b8671
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: vidc: Invalidate cache when allocating buffers

We need to remove stale entries in the cache when allocating buffers, as
the ION driver doesn't invalidate the cache.

CRs-Fixed: 456500
Change-Id: Ibe931251b6f06c6acbe6bc8a095b0e925dc08857
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>

Conflicts:
	drivers/media/video/msm_wfd/enc-mfc-subdev.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_utils.c
vidc:vdec: Clean extradata portion and invalidate whole buffer

This commit will ensure to clean the extradata portion in
output buffer changed by the CPU before sending the buffer
to Video hardware and invalidate the output buffer changed
by Video hardware before CPU access the buffer.

Change-Id: I05ea24fb381a164f6cfd520bd9071a94349ed2df
CRs-fixed: 366446
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Invalidate the cache before processing metadata.

- Encoder output bit stream is getting corrupted if cache
  is not invalidated before meta data processing.
- ION_IOC_INV_CACHES is called before meta data processing
  to make sure physical data & cached data are the same.

CRs-Fixed: 358392
Change-Id: Ia4b827619e64b0bc60f74692993001e44b0bbcbe
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>