vidc: move platform resource parsing out of v4l2

Keep v4l2 code cleaner by moving parsing logic to separate file.

Change-Id: I65999400ad4391caa396a2bdcc8494db1727bed9
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Eric Ho <yinlokh@codeaurora.org>
msm: vidc: Add support for Constrained High Profile

This commit allows encoder clients to choose Constrained High
profile when encoding.

Change-Id: I0860367022bcdfab7d1a410b985f1a95fc6361cc
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: add check for supported video session

Check if video session load can be handled by f/w
after session_init_done state and before moving to
load_resources state. This will ensure fallback of
unsupported video session to software codec library.

Change-Id: Ib8856a519a23c8bcab951c0e014dc5f454859efe
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
msm: vidc: Fix for fuzz issues in firmware

Firmware is reporting session error for etb/ftb
due to incorrect packet sizes being sent. Fix this
by modifying the size of zero lenth array elements
in etb/ftb packets to one.

Change-Id: I2127290b9bd7f62e524d19f2fee42691d26e6d0a
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
ASoC: msm: Avoid multiple release of ocmem memory

Add check to avoid multiple release of same OCMEM buffer,
by checking if the buffer is already freed before. This
is to avoid any system crash due to multiple release of
same buffer.

Change-Id: I527b1e9d502538818d2a15a614b693611c3a6cd9
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
msm: ocmem: Handle shrinking of memory after passive evictions

During a passive eviction, the information of the client
which triggered the eviction is not stored in the request
structure of the evicted client. This is needed during the
shrink operation of the evicted client.

Store the eviction data of the request being evicted in the
request structure to handle the shrink operation.

Change-Id: Ie03573d0c488801a6e436babccf6b84bd777fb3e
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
gpu: ion: Secure buffers at allocation time

Currently, buffers allocated as secure must be explicitly secured
with a lock call. Considering all buffers from secured heaps are now
always secured and will never be mapped in the non-secure world,
this extra lock call is redundant. Lock the buffer at allocation
time instead of requiring clients to do so explicitly. Reference
counting will ensure correctness until clients remove the lock/unlock
calls.

Change-Id: I1593b6ec651b13b22171997606c915b8f51a05fd
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Don't flush secure buffers

Secure buffers have very tight restrictions about mapping into
the non secure world. The buffers are always allocated as uncached
such that there should never be a reason to have a CPU side
non-secure mapping once the buffer is allocated. Some clients may
share the same code path for secure and non-secure transactions.
Unfortunately these clients either cannot or will not distiguish
between secure and non-secure buffers, meaning they will unconditionally
try to flush the buffers. This may lead to bad things. Until clients
manage to properly distinguish between secure and non-secure buffers,
add a check in the cache flushing code to not flush if the buffer is
secure.

Change-Id: Idb0d791a8b74367e0ce0b533f980caedc23044b3
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: vidc: Handle SSR event in q6 hfi

APR send SSR events through callback and these
events have to handled properly in Q6 HFI. This
change translates SSR events to SYS_ERROR HFI event.

Change-Id: I82fe850d2df4ab1721755507c6d74d7b32a09b90
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Sachin Shah <sachins@codeaurora.org>
msm: vidc: add check for bus scaling

Ensure the bus vector index calculated as
per macroblock load falls within the range
specified in the device dtsi file.

Change-Id: If972583932f26b76f10bf2e184f8050552b857cb
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
ASoC: msm: handle write done events in pause state

If a write done event is received when the compress driver
is in paused state, treat it as an underrun.

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Eric Laurent <elaurent@google.com>
ASoC: msm: Fix potential spin lock recursion in compress driver

1. compr_event_handler() in this driver is called from interrupt context. This
   function uses spin_lock_irq() and spin_unlock_irq().
2. Calling spin_unlock_irq() from interrupt handler will enable the interrupts
   and could result another interrupt while we are still in an interrupt
   handler.

Replace spin_lock_irq() with spin_lock() and spind_unlock_irq() with
spin_unlock() in the compr_event_handler() function.

Replace spin_lock_irq() with spin_lock_irqsave() and spin_unlock_irq() with
spin_unlock_irqrestore() in rest of file.

Signed-off-by: Naveen Ramaraj <nramaraj@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Revert ""msm: vidc: Use aligned width and height while calculating load""

