arm: exynos: Fix dev ion to use heap ids instead of types

Previously id's and types were being used interchangably.
This makes it impossible to introduce new heap types.

Change-Id: I3086474cfa709b350e3fe67d25642aa515b500c6
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
video: s3c-fb: Fix call to ion alloc to use the id instead of the type

Change-Id: I709738ef242854da6c6e9ca3bc6bb8e1c195987f
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
exynos: smdk5250: Move ion initialization to machine reserve

This enables the memblock_reserve of the memory for the chunk heap

Change-Id: I397034cf2e0df1869d4d0e097bf9f383e74dbb2d
Signe-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Modify reserve function for carveouts with no start address

This patch allows you to specify a heap that requires carveout memory
but that doesn't specify a start address.  Memblock_alloc will be called
to find a location for these heaps.

Change-Id: I9c79b30e3105e796060fc74b058f04093ee5e96e
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Fix bug where MAP ioctl was no longer supported

Change-Id: Idbe628ed7dbd6a14469194120b94934d6e99d367
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Switch heap rbtree to a prio list

Switches the rbtree tree of heaps for a plist.  This significantly
simplifies the code and the list is small and is modified only at
first boot so the rbtree is unnecessary.  This also switches
the traversal of the heap list to traverse from highest to lowest
id's.  This allows allocations to pass a heap mask that falls
back on the system heap -- typically id 0, which is the common case.

Change-Id: I715be6f4cf020a84ca4f1947c30ee3d2559fb523
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Refactor common mapping functions out of system heap

The system heap contained several general purpose functions to map
buffers to the kernel and userspace.  This patch refactors those
into ion_heap.c so they can be used by other heaps.

Change-Id: If64591798bdc2c248bf9064ace2c927909d7adb8
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Add chunk heap

This patch adds support for a chunk heap that allows for buffers that are
made up of a list of fixed size chunks taken from a carveout.  Chunk sizes
are configured when the heaps are created by passing the chunk size in the
priv field of the heap platform data.

Change-Id: Ia9e003f727b553a92804264debe119dcf78b14e0
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Clarify variable names and comments around heap ids v types

There is some confusion between when to use the heap type and when
the id.  This patch clarifies this by using clearer variable names
and describing the intention in the comments.  Also fixes the client
debug code to print heaps by id instead of type.

Change-Id: Ie8b3dadded52e18590fcb2ca94001f6ed46ef07d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Export ion_client_create

Will enable modules to allocate memory with ion.

Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Remove heapmask from client

The heapmask in the client generally wasn't being used.  This
patch removes it.

Change-Id: I3526723fbf8f2e81c28c0733deb583ea14bdd837
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
media: exynos: gsc-m2m: don't allow open devices to be reopened

Change-Id: I9e401b061040fcc56fbba687d4dceb95902c3d55
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ion: exynos: point the masks at the heap ids and not types

Change-Id: I13076cb6feafc76794ffc065f1a2a608e1c97d8e
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
video: s3c-fb: pass a mask of the id to ion_alloc

Change-Id: I028f08a6e42271593cd18d1e8d66e142041b12aa
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Modify zeroing code so it only allocates address space once

vmap/vunmap spend a significant amount of time allocating the
address space to map into.  Rather than allocating address space
for each page, instead allocate once for the entire allocation
and then just map and unmap each page into that address space.

Change-Id: I4a5c850717c80f75506a36b7ec2bcd55857b8dea
Signed-off-by: Rebecca Schultz Zavin <rschultz@google.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>