OSDN Git Service

Simulator build fixes for the new GL stuff. The simulator still doesn't run, but...
authorMarco Nelissen <marcone@google.com>
Tue, 7 Jul 2009 16:29:00 +0000 (09:29 -0700)
committerMarco Nelissen <marcone@google.com>
Tue, 7 Jul 2009 16:29:00 +0000 (09:29 -0700)
modules/gralloc/framebuffer.cpp
modules/gralloc/gralloc.cpp
modules/gralloc/gralloc_priv.h
modules/gralloc/mapper.cpp

index 2d0fa25..e73724f 100644 (file)
@@ -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>
index a371f05..44e42d8 100644 (file)
@@ -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*>(
index 7ec07ef..c3e34bd 100644 (file)
 
 #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);
index 1ab70ec..75a9bb6 100644 (file)
@@ -18,6 +18,7 @@
 #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,