resolve merge conflicts of 98804031fb4692cd1987c31a6056eb3052538ac4 to stage-aosp-master

Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: I545b97420802447969b2a960c3d6a50a9f228c7f
diff --git a/drmhwcomposer.h b/drmhwcomposer.h
index f3b000b..ab8f087 100644
--- a/drmhwcomposer.h
+++ b/drmhwcomposer.h
@@ -99,7 +99,8 @@
     return *this;
   }
 
-  int CopyBufferHandle(buffer_handle_t handle);
+  int CopyBufferHandle(buffer_handle_t handle, int width, int height,
+                       int layerCount, int format, int usage, int stride);
 
   void Clear();
 
diff --git a/hwcutils.cpp b/hwcutils.cpp
index e452bc8..be70a39 100644
--- a/hwcutils.cpp
+++ b/hwcutils.cpp
@@ -59,11 +59,14 @@
   return 0;
 }
 
-int DrmHwcNativeHandle::CopyBufferHandle(buffer_handle_t handle) {
+int DrmHwcNativeHandle::CopyBufferHandle(buffer_handle_t handle, int width,
+                                         int height, int layerCount,
+                                         int format, int usage, int stride) {
   native_handle_t *handle_copy;
   GraphicBufferMapper &gm(GraphicBufferMapper::get());
   int ret =
-      gm.importBuffer(handle, const_cast<buffer_handle_t *>(&handle_copy));
+      gm.importBuffer(handle, width, height, layerCount, format, usage,
+                      stride, const_cast<buffer_handle_t *>(&handle_copy));
   if (ret) {
     ALOGE("Failed to import buffer handle %d", ret);
     return ret;
@@ -96,11 +99,15 @@
   if (ret)
     return ret;
 
-  ret = handle.CopyBufferHandle(sf_handle);
+  const hwc_drm_bo *bo = buffer.operator->();
+
+  // FIXME: Add layerCount and a pixel stride to the hwc_drm_bo
+  ret = handle.CopyBufferHandle(sf_handle, bo->width, bo->height,
+                                1, bo->format, bo->usage, bo->width);
   if (ret)
     return ret;
 
-  gralloc_buffer_usage = buffer.operator->()->usage;
+  gralloc_buffer_usage = bo->usage;
 
   return 0;
 }