+int gralloc_lock_ycbcr(gralloc_module_t const* module,
+ buffer_handle_t handle, int usage,
+ int l, int t, int w, int h,
+ struct android_ycbcr *ycbcr)
+{
+ // This is called when a YUV buffer is being locked for software
+ // access. In this implementation we have nothing to do since
+ // no synchronization with the HW is needed.
+ // Typically this is used to wait for the h/w to finish with
+ // this buffer if relevant. The data cache may need to be
+ // flushed or invalidated depending on the usage bits and the
+ // hardware.
+
+ if (private_handle_t::validate(handle) < 0)
+ return -EINVAL;
+
+ private_handle_t* hnd = (private_handle_t*)handle;
+ ALOGV("lock_ycbcr for fmt=%d %dx%d %dx%d %d", hnd->format, hnd->width, hnd->height,
+ hnd->stride, hnd->vstride, hnd->size);
+ switch (hnd->format) {
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
+ {
+ int err = 0;
+ if (hnd->base1 == NULL || hnd->base == NULL) {
+ err = gralloc_map_yuv(module, hnd);
+ }
+ if (err == 0) {
+ ycbcr->y = (void*)hnd->base;
+ ycbcr->cb = (void*)hnd->base1;
+ ycbcr->cr = (void*)((uint8_t *)hnd->base + 1);
+ ycbcr->ystride = hnd->stride;
+ ycbcr->cstride = hnd->stride;
+ ycbcr->chroma_step = 2;
+ memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
+ }
+ return err;
+ }
+ default:
+ return -EINVAL;
+ }
+}
+
+int gralloc_perform(struct gralloc_module_t const* module, int operation, ... )
+{
+ // dummy implementation required to implement lock_ycbcr
+ return -EINVAL;
+}
+