#include <utils/Log.h>
/** Base path of the hal modules */
+#if defined(__LP64__)
+#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
+#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
+#else
#define HAL_LIBRARY_PATH1 "/system/lib/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
+#endif
/**
* There are a set of variant filename for modules. The form of the filename
snprintf(buff, sizeof buff, "pipe:%s", pipeName);
fd = open("/dev/qemu_pipe", O_RDWR);
+ if (fd < 0 && errno == ENOENT)
+ fd = open("/dev/goldfish_pipe", O_RDWR);
if (fd < 0) {
D("%s: Could not open /dev/qemu_pipe: %s", __FUNCTION__, strerror(errno));
//errno = ENOSYS;
gralloc.cpp \
framebuffer.cpp \
mapper.cpp
-
+
LOCAL_MODULE := gralloc.default
-LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\"
+LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -Wno-missing-field-initializers
include $(BUILD_SHARED_LIBRARY)
if (status >= 0) {
int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3);
int format = (m->info.bits_per_pixel == 32)
- ? HAL_PIXEL_FORMAT_RGBX_8888
+ ? (m->info.red.offset ? HAL_PIXEL_FORMAT_BGRA_8888 : HAL_PIXEL_FORMAT_RGBX_8888)
: HAL_PIXEL_FORMAT_RGB_565;
const_cast<uint32_t&>(dev->device.flags) = 0;
const_cast<uint32_t&>(dev->device.width) = m->info.xres;
#define GR_H_
#include <stdint.h>
-#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define
-# include <asm/page.h>
-#else
-# include <sys/user.h>
-#endif
+#include <sys/user.h>
#include <limits.h>
#include <sys/cdefs.h>
#include <hardware/gralloc.h>
}
static int gralloc_alloc_buffer(alloc_device_t* dev,
- size_t size, int usage, buffer_handle_t* pHandle)
+ size_t size, int /*usage*/, buffer_handle_t* pHandle)
{
int err = 0;
int fd = -1;
int offset;
// FIXME: the attributes below should be out-of-line
- int base;
+ uint64_t base __attribute__((aligned(8)));
int pid;
#ifdef __cplusplus
- static const int sNumInts = 6;
+ static inline int sNumInts() {
+ return (((sizeof(private_handle_t) - sizeof(native_handle_t))/sizeof(int)) - sNumFds);
+ }
static const int sNumFds = 1;
static const int sMagic = 0x3141592;
base(0), pid(getpid())
{
version = sizeof(native_handle);
- numInts = sNumInts;
+ numInts = sNumInts();
numFds = sNumFds;
}
~private_handle_t() {
static int validate(const native_handle* h) {
const private_handle_t* hnd = (const private_handle_t*)h;
if (!h || h->version != sizeof(native_handle) ||
- h->numInts != sNumInts || h->numFds != sNumFds ||
+ h->numInts != sNumInts() || h->numFds != sNumFds ||
hnd->magic != sMagic)
{
ALOGE("invalid gralloc handle (at %p)", h);
/*****************************************************************************/
-static int gralloc_map(gralloc_module_t const* module,
+static int gralloc_map(gralloc_module_t const* /*module*/,
buffer_handle_t handle,
void** vaddr)
{
ALOGE("Could not mmap %s", strerror(errno));
return -errno;
}
- hnd->base = intptr_t(mappedAddress) + hnd->offset;
+ hnd->base = uintptr_t(mappedAddress) + hnd->offset;
//ALOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
// hnd->fd, hnd->offset, hnd->size, mappedAddress);
}
return 0;
}
-static int gralloc_unmap(gralloc_module_t const* module,
+static int gralloc_unmap(gralloc_module_t const* /*module*/,
buffer_handle_t handle)
{
private_handle_t* hnd = (private_handle_t*)handle;
return 0;
}
-int gralloc_lock(gralloc_module_t const* module,
- buffer_handle_t handle, int usage,
- int l, int t, int w, int h,
+int gralloc_lock(gralloc_module_t const* /*module*/,
+ buffer_handle_t handle, int /*usage*/,
+ int /*l*/, int /*t*/, int /*w*/, int /*h*/,
void** vaddr)
{
// this is called when a buffer is being locked for software
return 0;
}
-int gralloc_unlock(gralloc_module_t const* module,
+int gralloc_unlock(gralloc_module_t const* /*module*/,
buffer_handle_t handle)
{
// we're done with a software buffer. nothing to do in this