graphics: support FB HAL using HWC2OnFbAdapter

FB (framebuffer) HAL has been replaced by HWC HAL for 5+ years, but
we still support the legacy path in SurfaceFlinger.  Devices using
the legacy path cannot be Treblized.

This change allows such devices to use HIDL IComposer, by adding
support for FB HAL in the default implementation.

Test: boots hikey960
Change-Id: Ie9050bbcaac0fd5b134786f4f9f0f5075f4ebd0c
diff --git a/graphics/composer/2.1/default/Hwc.h b/graphics/composer/2.1/default/Hwc.h
index cf6a72a..32c6b0b 100644
--- a/graphics/composer/2.1/default/Hwc.h
+++ b/graphics/composer/2.1/default/Hwc.h
@@ -34,6 +34,7 @@
 
 namespace android {
     class HWC2On1Adapter;
+    class HWC2OnFbAdapter;
 }
 
 namespace android {
@@ -147,6 +148,9 @@
     Error setLayerZOrder(Display display, Layer layer, uint32_t z) override;
 
 private:
+    uint32_t initWithHwc(const hw_module_t* module);
+    uint32_t initWithFb(const hw_module_t* module);
+
     void initCapabilities();
 
     template<typename T>
@@ -221,6 +225,10 @@
     // If the HWC implementation version is < 2.0, use an adapter to interface
     // between HWC 2.0 <-> HWC 1.X.
     std::unique_ptr<HWC2On1Adapter> mAdapter;
+
+    // If there is no HWC implementation, use an adapter to interface between
+    // HWC 2.0 <-> FB HAL.
+    std::unique_ptr<HWC2OnFbAdapter> mFbAdapter;
 };
 
 extern "C" IComposer* HIDL_FETCH_IComposer(const char* name);