drm_hwcomposer: Reorganize struct DrmHwcLayer
1. Move BlendMode, ColorSpace, SampleRange fields to the struct BufferInfo,
allowing extraction of the data from native_handle using Metadata@4 API.
Use it when data from HWC2 API can't be used (Currently it's a BlendMode
case for CLIENT layer)
2. Rename DrmHwcLayer to LayerData and move it to compositor/ directory.
(I was confused in the past because of similarity of names DrmHwcLayer
vs HwcLayer, so this step should meke it easier for newcomers to
understand the code)
3. Allow clonning of the LayerData to propagate it through the composition
pipeline. Thus LayerData can be used by both HwcLayer to track state
and by the compositor.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/bufferinfo/BufferInfo.h b/bufferinfo/BufferInfo.h
index ab714cf..b2297f9 100644
--- a/bufferinfo/BufferInfo.h
+++ b/bufferinfo/BufferInfo.h
@@ -20,6 +20,26 @@
constexpr int kBufferMaxPlanes = 4;
+enum class BufferColorSpace : int32_t {
+ kUndefined,
+ kItuRec601,
+ kItuRec709,
+ kItuRec2020,
+};
+
+enum class BufferSampleRange : int32_t {
+ kUndefined,
+ kFullRange,
+ kLimitedRange,
+};
+
+enum class BufferBlendMode : int32_t {
+ kUndefined,
+ kNone,
+ kPreMult,
+ kCoverage,
+};
+
struct BufferInfo {
uint32_t width;
uint32_t height;
@@ -30,4 +50,8 @@
uint32_t sizes[kBufferMaxPlanes];
int prime_fds[kBufferMaxPlanes];
uint64_t modifiers[kBufferMaxPlanes];
+
+ BufferColorSpace color_space;
+ BufferSampleRange sample_range;
+ BufferBlendMode blend_mode;
};
diff --git a/bufferinfo/BufferInfoGetter.cpp b/bufferinfo/BufferInfoGetter.cpp
index b42838d..fcd0532 100644
--- a/bufferinfo/BufferInfoGetter.cpp
+++ b/bufferinfo/BufferInfoGetter.cpp
@@ -48,12 +48,6 @@
return inst.get();
}
-bool BufferInfoGetter::IsHandleUsable(buffer_handle_t handle) {
- auto bo = GetBoInfo(handle);
-
- return bo && bo->prime_fds[0] != 0;
-}
-
int LegacyBufferInfoGetter::Init() {
int ret = hw_get_module(
GRALLOC_HARDWARE_MODULE_ID,
diff --git a/bufferinfo/BufferInfoGetter.h b/bufferinfo/BufferInfoGetter.h
index 4d35faa..667b5c1 100644
--- a/bufferinfo/BufferInfoGetter.h
+++ b/bufferinfo/BufferInfoGetter.h
@@ -38,8 +38,6 @@
virtual auto GetBoInfo(buffer_handle_t handle)
-> std::optional<BufferInfo> = 0;
- bool IsHandleUsable(buffer_handle_t handle);
-
static BufferInfoGetter *GetInstance();
static bool IsDrmFormatRgb(uint32_t drm_format);