drm_hwcomposer: Stop using HWC2 for setting layer buffer

Clean up HWC3 implementation around setting layer buffers a bit by
duping the acquire fence rather than relying on const_cast.

Set the layer buffer through LayerProperties instead of through the HWC2
SetLayerBuffer API.

Change-Id: Ifd873423d5536cdb07f4d6d868ef3a9fd641fafe
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc3/ComposerClient.h b/hwc3/ComposerClient.h
index b8ab715..45607fe 100644
--- a/hwc3/ComposerClient.h
+++ b/hwc3/ComposerClient.h
@@ -39,11 +39,6 @@
 
 class DrmHwcThree;
 
-struct HwcLayerWrapper {
-  int64_t layer_id;
-  ::android::HwcLayer* layer;
-};
-
 class ComposerClient : public BnComposerClient {
  public:
   ComposerClient();
@@ -161,10 +156,12 @@
   ::ndk::SpAIBinder createBinder() override;
 
  private:
+  hwc3::Error ImportLayerBuffer(int64_t display_id, int64_t layer_id,
+                                const Buffer& buffer,
+                                buffer_handle_t* out_imported_buffer);
+
   // Layer commands
   void DispatchLayerCommand(int64_t display_id, const LayerCommand& command);
-  void ExecuteSetLayerBuffer(int64_t display_id, HwcLayerWrapper& layer_id,
-                             const Buffer& buffer);
 
   // Display commands
   void ExecuteDisplayCommand(const DisplayCommand& command);