diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-05-23 20:55:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-23 20:55:12 +0000 |
commit | e198250e00f932db1fe92e5349c82c87cbba46b9 (patch) | |
tree | 80f52ed6e2ca86c38928cb6a8f44ef8317c44570 | |
parent | 75c88ab266f47c644bf7def767717daf368c0069 (diff) | |
parent | a12e37d48f32a32c919228a4649e50c89587db22 (diff) | |
download | hikey-e198250e00f932db1fe92e5349c82c87cbba46b9.tar.gz |
Merge changes I7ad0d7c2,Iccc7a5dd
* changes:
gralloc: fix numFds for framebuffer handles
gralloc: make register framebuffer no-op
-rw-r--r-- | gralloc/alloc_device.cpp | 6 | ||||
-rw-r--r-- | gralloc/gralloc_module.cpp | 4 | ||||
-rw-r--r-- | gralloc/gralloc_priv.h | 18 |
3 files changed, 24 insertions, 4 deletions
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp index 67734050..cef58511 100644 --- a/gralloc/alloc_device.cpp +++ b/gralloc/alloc_device.cpp @@ -333,6 +333,12 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t *dev, size_t size, in #endif } + + // correct numFds/numInts when there is no dmabuf fd + if (hnd->share_fd < 0) { + hnd->numFds--; + hnd->numInts++; + } #endif *pHandle = hnd; diff --git a/gralloc/gralloc_module.cpp b/gralloc/gralloc_module.cpp index cdcbc5b9..70d2c69b 100644 --- a/gralloc/gralloc_module.cpp +++ b/gralloc/gralloc_module.cpp @@ -96,7 +96,9 @@ static int gralloc_register_buffer(gralloc_module_t const *module, buffer_handle if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) { - AERR("Can't register buffer 0x%p as it is a framebuffer", handle); + AINF("Register framebuffer 0x%p is no-op", handle); + retval = 0; + } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) { diff --git a/gralloc/gralloc_priv.h b/gralloc/gralloc_priv.h index 547027e8..36159606 100644 --- a/gralloc/gralloc_priv.h +++ b/gralloc/gralloc_priv.h @@ -313,9 +313,21 @@ struct private_handle_t { const private_handle_t *hnd = (const private_handle_t *)h; - if (!h || h->version != sizeof(native_handle) || h->numFds != sNumFds || - h->numInts != (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds || - hnd->magic != sMagic) + if (!h || h->version != sizeof(native_handle) || hnd->magic != sMagic) + { + return -EINVAL; + } + + int numFds = sNumFds; + int numInts = (sizeof(private_handle_t) - sizeof(native_handle)) / sizeof(int) - sNumFds; +#if GRALLOC_ARM_DMA_BUF_MODULE + if (hnd->share_fd < 0) { + numFds--; + numInts++; + } +#endif + + if (h->numFds != numFds || h->numInts != numInts) { return -EINVAL; } |