Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 9 | #include <hardware/gralloc.h> |
| 10 | #include <memory.h> |
| 11 | |
| 12 | struct gralloc0_module { |
| 13 | gralloc_module_t base; |
| 14 | std::unique_ptr<alloc_device_t> alloc; |
| 15 | std::unique_ptr<cros_gralloc_driver> driver; |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 16 | bool initialized; |
| 17 | std::mutex initialization_mutex; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | /* This enumeration must match the one in <gralloc_drm.h>. |
| 21 | * The functions supported by this gralloc's temporary private API are listed |
| 22 | * below. Use of these functions is highly discouraged and should only be |
| 23 | * reserved for cases where no alternative to get same information (such as |
| 24 | * querying ANativeWindow) exists. |
| 25 | */ |
| 26 | // clang-format off |
| 27 | enum { |
| 28 | GRALLOC_DRM_GET_STRIDE, |
| 29 | GRALLOC_DRM_GET_FORMAT, |
| 30 | GRALLOC_DRM_GET_DIMENSIONS, |
| 31 | GRALLOC_DRM_GET_BACKING_STORE, |
| 32 | }; |
| 33 | // clang-format on |
| 34 | |
| 35 | static int64_t gralloc0_convert_flags(int flags) |
| 36 | { |
| 37 | uint64_t usage = BO_USE_NONE; |
| 38 | |
| 39 | if (flags & GRALLOC_USAGE_CURSOR) |
| 40 | usage |= BO_USE_NONE; |
| 41 | if ((flags & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_RARELY) |
| 42 | usage |= BO_USE_SW_READ_RARELY; |
| 43 | if ((flags & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN) |
| 44 | usage |= BO_USE_SW_READ_OFTEN; |
| 45 | if ((flags & GRALLOC_USAGE_SW_WRITE_MASK) == GRALLOC_USAGE_SW_WRITE_RARELY) |
| 46 | usage |= BO_USE_SW_WRITE_RARELY; |
| 47 | if ((flags & GRALLOC_USAGE_SW_WRITE_MASK) == GRALLOC_USAGE_SW_WRITE_OFTEN) |
| 48 | usage |= BO_USE_SW_WRITE_OFTEN; |
| 49 | if (flags & GRALLOC_USAGE_HW_TEXTURE) |
| 50 | usage |= BO_USE_TEXTURE; |
| 51 | if (flags & GRALLOC_USAGE_HW_RENDER) |
| 52 | usage |= BO_USE_RENDERING; |
| 53 | if (flags & GRALLOC_USAGE_HW_2D) |
| 54 | usage |= BO_USE_RENDERING; |
| 55 | if (flags & GRALLOC_USAGE_HW_COMPOSER) |
| 56 | /* HWC wants to use display hardware, but can defer to OpenGL. */ |
| 57 | usage |= BO_USE_SCANOUT | BO_USE_TEXTURE; |
| 58 | if (flags & GRALLOC_USAGE_HW_FB) |
| 59 | usage |= BO_USE_NONE; |
| 60 | if (flags & GRALLOC_USAGE_EXTERNAL_DISP) |
| 61 | /* |
| 62 | * This flag potentially covers external display for the normal drivers (i915, |
| 63 | * rockchip) and usb monitors (evdi/udl). It's complicated so ignore it. |
| 64 | * */ |
| 65 | usage |= BO_USE_NONE; |
| 66 | if (flags & GRALLOC_USAGE_PROTECTED) |
| 67 | usage |= BO_USE_PROTECTED; |
| 68 | if (flags & GRALLOC_USAGE_HW_VIDEO_ENCODER) |
| 69 | /*HACK: See b/30054495 */ |
| 70 | usage |= BO_USE_SW_READ_OFTEN; |
| 71 | if (flags & GRALLOC_USAGE_HW_CAMERA_WRITE) |
Tomasz Figa | fd0b016 | 2017-07-11 18:28:02 +0900 | [diff] [blame] | 72 | usage |= BO_USE_CAMERA_WRITE; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 73 | if (flags & GRALLOC_USAGE_HW_CAMERA_READ) |
Tomasz Figa | fd0b016 | 2017-07-11 18:28:02 +0900 | [diff] [blame] | 74 | usage |= BO_USE_CAMERA_READ; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 75 | if (flags & GRALLOC_USAGE_RENDERSCRIPT) |
| 76 | /* We use CPU for compute. */ |
| 77 | usage |= BO_USE_LINEAR; |
| 78 | |
| 79 | return usage; |
| 80 | } |
| 81 | |
| 82 | static int gralloc0_alloc(alloc_device_t *dev, int w, int h, int format, int usage, |
| 83 | buffer_handle_t *handle, int *stride) |
| 84 | { |
| 85 | int32_t ret; |
| 86 | bool supported; |
| 87 | struct cros_gralloc_buffer_descriptor descriptor; |
| 88 | auto mod = (struct gralloc0_module *)dev->common.module; |
| 89 | |
| 90 | descriptor.width = w; |
| 91 | descriptor.height = h; |
| 92 | descriptor.droid_format = format; |
| 93 | descriptor.producer_usage = descriptor.consumer_usage = usage; |
| 94 | descriptor.drm_format = cros_gralloc_convert_format(format); |
| 95 | descriptor.drv_usage = gralloc0_convert_flags(usage); |
| 96 | |
| 97 | supported = mod->driver->is_supported(&descriptor); |
| 98 | if (!supported && (usage & GRALLOC_USAGE_HW_COMPOSER)) { |
| 99 | descriptor.drv_usage &= ~BO_USE_SCANOUT; |
| 100 | supported = mod->driver->is_supported(&descriptor); |
| 101 | } |
| 102 | |
| 103 | if (!supported) { |
| 104 | cros_gralloc_error("Unsupported combination -- HAL format: %u, HAL flags: %u, " |
| 105 | "drv_format: %4.4s, drv_flags: %llu", |
Tomasz Figa | 23b85cb | 2017-07-11 18:07:11 +0900 | [diff] [blame] | 106 | format, usage, reinterpret_cast<char *>(&descriptor.drm_format), |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 107 | static_cast<unsigned long long>(descriptor.drv_usage)); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 108 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | ret = mod->driver->allocate(&descriptor, handle); |
| 112 | if (ret) |
| 113 | return ret; |
| 114 | |
| 115 | auto hnd = cros_gralloc_convert_handle(*handle); |
| 116 | *stride = hnd->pixel_stride; |
| 117 | |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 118 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | static int gralloc0_free(alloc_device_t *dev, buffer_handle_t handle) |
| 122 | { |
| 123 | auto mod = (struct gralloc0_module *)dev->common.module; |
| 124 | return mod->driver->release(handle); |
| 125 | } |
| 126 | |
| 127 | static int gralloc0_close(struct hw_device_t *dev) |
| 128 | { |
| 129 | /* Memory is freed by managed pointers on process close. */ |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 130 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 131 | } |
| 132 | |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 133 | static int gralloc0_init(struct gralloc0_module *mod, bool initialize_alloc) |
| 134 | { |
| 135 | std::lock_guard<std::mutex> lock(mod->initialization_mutex); |
| 136 | |
| 137 | if (mod->initialized) |
| 138 | return 0; |
| 139 | |
| 140 | mod->driver = std::make_unique<cros_gralloc_driver>(); |
| 141 | if (mod->driver->init()) { |
| 142 | cros_gralloc_error("Failed to initialize driver."); |
| 143 | return -ENODEV; |
| 144 | } |
| 145 | |
| 146 | if (initialize_alloc) { |
| 147 | mod->alloc = std::make_unique<alloc_device_t>(); |
| 148 | mod->alloc->alloc = gralloc0_alloc; |
| 149 | mod->alloc->free = gralloc0_free; |
| 150 | mod->alloc->common.tag = HARDWARE_DEVICE_TAG; |
| 151 | mod->alloc->common.version = 0; |
| 152 | mod->alloc->common.module = (hw_module_t *)mod; |
| 153 | mod->alloc->common.close = gralloc0_close; |
| 154 | } |
| 155 | |
| 156 | mod->initialized = true; |
| 157 | return 0; |
| 158 | } |
| 159 | |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 160 | static int gralloc0_open(const struct hw_module_t *mod, const char *name, struct hw_device_t **dev) |
| 161 | { |
| 162 | auto module = (struct gralloc0_module *)mod; |
| 163 | |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 164 | if (module->initialized) { |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 165 | *dev = &module->alloc->common; |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 166 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | if (strcmp(name, GRALLOC_HARDWARE_GPU0)) { |
| 170 | cros_gralloc_error("Incorrect device name - %s.", name); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 171 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 172 | } |
| 173 | |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 174 | if (gralloc0_init(module, true)) |
| 175 | return -ENODEV; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 176 | |
| 177 | *dev = &module->alloc->common; |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 178 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | static int gralloc0_register_buffer(struct gralloc_module_t const *module, buffer_handle_t handle) |
| 182 | { |
| 183 | auto mod = (struct gralloc0_module *)module; |
| 184 | |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 185 | if (!mod->initialized) |
| 186 | if (gralloc0_init(mod, false)) |
| 187 | return -ENODEV; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 188 | |
| 189 | return mod->driver->retain(handle); |
| 190 | } |
| 191 | |
| 192 | static int gralloc0_unregister_buffer(struct gralloc_module_t const *module, buffer_handle_t handle) |
| 193 | { |
| 194 | auto mod = (struct gralloc0_module *)module; |
| 195 | return mod->driver->release(handle); |
| 196 | } |
| 197 | |
| 198 | static int gralloc0_lock(struct gralloc_module_t const *module, buffer_handle_t handle, int usage, |
| 199 | int l, int t, int w, int h, void **vaddr) |
| 200 | { |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 201 | return module->lockAsync(module, handle, usage, l, t, w, h, vaddr, -1); |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | static int gralloc0_unlock(struct gralloc_module_t const *module, buffer_handle_t handle) |
| 205 | { |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 206 | int32_t fence_fd, ret; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 207 | auto mod = (struct gralloc0_module *)module; |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 208 | ret = mod->driver->unlock(handle, &fence_fd); |
| 209 | if (ret) |
| 210 | return ret; |
| 211 | |
| 212 | ret = cros_gralloc_sync_wait(fence_fd); |
| 213 | if (ret) |
| 214 | return ret; |
| 215 | |
| 216 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...) |
| 220 | { |
| 221 | va_list args; |
| 222 | int32_t *out_format, ret; |
| 223 | uint64_t *out_store; |
| 224 | buffer_handle_t handle; |
| 225 | uint32_t *out_width, *out_height, *out_stride; |
| 226 | auto mod = (struct gralloc0_module *)module; |
| 227 | |
| 228 | switch (op) { |
| 229 | case GRALLOC_DRM_GET_STRIDE: |
| 230 | case GRALLOC_DRM_GET_FORMAT: |
| 231 | case GRALLOC_DRM_GET_DIMENSIONS: |
| 232 | case GRALLOC_DRM_GET_BACKING_STORE: |
| 233 | break; |
| 234 | default: |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 235 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | va_start(args, op); |
| 239 | |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 240 | ret = 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 241 | handle = va_arg(args, buffer_handle_t); |
| 242 | auto hnd = cros_gralloc_convert_handle(handle); |
| 243 | if (!hnd) { |
| 244 | cros_gralloc_error("Invalid handle."); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 245 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | switch (op) { |
| 249 | case GRALLOC_DRM_GET_STRIDE: |
| 250 | out_stride = va_arg(args, uint32_t *); |
| 251 | *out_stride = hnd->pixel_stride; |
| 252 | break; |
| 253 | case GRALLOC_DRM_GET_FORMAT: |
| 254 | out_format = va_arg(args, int32_t *); |
| 255 | *out_format = hnd->droid_format; |
| 256 | break; |
| 257 | case GRALLOC_DRM_GET_DIMENSIONS: |
| 258 | out_width = va_arg(args, uint32_t *); |
| 259 | out_height = va_arg(args, uint32_t *); |
| 260 | *out_width = hnd->width; |
| 261 | *out_height = hnd->height; |
| 262 | break; |
| 263 | case GRALLOC_DRM_GET_BACKING_STORE: |
| 264 | out_store = va_arg(args, uint64_t *); |
| 265 | ret = mod->driver->get_backing_store(handle, out_store); |
| 266 | break; |
| 267 | default: |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 268 | ret = -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | va_end(args); |
| 272 | |
| 273 | return ret; |
| 274 | } |
| 275 | |
| 276 | static int gralloc0_lock_ycbcr(struct gralloc_module_t const *module, buffer_handle_t handle, |
| 277 | int usage, int l, int t, int w, int h, struct android_ycbcr *ycbcr) |
| 278 | { |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 279 | return module->lockAsync_ycbcr(module, handle, usage, l, t, w, h, ycbcr, -1); |
| 280 | } |
| 281 | |
| 282 | static int gralloc0_lock_async(struct gralloc_module_t const *module, buffer_handle_t handle, |
| 283 | int usage, int l, int t, int w, int h, void **vaddr, int fence_fd) |
| 284 | { |
| 285 | int32_t ret; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 286 | uint64_t flags; |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 287 | uint8_t *addr[DRV_MAX_PLANES]; |
| 288 | auto mod = (struct gralloc0_module *)module; |
| 289 | |
| 290 | auto hnd = cros_gralloc_convert_handle(handle); |
| 291 | if (!hnd) { |
| 292 | cros_gralloc_error("Invalid handle."); |
| 293 | return -EINVAL; |
| 294 | } |
| 295 | |
| 296 | if (hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888) { |
| 297 | cros_gralloc_error("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible."); |
| 298 | return -EINVAL; |
| 299 | } |
| 300 | |
| 301 | flags = gralloc0_convert_flags(usage); |
| 302 | ret = mod->driver->lock(handle, fence_fd, flags, addr); |
| 303 | *vaddr = addr[0]; |
| 304 | return ret; |
| 305 | } |
| 306 | |
| 307 | static int gralloc0_unlock_async(struct gralloc_module_t const *module, buffer_handle_t handle, |
| 308 | int *fence_fd) |
| 309 | { |
| 310 | auto mod = (struct gralloc0_module *)module; |
| 311 | return mod->driver->unlock(handle, fence_fd); |
| 312 | } |
| 313 | |
| 314 | static int gralloc0_lock_async_ycbcr(struct gralloc_module_t const *module, buffer_handle_t handle, |
| 315 | int usage, int l, int t, int w, int h, |
| 316 | struct android_ycbcr *ycbcr, int fence_fd) |
| 317 | { |
| 318 | uint64_t flags; |
| 319 | int32_t ret; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 320 | uint8_t *addr[DRV_MAX_PLANES] = { nullptr, nullptr, nullptr, nullptr }; |
| 321 | auto mod = (struct gralloc0_module *)module; |
| 322 | |
| 323 | auto hnd = cros_gralloc_convert_handle(handle); |
| 324 | if (!hnd) { |
| 325 | cros_gralloc_error("Invalid handle."); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 326 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888) && |
Tomasz Figa | aff29fd | 2017-07-05 17:50:18 +0900 | [diff] [blame] | 330 | (hnd->droid_format != HAL_PIXEL_FORMAT_YV12) && |
| 331 | (hnd->droid_format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)) { |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 332 | cros_gralloc_error("Non-YUV format not compatible."); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 333 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 334 | } |
| 335 | |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 336 | flags = gralloc0_convert_flags(usage); |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 337 | ret = mod->driver->lock(handle, fence_fd, flags, addr); |
Tomasz Figa | addd5f2 | 2017-07-05 17:50:18 +0900 | [diff] [blame] | 338 | if (ret) |
| 339 | return ret; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 340 | |
| 341 | switch (hnd->format) { |
| 342 | case DRM_FORMAT_NV12: |
| 343 | ycbcr->y = addr[0]; |
| 344 | ycbcr->cb = addr[1]; |
| 345 | ycbcr->cr = addr[1] + 1; |
| 346 | ycbcr->ystride = hnd->strides[0]; |
| 347 | ycbcr->cstride = hnd->strides[1]; |
| 348 | ycbcr->chroma_step = 2; |
| 349 | break; |
| 350 | case DRM_FORMAT_YVU420: |
| 351 | case DRM_FORMAT_YVU420_ANDROID: |
| 352 | ycbcr->y = addr[0]; |
| 353 | ycbcr->cb = addr[2]; |
| 354 | ycbcr->cr = addr[1]; |
| 355 | ycbcr->ystride = hnd->strides[0]; |
| 356 | ycbcr->cstride = hnd->strides[1]; |
| 357 | ycbcr->chroma_step = 1; |
| 358 | break; |
| 359 | default: |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 360 | module->unlock(module, handle); |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 361 | return -EINVAL; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 362 | } |
| 363 | |
Tomasz Figa | 90bb743 | 2017-07-21 17:54:05 +0900 | [diff] [blame] | 364 | return 0; |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | static struct hw_module_methods_t gralloc0_module_methods = {.open = gralloc0_open }; |
| 368 | |
| 369 | struct gralloc0_module HAL_MODULE_INFO_SYM = { |
| 370 | .base = |
| 371 | { |
| 372 | .common = |
| 373 | { |
| 374 | .tag = HARDWARE_MODULE_TAG, |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 375 | .module_api_version = GRALLOC_MODULE_API_VERSION_0_3, |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 376 | .hal_api_version = 0, |
| 377 | .id = GRALLOC_HARDWARE_MODULE_ID, |
| 378 | .name = "CrOS Gralloc", |
| 379 | .author = "Chrome OS", |
| 380 | .methods = &gralloc0_module_methods, |
| 381 | }, |
| 382 | |
| 383 | .registerBuffer = gralloc0_register_buffer, |
| 384 | .unregisterBuffer = gralloc0_unregister_buffer, |
| 385 | .lock = gralloc0_lock, |
| 386 | .unlock = gralloc0_unlock, |
| 387 | .perform = gralloc0_perform, |
| 388 | .lock_ycbcr = gralloc0_lock_ycbcr, |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 389 | .lockAsync = gralloc0_lock_async, |
| 390 | .unlockAsync = gralloc0_unlock_async, |
| 391 | .lockAsync_ycbcr = gralloc0_lock_async_ycbcr, |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 392 | }, |
| 393 | |
| 394 | .alloc = nullptr, |
| 395 | .driver = nullptr, |
Gurchetan Singh | bcfd758 | 2017-08-01 15:02:24 -0700 | [diff] [blame^] | 396 | .initialized = false, |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 397 | }; |