diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/gralloc_handle.h | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h index 43255ba5..9cb5a5d7 100644 --- a/android/gralloc_handle.h +++ b/android/gralloc_handle.h | |||
@@ -84,28 +84,26 @@ static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle) | |||
84 | /** | 84 | /** |
85 | * Create a buffer handle. | 85 | * Create a buffer handle. |
86 | */ | 86 | */ |
87 | static struct gralloc_handle_t gralloc_handle_create(int32_t width, | 87 | static inline native_handle_t *gralloc_handle_create(int32_t width, |
88 | int32_t height, | 88 | int32_t height, |
89 | int32_t format, | 89 | int32_t hal_format, |
90 | int32_t usage) | 90 | int32_t usage) |
91 | { | 91 | { |
92 | struct alloc_handle_t handle = { | 92 | struct gralloc_handle_t *handle; |
93 | .magic = GRALLOC_HANDLE_MAGIC, | ||
94 | .version = GRALLOC_HANDLE_VERSION }; | ||
95 | |||
96 | native_handle_t *nhandle = native_handle_create(GRALLOC_HANDLE_NUM_FDS, | 93 | native_handle_t *nhandle = native_handle_create(GRALLOC_HANDLE_NUM_FDS, |
97 | GRALLOC_HANDLE_NUM_INTS); | 94 | GRALLOC_HANDLE_NUM_INTS); |
98 | handle.base = *nhandle; | 95 | |
99 | native_handle_delete(nhandle); | 96 | if (!nhandle) |
100 | 97 | return NULL; | |
101 | handle.width = width; | 98 | |
102 | handle.height = height; | 99 | handle = gralloc_handle(nhandle); |
103 | handle.format = format; | 100 | handle->magic = GRALLOC_HANDLE_MAGIC; |
104 | handle.usage = usage; | 101 | handle->version = GRALLOC_HANDLE_VERSION; |
105 | handle.prime_fd = -1; | 102 | handle->width = width; |
106 | 103 | handle->height = height; | |
107 | handle->data_owner = getpid(); | 104 | handle->format = hal_format; |
108 | handle->data = bo; | 105 | handle->usage = usage; |
106 | handle->prime_fd = -1; | ||
109 | 107 | ||
110 | return handle; | 108 | return handle; |
111 | } | 109 | } |