summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--msm8996/sdm/include/core/display_interface.h3
-rw-r--r--msm8996/sdm/libs/core/display_base.cpp9
-rw-r--r--msm8996/sdm/libs/core/display_base.h8
-rw-r--r--msm8996/sdm/libs/hwc2/hwc_display.cpp27
-rw-r--r--msm8996/sdm/libs/hwc2/hwc_display.h6
-rw-r--r--msm8996/sdm/libs/hwc2/hwc_layers.cpp34
-rw-r--r--msm8996/sdm/libs/hwc2/hwc_layers.h7
-rw-r--r--msm8998/sdm/include/core/debug_interface.h1
-rw-r--r--msm8998/sdm/include/core/display_interface.h3
-rw-r--r--msm8998/sdm/include/core/layer_stack.h3
-rw-r--r--msm8998/sdm/libs/core/display_base.cpp3
-rw-r--r--msm8998/sdm/libs/hwc2/hwc_display.cpp30
-rw-r--r--msm8998/sdm/libs/hwc2/hwc_display.h5
-rw-r--r--msm8998/sdm/libs/hwc2/hwc_layers.cpp34
-rw-r--r--msm8998/sdm/libs/hwc2/hwc_layers.h7
15 files changed, 121 insertions, 59 deletions
diff --git a/msm8996/sdm/include/core/display_interface.h b/msm8996/sdm/include/core/display_interface.h
index bb89d1d7..612918ab 100644
--- a/msm8996/sdm/include/core/display_interface.h
+++ b/msm8996/sdm/include/core/display_interface.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -126,6 +126,7 @@ enum ContentQuality {
struct DisplayConfigFixedInfo {
bool underscan = false; //!< If display support CE underscan.
bool secure = false; //!< If this display is capable of handling secure content.
+ bool partial_update = false; //!< If display supports Partial Update.
};
/*! @brief This structure defines configuration for variable properties of a display device.
diff --git a/msm8996/sdm/libs/core/display_base.cpp b/msm8996/sdm/libs/core/display_base.cpp
index f355a548..fd7b0b00 100644
--- a/msm8996/sdm/libs/core/display_base.cpp
+++ b/msm8996/sdm/libs/core/display_base.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2017, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -396,6 +396,13 @@ DisplayError DisplayBase::GetConfig(uint32_t index, DisplayConfigVariableInfo *v
return kErrorNotSupported;
}
+DisplayError DisplayBase::GetConfig(DisplayConfigFixedInfo *fixed_info) {
+ lock_guard<recursive_mutex> obj(recursive_mutex_);
+ fixed_info->partial_update = hw_panel_info_.partial_update;
+
+ return kErrorNone;
+}
+
DisplayError DisplayBase::GetActiveConfig(uint32_t *index) {
lock_guard<recursive_mutex> obj(recursive_mutex_);
return hw_intf_->GetActiveConfig(index);
diff --git a/msm8996/sdm/libs/core/display_base.h b/msm8996/sdm/libs/core/display_base.h
index 6bcd46a4..efc48c58 100644
--- a/msm8996/sdm/libs/core/display_base.h
+++ b/msm8996/sdm/libs/core/display_base.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014-2016, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -63,6 +63,7 @@ class DisplayBase : public DisplayInterface, DumpImpl {
virtual DisplayError GetDisplayState(DisplayState *state);
virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count);
virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *variable_info);
+ virtual DisplayError GetConfig(DisplayConfigFixedInfo *fixed_info);
virtual DisplayError GetActiveConfig(uint32_t *index);
virtual DisplayError GetVSyncState(bool *enabled);
virtual DisplayError SetDisplayState(DisplayState state);
@@ -156,11 +157,6 @@ class DisplayBase : public DisplayInterface, DumpImpl {
HWMixerAttributes mixer_attributes_ = {};
DisplayConfigVariableInfo fb_config_ = {};
- private:
- // Unused
- virtual DisplayError GetConfig(DisplayConfigFixedInfo *variable_info) {
- return kErrorNone;
- }
};
} // namespace sdm
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp
index c326074f..0264b6d9 100644
--- a/msm8996/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -251,6 +251,12 @@ int HWCDisplay::Init() {
current_refresh_rate_ = max_refresh_rate_;
GetUnderScanConfig();
+
+ DisplayConfigFixedInfo fixed_info = {};
+ display_intf_->GetConfig(&fixed_info);
+ partial_update_enabled_ = fixed_info.partial_update;
+ client_target_->SetPartialUpdate(partial_update_enabled_);
+
DLOGI("Display created with id: %d", id_);
return 0;
}
@@ -279,6 +285,8 @@ HWC2::Error HWCDisplay::CreateLayer(hwc2_layer_t *out_layer_id) {
*out_layer_id = layer->GetId();
geometry_changes_ |= GeometryChanges::kAdded;
validated_ = false;
+ layer->SetPartialUpdate(partial_update_enabled_);
+
return HWC2::Error::None;
}
@@ -393,7 +401,7 @@ void HWCDisplay::BuildLayerStack() {
layer->flags.updating = true;
if (layer_set_.size() <= kMaxLayerCount) {
- layer->flags.updating = IsLayerUpdating(layer);
+ layer->flags.updating = IsLayerUpdating(hwc_layer);
}
layer_stack_.layers.push_back(layer);
@@ -402,6 +410,8 @@ void HWCDisplay::BuildLayerStack() {
layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0);
// Append client target to the layer stack
layer_stack_.layers.push_back(client_target_->GetSDMLayer());
+ Layer *sdm_client_target = client_target_->GetSDMLayer();
+ sdm_client_target->flags.updating = IsLayerUpdating(client_target_);
}
void HWCDisplay::BuildSolidFillStack() {
@@ -1595,24 +1605,17 @@ bool HWCDisplay::SingleLayerUpdating(void) {
return (updating_count == 1);
}
-bool HWCDisplay::IsLayerUpdating(const Layer *layer) {
+bool HWCDisplay::IsLayerUpdating(HWCLayer *hwc_layer) {
+ auto layer = hwc_layer->GetSDMLayer();
// Layer should be considered updating if
// a) layer is in single buffer mode, or
// b) valid dirty_regions(android specific hint for updating status), or
// c) layer stack geometry has changed (TODO(user): Remove when SDM accepts
// geometry_changed as bit fields).
- return (layer->flags.single_buffer || IsSurfaceUpdated(layer->dirty_regions) ||
+ return (layer->flags.single_buffer || hwc_layer->IsSurfaceUpdated() ||
geometry_changes_);
}
-bool HWCDisplay::IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions) {
- // based on dirty_regions determine if its updating
- // dirty_rect count = 0 - whole layer - updating.
- // dirty_rect count = 1 or more valid rects - updating.
- // dirty_rect count = 1 with (0,0,0,0) - not updating.
- return (dirty_regions.empty() || IsValid(dirty_regions.at(0)));
-}
-
uint32_t HWCDisplay::SanitizeRefreshRate(uint32_t req_refresh_rate) {
uint32_t refresh_rate = req_refresh_rate;
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.h b/msm8996/sdm/libs/hwc2/hwc_display.h
index 8d6be1cc..e9609e53 100644
--- a/msm8996/sdm/libs/hwc2/hwc_display.h
+++ b/msm8996/sdm/libs/hwc2/hwc_display.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -216,8 +216,7 @@ class HWCDisplay : public DisplayEventHandler {
void MarkLayersForClientComposition(void);
virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
bool SingleLayerUpdating(void);
- bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions);
- bool IsLayerUpdating(const Layer *layer);
+ bool IsLayerUpdating(HWCLayer *layer);
uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate);
virtual void CloseAcquireFds();
virtual void GetUnderScanConfig() { }
@@ -272,6 +271,7 @@ class HWCDisplay : public DisplayEventHandler {
bool CanSkipValidate();
qService::QService *qservice_ = NULL;
DisplayClass display_class_;
+ bool partial_update_enabled_ = false;
};
inline int HWCDisplay::Perform(uint32_t operation, ...) {
diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.cpp b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
index 935845e7..c3cab1ad 100644
--- a/msm8996/sdm/libs/hwc2/hwc_layers.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -128,7 +128,21 @@ HWC2::Error HWCLayer::SetLayerBuffer(buffer_handle_t buffer, int32_t acquire_fen
}
HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) {
- // Check if there is an update in SurfaceDamage rects
+ surface_updated_ = true;
+ if ((damage.numRects == 1) && (damage.rects[0].bottom == 0) && (damage.rects[0].right == 0)) {
+ surface_updated_ = false;
+ }
+
+ if (!layer_->flags.updating && surface_updated_) {
+ needs_validate_ = true;
+ }
+
+ if (!partial_update_enabled_) {
+ SetDirtyRegions(damage);
+ return HWC2::Error::None;
+ }
+
+ // Check if there is an update in SurfaceDamage rects.
if (layer_->dirty_regions.size() != damage.numRects) {
needs_validate_ = true;
} else {
@@ -142,12 +156,7 @@ HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) {
}
}
- layer_->dirty_regions.clear();
- for (uint32_t i = 0; i < damage.numRects; i++) {
- LayerRect rect;
- SetRect(damage.rects[i], &rect);
- layer_->dirty_regions.push_back(rect);
- }
+ SetDirtyRegions(damage);
return HWC2::Error::None;
}
@@ -628,4 +637,13 @@ int32_t HWCLayer::PopReleaseFence(void) {
return fence;
}
+void HWCLayer::SetDirtyRegions(hwc_region_t surface_damage) {
+ layer_->dirty_regions.clear();
+ for (uint32_t i = 0; i < surface_damage.numRects; i++) {
+ LayerRect rect;
+ SetRect(surface_damage.rects[i], &rect);
+ layer_->dirty_regions.push_back(rect);
+ }
+}
+
} // namespace sdm
diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.h b/msm8996/sdm/libs/hwc2/hwc_layers.h
index d77a3cab..53613204 100644
--- a/msm8996/sdm/libs/hwc2/hwc_layers.h
+++ b/msm8996/sdm/libs/hwc2/hwc_layers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -83,6 +83,8 @@ class HWCLayer {
int32_t PopReleaseFence(void);
void ResetValidation() { needs_validate_ = false; }
bool NeedsValidation() { return (needs_validate_ || geometry_changes_); }
+ bool IsSurfaceUpdated() { return surface_updated_; }
+ void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; }
private:
Layer *layer_ = nullptr;
@@ -95,6 +97,8 @@ class HWCLayer {
int ion_fd_ = -1;
HWCBufferAllocator *buffer_allocator_ = NULL;
bool needs_validate_ = true;
+ bool partial_update_enabled_ = false;
+ bool surface_updated_ = true;
// Composition requested by client(SF)
HWC2::Composition client_requested_ = HWC2::Composition::Device;
@@ -111,6 +115,7 @@ class HWCLayer {
DisplayError SetCSC(ColorSpace_t source, LayerCSC *target);
DisplayError SetIGC(IGC_t source, LayerIGC *target);
uint32_t RoundToStandardFPS(float fps);
+ void SetDirtyRegions(hwc_region_t surface_damage);
};
struct SortLayersByZ {
diff --git a/msm8998/sdm/include/core/debug_interface.h b/msm8998/sdm/include/core/debug_interface.h
index f4e3fc30..409ca418 100644
--- a/msm8998/sdm/include/core/debug_interface.h
+++ b/msm8998/sdm/include/core/debug_interface.h
@@ -49,6 +49,7 @@ enum DebugTag {
kTagRotator, //!< Debug log is tagged for rotator.
kTagScalar, //!< Debug log is tagged for Scalar Helper.
kTagQDCM, //!< Debug log is tagged for display QDCM color managing.
+ kTagClient, //!< Debug log is tagged for SDM client.
};
/*! @brief Display debug handler class.
diff --git a/msm8998/sdm/include/core/display_interface.h b/msm8998/sdm/include/core/display_interface.h
index f4054bb5..a4defcf2 100644
--- a/msm8998/sdm/include/core/display_interface.h
+++ b/msm8998/sdm/include/core/display_interface.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2017, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -148,6 +148,7 @@ struct DisplayConfigFixedInfo {
uint32_t max_luminance = 0; //!< From Panel's peak luminance
uint32_t average_luminance = 0; //!< From Panel's average luminance
uint32_t min_luminance = 0; //!< From Panel's blackness level
+ bool partial_update = false; //!< If display supports Partial Update.
};
/*! @brief This structure defines configuration for variable properties of a display device.
diff --git a/msm8998/sdm/include/core/layer_stack.h b/msm8998/sdm/include/core/layer_stack.h
index 6ee2e758..c53ddcd7 100644
--- a/msm8998/sdm/include/core/layer_stack.h
+++ b/msm8998/sdm/include/core/layer_stack.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -98,6 +98,7 @@ enum LayerComposition {
kCompositionBlit, //!< This layer will be composed using Blit Engine.
//!< This composition type is used only if BlitTarget layer is provided
//!< in a composition cycle.
+ kCompositionNone, //!< This layer will not be composed by any hardware.
/* === List of composition types set by Client === */
/* These composition types represent target buffer layers onto which GPU or Blit will draw if SDM
diff --git a/msm8998/sdm/libs/core/display_base.cpp b/msm8998/sdm/libs/core/display_base.cpp
index 3fdab564..6f2966f4 100644
--- a/msm8998/sdm/libs/core/display_base.cpp
+++ b/msm8998/sdm/libs/core/display_base.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2017, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -392,6 +392,7 @@ DisplayError DisplayBase::GetConfig(DisplayConfigFixedInfo *fixed_info) {
fixed_info->max_luminance = fixed_info->hdr_supported ? hw_panel_info_.peak_luminance: 0;
fixed_info->average_luminance = fixed_info->hdr_supported ? hw_panel_info_.average_luminance : 0;
fixed_info->min_luminance = fixed_info->hdr_supported ? hw_panel_info_.blackness_level: 0;
+ fixed_info->partial_update = hw_panel_info_.partial_update;
return kErrorNone;
}
diff --git a/msm8998/sdm/libs/hwc2/hwc_display.cpp b/msm8998/sdm/libs/hwc2/hwc_display.cpp
index 066dd6d6..498c05d1 100644
--- a/msm8998/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_display.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -379,6 +379,12 @@ int HWCDisplay::Init() {
current_refresh_rate_ = max_refresh_rate_;
GetUnderScanConfig();
+
+ DisplayConfigFixedInfo fixed_info = {};
+ display_intf_->GetConfig(&fixed_info);
+ partial_update_enabled_ = fixed_info.partial_update;
+ client_target_->SetPartialUpdate(partial_update_enabled_);
+
DLOGI("Display created with id: %d", id_);
return 0;
}
@@ -410,6 +416,7 @@ HWC2::Error HWCDisplay::CreateLayer(hwc2_layer_t *out_layer_id) {
*out_layer_id = layer->GetId();
geometry_changes_ |= GeometryChanges::kAdded;
validated_ = false;
+ layer->SetPartialUpdate(partial_update_enabled_);
return HWC2::Error::None;
}
@@ -552,7 +559,7 @@ void HWCDisplay::BuildLayerStack() {
layer->flags.updating = true;
if (layer_set_.size() <= kMaxLayerCount) {
- layer->flags.updating = IsLayerUpdating(layer);
+ layer->flags.updating = IsLayerUpdating(hwc_layer);
}
layer_stack_.layers.push_back(layer);
@@ -576,6 +583,7 @@ void HWCDisplay::BuildLayerStack() {
layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0);
// Append client target to the layer stack
Layer *sdm_client_target = client_target_->GetSDMLayer();
+ sdm_client_target->flags.updating = IsLayerUpdating(client_target_);
layer_stack_.layers.push_back(sdm_client_target);
// fall back frame composition to GPU when client target is 10bit
// TODO(user): clarify the behaviour from Client(SF) and SDM Extn -
@@ -1798,24 +1806,17 @@ bool HWCDisplay::SingleLayerUpdating(void) {
return (updating_count == 1);
}
-bool HWCDisplay::IsLayerUpdating(const Layer *layer) {
+bool HWCDisplay::IsLayerUpdating(HWCLayer *hwc_layer) {
+ auto layer = hwc_layer->GetSDMLayer();
// Layer should be considered updating if
// a) layer is in single buffer mode, or
// b) valid dirty_regions(android specific hint for updating status), or
// c) layer stack geometry has changed (TODO(user): Remove when SDM accepts
// geometry_changed as bit fields).
- return (layer->flags.single_buffer || IsSurfaceUpdated(layer->dirty_regions) ||
+ return (layer->flags.single_buffer || hwc_layer->IsSurfaceUpdated() ||
geometry_changes_);
}
-bool HWCDisplay::IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions) {
- // based on dirty_regions determine if its updating
- // dirty_rect count = 0 - whole layer - updating.
- // dirty_rect count = 1 or more valid rects - updating.
- // dirty_rect count = 1 with (0,0,0,0) - not updating.
- return (dirty_regions.empty() || IsValid(dirty_regions.at(0)));
-}
-
uint32_t HWCDisplay::SanitizeRefreshRate(uint32_t req_refresh_rate) {
uint32_t refresh_rate = req_refresh_rate;
@@ -1881,12 +1882,15 @@ bool HWCDisplay::CanSkipValidate() {
}
for (auto hwc_layer : layer_set_) {
+ Layer *layer = hwc_layer->GetSDMLayer();
if (hwc_layer->NeedsValidation()) {
return false;
}
// Do not allow Skip Validate, if any layer needs GPU Composition.
- if (hwc_layer->GetDeviceSelectedCompositionType() == HWC2::Composition::Client) {
+ if (layer->composition == kCompositionGPU || layer->composition == kCompositionNone) {
+ DLOGV_IF(kTagClient, "hwc_layer[%d] is %s. Returning false.", hwc_layer->GetId(),
+ (layer->composition == kCompositionGPU) ? "GPU composed": "Dropped");
return false;
}
}
diff --git a/msm8998/sdm/libs/hwc2/hwc_display.h b/msm8998/sdm/libs/hwc2/hwc_display.h
index 57180561..7157859b 100644
--- a/msm8998/sdm/libs/hwc2/hwc_display.h
+++ b/msm8998/sdm/libs/hwc2/hwc_display.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -235,7 +235,7 @@ class HWCDisplay : public DisplayEventHandler {
virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
bool SingleLayerUpdating(void);
bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions);
- bool IsLayerUpdating(const Layer *layer);
+ bool IsLayerUpdating(HWCLayer *layer);
uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate);
virtual void GetUnderScanConfig() { }
@@ -291,6 +291,7 @@ class HWCDisplay : public DisplayEventHandler {
bool CanSkipValidate();
qService::QService *qservice_ = NULL;
DisplayClass display_class_;
+ bool partial_update_enabled_ = false;
};
inline int HWCDisplay::Perform(uint32_t operation, ...) {
diff --git a/msm8998/sdm/libs/hwc2/hwc_layers.cpp b/msm8998/sdm/libs/hwc2/hwc_layers.cpp
index 1ae05ef1..ea8841bd 100644
--- a/msm8998/sdm/libs/hwc2/hwc_layers.cpp
+++ b/msm8998/sdm/libs/hwc2/hwc_layers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -277,7 +277,21 @@ HWC2::Error HWCLayer::SetLayerBuffer(buffer_handle_t buffer, int32_t acquire_fen
}
HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) {
- // Check if there is an update in SurfaceDamage rects
+ surface_updated_ = true;
+ if ((damage.numRects == 1) && (damage.rects[0].bottom == 0) && (damage.rects[0].right == 0)) {
+ surface_updated_ = false;
+ }
+
+ if (!layer_->flags.updating && surface_updated_) {
+ needs_validate_ = true;
+ }
+
+ if (!partial_update_enabled_) {
+ SetDirtyRegions(damage);
+ return HWC2::Error::None;
+ }
+
+ // Check if there is an update in SurfaceDamage rects.
if (layer_->dirty_regions.size() != damage.numRects) {
needs_validate_ = true;
} else {
@@ -291,12 +305,7 @@ HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) {
}
}
- layer_->dirty_regions.clear();
- for (uint32_t i = 0; i < damage.numRects; i++) {
- LayerRect rect;
- SetRect(damage.rects[i], &rect);
- layer_->dirty_regions.push_back(rect);
- }
+ SetDirtyRegions(damage);
return HWC2::Error::None;
}
@@ -820,4 +829,13 @@ int32_t HWCLayer::PopReleaseFence(void) {
return fence;
}
+void HWCLayer::SetDirtyRegions(hwc_region_t surface_damage) {
+ layer_->dirty_regions.clear();
+ for (uint32_t i = 0; i < surface_damage.numRects; i++) {
+ LayerRect rect;
+ SetRect(surface_damage.rects[i], &rect);
+ layer_->dirty_regions.push_back(rect);
+ }
+}
+
} // namespace sdm
diff --git a/msm8998/sdm/libs/hwc2/hwc_layers.h b/msm8998/sdm/libs/hwc2/hwc_layers.h
index b7f5ddd0..dbe33a9a 100644
--- a/msm8998/sdm/libs/hwc2/hwc_layers.h
+++ b/msm8998/sdm/libs/hwc2/hwc_layers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -92,6 +92,8 @@ class HWCLayer {
bool SupportLocalConversion(ColorPrimaries working_primaries);
void ResetValidation() { needs_validate_ = false; }
bool NeedsValidation() { return (needs_validate_ || geometry_changes_); }
+ bool IsSurfaceUpdated() { return surface_updated_; }
+ void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; }
private:
Layer *layer_ = nullptr;
@@ -104,6 +106,8 @@ class HWCLayer {
HWCBufferAllocator *buffer_allocator_ = NULL;
int32_t dataspace_ = HAL_DATASPACE_UNKNOWN;
bool needs_validate_ = true;
+ bool partial_update_enabled_ = false;
+ bool surface_updated_ = true;
// Composition requested by client(SF)
HWC2::Composition client_requested_ = HWC2::Composition::Device;
@@ -119,6 +123,7 @@ class HWCLayer {
DisplayError SetMetaData(const private_handle_t *pvt_handle, Layer *layer);
DisplayError SetIGC(IGC_t source, LayerIGC *target);
uint32_t RoundToStandardFPS(float fps);
+ void SetDirtyRegions(hwc_region_t surface_damage);
};
struct SortLayersByZ {