liboverlay: ensure open fd's are always closed

Ensures that reset and  mFd.Close is always called when MdpCtrl
and MdpData are closed down.

Acked-by: Arun Kumar K.R <akumarkr@codeaurora.org>
Change-Id: I775ba7cfe45c67e6acf874e3f4e8b4fa6fbe33b8
liboverlay: close all the opened pipes after framework reboot.

b/7147557

Add initOverlay() function to close all the opened pipes when
Surfaceflinger process gets killed.

Change-Id: I9c65a61c81f9c81198f1076d6cbd27933b164c05
Signed-off-by: Iliyan Malchev <malchev@google.com>
gralloc:  Send first 2 FB buffers to carveout and next to IOMMU

Gralloc uses the GRALLOC_USAGE_HW_FB flag to allocate memory from carveout.
This is fine for primary framebuffer, but for external framebuffer we need IOMMU
heap buffers, since the ioctls for external work with those.

Ideally, the primary buffers also need to come from IOMMU heap, which is ongoing
work. This patch allocates the first 2 FB buffer requests (assuming they are for
primary) from carveout and allocates all subsequent buffers from IOMMU heap.

Bug: 7124159
Change-Id: Ie53b2e1e7fcac136acd2d251f39cefe367fc7125
Signed-off-by: Iliyan Malchev <malchev@google.com>
overlay: mdprot: Call rotator start only on config change.

Call ROTATOR_START ioctl only if the rotator config changes.
Save the last good config when the start succeeds.

Make getSessId()'s return type uint32_t from int to match the member's.
This was causing all methods to think the rotator session id is a negative
invalid number. This ensures ROTATOR_FINISH is called.

Bug: 7320914
Change-Id: I5ca048ea866316f18d8df14dc08218fca2c82bdf
Signed-off-by: Iliyan Malchev <malchev@google.com>
overlay: Compile MDSS rotator even when headers not present

Change-Id: Ifc74531b6d73ab5d752441d1a0e7d3b0d0d658e0
(cherry picked from commit e76f183710272f02149e003357107c85bc74914b)
libgralloc: Discontinue allocating FB buffers from carveout.

Don't allocate primary framebuffer from carveout.
Allocate them from IOMMU heap just like the external framebuffer.

Bug: 7626586
Change-Id: I52a8db1a34d19856302b38d2c30c1290d1f2f060
Signed-off-by: Saurabh Shah <saurshah@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Revert "libgralloc: Discontinue allocating FB buffers from carveout."

This reverts commit c225c7fcf7403c3df92c41a7befb431de5421e06.
libgralloc: Fix possible leak of fd

Fix possible leak of fd in ion allocation.
If mmap fails close the fd before returning.

Change-Id: Id414792c14a75259f6075b0d76bc470c31fb5853
CRs-fixed: 387633
hwc: Use asynchronous commit ioctl for display post

bug: 7274951

Change-Id: I70b2a00d6a2558f533bd87c92038774126434f03
display: Fix includes

Need to include from kernel headers and
build for Qualcomm targets

Change-Id: Ie77ba8c7dd129a9dc24e2f69b0ef768ea0580c3d
hwc: Remove buffer_fence definition as it is not used

Change-Id: If5f4beceda0229c9f48b6b1ee74e23a95f14863a
gralloc : Don't fallback to system heap for framebuffer allocations

MDP can not handle buffers from system heap, so try camera heap
first, before falling back completely to system heap

Change-Id: I7e2ab0094be5d1075be1ca93295cf54b84101835
gralloc : Correct misleading OUT_OF_MEMORY logs

Don't log "ION_IOC_ALLOC failed", if fallback is possible

Change-Id: I2494851f9e6621676248ff07fd6d289597ba220b
Revert "gralloc:  Send first 2 FB buffers to carveout and next to IOMMU"

This reverts commit 0e48b2043fdc0305d175e8ceda1411b88f45b35e.