drm_hwcomposer: Introduce SharedFd, use standard c++ RAII for UniqueFd

We use too much dup() system calls for present fence propagating.
Also when propagating acquire fence we use additional logic for
skipping such propagation for the validate/test cycle.

Both issues can be solved by introducing SharedFd, which will track
reference count of fd object.

After that the UniqueFd is used very rarely and can be simplified by
wrapping it into std::unique_ptr without caring too much of adding
an extra malloc/free operation.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/DrmAtomicStateManager.h b/drm/DrmAtomicStateManager.h
index 5f19bcc..e456a91 100644
--- a/drm/DrmAtomicStateManager.h
+++ b/drm/DrmAtomicStateManager.h
@@ -37,7 +37,7 @@
   std::shared_ptr<DrmKmsPlan> composition;
 
   /* out */
-  UniqueFd out_fence;
+  SharedFd out_fence;
 
   /* helpers */
   auto HasInputs() -> bool {
@@ -95,7 +95,7 @@
   void CleanupPriorFrameResources();
 
   KmsState staged_frame_state_;
-  UniqueFd last_present_fence_;
+  SharedFd last_present_fence_;
   int frames_staged_{};
   int frames_tracked_{};