gralloc: implement yuv offset query as hw specific function

This patch reverts earlier cca14cfd... and introduces a new hw
specific hook to query yuv components offsets which can vary
between different hw, decoders, cameras etc.

Change-Id: Ib60bc8ee28df7bc9425b6d7934294fe36fc55354
Depends-Change-Id: I1aa5368b21e588d5d711c1005fff2a5296e143a0
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
diff --git a/gralloc_drm.c b/gralloc_drm.c
index cf0fe84..53d764a 100644
--- a/gralloc_drm.c
+++ b/gralloc_drm.c
@@ -355,6 +355,22 @@
 }
 
 /*
+ * Query YUV component offsets for a buffer handle
+ */
+void gralloc_drm_resolve_format(buffer_handle_t _handle,
+	uint32_t *pitches, uint32_t *offsets, uint32_t *handles)
+{
+	struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);
+	struct gralloc_drm_bo_t *bo = (struct gralloc_drm_bo_t *) handle->data;
+	struct gralloc_drm_t *drm = bo->drm;
+
+	/* if handle exists and driver implements resolve_format */
+	if (handle && drm->drv->resolve_format)
+		drm->drv->resolve_format(drm->drv, bo,
+			pitches, offsets, handles);
+}
+
+/*
  * Lock a bo.  XXX thread-safety?
  */
 int gralloc_drm_bo_lock(struct gralloc_drm_bo_t *bo,