blob: df1f62cb86c6dc7370d78cddec07db25e7033261 [file] [log] [blame]
Gurchetan Singhd6b8b032017-05-31 14:31:31 -07001/*
2 * Copyright 2016 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#include "../cros_gralloc_driver.h"
8
Tomasz Mikolajewskica2938a2017-11-17 20:30:56 +09009#include <cassert>
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070010#include <hardware/gralloc.h>
11#include <memory.h>
12
13struct gralloc0_module {
14 gralloc_module_t base;
15 std::unique_ptr<alloc_device_t> alloc;
16 std::unique_ptr<cros_gralloc_driver> driver;
Gurchetan Singhbcfd7582017-08-01 15:02:24 -070017 bool initialized;
18 std::mutex initialization_mutex;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070019};
20
21/* This enumeration must match the one in <gralloc_drm.h>.
22 * The functions supported by this gralloc's temporary private API are listed
23 * below. Use of these functions is highly discouraged and should only be
24 * reserved for cases where no alternative to get same information (such as
25 * querying ANativeWindow) exists.
26 */
27// clang-format off
28enum {
29 GRALLOC_DRM_GET_STRIDE,
30 GRALLOC_DRM_GET_FORMAT,
31 GRALLOC_DRM_GET_DIMENSIONS,
32 GRALLOC_DRM_GET_BACKING_STORE,
33};
34// clang-format on
35
Gurchetan Singha1892b22017-09-28 16:40:52 -070036static uint64_t gralloc0_convert_usage(int usage)
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070037{
Gurchetan Singha1892b22017-09-28 16:40:52 -070038 uint64_t use_flags = BO_USE_NONE;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070039
Gurchetan Singha1892b22017-09-28 16:40:52 -070040 if (usage & GRALLOC_USAGE_CURSOR)
41 use_flags |= BO_USE_NONE;
42 if ((usage & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_RARELY)
43 use_flags |= BO_USE_SW_READ_RARELY;
44 if ((usage & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN)
45 use_flags |= BO_USE_SW_READ_OFTEN;
46 if ((usage & GRALLOC_USAGE_SW_WRITE_MASK) == GRALLOC_USAGE_SW_WRITE_RARELY)
47 use_flags |= BO_USE_SW_WRITE_RARELY;
48 if ((usage & GRALLOC_USAGE_SW_WRITE_MASK) == GRALLOC_USAGE_SW_WRITE_OFTEN)
49 use_flags |= BO_USE_SW_WRITE_OFTEN;
50 if (usage & GRALLOC_USAGE_HW_TEXTURE)
51 use_flags |= BO_USE_TEXTURE;
52 if (usage & GRALLOC_USAGE_HW_RENDER)
53 use_flags |= BO_USE_RENDERING;
54 if (usage & GRALLOC_USAGE_HW_2D)
55 use_flags |= BO_USE_RENDERING;
56 if (usage & GRALLOC_USAGE_HW_COMPOSER)
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070057 /* HWC wants to use display hardware, but can defer to OpenGL. */
Gurchetan Singha1892b22017-09-28 16:40:52 -070058 use_flags |= BO_USE_SCANOUT | BO_USE_TEXTURE;
59 if (usage & GRALLOC_USAGE_HW_FB)
60 use_flags |= BO_USE_NONE;
61 if (usage & GRALLOC_USAGE_EXTERNAL_DISP)
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070062 /*
63 * This flag potentially covers external display for the normal drivers (i915,
64 * rockchip) and usb monitors (evdi/udl). It's complicated so ignore it.
65 * */
Gurchetan Singha1892b22017-09-28 16:40:52 -070066 use_flags |= BO_USE_NONE;
67 if (usage & GRALLOC_USAGE_PROTECTED)
68 use_flags |= BO_USE_PROTECTED;
69 if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER)
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070070 /*HACK: See b/30054495 */
Gurchetan Singha1892b22017-09-28 16:40:52 -070071 use_flags |= BO_USE_SW_READ_OFTEN;
72 if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE)
73 use_flags |= BO_USE_CAMERA_WRITE;
74 if (usage & GRALLOC_USAGE_HW_CAMERA_READ)
75 use_flags |= BO_USE_CAMERA_READ;
76 if (usage & GRALLOC_USAGE_RENDERSCRIPT)
77 use_flags |= BO_USE_RENDERSCRIPT;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070078
Gurchetan Singha1892b22017-09-28 16:40:52 -070079 return use_flags;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070080}
81
Gurchetan Singhf7f633a2017-09-28 17:02:12 -070082static uint32_t gralloc0_convert_map_usage(int map_usage)
83{
84 uint32_t map_flags = BO_MAP_NONE;
85
86 if (map_usage & GRALLOC_USAGE_SW_READ_MASK)
87 map_flags |= BO_MAP_READ;
88 if (map_usage & GRALLOC_USAGE_SW_WRITE_MASK)
89 map_flags |= BO_MAP_WRITE;
90
91 return map_flags;
92}
93
Gurchetan Singhd6b8b032017-05-31 14:31:31 -070094static int gralloc0_alloc(alloc_device_t *dev, int w, int h, int format, int usage,
95 buffer_handle_t *handle, int *stride)
96{
97 int32_t ret;
98 bool supported;
99 struct cros_gralloc_buffer_descriptor descriptor;
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700100 auto mod = (struct gralloc0_module const *)dev->common.module;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700101
102 descriptor.width = w;
103 descriptor.height = h;
104 descriptor.droid_format = format;
105 descriptor.producer_usage = descriptor.consumer_usage = usage;
106 descriptor.drm_format = cros_gralloc_convert_format(format);
Gurchetan Singha1892b22017-09-28 16:40:52 -0700107 descriptor.use_flags = gralloc0_convert_usage(usage);
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700108
109 supported = mod->driver->is_supported(&descriptor);
110 if (!supported && (usage & GRALLOC_USAGE_HW_COMPOSER)) {
Gurchetan Singha1892b22017-09-28 16:40:52 -0700111 descriptor.use_flags &= ~BO_USE_SCANOUT;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700112 supported = mod->driver->is_supported(&descriptor);
113 }
114
115 if (!supported) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700116 drv_log("Unsupported combination -- HAL format: %u, HAL usage: %u, "
117 "drv_format: %4.4s, use_flags: %llu\n",
118 format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
119 static_cast<unsigned long long>(descriptor.use_flags));
Tomasz Figa90bb7432017-07-21 17:54:05 +0900120 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700121 }
122
123 ret = mod->driver->allocate(&descriptor, handle);
124 if (ret)
125 return ret;
126
127 auto hnd = cros_gralloc_convert_handle(*handle);
128 *stride = hnd->pixel_stride;
129
Tomasz Figa90bb7432017-07-21 17:54:05 +0900130 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700131}
132
133static int gralloc0_free(alloc_device_t *dev, buffer_handle_t handle)
134{
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700135 auto mod = (struct gralloc0_module const *)dev->common.module;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700136 return mod->driver->release(handle);
137}
138
139static int gralloc0_close(struct hw_device_t *dev)
140{
141 /* Memory is freed by managed pointers on process close. */
Tomasz Figa90bb7432017-07-21 17:54:05 +0900142 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700143}
144
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700145static int gralloc0_init(struct gralloc0_module *mod, bool initialize_alloc)
146{
147 std::lock_guard<std::mutex> lock(mod->initialization_mutex);
148
149 if (mod->initialized)
150 return 0;
151
152 mod->driver = std::make_unique<cros_gralloc_driver>();
153 if (mod->driver->init()) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700154 drv_log("Failed to initialize driver.\n");
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700155 return -ENODEV;
156 }
157
158 if (initialize_alloc) {
159 mod->alloc = std::make_unique<alloc_device_t>();
160 mod->alloc->alloc = gralloc0_alloc;
161 mod->alloc->free = gralloc0_free;
162 mod->alloc->common.tag = HARDWARE_DEVICE_TAG;
163 mod->alloc->common.version = 0;
164 mod->alloc->common.module = (hw_module_t *)mod;
165 mod->alloc->common.close = gralloc0_close;
166 }
167
168 mod->initialized = true;
169 return 0;
170}
171
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700172static int gralloc0_open(const struct hw_module_t *mod, const char *name, struct hw_device_t **dev)
173{
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700174 auto const_module = reinterpret_cast<const struct gralloc0_module *>(mod);
175 auto module = const_cast<struct gralloc0_module *>(const_module);
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700176
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700177 if (module->initialized) {
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700178 *dev = &module->alloc->common;
Tomasz Figa90bb7432017-07-21 17:54:05 +0900179 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700180 }
181
182 if (strcmp(name, GRALLOC_HARDWARE_GPU0)) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700183 drv_log("Incorrect device name - %s.\n", name);
Tomasz Figa90bb7432017-07-21 17:54:05 +0900184 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700185 }
186
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700187 if (gralloc0_init(module, true))
188 return -ENODEV;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700189
190 *dev = &module->alloc->common;
Tomasz Figa90bb7432017-07-21 17:54:05 +0900191 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700192}
193
194static int gralloc0_register_buffer(struct gralloc_module_t const *module, buffer_handle_t handle)
195{
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700196 auto const_module = reinterpret_cast<const struct gralloc0_module *>(module);
197 auto mod = const_cast<struct gralloc0_module *>(const_module);
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700198
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700199 if (!mod->initialized)
200 if (gralloc0_init(mod, false))
201 return -ENODEV;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700202
203 return mod->driver->retain(handle);
204}
205
206static int gralloc0_unregister_buffer(struct gralloc_module_t const *module, buffer_handle_t handle)
207{
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700208 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700209 return mod->driver->release(handle);
210}
211
212static int gralloc0_lock(struct gralloc_module_t const *module, buffer_handle_t handle, int usage,
213 int l, int t, int w, int h, void **vaddr)
214{
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700215 return module->lockAsync(module, handle, usage, l, t, w, h, vaddr, -1);
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700216}
217
218static int gralloc0_unlock(struct gralloc_module_t const *module, buffer_handle_t handle)
219{
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700220 int32_t fence_fd, ret;
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700221 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700222 ret = mod->driver->unlock(handle, &fence_fd);
223 if (ret)
224 return ret;
225
226 ret = cros_gralloc_sync_wait(fence_fd);
227 if (ret)
228 return ret;
229
230 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700231}
232
233static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...)
234{
235 va_list args;
236 int32_t *out_format, ret;
237 uint64_t *out_store;
238 buffer_handle_t handle;
239 uint32_t *out_width, *out_height, *out_stride;
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700240 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700241
242 switch (op) {
243 case GRALLOC_DRM_GET_STRIDE:
244 case GRALLOC_DRM_GET_FORMAT:
245 case GRALLOC_DRM_GET_DIMENSIONS:
246 case GRALLOC_DRM_GET_BACKING_STORE:
247 break;
248 default:
Tomasz Figa90bb7432017-07-21 17:54:05 +0900249 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700250 }
251
252 va_start(args, op);
253
Tomasz Figa90bb7432017-07-21 17:54:05 +0900254 ret = 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700255 handle = va_arg(args, buffer_handle_t);
256 auto hnd = cros_gralloc_convert_handle(handle);
257 if (!hnd) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700258 drv_log("Invalid handle.\n");
Tomasz Figa90bb7432017-07-21 17:54:05 +0900259 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700260 }
261
262 switch (op) {
263 case GRALLOC_DRM_GET_STRIDE:
264 out_stride = va_arg(args, uint32_t *);
265 *out_stride = hnd->pixel_stride;
266 break;
267 case GRALLOC_DRM_GET_FORMAT:
268 out_format = va_arg(args, int32_t *);
269 *out_format = hnd->droid_format;
270 break;
271 case GRALLOC_DRM_GET_DIMENSIONS:
272 out_width = va_arg(args, uint32_t *);
273 out_height = va_arg(args, uint32_t *);
274 *out_width = hnd->width;
275 *out_height = hnd->height;
276 break;
277 case GRALLOC_DRM_GET_BACKING_STORE:
278 out_store = va_arg(args, uint64_t *);
279 ret = mod->driver->get_backing_store(handle, out_store);
280 break;
281 default:
Tomasz Figa90bb7432017-07-21 17:54:05 +0900282 ret = -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700283 }
284
285 va_end(args);
286
287 return ret;
288}
289
290static int gralloc0_lock_ycbcr(struct gralloc_module_t const *module, buffer_handle_t handle,
291 int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr)
292{
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700293 return module->lockAsync_ycbcr(module, handle, usage, l, t, w, h, ycbcr, -1);
294}
295
296static int gralloc0_lock_async(struct gralloc_module_t const *module, buffer_handle_t handle,
297 int usage, int l, int t, int w, int h, void **vaddr, int fence_fd)
298{
299 int32_t ret;
Gurchetan Singhf7f633a2017-09-28 17:02:12 -0700300 uint32_t map_flags;
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700301 uint8_t *addr[DRV_MAX_PLANES];
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700302 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singh2b1d6892018-09-17 16:58:16 -0700303 struct rectangle rect = { .x = static_cast<uint32_t>(l),
304 .y = static_cast<uint32_t>(t),
305 .width = static_cast<uint32_t>(w),
306 .height = static_cast<uint32_t>(h) };
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700307
308 auto hnd = cros_gralloc_convert_handle(handle);
309 if (!hnd) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700310 drv_log("Invalid handle.\n");
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700311 return -EINVAL;
312 }
313
314 if (hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700315 drv_log("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible.\n");
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700316 return -EINVAL;
317 }
318
Gurchetan Singh1ef809e2017-11-06 11:07:52 -0800319 assert(l >= 0);
320 assert(t >= 0);
321 assert(w >= 0);
322 assert(h >= 0);
323
Gurchetan Singhf7f633a2017-09-28 17:02:12 -0700324 map_flags = gralloc0_convert_map_usage(usage);
Gurchetan Singh1ef809e2017-11-06 11:07:52 -0800325 ret = mod->driver->lock(handle, fence_fd, &rect, map_flags, addr);
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700326 *vaddr = addr[0];
327 return ret;
328}
329
330static int gralloc0_unlock_async(struct gralloc_module_t const *module, buffer_handle_t handle,
331 int *fence_fd)
332{
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700333 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700334 return mod->driver->unlock(handle, fence_fd);
335}
336
337static int gralloc0_lock_async_ycbcr(struct gralloc_module_t const *module, buffer_handle_t handle,
338 int usage, int l, int t, int w, int h,
339 struct android_ycbcr *ycbcr, int fence_fd)
340{
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700341 int32_t ret;
Gurchetan Singhf7f633a2017-09-28 17:02:12 -0700342 uint32_t map_flags;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700343 uint8_t *addr[DRV_MAX_PLANES] = { nullptr, nullptr, nullptr, nullptr };
Alistair Strachanf8ff0f52018-04-09 18:49:51 -0700344 auto mod = (struct gralloc0_module const *)module;
Gurchetan Singh2b1d6892018-09-17 16:58:16 -0700345 struct rectangle rect = { .x = static_cast<uint32_t>(l),
346 .y = static_cast<uint32_t>(t),
347 .width = static_cast<uint32_t>(w),
348 .height = static_cast<uint32_t>(h) };
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700349
350 auto hnd = cros_gralloc_convert_handle(handle);
351 if (!hnd) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700352 drv_log("Invalid handle.\n");
Tomasz Figa90bb7432017-07-21 17:54:05 +0900353 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700354 }
355
356 if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888) &&
Tomasz Figaaff29fd2017-07-05 17:50:18 +0900357 (hnd->droid_format != HAL_PIXEL_FORMAT_YV12) &&
358 (hnd->droid_format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)) {
Alistair Strachan0cfaaa52018-03-19 14:03:23 -0700359 drv_log("Non-YUV format not compatible.\n");
Tomasz Figa90bb7432017-07-21 17:54:05 +0900360 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700361 }
362
Gurchetan Singh1ef809e2017-11-06 11:07:52 -0800363 assert(l >= 0);
364 assert(t >= 0);
365 assert(w >= 0);
366 assert(h >= 0);
367
Gurchetan Singhf7f633a2017-09-28 17:02:12 -0700368 map_flags = gralloc0_convert_map_usage(usage);
Gurchetan Singh1ef809e2017-11-06 11:07:52 -0800369 ret = mod->driver->lock(handle, fence_fd, &rect, map_flags, addr);
Tomasz Figaaddd5f22017-07-05 17:50:18 +0900370 if (ret)
371 return ret;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700372
373 switch (hnd->format) {
374 case DRM_FORMAT_NV12:
375 ycbcr->y = addr[0];
376 ycbcr->cb = addr[1];
377 ycbcr->cr = addr[1] + 1;
378 ycbcr->ystride = hnd->strides[0];
379 ycbcr->cstride = hnd->strides[1];
380 ycbcr->chroma_step = 2;
381 break;
382 case DRM_FORMAT_YVU420:
383 case DRM_FORMAT_YVU420_ANDROID:
384 ycbcr->y = addr[0];
385 ycbcr->cb = addr[2];
386 ycbcr->cr = addr[1];
387 ycbcr->ystride = hnd->strides[0];
388 ycbcr->cstride = hnd->strides[1];
389 ycbcr->chroma_step = 1;
390 break;
391 default:
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700392 module->unlock(module, handle);
Tomasz Figa90bb7432017-07-21 17:54:05 +0900393 return -EINVAL;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700394 }
395
Tomasz Figa90bb7432017-07-21 17:54:05 +0900396 return 0;
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700397}
398
Tomasz Figa4df286c2017-08-02 19:35:40 +0900399// clang-format off
400static struct hw_module_methods_t gralloc0_module_methods = { .open = gralloc0_open };
401// clang-format on
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700402
403struct gralloc0_module HAL_MODULE_INFO_SYM = {
404 .base =
405 {
406 .common =
407 {
408 .tag = HARDWARE_MODULE_TAG,
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700409 .module_api_version = GRALLOC_MODULE_API_VERSION_0_3,
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700410 .hal_api_version = 0,
411 .id = GRALLOC_HARDWARE_MODULE_ID,
412 .name = "CrOS Gralloc",
413 .author = "Chrome OS",
414 .methods = &gralloc0_module_methods,
415 },
416
417 .registerBuffer = gralloc0_register_buffer,
418 .unregisterBuffer = gralloc0_unregister_buffer,
419 .lock = gralloc0_lock,
420 .unlock = gralloc0_unlock,
421 .perform = gralloc0_perform,
422 .lock_ycbcr = gralloc0_lock_ycbcr,
Gurchetan Singh4b5d0bf2017-06-22 18:38:37 -0700423 .lockAsync = gralloc0_lock_async,
424 .unlockAsync = gralloc0_unlock_async,
425 .lockAsync_ycbcr = gralloc0_lock_async_ycbcr,
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700426 },
427
428 .alloc = nullptr,
429 .driver = nullptr,
Gurchetan Singhbcfd7582017-08-01 15:02:24 -0700430 .initialized = false,
Gurchetan Singhd6b8b032017-05-31 14:31:31 -0700431};