gralloc: Import utgard r8p1 gralloc update
am: e5c5bb3a93
Change-Id: I55ae4b3885d0831c554049836b26a1cc90cce310
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index fc62685..61ff7ff 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -1,4 +1,6 @@
+#
# Copyright (C) 2010 ARM Limited. All rights reserved.
+#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,23 +15,55 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+
LOCAL_PATH := $(call my-dir)
# HAL module implemenation, not prelinked and stored in
# hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
include $(CLEAR_VARS)
+LOCAL_PRELINK_MODULE := false
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo OK),OK)
+ LOCAL_MODULE_RELATIVE_PATH := hw
+else
+ LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+endif
+
+MALI_DDK_TEST_PATH := hardware/arm/
+
+LOCAL_MODULE := gralloc.default
+#LOCAL_MODULE_TAGS := optional
+
+# Which DDK are we building for?
+ifeq (,$(wildcard $(MALI_DDK_TEST_PATH)))
+# Mali-T6xx DDK
+MALI_DDK_PATH := vendor/arm/mali6xx
+LOCAL_SHARED_LIBRARIES := liblog libcutils libGLESv1_CM libGLES_mali libion
+
+# All include files are accessed from the DDK root
+DDK_PATH := $(LOCAL_PATH)/../../..
+UMP_HEADERS_PATH := $(DDK_PATH)/kernel/include
+LOCAL_C_INCLUDES := $(DDK_PATH) $(UMP_HEADERS_PATH)
+
+LOCAL_CFLAGS := -DLOG_TAG=\"gralloc\" -DSTANDARD_LINUX_SCREEN -DMALI_600
+else
+# Mali-200/300/400MP DDK
+MALI_DDK_PATH := hardware/arm/mali
+#SHARED_MEM_LIBS := libUMP
SHARED_MEM_LIBS := libion libhardware
-LOCAL_SHARED_LIBRARIES := liblog libcutils libGLESv1_CM $(SHARED_MEM_LIBS)
-LOCAL_C_INCLUDES := system/core/include/
+LOCAL_SHARED_LIBRARIES := liblog libsync libGLESv1_CM $(SHARED_MEM_LIBS)
+
+LOCAL_C_INCLUDES := system/core/include/ $(MALI_DDK_PATH)/include
+# Include the UMP header files
+LOCAL_C_INCLUDES += $(MALI_DDK_PATH)/src/ump/include
+
LOCAL_CFLAGS := -DLOG_TAG=\"gralloc\" -DGRALLOC_32_BITS -DSTANDARD_LINUX_SCREEN -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
+endif
LOCAL_SRC_FILES := \
gralloc_module.cpp \
alloc_device.cpp \
framebuffer_device.cpp
-LOCAL_MODULE := gralloc.hikey
-LOCAL_MODULE_RELATIVE_PATH := hw
-
+#LOCAL_CFLAGS+= -DMALI_VSYNC_EVENT_REPORT_ENABLE
include $(BUILD_SHARED_LIBRARY)
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index 488e47c..1bb712f 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-#include <cstdlib>
#include <string.h>
#include <errno.h>
#include <pthread.h>
@@ -41,10 +40,8 @@
#if GRALLOC_ARM_DMA_BUF_MODULE
#include <linux/ion.h>
#include <ion/ion.h>
-#include "ion_4.12.h"
#endif
-#define GRALLOC_ALIGN( value, base ) (((value) + ((base) - 1)) & ~((base) - 1))
#if GRALLOC_SIMULATE_FAILURES
#include <cutils/properties.h>
@@ -96,6 +93,27 @@
}
#endif
+#ifdef FBIOGET_DMABUF
+static int fb_get_framebuffer_dmabuf(private_module_t *m, private_handle_t *hnd)
+{
+ struct fb_dmabuf_export fb_dma_buf;
+ int res;
+ res = ioctl(m->framebuffer->fd, FBIOGET_DMABUF, &fb_dma_buf);
+
+ if (res == 0)
+ {
+ hnd->share_fd = fb_dma_buf.fd;
+ return 0;
+ }
+ else
+ {
+ AINF("FBIOGET_DMABUF ioctl failed(%d). See gralloc_priv.h and the integration manual for vendor framebuffer "
+ "integration",
+ res);
+ return -1;
+ }
+}
+#endif
static int gralloc_alloc_buffer(alloc_device_t *dev, size_t size, int usage, buffer_handle_t *pHandle)
{
@@ -103,53 +121,66 @@
{
private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
ion_user_handle_t ion_hnd;
- unsigned char *cpu_ptr;
+ void *cpu_ptr = MAP_FAILED;
int shared_fd;
int ret;
+ unsigned int heap_mask;
+ int lock_state = 0;
+ int map_mask = 0;
- if (m->gralloc_legacy_ion)
+ if (usage & GRALLOC_USAGE_PROTECTED)
{
- ret = ion_alloc(m->ion_client, size, 0, ION_HEAP_SYSTEM_MASK, 0, &(ion_hnd));
-
- if (ret != 0)
- {
- AERR("Failed to ion_alloc from ion_client:%d", m->ion_client);
- return -1;
- }
-
- ret = ion_share(m->ion_client, ion_hnd, &shared_fd);
-
- if (ret != 0)
- {
- AERR("ion_share( %d ) failed", m->ion_client);
-
- if (0 != ion_free(m->ion_client, ion_hnd))
- {
- AERR("ion_free( %d ) failed", m->ion_client);
- }
-
- return -1;
- }
-
- // we do not need ion_hnd once we have shared_fd
- if (0 != ion_free(m->ion_client, ion_hnd))
- {
- AWAR("ion_free( %d ) failed", m->ion_client);
- }
- ion_hnd = ION_INVALID_HANDLE;
+#if defined(ION_HEAP_SECURE_MASK)
+ heap_mask = ION_HEAP_SECURE_MASK;
+#else
+ AERR("The platform does NOT support protected ION memory.");
+ return -1;
+#endif
}
else
{
- ret = ion_alloc_fd(m->ion_client, size, 0, 1 << m->system_heap_id, 0, &(shared_fd));
-
- if (ret != 0)
- {
- AERR("Failed to ion_alloc_fd from ion_client:%d", m->ion_client);
- return -1;
- }
+ heap_mask = ION_HEAP_SYSTEM_MASK;
}
- cpu_ptr = (unsigned char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, shared_fd, 0);
+ ret = ion_alloc(m->ion_client, size, 0, heap_mask, 0, &(ion_hnd));
+
+ if (ret != 0)
+ {
+ AERR("Failed to ion_alloc from ion_client:%d", m->ion_client);
+ return -1;
+ }
+
+ ret = ion_share(m->ion_client, ion_hnd, &shared_fd);
+
+ if (ret != 0)
+ {
+ AERR("ion_share( %d ) failed", m->ion_client);
+
+ if (0 != ion_free(m->ion_client, ion_hnd))
+ {
+ AERR("ion_free( %d ) failed", m->ion_client);
+ }
+
+ return -1;
+ }
+
+ if (!(usage & GRALLOC_USAGE_PROTECTED))
+ {
+ map_mask = PROT_READ | PROT_WRITE;
+ }
+ else
+ {
+ map_mask = PROT_WRITE;
+ }
+ // ion_hnd is no longer needed once we acquire shared_fd.
+ if (0 != ion_free(m->ion_client, ion_hnd))
+ {
+ AWAR("ion_free( %d ) failed", m->ion_client);
+ }
+
+ ion_hnd = ION_INVALID_HANDLE;
+
+ cpu_ptr = mmap(NULL, size, map_mask, MAP_SHARED, shared_fd, 0);
if (MAP_FAILED == cpu_ptr)
{
@@ -159,7 +190,9 @@
return -1;
}
- private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_ION, usage, size, cpu_ptr, private_handle_t::LOCK_STATE_MAPPED);
+ lock_state = private_handle_t::LOCK_STATE_MAPPED;
+
+ private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_ION, usage, size, cpu_ptr, lock_state);
if (NULL != hnd)
{
@@ -173,6 +206,7 @@
}
close(shared_fd);
+
ret = munmap(cpu_ptr, size);
if (0 != ret)
@@ -213,48 +247,55 @@
else
#endif
{
- ump_mem_handle = ump_ref_drv_allocate(size, constraints);
-
- if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle)
+ if (usage & GRALLOC_USAGE_PROTECTED)
{
- cpu_ptr = ump_mapped_pointer_get(ump_mem_handle);
-
- if (NULL != cpu_ptr)
- {
- ump_id = ump_secure_id_get(ump_mem_handle);
-
- if (UMP_INVALID_SECURE_ID != ump_id)
- {
- private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_UMP, usage, size, cpu_ptr,
- private_handle_t::LOCK_STATE_MAPPED, ump_id, ump_mem_handle);
-
- if (NULL != hnd)
- {
- *pHandle = hnd;
- return 0;
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to allocate handle. ump_handle = %p, ump_id = %d", ump_mem_handle, ump_id);
- }
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to retrieve valid secure id. ump_handle = %p", ump_mem_handle);
- }
-
- ump_mapped_pointer_release(ump_mem_handle);
- }
- else
- {
- AERR("gralloc_alloc_buffer() failed to map UMP memory. ump_handle = %p", ump_mem_handle);
- }
-
- ump_reference_release(ump_mem_handle);
+ AERR("gralloc_alloc_buffer() does not support to allocate protected UMP memory.");
}
else
{
- AERR("gralloc_alloc_buffer() failed to allocate UMP memory. size:%d constraints: %d", size, constraints);
+ ump_mem_handle = ump_ref_drv_allocate(size, constraints);
+
+ if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle)
+ {
+ cpu_ptr = ump_mapped_pointer_get(ump_mem_handle);
+
+ if (NULL != cpu_ptr)
+ {
+ ump_id = ump_secure_id_get(ump_mem_handle);
+
+ if (UMP_INVALID_SECURE_ID != ump_id)
+ {
+ private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_USES_UMP, usage, size, cpu_ptr,
+ private_handle_t::LOCK_STATE_MAPPED, ump_id, ump_mem_handle);
+
+ if (NULL != hnd)
+ {
+ *pHandle = hnd;
+ return 0;
+ }
+ else
+ {
+ AERR("gralloc_alloc_buffer() failed to allocate handle. ump_handle = %p, ump_id = %d", ump_mem_handle, ump_id);
+ }
+ }
+ else
+ {
+ AERR("gralloc_alloc_buffer() failed to retrieve valid secure id. ump_handle = %p", ump_mem_handle);
+ }
+
+ ump_mapped_pointer_release(ump_mem_handle);
+ }
+ else
+ {
+ AERR("gralloc_alloc_buffer() failed to map UMP memory. ump_handle = %p", ump_mem_handle);
+ }
+
+ ump_reference_release(ump_mem_handle);
+ }
+ else
+ {
+ AERR("gralloc_alloc_buffer() failed to allocate UMP memory. size:%d constraints: %d", size, constraints);
+ }
}
}
@@ -280,7 +321,7 @@
}
}
- const uint32_t bufferMask = m->bufferMask;
+ uint32_t bufferMask = m->bufferMask;
const uint32_t numBuffers = m->numBuffers;
const size_t bufferSize = m->finfo.line_length * m->info.yres;
@@ -296,8 +337,9 @@
if (bufferMask >= ((1LU << numBuffers) - 1))
{
- // We ran out of buffers.
- return -ENOMEM;
+ // We ran out of buffers, reset bufferMask.
+ bufferMask = 0;
+ m->bufferMask = 0;
}
void *vaddr = m->framebuffer->base;
@@ -314,10 +356,10 @@
vaddr = (void *)((uintptr_t)vaddr + bufferSize);
}
- int fbdev_fd = m->framebuffer->shallow_fbdev_fd;
// The entire framebuffer memory is already mapped, now create a buffer object for parts of this memory
private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, usage, size, vaddr,
- 0, fbdev_fd, (uintptr_t)vaddr - (uintptr_t) m->framebuffer->base);
+ 0, m->framebuffer->fd, (uintptr_t)vaddr - (uintptr_t) m->framebuffer->base, m->framebuffer->fb_paddr);
+
#if GRALLOC_ARM_UMP_MODULE
hnd->ump_id = m->framebuffer->ump_id;
@@ -337,19 +379,23 @@
#if GRALLOC_ARM_DMA_BUF_MODULE
{
#ifdef FBIOGET_DMABUF
- struct fb_dmabuf_export fb_dma_buf;
-
- if (ioctl(fbdev_fd, FBIOGET_DMABUF, &fb_dma_buf) == 0)
+ /*
+ * Perform allocator specific actions. If these fail we fall back to a regular buffer
+ * which will be memcpy'ed to the main screen when fb_post is called.
+ */
+ if (fb_get_framebuffer_dmabuf(m, hnd) == -1)
{
- AINF("framebuffer accessed with dma buf (fd 0x%x)\n", (int)fb_dma_buf.fd);
- hnd->share_fd = fb_dma_buf.fd;
- }
+ int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
+ AINF("Fallback to single buffering. Unable to map framebuffer memory to handle:%p", hnd);
+ return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle);
+ }
#endif
}
// correct numFds/numInts when there is no dmabuf fd
- if (hnd->share_fd < 0) {
+ if (hnd->share_fd < 0)
+ {
hnd->numFds--;
hnd->numInts++;
}
@@ -400,7 +446,12 @@
#ifdef SUPPORT_LEGACY_FORMAT
case HAL_PIXEL_FORMAT_YCbCr_420_P:
#endif
- stride = GRALLOC_ALIGN(w, 16);
+ /*
+ * Since Utgard has limitation that "64-byte alignment is enforced on texture and mipmap addresses", here to make sure
+ * the v, u plane start addresses are 64-byte aligned.
+ */
+ stride = GRALLOC_ALIGN(w, (h % 8 == 0) ? GRALLOC_ALIGN_BASE_16 :
+ ((h % 4 == 0) ? GRALLOC_ALIGN_BASE_64 : GRALLOC_ALIGN_BASE_128));
size = GRALLOC_ALIGN(h, 2) * (stride + GRALLOC_ALIGN(stride / 2, 16));
break;
@@ -446,26 +497,13 @@
bpp = 2;
break;
- case HAL_PIXEL_FORMAT_BLOB:
- if (h != 1) {
- AERR("Height for HAL_PIXEL_FORMAT_BLOB must be 1. h=%d", h);
- return -EINVAL;
- }
- break;
-
default:
- AERR("The format is not supported yet: format=%d\n", format);
return -EINVAL;
}
- if (format == HAL_PIXEL_FORMAT_BLOB) {
- stride = 0; /* No 'rows', it's effectively a long one dimensional array */
- size = w;
- }else{
- size_t bpr = GRALLOC_ALIGN(w * bpp, 64);
- size = bpr * h;
- stride = bpr / bpp;
- }
+ size_t bpr = GRALLOC_ALIGN(w * bpp, 64);
+ size = bpr * h;
+ stride = bpr / bpp;
}
int err;
@@ -541,12 +579,6 @@
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
{
- // free this buffer
- private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
- const size_t bufferSize = m->finfo.line_length * m->info.yres;
- int index = ((uintptr_t)hnd->base - (uintptr_t)m->framebuffer->base) / bufferSize;
- m->bufferMask &= ~(1 << index);
-
#if GRALLOC_ARM_UMP_MODULE
if ((int)UMP_INVALID_MEMORY_HANDLE != hnd->ump_mem_handle)
@@ -568,18 +600,20 @@
}
#else
- AERR("Can't free ump memory for handle:0x%p. Not supported.", hnd);
+ AERR("Can't free ump memory for handle:%p. Not supported.", hnd);
#endif
}
else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
{
#if GRALLOC_ARM_DMA_BUF_MODULE
+ private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
+
/* Buffer might be unregistered so we need to check for invalid ump handle*/
if (0 != hnd->base)
{
if (0 != munmap((void *)hnd->base, hnd->size))
{
- AERR("Failed to munmap handle 0x%p", hnd);
+ AERR("Failed to munmap handle %p", hnd);
}
}
@@ -622,54 +656,6 @@
return 0;
}
-#if GRALLOC_ARM_DMA_BUF_MODULE
-static int find_system_heap_id(int ion_client)
-{
- int i, ret, cnt, system_heap_id = -1;
- struct ion_heap_data *data;
-
- ret = ion_query_heap_cnt(ion_client, &cnt);
-
- if (ret)
- {
- AERR("ion count query failed with %s", strerror(errno));
- return -1;
- }
-
- data = (struct ion_heap_data *)malloc(cnt * sizeof(*data));
- if (!data)
- {
- AERR("Error allocating data %s\n", strerror(errno));
- return -1;
- }
-
- ret = ion_query_get_heaps(ion_client, cnt, data);
- if (ret)
- {
- AERR("Error querying heaps from ion %s", strerror(errno));
- }
- else
- {
- for (i = 0; i < cnt; i++) {
- struct ion_heap_data *dat = (struct ion_heap_data *)data;
- if (strcmp(dat[i].name, "ion_system_heap") == 0) {
- system_heap_id = dat[i].heap_id;
- break;
- }
- }
-
- if (i > cnt)
- {
- AERR("No System Heap Found amongst %d heaps\n", cnt);
- system_heap_id = -1;
- }
- }
-
- free(data);
- return system_heap_id;
-}
-#endif
-
int alloc_device_open(hw_module_t const *module, const char *name, hw_device_t **device)
{
MALI_IGNORE(name);
@@ -716,20 +702,6 @@
return -1;
}
- m->gralloc_legacy_ion = ion_is_legacy(m->ion_client);
-
- if (!m->gralloc_legacy_ion)
- {
- m->system_heap_id = find_system_heap_id(m->ion_client);
- if (m->system_heap_id < 0)
- {
- delete dev;
- ion_close(m->ion_client);
- m->ion_client = -1;
- return -1;
- }
- }
-
#endif
*device = &dev->common;
diff --git a/gralloc/alloc_device.h b/gralloc/alloc_device.h
index 534a0d6..563c27c 100644
--- a/gralloc/alloc_device.h
+++ b/gralloc/alloc_device.h
@@ -19,17 +19,23 @@
#include <hardware/hardware.h>
#ifndef AWAR
-#define AWAR(fmt, args...) __android_log_print(ANDROID_LOG_WARN, "[Gralloc-Warning]", "%s:%d " fmt,__func__,__LINE__,args)
+#define AWAR(fmt, args...) __android_log_print(ANDROID_LOG_WARN, "[Gralloc-Warning]", "%s:%d " fmt,__func__,__LINE__,##args)
#endif
#ifndef AINF
-#define AINF(fmt, args...) __android_log_print(ANDROID_LOG_INFO, "[Gralloc]", fmt,args)
+#define AINF(fmt, args...) __android_log_print(ANDROID_LOG_INFO, "[Gralloc]", fmt,##args)
#endif
#ifndef AERR
-#define AERR(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, "[Gralloc-ERROR]", "%s:%d " fmt,__func__,__LINE__,args)
+#define AERR(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, "[Gralloc-ERROR]", "%s:%d " fmt,__func__,__LINE__,##args)
#endif
#ifndef AERR_IF
#define AERR_IF( eq, fmt, args...) if ( (eq) ) AERR( fmt, args )
#endif
+#define GRALLOC_ALIGN( value, base ) (((value) + ((base) - 1)) & ~((base) - 1))
+
+#define GRALLOC_ALIGN_BASE_16 16
+#define GRALLOC_ALIGN_BASE_64 64
+#define GRALLOC_ALIGN_BASE_128 128
+
// Create an alloc device
int alloc_device_open(hw_module_t const *module, const char *name, hw_device_t **device);
diff --git a/gralloc/framebuffer_device.cpp b/gralloc/framebuffer_device.cpp
index bacefee..6ab88a5 100644
--- a/gralloc/framebuffer_device.cpp
+++ b/gralloc/framebuffer_device.cpp
@@ -22,6 +22,7 @@
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <stdlib.h>
+
#include <cutils/log.h>
#include <cutils/atomic.h>
#include <hardware/hardware.h>
@@ -85,20 +86,17 @@
m->base.lock(&m->base, buffer, private_module_t::PRIV_USAGE_LOCKED_FOR_POST,
0, 0, m->info.xres, m->info.yres, NULL);
- const size_t offset = (uintptr_t)hnd->base - (uintptr_t)m->framebuffer->base;
int interrupt;
m->info.activate = FB_ACTIVATE_VBL;
- m->info.yoffset = offset / m->finfo.line_length;
+ m->info.yoffset = hnd->offset / m->finfo.line_length;
#ifdef STANDARD_LINUX_SCREEN
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
#define S3CFB_SET_VSYNC_INT _IOW('F', 206, unsigned int)
- int fbdev_fd = m->framebuffer->shallow_fbdev_fd;
-
- if (ioctl(fbdev_fd, FBIOPAN_DISPLAY, &m->info) == -1)
+ if (ioctl(m->framebuffer->fd, FBIOPAN_DISPLAY, &m->info) == -1)
{
- AERR("FBIOPAN_DISPLAY failed for fd: %d", fbdev_fd);
+ AERR("FBIOPAN_DISPLAY failed for fd: %d", m->framebuffer->fd);
m->base.unlock(&m->base, buffer);
return 0;
}
@@ -108,9 +106,9 @@
// enable VSYNC
interrupt = 1;
- if (ioctl(fbdev_fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
+ if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
{
- // AERR("S3CFB_SET_VSYNC_INT enable failed for fd: %d", fbdev_fd);
+ // AERR("S3CFB_SET_VSYNC_INT enable failed for fd: %d", m->framebuffer->fd);
return 0;
}
@@ -120,9 +118,9 @@
#endif
int crtc = 0;
- if (ioctl(fbdev_fd, FBIO_WAITFORVSYNC, &crtc) < 0)
+ if (ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &crtc) < 0)
{
- AERR("FBIO_WAITFORVSYNC failed for fd: %d", fbdev_fd);
+ AERR("FBIO_WAITFORVSYNC failed for fd: %d", m->framebuffer->fd);
#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
#endif
@@ -135,9 +133,9 @@
// disable VSYNC
interrupt = 0;
- if (ioctl(fbdev_fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
+ if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0)
{
- AERR("S3CFB_SET_VSYNC_INT disable failed for fd: %d", fbdev_fd);
+ AERR("S3CFB_SET_VSYNC_INT disable failed for fd: %d", m->framebuffer->fd);
return 0;
}
}
@@ -148,9 +146,9 @@
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_BEGIN_WAIT);
#endif
- if (ioctl(fbdev_fd, FBIOPUT_VSCREENINFO, &m->info) == -1)
+ if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1)
{
- AERR("FBIOPUT_VSCREENINFO failed for fd: %d", fbdev_fd);
+ AERR("FBIOPUT_VSCREENINFO failed for fd: %d", m->framebuffer->fd);
#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
#endif
@@ -254,14 +252,14 @@
* Explicitly request 8/8/8
*/
info.bits_per_pixel = 32;
- info.red.offset = 0;
+ info.red.offset = 16;
info.red.length = 8;
info.green.offset = 8;
info.green.length = 8;
- info.blue.offset = 16;
+ info.blue.offset = 0;
info.blue.length = 8;
- info.transp.offset = 24;
- info.transp.length = 8;
+ info.transp.offset = 0;
+ info.transp.length = 0;
#endif
/*
@@ -385,7 +383,11 @@
// Create a "fake" buffer object for the entire frame buffer memory, and store it in the module
module->framebuffer = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, 0, fbSize, vaddr,
- 0, fd, 0);
+ 0, fd, 0, (void *)finfo.smem_start);
+
+ /* There is no share_fd in framebuffer handle, correct numFds/numInts */
+ module->framebuffer->numFds--;
+ module->framebuffer->numInts++;
module->numBuffers = info.yres_virtual / info.yres;
module->bufferMask = 0;
@@ -471,12 +473,6 @@
/* initialize our state here */
framebuffer_device_t *dev = (framebuffer_device_t *)malloc(sizeof(framebuffer_device_t));
- if (dev == NULL)
- {
- AERR("Error to malloc the framebuffer (%s)", strerror(errno));
- gralloc_close(gralloc_device);
- return -ENOMEM;
- }
memset(dev, 0, sizeof(*dev));
/* initialize the procs */
@@ -497,7 +493,7 @@
#ifdef GRALLOC_16_BITS
const_cast<int &>(dev->format) = HAL_PIXEL_FORMAT_RGB_565;
#else
- const_cast<int &>(dev->format) = HAL_PIXEL_FORMAT_RGBA_8888;
+ const_cast<int &>(dev->format) = HAL_PIXEL_FORMAT_BGRA_8888;
#endif
const_cast<float &>(dev->xdpi) = m->xdpi;
const_cast<float &>(dev->ydpi) = m->ydpi;
diff --git a/gralloc/gralloc_module.cpp b/gralloc/gralloc_module.cpp
index 38ed3da..20f833d 100644
--- a/gralloc/gralloc_module.cpp
+++ b/gralloc/gralloc_module.cpp
@@ -18,7 +18,7 @@
#include <errno.h>
#include <pthread.h>
-#include <string.h>
+#include <sync/sync.h>
#include <cutils/log.h>
#include <cutils/atomic.h>
@@ -64,7 +64,7 @@
if (private_handle_t::validate(handle) < 0)
{
- AERR("Registering invalid buffer 0x%p, returning error", handle);
+ AERR("Registering invalid buffer %p, returning error", handle);
return -EINVAL;
}
@@ -97,9 +97,8 @@
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
{
- AINF("Register framebuffer 0x%p is no-op", handle);
+ AINF("Register buffer %p although it will be treated as a nop", handle);
retval = 0;
-
}
else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP)
{
@@ -114,6 +113,7 @@
{
hnd->writeOwner = 0;
hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED);
+
pthread_mutex_unlock(&s_map_lock);
return 0;
}
@@ -130,12 +130,13 @@
}
#else
- AERR("Gralloc does not support UMP. Unable to register UMP memory for handle 0x%p", hnd);
+ AERR("Gralloc does not support UMP. Unable to register UMP memory for handle %p", hnd);
#endif
}
else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
{
#if GRALLOC_ARM_DMA_BUF_MODULE
+ int ret;
unsigned char *mappedAddress;
size_t size = hnd->size;
hw_module_t *pmodule = NULL;
@@ -147,7 +148,7 @@
}
else
{
- AERR("Could not get gralloc module for handle: 0x%p", hnd);
+ AERR("Could not get gralloc module for handle: %p", hnd);
retval = -errno;
goto cleanup;
}
@@ -163,7 +164,7 @@
if (m->ion_client < 0)
{
- AERR("Could not open ion device for handle: 0x%p", hnd);
+ AERR("Could not open ion device for handle: %p", hnd);
retval = -errno;
goto cleanup;
}
@@ -180,6 +181,7 @@
hnd->base = mappedAddress + hnd->offset;
hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED);
+
pthread_mutex_unlock(&s_map_lock);
return 0;
#endif
@@ -189,7 +191,9 @@
AERR("registering non-UMP buffer not supported. flags = %d", hnd->flags);
}
+#if GRALLOC_ARM_DMA_BUF_MODULE
cleanup:
+#endif
pthread_mutex_unlock(&s_map_lock);
return retval;
}
@@ -203,7 +207,7 @@
ump_reference_release((ump_handle)hnd->ump_mem_handle);
hnd->ump_mem_handle = (int)UMP_INVALID_MEMORY_HANDLE;
#else
- AERR("Can't unregister UMP buffer for handle 0x%p. Not supported", hnd);
+ AERR("Can't unregister UMP buffer for handle %p. Not supported", hnd);
#endif
}
else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
@@ -214,7 +218,7 @@
if (munmap(base, size) < 0)
{
- AERR("Could not munmap base:0x%p size:%lu '%s'", base, (unsigned long)size, strerror(errno));
+ AERR("Could not munmap base:%p size:%lu '%s'", base, (unsigned long)size, strerror(errno));
}
#else
@@ -238,7 +242,7 @@
if (private_handle_t::validate(handle) < 0)
{
- AERR("unregistering invalid buffer 0x%p, returning error", handle);
+ AERR("unregistering invalid buffer %p, returning error", handle);
return -EINVAL;
}
@@ -248,7 +252,7 @@
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)
{
- AERR("Can't unregister buffer 0x%p as it is a framebuffer", handle);
+ AERR("Can't unregister buffer %p as it is a framebuffer", handle);
}
else if (hnd->pid == getpid()) // never unmap buffers that were not registered in this process
{
@@ -268,7 +272,7 @@
}
else
{
- AERR("Trying to unregister buffer 0x%p from process %d that was not created in current process: %d", hnd, hnd->pid, getpid());
+ AERR("Trying to unregister buffer %p from process %d that was not created in current process: %d", hnd, hnd->pid, getpid());
}
return 0;
@@ -276,19 +280,27 @@
static int gralloc_lock(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, void **vaddr)
{
+
+
if (private_handle_t::validate(handle) < 0)
{
- AERR("Locking invalid buffer 0x%p, returning error", handle);
+ AERR("Locking invalid buffer %p, returning error", handle);
return -EINVAL;
}
private_handle_t *hnd = (private_handle_t *)handle;
+ if (hnd->format == HAL_PIXEL_FORMAT_YCbCr_420_888)
+ {
+ AERR("Buffer with format HAL_PIXEL_FORMAT_YCbCr_*_888 must be locked by lock_ycbcr()");
+ return -EINVAL;
+ }
+
pthread_mutex_lock(&s_map_lock);
if (hnd->lockState & private_handle_t::LOCK_STATE_UNREGISTERED)
{
- AERR("Locking on an unregistered buffer 0x%p, returning error", hnd);
+ AERR("Locking on an unregistered buffer %p, returning error", hnd);
pthread_mutex_unlock(&s_map_lock);
return -EINVAL;
}
@@ -315,13 +327,93 @@
return 0;
}
+static int gralloc_lock_ycbcr(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr)
+{
+ int retval = 0;
+ int ystride, cstride;
+
+ if (private_handle_t::validate(handle) < 0)
+ {
+ AERR("Locking invalid buffer %p, returning error", handle);
+ return -EINVAL;
+ }
+
+ private_handle_t *hnd = (private_handle_t *)handle;
+
+ pthread_mutex_lock(&s_map_lock);
+
+ if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP || hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
+ {
+ hnd->writeOwner = usage & GRALLOC_USAGE_SW_WRITE_MASK;
+ }
+
+ hnd->lockState |= private_handle_t::LOCK_STATE_WRITE;
+
+ pthread_mutex_unlock(&s_map_lock);
+
+
+ if (usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK))
+ {
+ switch (hnd->format)
+ {
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
+ ycbcr->y = (void *)hnd->base;
+ ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * hnd->height);
+ ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * hnd->height + 1);
+ ycbcr->ystride = ystride;
+ ycbcr->cstride = cstride;
+ ycbcr->chroma_step = 2;
+ break;
+
+ case HAL_PIXEL_FORMAT_YV12:
+ /* Here to keep consistency with YV12 alignment, define the ystride according to image height. */
+ ystride = GRALLOC_ALIGN(hnd->width, (hnd->height % 8 == 0) ? GRALLOC_ALIGN_BASE_16 :
+ ((hnd->height % 4 == 0) ? GRALLOC_ALIGN_BASE_64 : GRALLOC_ALIGN_BASE_128));
+ cstride = GRALLOC_ALIGN(ystride / 2, 16);
+ ycbcr->y = (void *)hnd->base;
+ /* the ystride calc is assuming the height can at least be divided by 2 */
+ ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * GRALLOC_ALIGN(hnd->height, 2));
+ ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * GRALLOC_ALIGN(hnd->height, 2) + cstride * hnd->height / 2);
+ ycbcr->ystride = ystride;
+ ycbcr->cstride = cstride;
+ ycbcr->chroma_step = 1;
+ break;
+
+#ifdef SUPPORT_LEGACY_FORMAT
+
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+ ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
+ ycbcr->y = (void *)hnd->base;
+ ycbcr->cb = (void *)((unsigned char *)hnd->base + ystride * hnd->height);
+ ycbcr->cr = (void *)((unsigned char *)hnd->base + ystride * hnd->height + 1);
+ ycbcr->ystride = ystride;
+ ycbcr->cstride = cstride;
+ ycbcr->chroma_step = 2;
+ break;
+#endif
+
+ default:
+ AERR("Can not lock buffer, invalid format: 0x%x", hnd->format);
+ retval = -EINVAL;
+ }
+ }
+
+ MALI_IGNORE(module);
+ MALI_IGNORE(l);
+ MALI_IGNORE(t);
+ MALI_IGNORE(w);
+ MALI_IGNORE(h);
+ return retval;
+}
+
static int gralloc_unlock(gralloc_module_t const *module, buffer_handle_t handle)
{
MALI_IGNORE(module);
if (private_handle_t::validate(handle) < 0)
{
- AERR("Unlocking invalid buffer 0x%p, returning error", handle);
+ AERR("Unlocking invalid buffer %p, returning error", handle);
return -EINVAL;
}
@@ -332,18 +424,25 @@
#if GRALLOC_ARM_UMP_MODULE
ump_cpu_msync_now((ump_handle)hnd->ump_mem_handle, UMP_MSYNC_CLEAN_AND_INVALIDATE, (void *)hnd->base, hnd->size);
#else
- AERR("Buffer 0x%p is UMP type but it is not supported", hnd);
+ AERR("Buffer %p is UMP type but it is not supported", hnd);
#endif
}
else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION && hnd->writeOwner)
{
#if GRALLOC_ARM_DMA_BUF_MODULE
hw_module_t *pmodule = NULL;
+ private_module_t *m = NULL;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&pmodule) != 0)
+ if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&pmodule) == 0)
{
- AERR("Couldnot get gralloc module for handle 0x%p\n", handle);
+ m = reinterpret_cast<private_module_t *>(pmodule);
+ //ion_sync_fd(m->ion_client, hnd->share_fd);
}
+ else
+ {
+ AERR("Couldnot get gralloc module for handle %p\n", handle);
+ }
+
#endif
}
@@ -362,11 +461,48 @@
return 0;
}
+#if defined(GRALLOC_MODULE_API_VERSION_0_3)
+static int gralloc_lock_async (gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, void **vaddr, int fenceFD)
+{
+ if (fenceFD >= 0)
+ {
+ sync_wait(fenceFD, -1);
+ close(fenceFD);
+ }
+
+ return gralloc_lock(module, handle, usage, l, t, w, h, vaddr);
+}
+
+static int gralloc_unlock_async(gralloc_module_t const *module, buffer_handle_t handle, int *fenceFD)
+{
+ *fenceFD = -1;
+
+ if (gralloc_unlock(module, handle) < 0)
+ {
+ return -EINVAL;
+ }
+
+ return 0;
+
+}
+
+static int gralloc_lock_async_ycbcr(gralloc_module_t const *module, buffer_handle_t handle, int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr, int fenceFD)
+{
+ if (fenceFD >= 0)
+ {
+ sync_wait(fenceFD, -1);
+ close(fenceFD);
+ }
+
+ return gralloc_lock_ycbcr(module, handle, usage, l, t, w, h, ycbcr);
+}
+#endif
+
// There is one global instance of the module
static struct hw_module_methods_t gralloc_module_methods =
{
- .open = gralloc_device_open,
+ .open = gralloc_device_open
};
private_module_t::private_module_t()
@@ -374,7 +510,11 @@
#define INIT_ZERO(obj) (memset(&(obj),0,sizeof((obj))))
base.common.tag = HARDWARE_MODULE_TAG;
- base.common.version_major = 1;
+#if defined(GRALLOC_MODULE_API_VERSION_0_3)
+ base.common.version_major = GRALLOC_MODULE_API_VERSION_0_3;
+#else
+ base.common.version_major = GRALLOC_MODULE_API_VERSION_0_2;
+#endif
base.common.version_minor = 0;
base.common.id = GRALLOC_HARDWARE_MODULE_ID;
base.common.name = "Graphics Memory Allocator Module";
@@ -388,6 +528,12 @@
base.lock = gralloc_lock;
base.unlock = gralloc_unlock;
base.perform = NULL;
+ base.lock_ycbcr = gralloc_lock_ycbcr;
+#if defined(GRALLOC_MODULE_API_VERSION_0_3)
+ base.lockAsync = gralloc_lock_async;
+ base.unlockAsync = gralloc_unlock_async;
+ base.lockAsync_ycbcr = gralloc_lock_async_ycbcr;
+#endif
INIT_ZERO(base.reserved_proc);
framebuffer = NULL;
diff --git a/gralloc/gralloc_priv.h b/gralloc/gralloc_priv.h
index 582c487..ab45f8b 100644
--- a/gralloc/gralloc_priv.h
+++ b/gralloc/gralloc_priv.h
@@ -60,6 +60,8 @@
__u32 fd;
__u32 flags;
};
+
+/* Un-comment this line to use dma_buf framebuffer */
/*#define FBIOGET_DMABUF _IOR('F', 0x21, struct fb_dmabuf_export)*/
#if PLATFORM_SDK_VERSION >= 21
@@ -110,8 +112,6 @@
pthread_mutex_t lock;
buffer_handle_t currentBuffer;
int ion_client;
- int system_heap_id;
- bool gralloc_legacy_ion;
struct fb_var_screeninfo info;
struct fb_fix_screeninfo finfo;
@@ -150,7 +150,7 @@
LOCK_STATE_WRITE = 1 << 31,
LOCK_STATE_MAPPED = 1 << 30,
LOCK_STATE_UNREGISTERED = 1 << 29,
- LOCK_STATE_READ_MASK = 0x1FFFFFFF
+ LOCK_STATE_READ_MASK = 0x3FFFFFFF
};
// ints
@@ -184,11 +184,15 @@
#endif
// Following members is for framebuffer only
- int shallow_fbdev_fd; // shallow copy, not dup'ed
+ int fd; //Shallow copy, DO NOT duplicate
int offset;
-
+ union
+ {
+ void *fb_paddr;
+ uint64_t fb_paddr_padding;
+ };
#if GRALLOC_ARM_DMA_BUF_MODULE
- ion_user_handle_t ion_hnd_UNUSED;
+ ion_user_handle_t ion_hnd;
#endif
#if GRALLOC_ARM_DMA_BUF_MODULE
@@ -221,11 +225,12 @@
yuv_info(MALI_YUV_NO_INFO),
ump_id((int)secure_id),
ump_mem_handle((int)handle),
- shallow_fbdev_fd(0),
- offset(0)
+ fd(0),
+ offset(0),
+ fb_paddr(NULL)
#if GRALLOC_ARM_DMA_BUF_MODULE
,
- ion_hnd_UNUSED(ION_INVALID_HANDLE)
+ ion_hnd(ION_INVALID_HANDLE)
#endif
{
@@ -255,9 +260,10 @@
ump_id((int)UMP_INVALID_SECURE_ID),
ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
#endif
- shallow_fbdev_fd(0),
+ fd(0),
offset(0),
- ion_hnd_UNUSED(ION_INVALID_HANDLE)
+ fb_paddr(NULL),
+ ion_hnd(ION_INVALID_HANDLE)
{
version = sizeof(native_handle);
@@ -267,7 +273,7 @@
#endif
- private_handle_t(int flags, int usage, int size, void *base, int lock_state, int fb_file, int fb_offset):
+ private_handle_t(int flags, int usage, int size, void *base, int lock_state, int fb_file, int fb_offset, void *fb_paddr):
#if GRALLOC_ARM_DMA_BUF_MODULE
share_fd(-1),
#endif
@@ -288,11 +294,12 @@
ump_id((int)UMP_INVALID_SECURE_ID),
ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
#endif
- shallow_fbdev_fd(fb_file),
- offset(fb_offset)
+ fd(fb_file),
+ offset(fb_offset),
+ fb_paddr(fb_paddr)
#if GRALLOC_ARM_DMA_BUF_MODULE
,
- ion_hnd_UNUSED(ION_INVALID_HANDLE)
+ ion_hnd(ION_INVALID_HANDLE)
#endif
{
@@ -315,21 +322,23 @@
{
const private_handle_t *hnd = (const private_handle_t *)h;
- if (!h || h->version != sizeof(native_handle) || hnd->magic != sMagic)
+ if (!hnd || hnd->version != sizeof(native_handle) || hnd->magic != sMagic)
{
return -EINVAL;
}
int numFds = sNumFds;
int numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds;
+
#if GRALLOC_ARM_DMA_BUF_MODULE
- if (hnd->share_fd < 0) {
+ if (hnd->share_fd < 0)
+ {
numFds--;
numInts++;
}
#endif
- if (h->numFds != numFds || h->numInts != numInts)
+ if (hnd->numFds != numFds || hnd->numInts != numInts)
{
return -EINVAL;
}
diff --git a/gralloc/ion_4.12.h b/gralloc/ion_4.12.h
deleted file mode 100644
index 6ae79d4..0000000
--- a/gralloc/ion_4.12.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Adapted from drivers/staging/android/uapi/ion.h
- *
- * Copyright (C) 2011 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _UAPI_LINUX_ION_NEW_H
-#define _UAPI_LINUX_ION_NEW_H
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8)
-
-/**
- * DOC: Ion Userspace API
- *
- * create a client by opening /dev/ion
- * most operations handled via following ioctls
- *
- */
-
-/**
- * struct ion_new_allocation_data - metadata passed from userspace for allocations
- * @len: size of the allocation
- * @heap_id_mask: mask of heap ids to allocate from
- * @flags: flags passed to heap
- * @handle: pointer that will be populated with a cookie to use to
- * refer to this allocation
- *
- * Provided by userspace as an argument to the ioctl - added _new to denote
- * this belongs to the new ION interface.
- */
-struct ion_new_allocation_data {
- __u64 len;
- __u32 heap_id_mask;
- __u32 flags;
- __u32 fd;
- __u32 unused;
-};
-
-#define MAX_HEAP_NAME 32
-
-/**
- * struct ion_heap_data - data about a heap
- * @name - first 32 characters of the heap name
- * @type - heap type
- * @heap_id - heap id for the heap
- */
-struct ion_heap_data {
- char name[MAX_HEAP_NAME];
- __u32 type;
- __u32 heap_id;
- __u32 reserved0;
- __u32 reserved1;
- __u32 reserved2;
-};
-
-/**
- * struct ion_heap_query - collection of data about all heaps
- * @cnt - total number of heaps to be copied
- * @heaps - buffer to copy heap data
- */
-struct ion_heap_query {
- __u32 cnt; /* Total number of heaps to be copied */
- __u32 reserved0; /* align to 64bits */
- __u64 heaps; /* buffer to be populated */
- __u32 reserved1;
- __u32 reserved2;
-};
-
-#define ION_IOC_MAGIC 'I'
-
-/**
- * DOC: ION_IOC_NEW_ALLOC - allocate memory
- *
- * Takes an ion_allocation_data struct and returns it with the handle field
- * populated with the opaque handle for the allocation.
- * TODO: This IOCTL will clash by design; however, only one of
- * ION_IOC_ALLOC or ION_IOC_NEW_ALLOC paths will be exercised,
- * so this should not conflict.
- */
-#define ION_IOC_NEW_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_new_allocation_data)
-
-/**
- * DOC: ION_IOC_FREE - free memory
- *
- * Takes an ion_handle_data struct and frees the handle.
- *
- * #define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
- * This will come from the older kernels, so don't redefine here
- */
-
-/**
- * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
- *
- * Takes an ion_fd_data struct with the handle field populated with a valid
- * opaque handle. Returns the struct with the fd field set to a file
- * descriptor open in the current address space. This file descriptor
- * can then be passed to another process. The corresponding opaque handle can
- * be retrieved via ION_IOC_IMPORT.
- *
- * #define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
- * This will come from the older kernels, so don't redefine here
- */
-
-/**
- * DOC: ION_IOC_HEAP_QUERY - information about available heaps
- *
- * Takes an ion_heap_query structure and populates information about
- * available Ion heaps.
- */
-#define ION_IOC_HEAP_QUERY _IOWR(ION_IOC_MAGIC, 8, struct ion_heap_query)
-
-#endif /* _UAPI_LINUX_ION_NEW_H */