Merge "sdm: Scale display frame of each layer appropriately." into dev-2.0
diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h
index 2cf5c80..9ba60f2 100644
--- a/libqdutils/display_config.h
+++ b/libqdutils/display_config.h
@@ -47,10 +47,10 @@
// Use this enum to specify the dpy parameters where needed
enum {
- DISPLAY_PRIMARY = HWC_DISPLAY_PRIMARY,
- DISPLAY_EXTERNAL = HWC_DISPLAY_EXTERNAL,
- DISPLAY_TERTIARY = HWC_DISPLAY_TERTIARY,
- DISPLAY_VIRTUAL = HWC_DISPLAY_VIRTUAL,
+ DISPLAY_PRIMARY = 0,
+ DISPLAY_EXTERNAL,
+ DISPLAY_TERTIARY,
+ DISPLAY_VIRTUAL,
};
// External Display states - used in setSecondaryDisplayStatus()
diff --git a/sdm/libs/core/fb/hw_virtual.cpp b/sdm/libs/core/fb/hw_virtual.cpp
index 27c979a..033159f 100644
--- a/sdm/libs/core/fb/hw_virtual.cpp
+++ b/sdm/libs/core/fb/hw_virtual.cpp
@@ -74,9 +74,5 @@
return HWDevice::Validate(hw_layers);
}
-DisplayError HWVirtual::Flush() {
- return kErrorNone;
-}
-
} // namespace sdm
diff --git a/sdm/libs/core/fb/hw_virtual.h b/sdm/libs/core/fb/hw_virtual.h
index c0591b3..2b740d5 100644
--- a/sdm/libs/core/fb/hw_virtual.h
+++ b/sdm/libs/core/fb/hw_virtual.h
@@ -39,7 +39,6 @@
HWVirtual(BufferSyncHandler *buffer_sync_handler, HWInfoInterface *hw_info_intf);
virtual DisplayError Init(HWEventHandler *eventhandler);
virtual DisplayError Validate(HWLayers *hw_layers);
- virtual DisplayError Flush();
};
} // namespace sdm
diff --git a/sdm/libs/hwc/blit_engine_c2d.cpp b/sdm/libs/hwc/blit_engine_c2d.cpp
index be8c6f9..a7f621d 100644
--- a/sdm/libs/hwc/blit_engine_c2d.cpp
+++ b/sdm/libs/hwc/blit_engine_c2d.cpp
@@ -57,6 +57,7 @@
#include <utils/rect.h>
#include "blit_engine_c2d.h"
+#include "hwc_debugger.h"
#define __CLASS__ "BlitEngineC2D"
@@ -88,11 +89,13 @@
return 0;
}
-BlitEngineC2d::BlitEngineC2d() : blit_active_(false), dump_frame_count_(0), dump_frame_index_(0) {
+BlitEngineC2d::BlitEngineC2d() {
for (uint32_t i = 0; i < kNumBlitTargetBuffers; i++) {
blit_target_buffer_[i] = NULL;
release_fence_fd_[i] = -1;
}
+
+ HWCDebugHandler::Get()->GetProperty("persist.hwc.blit.comp", &blit_supported_);
}
BlitEngineC2d::~BlitEngineC2d() {
@@ -250,8 +253,7 @@
for (i = 0; i < layer_stack->layer_count; i++) {
Layer &layer = layer_stack->layers[i];
- if (IsUBWCFormat(layer.input_buffer->format)) {
- // UBWC is not currently supported
+ if (!blit_supported_) {
return -1;
}
if (layer.composition == kCompositionGPUTarget) {
diff --git a/sdm/libs/hwc/blit_engine_c2d.h b/sdm/libs/hwc/blit_engine_c2d.h
index 74c4b81..5400611 100644
--- a/sdm/libs/hwc/blit_engine_c2d.h
+++ b/sdm/libs/hwc/blit_engine_c2d.h
@@ -112,9 +112,10 @@
int release_fence_fd_[kNumBlitTargetBuffers];
uint32_t num_blit_target_;
int blit_target_start_index_;
- bool blit_active_;
- uint32_t dump_frame_count_;
- uint32_t dump_frame_index_;
+ bool blit_active_ = false;
+ uint32_t dump_frame_count_ = 0;
+ uint32_t dump_frame_index_ = 0;
+ int blit_supported_ = 0;
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index e68e05f..ba4c23c 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -789,8 +789,15 @@
bool HWCDisplay::NeedsFrameBufferRefresh(hwc_display_contents_1_t *content_list) {
uint32_t layer_count = layer_stack_.layer_count;
+ // Handle ongoing animation and end here, start is handled below
if (layer_stack_cache_.animating) {
- return false;
+ if (!layer_stack_.flags.animating) {
+ // Animation is ending.
+ return true;
+ } else {
+ // Animation is going on.
+ return false;
+ }
}
// Frame buffer needs to be refreshed for the following reasons:
@@ -838,7 +845,7 @@
void HWCDisplay::CacheLayerStackInfo(hwc_display_contents_1_t *content_list) {
uint32_t layer_count = layer_stack_.layer_count;
- if (layer_count > kMaxLayerCount) {
+ if (layer_count > kMaxLayerCount || layer_stack_.flags.animating) {
ResetLayerCacheStack();
return;
}
@@ -1192,6 +1199,7 @@
int HWCDisplay::SetDisplayStatus(uint32_t display_status) {
int status = 0;
+ const hwc_procs_t *hwc_procs = *hwc_procs_;
switch (display_status) {
case kDisplayStatusResume:
@@ -1209,6 +1217,11 @@
return -EINVAL;
}
+ if (display_status == kDisplayStatusResume ||
+ display_status == kDisplayStatusPause) {
+ hwc_procs->invalidate(hwc_procs);
+ }
+
return status;
}
@@ -1357,7 +1370,9 @@
}
int HWCDisplay::ToggleScreenUpdates(bool enable) {
+ const hwc_procs_t *hwc_procs = *hwc_procs_;
display_paused_ = enable ? false : true;
+ hwc_procs->invalidate(hwc_procs);
return 0;
}
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index 569fc0f..5cf1b56 100755
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -113,6 +113,7 @@
int HWCDisplayPrimary::Prepare(hwc_display_contents_1_t *content_list) {
int status = 0;
+ DisplayError error = kErrorNone;
if (!boot_animation_completed_)
ProcessBootAnimCompleted();
@@ -136,7 +137,10 @@
ToggleCPUHint(one_updating_layer);
uint32_t refresh_rate = GetOptimalRefreshRate(one_updating_layer);
- DisplayError error = display_intf_->SetRefreshRate(refresh_rate);
+ if (current_refresh_rate_ != refresh_rate) {
+ error = display_intf_->SetRefreshRate(refresh_rate);
+ }
+
if (error == kErrorNone) {
// On success, set current refresh rate to new refresh rate
current_refresh_rate_ = refresh_rate;