drm_hwcomposer: Clean up SetLayerBlendMode for hwc3
Don't use the existing HWC2 api. Remove related hwc2/hwc3 conversion
helper.
Change-Id: Ie3e53d1854df2e895360bd0c445d398649ab310a
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index 87d2da7..6bc3b6b 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -58,7 +58,7 @@
return configs_;
}
- // HWC Hooks
+ // HWC2 Hooks - these should not be used outside of the hwc2 device.
HWC2::Error AcceptDisplayChanges();
HWC2::Error CreateLayer(hwc2_layer_t *layer);
HWC2::Error DestroyLayer(hwc2_layer_t layer);
diff --git a/hwc2_device/HwcLayer.cpp b/hwc2_device/HwcLayer.cpp
index da4ce7c..e2b20f4 100644
--- a/hwc2_device/HwcLayer.cpp
+++ b/hwc2_device/HwcLayer.cpp
@@ -24,6 +24,12 @@
namespace android {
+void HwcLayer::SetLayerProperties(const LayerProperties& layer_properties) {
+ if (layer_properties.blend_mode) {
+ blend_mode_ = layer_properties.blend_mode.value();
+ }
+}
+
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
HWC2::Error HwcLayer::SetCursorPosition(int32_t /*x*/, int32_t /*y*/) {
return HWC2::Error::None;
diff --git a/hwc2_device/HwcLayer.h b/hwc2_device/HwcLayer.h
index b69ce5b..21e6b58 100644
--- a/hwc2_device/HwcLayer.h
+++ b/hwc2_device/HwcLayer.h
@@ -16,6 +16,7 @@
#pragma once
+#include <aidl/android/hardware/graphics/common/Transform.h>
#include <hardware/hwcomposer2.h>
#include "bufferinfo/BufferInfoGetter.h"
@@ -27,6 +28,11 @@
class HwcLayer {
public:
+ // A set of properties to be validated.
+ struct LayerProperties {
+ std::optional<BufferBlendMode> blend_mode;
+ };
+
explicit HwcLayer(HwcDisplay *parent_display) : parent_(parent_display){};
HWC2::Composition GetSfType() const {
@@ -61,7 +67,9 @@
return layer_data_;
}
- // Layer hooks
+ void SetLayerProperties(const LayerProperties &layer_properties);
+
+ // HWC2 Layer hooks
HWC2::Error SetCursorPosition(int32_t /*x*/, int32_t /*y*/);
HWC2::Error SetLayerBlendMode(int32_t mode);
HWC2::Error SetLayerBuffer(buffer_handle_t buffer, int32_t acquire_fence);