gralloc: Clean pmem caches after memset
Change-Id: If403dde70863e0d6ea221f2a105b86bdec134261
This commit is contained in:
parent
f979fa8589
commit
3de087d0bb
@ -108,6 +108,14 @@ class PmemAllocatorDepsDeviceImpl : public PmemUserspaceAllocator::Deps,
|
||||
return ioctl(fd, PMEM_ALLOCATE_ALIGNED, &allocation);
|
||||
}
|
||||
|
||||
virtual int cleanPmem(int fd, unsigned long base, int offset, size_t size) {
|
||||
struct pmem_addr pmem_addr;
|
||||
pmem_addr.vaddr = base;
|
||||
pmem_addr.offset = offset;
|
||||
pmem_addr.length = size;
|
||||
return ioctl(fd, PMEM_CLEAN_INV_CACHES, &pmem_addr);
|
||||
}
|
||||
|
||||
virtual int getErrno() {
|
||||
return errno;
|
||||
}
|
||||
|
@ -181,6 +181,8 @@ int PmemUserspaceAllocator::alloc_pmem_buffer(size_t size, int usage,
|
||||
} else {
|
||||
LOGV("%s: mapped fd %d at offset %d, size %d", pmemdev, fd, offset, size);
|
||||
memset((char*)base + offset, 0, size);
|
||||
//Clean cache before flushing to ensure pmem is properly flushed
|
||||
deps.cleanPmem(fd, (unsigned long) base, offset, size);
|
||||
#ifdef HOST
|
||||
cacheflush(intptr_t(base) + offset, intptr_t(base) + offset + size, 0);
|
||||
#endif
|
||||
|
@ -69,6 +69,7 @@ class PmemUserspaceAllocator: public PmemAllocator {
|
||||
virtual int connectPmem(int fd, int master_fd) = 0;
|
||||
virtual int mapPmem(int fd, int offset, size_t size) = 0;
|
||||
virtual int unmapPmem(int fd, int offset, size_t size) = 0;
|
||||
virtual int cleanPmem(int fd, unsigned long base, int offset, size_t size) = 0;
|
||||
|
||||
// C99
|
||||
virtual int getErrno() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user