sdm: Add mask layer flag support to input buffer flags.
Set DISABLE_MASK_LAYER_HINT property to disable
this hint
Change-Id: I526025e2c32d386877b4b0b70c6423642421213f
CRs-Fixed: 2396411
diff --git a/include/display_properties.h b/include/display_properties.h
index 978bc8a..1161788 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -95,6 +95,7 @@
#define DISABLE_EXCl_RECT_PARTIAL_FB DISPLAY_PROP("disable_excl_rect_partial_fb")
#define DISABLE_FBID_CACHE DISPLAY_PROP("disable_fbid_cache")
#define DISABLE_HOTPLUG_BWCHECK DISPLAY_PROP("disable_hotplug_bwcheck")
+#define DISABLE_MASK_LAYER_HINT DISPLAY_PROP("disable_mask_layer_hint")
#define DISABLE_HDR_LUT_GEN DISPLAY_PROP("disable_hdr_lut_gen")
#define ENABLE_DEFAULT_COLOR_MODE DISPLAY_PROP("enable_default_color_mode")
diff --git a/sdm/include/core/layer_buffer.h b/sdm/include/core/layer_buffer.h
index 41bffac..1f55913 100644
--- a/sdm/include/core/layer_buffer.h
+++ b/sdm/include/core/layer_buffer.h
@@ -210,6 +210,10 @@
uint32_t ubwc_pi : 1; //!< This flag shall be set by the client to indicate that the
//!< buffer has PI content.
+
+ uint32_t mask_layer : 1; //!< This flag shall be set by client to indicate that the layer
+ //!< is union of solid fill regions typically transparent pixels
+ //!< and black pixels.
};
uint32_t flags = 0; //!< For initialization purpose only.
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index 8cdf63d..7680616 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -1021,4 +1021,9 @@
}
}
+void HWCLayer::SetLayerAsMask() {
+ layer_->input_buffer.flags.mask_layer = true;
+ DLOGV_IF(kTagClient, " Layer Id: ""[%" PRIu64 "]", id_);
+}
+
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index b21c2bb..b7d021b 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -26,6 +26,7 @@
#include <gralloc_priv.h>
#include <qdMetaData.h>
#include <core/layer_stack.h>
+#include <core/layer_buffer.h>
#include <utils/utils.h>
#define HWC2_INCLUDE_STRINGIFICATION
#define HWC2_USE_CPP11
@@ -113,6 +114,7 @@
bool IsNonIntegralSourceCrop() { return non_integral_source_crop_; }
bool HasMetaDataRefreshRate() { return has_metadata_refresh_rate_; }
bool IsColorTransformSet() { return color_transform_matrix_set_; }
+ void SetLayerAsMask();
private:
Layer *layer_ = nullptr;
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 7f26929..6b8c4a7 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -185,6 +185,7 @@
StartServices();
HWCDebugHandler::Get()->GetProperty(ENABLE_NULL_DISPLAY_PROP, &null_display_mode_);
HWCDebugHandler::Get()->GetProperty(DISABLE_HOTPLUG_BWCHECK, &disable_hotplug_bwcheck_);
+ HWCDebugHandler::Get()->GetProperty(DISABLE_MASK_LAYER_HINT, &disable_mask_layer_hint_);
DisplayError error = kErrorNone;
HWDisplayInterfaceInfo hw_disp_info = {};
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index bb789e4..cb30c3e 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -435,6 +435,7 @@
int32_t max_sde_builtin_displays_ = 0;
int32_t registered_builtin_displays_ = 0;
int32_t disable_hotplug_bwcheck_ = 0;
+ int32_t disable_mask_layer_hint_ = 0;
};
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index dc5d2a9..90347f9 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -755,6 +755,25 @@
}
Return<int32_t> HWCSession::setLayerAsMask(uint32_t disp_id, uint64_t layer_id) {
+ SCOPE_LOCK(locker_[disp_id]);
+ HWCDisplay *hwc_display = hwc_display_[disp_id];
+ if (!hwc_display) {
+ DLOGW("Display = %d is not connected.", disp_id);
+ return -EINVAL;
+ }
+
+ if (disable_mask_layer_hint_) {
+ DLOGW("Mask layer hint is disabled!");
+ return -EINVAL;
+ }
+
+ auto hwc_layer = hwc_display->GetHWCLayer(layer_id);
+ if (hwc_layer == nullptr) {
+ return -EINVAL;
+ }
+
+ hwc_layer->SetLayerAsMask();
+
return 0;
}