From 17cd7b8ac445759613a969239754354785a1ffc0 Mon Sep 17 00:00:00 2001 From: Namit Solanki Date: Thu, 15 Feb 2018 19:00:17 +0530 Subject: [PATCH] sdm: Drop HW VSYNC in min FPS state. -Do not send HW VSYNC to SF in min FPS state until a commit is received. If HW VSYNC is sent to SF in min FPS state, this cause SW VSYNC in SF to first adjust to min FPS initially, and then after commit SW VSYNC again adjusts to max FPS. Change-Id: I47ec673e68c4eae643103ebfb2009fb96f6934f3 CRs-Fixed: 2192683 --- sdm/libs/core/display_base.cpp | 11 +++++++++-- sdm/libs/core/display_base.h | 3 +++ sdm/libs/core/display_primary.cpp | 2 +- sdm/libs/core/display_primary.h | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp index 82d14d90..936c3985 100644 --- a/sdm/libs/core/display_base.cpp +++ b/sdm/libs/core/display_base.cpp @@ -60,6 +60,7 @@ DisplayError DisplayBase::Init() { hw_intf_->GetHWPanelInfo(&hw_panel_info_); uint32_t active_index = 0; + int drop_vsync = 0; hw_intf_->GetActiveConfig(&active_index); hw_intf_->GetDisplayAttributes(active_index, &display_attributes_); fb_config_ = display_attributes_; @@ -117,7 +118,8 @@ DisplayError DisplayBase::Init() { // TODO(user): Temporary changes, to be removed when DRM driver supports // Partial update with Destination scaler enabled. SetPUonDestScaler(); - + Debug::Get()->GetProperty("sdm.drop_skewed_vsync", &drop_vsync); + drop_skewed_vsync_ = (drop_vsync == 1); return kErrorNone; CleanupOnError: @@ -342,7 +344,8 @@ DisplayError DisplayBase::Commit(LayerStack *layer_stack) { if (error != kErrorNone) { return error; } - + // Stop dropping vsync when first commit is received after idle fallback. + drop_hw_vsync_ = false; DLOGI_IF(kTagDisplay, "Exiting commit for display type : %d", display_type_); return kErrorNone; } @@ -1029,6 +1032,10 @@ DisplayError DisplayBase::SetVSyncState(bool enable) { if (vsync_enable_ != enable) { error = hw_intf_->SetVSyncState(enable); if (error == kErrorNotSupported) { + if (drop_skewed_vsync_ && (hw_panel_info_.mode == kModeVideo) && + enable && (current_refresh_rate_ == hw_panel_info_.min_fps)) { + drop_hw_vsync_ = true; + } error = hw_events_intf_->SetEventState(HWEvent::VSYNC, enable); } if (error == kErrorNone) { diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h index 014ea112..514f09d4 100644 --- a/sdm/libs/core/display_base.h +++ b/sdm/libs/core/display_base.h @@ -189,6 +189,9 @@ class DisplayBase : public DisplayInterface { bool hdr_mode_ = false; int disable_hdr_lut_gen_ = 0; DisplayState last_power_mode_ = kStateOff; + bool drop_hw_vsync_ = false; + uint32_t current_refresh_rate_ = 0; + bool drop_skewed_vsync_ = false; }; } // namespace sdm diff --git a/sdm/libs/core/display_primary.cpp b/sdm/libs/core/display_primary.cpp index 8466f8bf..8d9c2540 100644 --- a/sdm/libs/core/display_primary.cpp +++ b/sdm/libs/core/display_primary.cpp @@ -291,7 +291,7 @@ DisplayError DisplayPrimary::SetRefreshRate(uint32_t refresh_rate, bool final_ra } DisplayError DisplayPrimary::VSync(int64_t timestamp) { - if (vsync_enable_) { + if (vsync_enable_ && !drop_hw_vsync_) { DisplayEventVSync vsync; vsync.timestamp = timestamp; event_handler_->VSync(vsync); diff --git a/sdm/libs/core/display_primary.h b/sdm/libs/core/display_primary.h index a4dd4b84..621906b3 100644 --- a/sdm/libs/core/display_primary.h +++ b/sdm/libs/core/display_primary.h @@ -71,7 +71,6 @@ class DisplayPrimary : public DisplayBase, HWEventHandler { bool avr_prop_disabled_ = false; bool switch_to_cmd_ = false; bool handle_idle_timeout_ = false; - uint32_t current_refresh_rate_ = 0; bool reset_panel_ = false; };