sdm: Prevent updates on idle timeout for GPU or cached frames
Prevent updates on idle timeout for GPU or cache composed frames.
This prevents unnecessary GPU fallbacks when pipes have already
been folded.
Change-Id: I546787dc1d612e0d6cec215b18a784c4db7237d9
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 002b32c..0c080bf 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -49,8 +49,8 @@
display_intf_(NULL), flush_(false), dump_frame_count_(0), dump_frame_index_(0),
dump_input_layers_(false), swap_interval_zero_(false), framebuffer_config_(NULL),
display_paused_(false), use_metadata_refresh_rate_(false), metadata_refresh_rate_(0),
- boot_animation_completed_(false), shutdown_pending_(false), use_blit_comp_(false),
- blit_engine_(NULL) {
+ boot_animation_completed_(false), shutdown_pending_(false), handle_refresh_(false),
+ use_blit_comp_(false), blit_engine_(NULL) {
}
int HWCDisplay::Init() {
@@ -296,7 +296,7 @@
}
DisplayError HWCDisplay::Refresh() {
- if (*hwc_procs_) {
+ if (*hwc_procs_ && handle_refresh_) {
(*hwc_procs_)->invalidate(*hwc_procs_);
}
@@ -1220,5 +1220,40 @@
layer_stack_cache_.layer_count = 0;
}
+bool HWCDisplay::IsFullFrameGPUComposed() {
+ uint32_t layer_count = layer_stack_.layer_count;
+ for (size_t i = 0; i < layer_count; i++) {
+ LayerComposition composition = layer_stack_.layers[i].composition;
+ if (composition == kCompositionGPUTarget || composition == kCompositionBlitTarget) {
+ continue;
+ }
+ if (composition != kCompositionGPU) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool HWCDisplay::IsFullFrameSDEComposed() {
+ uint32_t layer_count = layer_stack_.layer_count;
+ for (size_t i = 0; i < layer_count; i++) {
+ LayerComposition composition = layer_stack_.layers[i].composition;
+ if (composition == kCompositionGPUTarget || composition == kCompositionBlitTarget) {
+ continue;
+ }
+ if (composition != kCompositionSDE && composition != kCompositionBlit &&
+ composition != kCompositionHybrid) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool HWCDisplay::IsFullFrameCached(hwc_display_contents_1_t *content_list) {
+ return IsFullFrameSDEComposed() && !NeedsFrameBufferRefresh(content_list);
+}
+
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
index d87c184..cc78760 100644
--- a/sdm/libs/hwc/hwc_display.h
+++ b/sdm/libs/hwc/hwc_display.h
@@ -123,6 +123,10 @@
virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
DisplayError SetColorSpace(const ColorSpace_t source, LayerColorSpace *target);
DisplayError SetMetaData(const MetaData_t &meta_data, Layer *layer);
+ bool NeedsFrameBufferRefresh(hwc_display_contents_1_t *content_list);
+ bool IsFullFrameGPUComposed();
+ bool IsFullFrameSDEComposed();
+ bool IsFullFrameCached(hwc_display_contents_1_t *content_list);
enum {
INPUT_LAYER_DUMP,
@@ -150,15 +154,15 @@
uint32_t metadata_refresh_rate_;
bool boot_animation_completed_;
bool shutdown_pending_;
+ bool handle_refresh_;
+ bool use_blit_comp_;
private:
bool IsFrameBufferScaled();
void DumpInputBuffers(hwc_display_contents_1_t *content_list);
- bool NeedsFrameBufferRefresh(hwc_display_contents_1_t *content_list);
int PrepareLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer, uint32_t fps);
void CommitLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer);
void ResetLayerCacheStack();
- bool use_blit_comp_;
BlitEngine *blit_engine_;
};
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index aeeee9f..d6af70f 100644
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -116,6 +116,16 @@
return status;
}
+ handle_refresh_ = true;
+ int app_layer_count = layer_stack_.layer_count - 1;
+ if (needs_blit_ && use_blit_comp_) {
+ app_layer_count -= kMaxBlitTargetLayers;
+ }
+
+ if (app_layer_count <= 1 || IsFullFrameGPUComposed() || IsFullFrameCached(content_list)) {
+ handle_refresh_ = false;
+ }
+
if (use_metadata_refresh_rate_) {
SetRefreshRate(metadata_refresh_rate_);
}