diff options
author | Marco Nelissen <marcone@google.com> | 2009-07-07 09:29:00 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2009-07-07 09:29:00 -0700 |
commit | a4b587cb063dfd1b11f0006b0149e5e3045cc873 (patch) | |
tree | 95a0b62c5a154c1a1425f6695a0f35343f498b44 /modules | |
parent | cdb66fbc8a192e4b01b8b529c78773b2a3bf4573 (diff) | |
download | hardware_libhardware-a4b587cb063dfd1b11f0006b0149e5e3045cc873.zip hardware_libhardware-a4b587cb063dfd1b11f0006b0149e5e3045cc873.tar.gz hardware_libhardware-a4b587cb063dfd1b11f0006b0149e5e3045cc873.tar.bz2 |
Simulator build fixes for the new GL stuff. The simulator still doesn't run, but at least it builds.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gralloc/framebuffer.cpp | 3 | ||||
-rw-r--r-- | modules/gralloc/gralloc.cpp | 12 | ||||
-rw-r--r-- | modules/gralloc/gralloc_priv.h | 4 | ||||
-rw-r--r-- | modules/gralloc/mapper.cpp | 9 |
4 files changed, 25 insertions, 3 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp index 2d0fa25..e73724f 100644 --- a/modules/gralloc/framebuffer.cpp +++ b/modules/gralloc/framebuffer.cpp @@ -26,6 +26,9 @@ #include <fcntl.h> #include <errno.h> +#include <sys/ioctl.h> +#include <string.h> +#include <stdlib.h> #include <cutils/log.h> #include <cutils/atomic.h> diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp index a371f05..44e42d8 100644 --- a/modules/gralloc/gralloc.cpp +++ b/modules/gralloc/gralloc.cpp @@ -19,6 +19,8 @@ #include <fcntl.h> #include <errno.h> #include <pthread.h> +#include <stdlib.h> +#include <string.h> #include <sys/mman.h> #include <sys/stat.h> @@ -238,6 +240,10 @@ try_ashmem: err = -errno; } } else { +#ifndef HAVE_ANDROID_OS // should probably define HAVE_PMEM somewhere + LOGE("pmem not available on this target"); + err = -1; +#else private_module_t* m = reinterpret_cast<private_module_t*>( dev->common.module); @@ -284,6 +290,7 @@ try_ashmem: LOGE("couldn't open pmem (%s)", strerror(-errno)); } } +#endif // HAVE_ANDROID_OS } if (err == 0) { @@ -380,6 +387,10 @@ static int gralloc_free(alloc_device_t* dev, } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) { +#ifndef HAVE_ANDROID_OS + LOGE("pmem not available on this target"); + return -EINVAL; +#else if (hnd->fd >= 0) { struct pmem_region sub = { hnd->offset, hnd->size }; int err = ioctl(hnd->fd, PMEM_UNMAP, &sub); @@ -393,6 +404,7 @@ static int gralloc_free(alloc_device_t* dev, sAllocator.deallocate(hnd->offset); } } +#endif // HAVE_ANDROID_OS } gralloc_module_t* m = reinterpret_cast<gralloc_module_t*>( diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h index 7ec07ef..c3e34bd 100644 --- a/modules/gralloc/gralloc_priv.h +++ b/modules/gralloc/gralloc_priv.h @@ -28,16 +28,14 @@ #include <cutils/native_handle.h> -#if HAVE_ANDROID_OS #include <linux/fb.h> -#endif /*****************************************************************************/ struct private_module_t; inline size_t roundUpToPageSize(size_t x) { - return (x + (PAGESIZE-1)) & ~(PAGESIZE-1); + return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1); } int mapFrameBufferLocked(struct private_module_t* module); diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp index 1ab70ec..75a9bb6 100644 --- a/modules/gralloc/mapper.cpp +++ b/modules/gralloc/mapper.cpp @@ -18,6 +18,7 @@ #include <errno.h> #include <pthread.h> #include <unistd.h> +#include <string.h> #include <sys/mman.h> #include <sys/stat.h> @@ -35,6 +36,14 @@ // we need this for now because pmem cannot mmap at an offset #define PMEM_HACK 1 +/* desktop Linux needs a little help with gettid() */ +#if defined(ARCH_X86) && !defined(HAVE_ANDROID_OS) +#define __KERNEL__ +# include <linux/unistd.h> +pid_t gettid() { return syscall(__NR_gettid);} +#undef __KERNEL__ +#endif + /*****************************************************************************/ static int gralloc_map(gralloc_module_t const* module, |