gralloc: Remove opaque types
Remove opaque types like size_t, uintptr_t, intptr_t to support
32bit and 64bit processes together.
When a 64bit process creates a handle and a 32bit process validates
the incoming ints against expected ints, opaque types lead to
different and mismatching values.
Always use unit64_t for base address for 32bit and 64bit SF.
Use unsigned int for offset and size, since ION uses that.
Change-Id: I7db5544556a8924f98010b965f837592e9f0b4ca
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index d1f4207..ca11bea 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -87,7 +87,8 @@
reinterpret_cast<private_module_t*>(dev->common.module);
private_handle_t *hnd = static_cast<private_handle_t*>
(const_cast<native_handle_t*>(buffer));
- const size_t offset = hnd->base - m->framebuffer->base;
+ const unsigned int offset = (unsigned int) (hnd->base -
+ m->framebuffer->base);
m->info.activate = FB_ACTIVATE_VBL;
m->info.yoffset = (int)(offset / m->finfo.line_length);
if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
@@ -204,7 +205,7 @@
}
//adreno needs 4k aligned offsets. Max hole size is 4096-1
- size_t size = roundUpToPageSize(info.yres * info.xres *
+ unsigned int size = roundUpToPageSize(info.yres * info.xres *
(info.bits_per_pixel/8));
/*
@@ -326,7 +327,7 @@
module->numBuffers = info.yres_virtual / info.yres;
module->bufferMask = 0;
//adreno needs page aligned offsets. Align the fbsize to pagesize.
- size_t fbSize = roundUpToPageSize(finfo.line_length * info.yres)*
+ unsigned int fbSize = roundUpToPageSize(finfo.line_length * info.yres)*
module->numBuffers;
module->framebuffer = new private_handle_t(fd, fbSize,
private_handle_t::PRIV_FLAGS_USES_ION,
@@ -338,7 +339,7 @@
close(fd);
return -errno;
}
- module->framebuffer->base = uintptr_t(vaddr);
+ module->framebuffer->base = uint64_t(vaddr);
memset(vaddr, 0, fbSize);
//Enable vsync
int enable = 1;