gralloc1: Import ion handle into registering process

Importing the ion handle when retain() is called validates the
incoming ion fd and holds the client process accountable for
releasing the handle once it's done.

CRs-Fixed: 2020175
Change-Id: I3a169983b6d6b201d044e1c777a631aa16f9cb9a
This commit is contained in:
Naseer Ahmed
2017-03-15 19:21:40 -04:00
parent 08c3e40f15
commit 3a9d53a1ac
6 changed files with 116 additions and 57 deletions

View File

@@ -129,6 +129,13 @@ int Allocator::MapBuffer(void **base, unsigned int size, unsigned int offset, in
return -EINVAL;
}
int Allocator::ImportBuffer(int fd) {
if (ion_allocator_) {
return ion_allocator_->ImportBuffer(fd);
}
return -EINVAL;
}
int Allocator::FreeBuffer(void *base, unsigned int size, unsigned int offset, int fd,
int handle) {
if (ion_allocator_) {
@@ -138,9 +145,9 @@ int Allocator::FreeBuffer(void *base, unsigned int size, unsigned int offset, in
return -EINVAL;
}
int Allocator::CleanBuffer(void *base, unsigned int size, unsigned int offset, int fd, int op) {
int Allocator::CleanBuffer(void *base, unsigned int size, unsigned int offset, int handle, int op) {
if (ion_allocator_) {
return ion_allocator_->CleanBuffer(base, size, offset, fd, op);
return ion_allocator_->CleanBuffer(base, size, offset, handle, op);
}
return -EINVAL;