#include <fcntl.h>
#include <errno.h>
#include <pthread.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
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);
LOGE("couldn't open pmem (%s)", strerror(-errno));
}
}
+#endif // HAVE_ANDROID_OS
}
if (err == 0) {
}
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);
sAllocator.deallocate(hnd->offset);
}
}
+#endif // HAVE_ANDROID_OS
}
gralloc_module_t* m = reinterpret_cast<gralloc_module_t*>(
#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);
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
// 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,