hwcomposer.ranchu: Maintain its own copy of drmhwcgralloc.h

The ranchu hwcomposer logic pulls in the drmhwcgralloc.h from
drm_hwcomposer for the hwc_drm_bo definition.

However, upstream in drm_hwcomposer, that structure has been
reworked, which then causes the ranchu hwcomposer to stop
building when we update the drm_hwcomposer tree.

As the structure is just being re-utilized as convenience /
storage structure and isn't used as a shared data structure with
other components, so I've copied it over locally so things can
continue to build and the drm_hwcomposer can be updated
independently.

Bug: 200733475

Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I86e100c46ffe211c9e8c48c0c9222592d41f240a
Merged-In: I86e100c46ffe211c9e8c48c0c9222592d41f240a
diff --git a/system/hwc2/Android.mk b/system/hwc2/Android.mk
index 62082b6..918251c 100644
--- a/system/hwc2/Android.mk
+++ b/system/hwc2/Android.mk
@@ -78,7 +78,6 @@
 LOCAL_SHARED_LIBRARIES += libui
 LOCAL_SRC_FILES := $(emulator_hwcomposer2_src_files)
 LOCAL_C_INCLUDES := $(emulator_hwcomposer_c_includes)
-LOCAL_C_INCLUDES += external/drm_hwcomposer
 LOCAL_C_INCLUDES += external/minigbm/cros_gralloc
 LOCAL_MODULE_RELATIVE_PATH := $(emulator_hwcomposer_relative_path)
 
@@ -99,7 +98,6 @@
 LOCAL_SHARED_LIBRARIES += libdrm
 LOCAL_C_INCLUDES := $(emulator_hwcomposer_c_includes)
 LOCAL_C_INCLUDES += external/libdrm
-LOCAL_C_INCLUDES += external/drm_hwcomposer
 LOCAL_C_INCLUDES += external/minigbm/cros_gralloc
 LOCAL_MODULE := emulatorDrmTest
 LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
diff --git a/system/hwc2/DrmPresenter.h b/system/hwc2/DrmPresenter.h
index 7f9edb2..d65ce9d 100644
--- a/system/hwc2/DrmPresenter.h
+++ b/system/hwc2/DrmPresenter.h
@@ -18,7 +18,6 @@
 #define ANDROID_HWC_DRMPRESENTER_H
 
 #include <android-base/unique_fd.h>
-#include <include/drmhwcgralloc.h>
 #include <utils/Thread.h>
 #include <xf86drm.h>
 #include <xf86drmMode.h>
@@ -27,6 +26,7 @@
 #include <memory>
 #include <vector>
 
+#include "drmhwcgralloc.h"
 #include "Common.h"
 #include "android/base/synchronization/AndroidLock.h"
 
diff --git a/system/hwc2/drmTest.cpp b/system/hwc2/drmTest.cpp
index 86267da..254772c 100644
--- a/system/hwc2/drmTest.cpp
+++ b/system/hwc2/drmTest.cpp
@@ -107,7 +107,7 @@
     return;                                                          \
   }
 
-#include "include/drmhwcgralloc.h"
+#include "drmhwcgralloc.h"
 void convertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
   cros_gralloc_handle *gr_handle = (cros_gralloc_handle *)handle;
   if (!gr_handle) return;
diff --git a/system/hwc2/drmhwcgralloc.h b/system/hwc2/drmhwcgralloc.h
new file mode 100644
index 0000000..05b2cf0
--- /dev/null
+++ b/system/hwc2/drmhwcgralloc.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_DRMHWCGRALLOC_H_
+#define ANDROID_DRMHWCGRALLOC_H_
+
+#include <stdint.h>
+
+#define HWC_DRM_BO_MAX_PLANES 4
+typedef struct hwc_drm_bo {
+  uint32_t width;
+  uint32_t height;
+  uint32_t format;     /* DRM_FORMAT_* from drm_fourcc.h */
+  uint32_t hal_format; /* HAL_PIXEL_FORMAT_* */
+  uint32_t usage;
+  uint32_t pitches[HWC_DRM_BO_MAX_PLANES];
+  uint32_t offsets[HWC_DRM_BO_MAX_PLANES];
+  uint32_t prime_fds[HWC_DRM_BO_MAX_PLANES];
+  uint32_t gem_handles[HWC_DRM_BO_MAX_PLANES];
+  uint64_t modifiers[HWC_DRM_BO_MAX_PLANES];
+  uint32_t fb_id;
+  int acquire_fence_fd;
+  void *priv;
+} hwc_drm_bo_t;
+
+#endif  // ANDROID_DRMHWCGRALLOC_H_