drm_hwcomposer: Rework HWC frontends buffer management
Change summary:
- Use BufferInfo instead of native_buffer to configure the HwcLayer.
- Extend buffer properties with slot info.
- Provide fence and active slot ID separate from the buffer.
- Move swapchain tracking into HWC2. HWC3 doesn't need that.
Why:
- Support more flexible resource management control from the frontend
side, which is required by HWC3 API.
- Move more Android-specific data types to the frontend module.
Change-Id: Idaa4c552f600f78d6f0ad21997cfa7f3a6c6cbd8
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/bufferinfo/BufferInfo.h b/bufferinfo/BufferInfo.h
index b2297f9..db4c53e 100644
--- a/bufferinfo/BufferInfo.h
+++ b/bufferinfo/BufferInfo.h
@@ -17,6 +17,7 @@
#pragma once
#include <cstdint>
+#include <memory>
constexpr int kBufferMaxPlanes = 4;
@@ -40,6 +41,11 @@
kCoverage,
};
+class PrimeFdsSharedBase {
+ public:
+ virtual ~PrimeFdsSharedBase() = default;
+};
+
struct BufferInfo {
uint32_t width;
uint32_t height;
@@ -54,4 +60,9 @@
BufferColorSpace color_space;
BufferSampleRange sample_range;
BufferBlendMode blend_mode;
+
+ /* prime_fds field require valid file descriptors. While their lifecycle is
+ * managed elsewhere. The shared_ptr is used to ensure that the fds are not
+ * closed while the BufferInfo is still in use. */
+ std::shared_ptr<PrimeFdsSharedBase> fds_shared;
};