- Total core load is exceeding due to considering aligned dimensions.
- Session load should be calculated from  actual height & width.

This reverts commit 5004a84a2c1b9a04cfdefb83d9b818f6c299d8b7.

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

Conflicts:

	drivers/media/platform/msm/vidc/msm_vidc_common.c

Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
msm: vidc: disable h/w load calculation for thumbnail

Thumbnail decode load should not be considered while
calculating the overall h/w load. This is needed
especially on devices with limited h/w capability.
Without this change, we can see thumbnail decode
failing if two thumbnail sessions start in parallel
and h/w capability is exceeded.

CRs-fixed: 504248
Change-Id: Icdceddc5c15cd5beac391fe15dac9d60e5eb35bb
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
ASoc: qdsp6: Add support for post processing on low latency path

Current implementation does not send audio calibration data to
DSP if the playback goes throug low latency path. This results
poor quality audio on Speaker if it needs tuning.
Update ADM and RTAC drivers to send audio calibration data
to DSP and update properly in the QACT tool.

Bug: 11077919

Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
arm/dt: msm8974: Double the "ab" values for VIDC DDR bandwidth request

As per the recommendation by performance team, update the
"ab" values for DDR BW requests. This change fixes the
display under-runs seen during video playback.

Change-Id: I521cfa50d3ecf2dc3b57ca0207ba3ccd2b7b28f2
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
gpu: ion: Attempt heaps in the order given

A previous change (47b9888cc80b224b3d341227224c44b3c884d28a
"gpu: ion: Switch heap rbtree to a prio list") changed the
priority of the heaps to attempt higher numbers first. The
current setup of heaps assumes that lower numbers will be tried
first. Rather than break the userspace ABI once again to match
what was done previously, change the heap priority back.

Change-Id: Ibb7664e11c0b9037f6968e0766486936b3d42e16
CRs-Fixed: 502722
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
mm: add a field to store names for private anonymous memory

Userspace processes often have multiple allocators that each do
anonymous mmaps to get memory.  When examining memory usage of
individual processes or systems as a whole, it is useful to be
able to break down the various heaps that were allocated by
each layer and examine their size, RSS, and physical memory
usage.

This patch adds a user pointer to the shared union in
vm_area_struct that points to a null terminated string inside
the user process containing a name for the vma.  vmas that
point to the same address will be merged, but vmas that
point to equivalent strings at different addresses will
not be merged.

Userspace can set the name for a region of memory by calling
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);
Setting the name to NULL clears it.

The names of named anonymous vmas are shown in /proc/pid/maps
as [anon:<name>] and in /proc/pid/smaps in a new "Name" field
that is only present for named vmas.  If the userspace pointer
is no longer valid all or part of the name will be replaced
with "<fault>".

The idea to store a userspace pointer to reduce the complexity
within mm (at the expense of the complexity of reading
/proc/pid/mem) came from Dave Hansen.  This results in no
runtime overhead in the mm subsystem other than comparing
the anon_name pointers when considering vma merging.  The pointer
is stored in a union with fieds that are only used on file-backed
mappings, so it does not increase memory usage.

Change-Id: Ie2ffc0967d4ffe7ee4c70781313c7b00cf7e3092
Signed-off-by: Colin Cross <ccross@android.com>
slub: tid must be retrieved from the percpu area of the current processor

As Steven Rostedt has pointer out: rescheduling could occur on a
different processor after the determination of the per cpu pointer and
before the tid is retrieved. This could result in allocation from the
wrong node in slab_alloc().

The effect is much more severe in slab_free() where we could free to the
freelist of the wrong page.

The window for something like that occurring is pretty small but it is
possible.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm: pass readahead info down to the i/o scheduler

Some i/o schedulers (i.e. row-iosched, cfq-iosched) deploy an idling
algorithm in order to be better synced with the readahead algorithm.
Idling is a prediction algorithm for incoming read requests.

In this patch we mark pages which are part of a readahead window, by
setting a newly introduced flag. With this flag, the i/o scheduler can
identify a request which is associated with a readahead page. This
enables the i/o scheduler's idling mechanism to be en-sync with the
readahead mechanism and, in turn, can increase read throughput.

Change-Id: I0654f23315b6d19d71bcc9cc029c6b281a44b196
Signed-off-by: Lee Susman <lsusman@codeaurora.org>