HWC: Set skip to layers with Non Integral Source Crop.
HWC modifies Source Crop to floor and ceil based to LT and RB
respectively. This can result in flicker if there is switch in
Composition between MDP and GPU. Instead mark the layer as skip.
Change-Id: I35d9461d2db44c9d9b4402b17c44a569e1f705c9
Source: I2f7a62fbf5ae2a0c0d13f15118b053afbabf99c8
CRs-Fixed: 2143554
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 213230f..978c3bc 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -514,6 +514,7 @@
}
}
+ bool is_secure = false;
const private_handle_t *handle =
reinterpret_cast<const private_handle_t *>(layer->input_buffer.buffer_id);
if (handle) {
@@ -521,21 +522,17 @@
layer_stack_.flags.video_present = true;
}
// TZ Protected Buffer - L1
- if (handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
- layer_stack_.flags.secure_present = true;
- }
// Gralloc Usage Protected Buffer - L3 - which needs to be treated as Secure & avoid fallback
- if (handle->flags & private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER) {
+ if (handle->flags & private_handle_t::PRIV_FLAGS_PROTECTED_BUFFER ||
+ handle->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
layer_stack_.flags.secure_present = true;
+ is_secure = true;
}
}
- if (layer->flags.skip) {
- layer_stack_.flags.skip_present = true;
- }
-
if (layer->input_buffer.flags.secure_display) {
secure_display_active = true;
+ is_secure = true;
}
if (hwc_layer->IsSingleBuffered() &&
@@ -561,6 +558,14 @@
layer_stack_.flags.hdr_present = true;
}
+ if (hwc_layer->IsNonIntegralSourceCrop() && !is_secure && !hdr_layer) {
+ layer->flags.skip = true;
+ }
+
+ if (layer->flags.skip) {
+ layer_stack_.flags.skip_present = true;
+ }
+
// TODO(user): Move to a getter if this is needed at other places
hwc_rect_t scaled_display_frame = {INT(layer->dst_rect.left), INT(layer->dst_rect.top),
INT(layer->dst_rect.right), INT(layer->dst_rect.bottom)};
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index 71ca78d..605b319 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -435,6 +435,10 @@
HWC2::Error HWCLayer::SetLayerSourceCrop(hwc_frect_t crop) {
LayerRect src_rect = {};
SetRect(crop, &src_rect);
+ non_integral_source_crop_ = ((crop.left != roundf(crop.left)) ||
+ (crop.top != roundf(crop.top)) ||
+ (crop.right != roundf(crop.right)) ||
+ (crop.bottom != roundf(crop.bottom)));
if (layer_->src_rect != src_rect) {
geometry_changes_ |= kSourceCrop;
layer_->src_rect = src_rect;
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index ed03c50..bbc602e 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -97,6 +97,7 @@
bool IsSingleBuffered() { return single_buffer_; }
bool IsScalingPresent();
bool IsRotationPresent();
+ bool IsNonIntegralSourceCrop() { return non_integral_source_crop_; }
private:
Layer *layer_ = nullptr;
@@ -112,6 +113,7 @@
bool needs_validate_ = true;
bool single_buffer_ = false;
int buffer_fd_ = -1;
+ bool non_integral_source_crop_ = false;
// Composition requested by client(SF)
HWC2::Composition client_requested_ = HWC2::Composition::Device;