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
This commit is contained in:
Saurabh Shah
2014-05-19 16:48:53 -07:00
parent 386f201efd
commit 8f0ea6ff81
12 changed files with 99 additions and 92 deletions

View File

@@ -87,7 +87,8 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
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 @@ int mapFrameBufferLocked(struct private_module_t* module)
}
//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 @@ int mapFrameBufferLocked(struct private_module_t* module)
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 @@ int mapFrameBufferLocked(struct private_module_t* module)
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;