diff options
author | Mathias Agopian <mathias@google.com> | 2009-07-07 12:43:35 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-07-07 12:43:35 -0700 |
commit | bfc010a750eb091017e370640d5c1644d671c7e4 (patch) | |
tree | 5267f49e544eccf76669249c537b17f85e30169f /modules/gralloc | |
parent | d34fd72bfd1ff3afa25c292d77077bacaa26f15e (diff) | |
download | hardware_libhardware-bfc010a750eb091017e370640d5c1644d671c7e4.zip hardware_libhardware-bfc010a750eb091017e370640d5c1644d671c7e4.tar.gz hardware_libhardware-bfc010a750eb091017e370640d5c1644d671c7e4.tar.bz2 |
better fix for gralloc on sim
Diffstat (limited to 'modules/gralloc')
-rw-r--r-- | modules/gralloc/gralloc.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp index 44e42d8..257bb4a 100644 --- a/modules/gralloc/gralloc.cpp +++ b/modules/gralloc/gralloc.cpp @@ -222,6 +222,8 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size = roundUpToPageSize(size); +#if HAVE_ANDROID_OS // should probably define HAVE_PMEM somewhere + if (usage & GRALLOC_USAGE_HW_TEXTURE) { // enable pmem in that case, so our software GL can fallback to // the copybit module. @@ -240,10 +242,6 @@ 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); @@ -290,9 +288,18 @@ try_ashmem: LOGE("couldn't open pmem (%s)", strerror(-errno)); } } -#endif // HAVE_ANDROID_OS } +#else // HAVE_ANDROID_OS + + fd = ashmem_create_region("Buffer", size); + if (fd < 0) { + LOGE("couldn't create ashmem (%s)", strerror(-errno)); + err = -errno; + } + +#endif // HAVE_ANDROID_OS + if (err == 0) { private_handle_t* hnd = new private_handle_t(fd, size, flags); hnd->offset = offset; @@ -385,12 +392,9 @@ static int gralloc_free(alloc_device_t* dev, int index = (hnd->base - m->framebuffer->base) / bufferSize; m->bufferMask &= ~(1<<index); } +#if HAVE_ANDROID_OS 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); @@ -404,8 +408,8 @@ static int gralloc_free(alloc_device_t* dev, sAllocator.deallocate(hnd->offset); } } -#endif // HAVE_ANDROID_OS } +#endif // HAVE_ANDROID_OS gralloc_module_t* m = reinterpret_cast<gralloc_module_t*>( dev->common.module); |