Merge "Add chunk heap, use it for gralloc buffers"
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index f3610f3..83a2407 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -44,10 +44,13 @@
#include "exynos_format.h"
#include "gr.h"
-#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
+#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
#define ION_EXYNOS_FIMD_VIDEO_MASK (1 << 28)
#define ION_EXYNOS_MFC_OUTPUT_MASK (1 << 26)
#define ION_EXYNOS_MFC_INPUT_MASK (1 << 25)
+#define ION_HEAP_SYSTEM_ID 0
+#define ION_HEAP_EXYNOS_CONTIG_ID 4
+#define ION_HEAP_CHUNK_ID 6
#define MB_1 (1024*1024)
@@ -121,9 +124,9 @@
unsigned int heap_mask;
if (usage & GRALLOC_USAGE_PROTECTED)
- heap_mask = ION_HEAP_EXYNOS_CONTIG_MASK;
+ heap_mask = (1 << ION_HEAP_EXYNOS_CONTIG_ID);
else
- heap_mask = ION_HEAP_SYSTEM_MASK;
+ heap_mask = (1 << ION_HEAP_SYSTEM_ID) | (1 << ION_HEAP_CHUNK_ID);
return heap_mask;
}
@@ -189,6 +192,7 @@
{
size_t size;
int err, fd;
+ unsigned int heap_mask = _select_heap(usage);
switch (format) {
case HAL_PIXEL_FORMAT_YV12:
@@ -204,8 +208,7 @@
return -EINVAL;
}
- err = ion_alloc_fd(ionfd, size, 0, 1 << ION_HEAP_TYPE_SYSTEM,
- ion_flags, &fd);
+ err = ion_alloc_fd(ionfd, size, 0, heap_mask, ion_flags, &fd);
if (err)
return err;
diff --git a/include/ion.h b/include/ion.h
index 0c6045e..e790cb4 100644
--- a/include/ion.h
+++ b/include/ion.h
@@ -20,6 +20,7 @@
#include <unistd.h> /* size_t */
#define ION_FLAG_CACHED 1
+#define ION_FLAG_CACHED_NEEDS_SYNC 2
#define ION_HEAP_SYSTEM_MASK (1 << 0)
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << 1)
diff --git a/libcamera2/ExynosCameraHWInterface2.cpp b/libcamera2/ExynosCameraHWInterface2.cpp
index ea90d05..d6174bb 100644
--- a/libcamera2/ExynosCameraHWInterface2.cpp
+++ b/libcamera2/ExynosCameraHWInterface2.cpp
@@ -6046,7 +6046,7 @@
break;
}
if (1 << i & cacheFlag)
- flag = ION_FLAG_CACHED;
+ flag = ION_FLAG_CACHED | ION_FLAG_CACHED_NEEDS_SYNC;
else
flag = 0;
buf->fd.extFd[i] = ion_alloc(ionClient, \