summaryrefslogtreecommitdiff
path: root/gralloc/gralloc_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'gralloc/gralloc_priv.h')
-rw-r--r--gralloc/gralloc_priv.h18
1 files changed, 15 insertions, 3 deletions
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;
}