display: Clean up gralloc

* Remove pmem and ashmem implementations
* Remove usage of RefBase
* Reduce log verbosity

Change-Id: If8ef543d236e5305bd5430f4f9c62c51b3a13787
This commit is contained in:
Naseer Ahmed
2012-07-14 21:08:13 -07:00
committed by Brian Muramatsu
parent 0c8b7b5c84
commit 01d3fd3318
19 changed files with 74 additions and 1347 deletions

View File

@@ -27,7 +27,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define DEBUG 0
#include <linux/ioctl.h>
#include <sys/mman.h>
#include <stdlib.h>
@@ -85,8 +85,7 @@ int IonAlloc::alloc_buffer(alloc_data& data)
if(data.uncached) {
// Use the sync FD to alloc and map
// when we need uncached memory
// XXX: Change O_SYNC to O_DSYNC when available in bionic
ionSyncFd = open(ION_DEVICE, O_RDONLY|O_SYNC);
ionSyncFd = open(ION_DEVICE, O_RDONLY|O_DSYNC);
if(ionSyncFd < 0) {
ALOGE("%s: Failed to open ion device - %s",
__FUNCTION__, strerror(errno));
@@ -119,9 +118,7 @@ int IonAlloc::alloc_buffer(alloc_data& data)
return err;
}
if(!(data.flags & ION_SECURE) &&
!(data.allocType & private_handle_t::PRIV_FLAGS_NOT_MAPPED)) {
if(!(data.flags & ION_SECURE)) {
base = mmap(0, ionAllocData.len, PROT_READ|PROT_WRITE,
MAP_SHARED, fd_data.fd, 0);
if(base == MAP_FAILED) {
@@ -145,7 +142,7 @@ int IonAlloc::alloc_buffer(alloc_data& data)
data.base = base;
data.fd = fd_data.fd;
ioctl(mIonFd, ION_IOC_FREE, &handle_data);
ALOGD("ion: Allocated buffer base:%p size:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%d fd:%d",
data.base, ionAllocData.len, data.fd);
return 0;
}
@@ -154,7 +151,7 @@ int IonAlloc::alloc_buffer(alloc_data& data)
int IonAlloc::free_buffer(void* base, size_t size, int offset, int fd)
{
Locker::Autolock _l(mLock);
ALOGD("ion: Freeing buffer base:%p size:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Freeing buffer base:%p size:%d fd:%d",
base, size, fd);
int err = 0;
err = open_device();
@@ -182,10 +179,10 @@ int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd)
*pBase = base;
if(base == MAP_FAILED) {
err = -errno;
ALOGD("ion: Failed to map memory in the client: %s",
ALOGE("ion: Failed to map memory in the client: %s",
strerror(errno));
} else {
ALOGD("ion: Mapped buffer base:%p size:%d offset:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Mapped buffer base:%p size:%d offset:%d fd:%d",
base, size, offset, fd);
}
return err;
@@ -193,7 +190,7 @@ int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd)
int IonAlloc::unmap_buffer(void *base, size_t size, int offset)
{
ALOGD("ion: Unmapping buffer base:%p size:%d", base, size);
ALOGD_IF(DEBUG, "ion: Unmapping buffer base:%p size:%d", base, size);
int err = 0;
if(munmap(base, size)) {
err = -errno;