diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp index 228deaa..6eeae24 100644 --- a/libcopybit/copybit.cpp +++ b/libcopybit/copybit.cpp @@ -131,7 +131,7 @@ static int get_format(int format) { } /** convert from copybit image to mdp image structure */ -static void set_image(struct mdp_img *img, const struct copybit_image_t *rhs) +static void set_image(struct mdp_img *img, const struct copybit_image_t *rhs) { private_handle_t* hnd = (private_handle_t*)rhs->handle; img->width = rhs->w; @@ -201,7 +201,7 @@ static void set_infos(struct copybit_context_t *dev, struct mdp_blit_req *req) { } /** copy the bits */ -static int msm_copybit(struct copybit_context_t *dev, void const *list) +static int msm_copybit(struct copybit_context_t *dev, void const *list) { int err = ioctl(dev->mFD, MSMFB_BLIT, (struct mdp_blit_req_list const*)list); @@ -245,7 +245,7 @@ static int msm_copybit(struct copybit_context_t *dev, void const *list) static int set_parameter_copybit( struct copybit_device_t *dev, int name, - int value) + int value) { struct copybit_context_t* ctx = (struct copybit_context_t*)dev; int status = 0; @@ -308,7 +308,7 @@ static int set_parameter_copybit( } /** Get a static info value */ -static int get(struct copybit_device_t *dev, int name) +static int get(struct copybit_device_t *dev, int name) { struct copybit_context_t* ctx = (struct copybit_context_t*)dev; int value; @@ -342,7 +342,7 @@ static int stretch_copybit( struct copybit_image_t const *src, struct copybit_rect_t const *dst_rect, struct copybit_rect_t const *src_rect, - struct copybit_region_t const *region) + struct copybit_region_t const *region) { struct copybit_context_t* ctx = (struct copybit_context_t*)dev; int status = 0; @@ -413,7 +413,7 @@ static int blit_copybit( struct copybit_device_t *dev, struct copybit_image_t const *dst, struct copybit_image_t const *src, - struct copybit_region_t const *region) + struct copybit_region_t const *region) { struct copybit_rect_t dr = { 0, 0, dst->w, dst->h }; struct copybit_rect_t sr = { 0, 0, src->w, src->h }; @@ -423,7 +423,7 @@ static int blit_copybit( /*****************************************************************************/ /** Close the copybit device */ -static int close_copybit(struct hw_device_t *dev) +static int close_copybit(struct hw_device_t *dev) { struct copybit_context_t* ctx = (struct copybit_context_t*)dev; if (ctx) { diff --git a/libgralloc/Android.mk b/libgralloc/Android.mk index 9ae840f..7cae2a3 100644 --- a/libgralloc/Android.mk +++ b/libgralloc/Android.mk @@ -23,12 +23,12 @@ LOCAL_PRELINK_MODULE := false LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_SHARED_LIBRARIES := liblog libcutils -LOCAL_SRC_FILES := \ - allocator.cpp \ - gralloc.cpp \ - framebuffer.cpp \ - mapper.cpp - +LOCAL_SRC_FILES := \ + allocator.cpp \ + gralloc.cpp \ + framebuffer.cpp \ + mapper.cpp + LOCAL_MODULE := gralloc.bahamas LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" include $(BUILD_SHARED_LIBRARY) diff --git a/libgralloc/allocator.cpp b/libgralloc/allocator.cpp index e7645b1..cbc2522 100644 --- a/libgralloc/allocator.cpp +++ b/libgralloc/allocator.cpp @@ -50,8 +50,8 @@ ssize_t SimpleBestFitAllocator::setSize(size_t size) mList.insertHead(node); return size; } - - + + size_t SimpleBestFitAllocator::size() const { return mHeapSize; diff --git a/libgralloc/allocator.h b/libgralloc/allocator.h index b0d89e9..19722de 100644 --- a/libgralloc/allocator.h +++ b/libgralloc/allocator.h @@ -70,7 +70,7 @@ public: mFirst = newNode; } } - + void insertTail(NODE* newNode) { if (mLast == 0) { insertHead(newNode); @@ -107,7 +107,7 @@ public: private: struct chunk_t { - chunk_t(size_t start, size_t size) + chunk_t(size_t start, size_t size) : start(start), size(size), free(1), prev(0), next(0) { } size_t start; diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp index 7587858..b45d18c 100644 --- a/libgralloc/framebuffer.cpp +++ b/libgralloc/framebuffer.cpp @@ -75,7 +75,7 @@ static int fb_setUpdateRect(struct framebuffer_device_t* dev, { if (((w|h) <= 0) || ((l|t)<0)) return -EINVAL; - + fb_context_t* ctx = (fb_context_t*)dev; private_module_t* m = reinterpret_cast( dev->common.module); @@ -95,32 +95,32 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) private_handle_t const* hnd = reinterpret_cast(buffer); private_module_t* m = reinterpret_cast( dev->common.module); - + if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) { const size_t offset = hnd->base - m->framebuffer->base; m->info.activate = FB_ACTIVATE_VBL; m->info.yoffset = offset / m->finfo.line_length; if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) { LOGE("FBIOPUT_VSCREENINFO failed"); - m->base.unlock(&m->base, buffer); + m->base.unlock(&m->base, buffer); return -errno; } m->currentBuffer = buffer; - + } else { - // If we can't do the page_flip, just copy the buffer to the front + // If we can't do the page_flip, just copy the buffer to the front // FIXME: use copybit HAL instead of memcpy - + void* fb_vaddr; void* buffer_vaddr; - - m->base.lock(&m->base, m->framebuffer, - GRALLOC_USAGE_SW_WRITE_RARELY, + + m->base.lock(&m->base, m->framebuffer, + GRALLOC_USAGE_SW_WRITE_RARELY, 0, 0, m->info.xres, m->info.yres, &fb_vaddr); - m->base.lock(&m->base, buffer, - GRALLOC_USAGE_SW_READ_RARELY, + m->base.lock(&m->base, buffer, + GRALLOC_USAGE_SW_READ_RARELY, 0, 0, m->info.xres, m->info.yres, &buffer_vaddr); @@ -130,11 +130,11 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) m->info.xres, m->info.yres, m->info.xoffset, m->info.yoffset, m->info.width, m->info.height); - - m->base.unlock(&m->base, buffer); - m->base.unlock(&m->base, m->framebuffer); + + m->base.unlock(&m->base, buffer); + m->base.unlock(&m->base, m->framebuffer); } - + return 0; } @@ -146,7 +146,7 @@ int mapFrameBufferLocked(struct private_module_t* module) if (module->framebuffer) { return 0; } - + char const * const device_template[] = { "/dev/graphics/fb%u", "/dev/fb%u", @@ -403,7 +403,7 @@ msm_copy_buffer(buffer_handle_t handle, int fd, int width, int height, blit.req.dst.width = width; blit.req.dst.height = height; blit.req.dst.offset = 0; - blit.req.dst.memory_id = fd; + blit.req.dst.memory_id = fd; blit.req.dst.format = MDP_RGB_565; blit.req.src_rect.x = blit.req.dst_rect.x = x; diff --git a/libgralloc/gralloc.cpp b/libgralloc/gralloc.cpp index 2424121..375d136 100644 --- a/libgralloc/gralloc.cpp +++ b/libgralloc/gralloc.cpp @@ -74,7 +74,7 @@ extern int gralloc_lock(gralloc_module_t const* module, int l, int t, int w, int h, void** vaddr); -extern int gralloc_unlock(gralloc_module_t const* module, +extern int gralloc_unlock(gralloc_module_t const* module, buffer_handle_t handle); extern int gralloc_register_buffer(gralloc_module_t const* module, @@ -171,7 +171,7 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev, } vaddr += bufferSize; } - + hnd->base = vaddr; hnd->offset = vaddr - intptr_t(m->framebuffer->base); *pHandle = hnd; @@ -196,7 +196,7 @@ static int init_pmem_area_locked(private_module_t* m) int err = 0; int master_fd = open("/dev/pmem", O_RDWR, 0); if (master_fd >= 0) { - + size_t size; pmem_region region; if (ioctl(master_fd, PMEM_GET_TOTAL_SIZE, ®ion) < 0) { @@ -207,7 +207,7 @@ static int init_pmem_area_locked(private_module_t* m) } sAllocator.setSize(size); - void* base = mmap(0, size, + void* base = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, master_fd, 0); if (base == MAP_FAILED) { err = -errno; @@ -254,15 +254,15 @@ static int init_gpu_area_locked(private_module_t* m) LOGE("HW3D_GET_REGIONS failed (%s)", strerror(errno)); err = -errno; } else { - LOGD("smi: offset=%08lx, len=%08lx, phys=%p", - regions[HW3D_SMI].map_offset, - regions[HW3D_SMI].len, + LOGD("smi: offset=%08lx, len=%08lx, phys=%p", + regions[HW3D_SMI].map_offset, + regions[HW3D_SMI].len, regions[HW3D_SMI].phys); - LOGD("ebi: offset=%08lx, len=%08lx, phys=%p", + LOGD("ebi: offset=%08lx, len=%08lx, phys=%p", regions[HW3D_EBI].map_offset, regions[HW3D_EBI].len, regions[HW3D_EBI].phys); - LOGD("reg: offset=%08lx, len=%08lx, phys=%p", + LOGD("reg: offset=%08lx, len=%08lx, phys=%p", regions[HW3D_REGS].map_offset, regions[HW3D_REGS].len, regions[HW3D_REGS].phys); @@ -323,13 +323,13 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, int offset = 0; size = roundUpToPageSize(size); - + if (usage & GRALLOC_USAGE_HW_TEXTURE) { // enable pmem in that case, so our software GL can fallback to // the copybit module. flags |= private_handle_t::PRIV_FLAGS_USES_PMEM; } - + if (usage & GRALLOC_USAGE_HW_2D) { flags |= private_handle_t::PRIV_FLAGS_USES_PMEM; } @@ -355,11 +355,11 @@ try_ashmem: err = -ENOMEM; } else { struct pmem_region sub = { offset, size }; - + // now create the "sub-heap" fd = open("/dev/pmem", O_RDWR, 0); err = fd < 0 ? fd : 0; - + // and connect to it if (err == 0) err = ioctl(fd, PMEM_CONNECT, m->pmem_master); @@ -450,9 +450,9 @@ try_ashmem: *pHandle = hnd; } } - + LOGE_IF(err, "gralloc failed err=%s", strerror(-err)); - + return err; } @@ -528,8 +528,8 @@ static int gralloc_free(alloc_device_t* dev, dev->common.module); const size_t bufferSize = m->finfo.line_length * m->info.yres; int index = (hnd->base - m->framebuffer->base) / bufferSize; - m->bufferMask &= ~(1<bufferMask &= ~(1<flags & private_handle_t::PRIV_FLAGS_USES_PMEM) { if (hnd->fd >= 0) { struct pmem_region sub = { hnd->offset, hnd->size }; diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index 3925d79..1ccdf73 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -65,7 +65,7 @@ struct private_handle_t : public native_handle { struct private_handle_t { native_handle_t nativeHandle; #endif - + enum { PRIV_FLAGS_FRAMEBUFFER = 0x00000001, PRIV_FLAGS_USES_PMEM = 0x00000002, @@ -107,7 +107,7 @@ struct private_handle_t { const private_handle_t* hnd = (const private_handle_t*)h; if (!h || h->version != sizeof(native_handle) || h->numInts != sNumInts || h->numFds != sNumFds || - hnd->magic != sMagic) + hnd->magic != sMagic) { LOGE("invalid gralloc handle (at %p)", h); return -EINVAL; diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp index 8be6b71..24afff0 100644 --- a/libgralloc/mapper.cpp +++ b/libgralloc/mapper.cpp @@ -69,7 +69,7 @@ static int gralloc_map(gralloc_module_t const* module, return -errno; } hnd->base = intptr_t(mappedAddress) + hnd->offset; - //LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", + //LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", // hnd->fd, hnd->offset, hnd->size, mappedAddress); } *vaddr = (void*)hnd->base; @@ -98,7 +98,7 @@ static int gralloc_unmap(gralloc_module_t const* module, /*****************************************************************************/ -static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; /*****************************************************************************/ @@ -187,7 +187,7 @@ int gralloc_lock(gralloc_module_t const* module, 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 diff --git a/libsensors/Android.mk b/libsensors/Android.mk index 0a50ef6..46952a0 100644 --- a/libsensors/Android.mk +++ b/libsensors/Android.mk @@ -28,13 +28,13 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -LOCAL_SRC_FILES := \ - sensors.c \ - nusensors.cpp \ - InputEventReader.cpp \ - SensorBase.cpp \ - AkmSensor.cpp - +LOCAL_SRC_FILES := \ + sensors.c \ + nusensors.cpp \ + InputEventReader.cpp \ + SensorBase.cpp \ + AkmSensor.cpp + LOCAL_SHARED_LIBRARIES := liblog libcutils LOCAL_PRELINK_MODULE := false