Merge "sdm: Change idle fallback time dynamically."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
d77bc08802
@@ -405,11 +405,11 @@ class DisplayInterface {
|
||||
|
||||
/*! @brief Method to set idle timeout value. Idle fallback is disabled with timeout value 0.
|
||||
|
||||
@param[in] timeout value in milliseconds.
|
||||
@param[in] active_ms value in milliseconds.
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetIdleTimeoutMs(uint32_t timeout_ms) = 0;
|
||||
virtual void SetIdleTimeoutMs(uint32_t active_ms) = 0;
|
||||
|
||||
/*! @brief Method to set maximum number of mixer stages for each display.
|
||||
|
||||
|
||||
@@ -469,7 +469,9 @@ struct HWLayersInfo {
|
||||
// be programmed on hardware.
|
||||
uint32_t roi_index[kMaxSDELayers] = {0}; // Stores the ROI index where the layers are visible.
|
||||
|
||||
int sync_handle = -1;
|
||||
int sync_handle = -1; // Release fence id for current draw cycle.
|
||||
int set_idle_time_ms = -1; // Set idle time to the new specified value.
|
||||
// -1 indicates no change in idle time since last set value.
|
||||
|
||||
std::vector<LayerRect> left_frame_roi = {}; // Left ROI.
|
||||
std::vector<LayerRect> right_frame_roi = {}; // Right ROI.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2014 - 2017, 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:
|
||||
@@ -54,6 +54,7 @@ class StrategyInterface {
|
||||
const DisplayConfigVariableInfo &fb_config) = 0;
|
||||
virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable) = 0;
|
||||
virtual DisplayError Purge() = 0;
|
||||
virtual DisplayError SetIdleTimeoutMs(uint32_t active_ms) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~StrategyInterface() { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2014 - 2017, 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:
|
||||
@@ -48,6 +48,8 @@
|
||||
#define ROUND_UP_ALIGN_UP(value, a) FLOAT(CeilToMultipleOf(UINT32(value + 0.5f), UINT32(a)))
|
||||
|
||||
#define IDLE_TIMEOUT_DEFAULT_MS 70
|
||||
#define IDLE_TIMEOUT_ACTIVE_MS IDLE_TIMEOUT_DEFAULT_MS
|
||||
#define IDLE_TIMEOUT_INACTIVE_MS 520
|
||||
|
||||
#define IS_RGB_FORMAT(format) (((format) < kFormatYCbCr420Planar) ? true: false)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2014 - 2017, 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
|
||||
@@ -64,7 +64,7 @@ class Debug {
|
||||
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
||||
static int GetSimulationFlag();
|
||||
static int GetHDMIResolution();
|
||||
static uint32_t GetIdleTimeoutMs();
|
||||
static void GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms);
|
||||
static int GetBootAnimLayerCount();
|
||||
static bool IsRotatorDownScaleDisabled();
|
||||
static bool IsDecimationDisabled();
|
||||
|
||||
@@ -397,6 +397,15 @@ void CompManager::Purge(Handle display_ctx) {
|
||||
display_comp_ctx->strategy->Purge();
|
||||
}
|
||||
|
||||
DisplayError CompManager::SetIdleTimeoutMs(Handle display_ctx, uint32_t active_ms) {
|
||||
SCOPE_LOCK(locker_);
|
||||
|
||||
DisplayCompositionContext *display_comp_ctx =
|
||||
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
|
||||
|
||||
return display_comp_ctx->strategy->SetIdleTimeoutMs(active_ms);
|
||||
}
|
||||
|
||||
void CompManager::ProcessIdleTimeout(Handle display_ctx) {
|
||||
SCOPE_LOCK(locker_);
|
||||
|
||||
@@ -518,21 +527,6 @@ DisplayError CompManager::SetMaxBandwidthMode(HWBwModes mode) {
|
||||
return resource_intf_->SetMaxBandwidthMode(mode);
|
||||
}
|
||||
|
||||
bool CompManager::CanSetIdleTimeout(Handle display_ctx) {
|
||||
DisplayCompositionContext *display_comp_ctx =
|
||||
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
|
||||
|
||||
if (!display_comp_ctx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!display_comp_ctx->idle_fallback) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DisplayError CompManager::GetScaleLutConfig(HWScaleLutInfo *lut_info) {
|
||||
return resource_intf_->GetScaleLutConfig(lut_info);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ class CompManager : public DumpImpl {
|
||||
DisplayError ReConfigure(Handle display_ctx, HWLayers *hw_layers);
|
||||
DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers);
|
||||
void Purge(Handle display_ctx);
|
||||
DisplayError SetIdleTimeoutMs(Handle display_ctx, uint32_t active_ms);
|
||||
void ProcessIdleTimeout(Handle display_ctx);
|
||||
void ProcessThermalEvent(Handle display_ctx, int64_t thermal_level);
|
||||
void ProcessIdlePowerCollapse(Handle display_ctx);
|
||||
@@ -67,7 +68,6 @@ class CompManager : public DumpImpl {
|
||||
DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst, bool rotate90);
|
||||
DisplayError ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers, int x, int y);
|
||||
bool SupportLayerAsCursor(Handle display_ctx, HWLayers *hw_layers);
|
||||
bool CanSetIdleTimeout(Handle display_ctx);
|
||||
bool SetDisplayState(Handle display_ctx, DisplayState state, DisplayType display_type);
|
||||
DisplayError SetMaxBandwidthMode(HWBwModes mode);
|
||||
DisplayError GetScaleLutConfig(HWScaleLutInfo *lut_info);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2014-2017, 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:
|
||||
@@ -99,7 +99,7 @@ class DisplayBase : public DisplayInterface, DumpImpl {
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
virtual DisplayError SetVSyncState(bool enable);
|
||||
virtual void SetIdleTimeoutMs(uint32_t timeout_ms) {}
|
||||
virtual void SetIdleTimeoutMs(uint32_t active_ms) {}
|
||||
virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
|
||||
virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
|
||||
virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info);
|
||||
|
||||
@@ -59,8 +59,6 @@ DisplayError DisplayPrimary::Init() {
|
||||
return error;
|
||||
}
|
||||
|
||||
idle_timeout_ms_ = Debug::GetIdleTimeoutMs();
|
||||
|
||||
if (hw_panel_info_.mode == kModeCommand && Debug::IsVideoModeEnabled()) {
|
||||
error = hw_intf_->SetDisplayMode(kModeVideo);
|
||||
if (error != kErrorNone) {
|
||||
@@ -145,8 +143,6 @@ DisplayError DisplayPrimary::Commit(LayerStack *layer_stack) {
|
||||
}
|
||||
}
|
||||
|
||||
bool set_idle_timeout = comp_manager_->CanSetIdleTimeout(display_comp_ctx_);
|
||||
|
||||
error = DisplayBase::Commit(layer_stack);
|
||||
if (error != kErrorNone) {
|
||||
return error;
|
||||
@@ -154,13 +150,12 @@ DisplayError DisplayPrimary::Commit(LayerStack *layer_stack) {
|
||||
|
||||
DisplayBase::ReconfigureDisplay();
|
||||
|
||||
if (hw_panel_info_.mode == kModeVideo) {
|
||||
if (set_idle_timeout && !layer_stack->flags.single_buffered_layer_present) {
|
||||
hw_intf_->SetIdleTimeoutMs(idle_timeout_ms_);
|
||||
} else {
|
||||
hw_intf_->SetIdleTimeoutMs(0);
|
||||
int idle_time_ms = hw_layers_.info.set_idle_time_ms;
|
||||
if (idle_time_ms >= 0) {
|
||||
hw_intf_->SetIdleTimeoutMs(UINT32(idle_time_ms));
|
||||
}
|
||||
} else if (switch_to_cmd_) {
|
||||
|
||||
if (switch_to_cmd_) {
|
||||
uint32_t pending;
|
||||
switch_to_cmd_ = false;
|
||||
ControlPartialUpdate(true /* enable */, &pending);
|
||||
@@ -185,19 +180,20 @@ DisplayError DisplayPrimary::SetDisplayState(DisplayState state) {
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
void DisplayPrimary::SetIdleTimeoutMs(uint32_t timeout_ms) {
|
||||
void DisplayPrimary::SetIdleTimeoutMs(uint32_t active_ms) {
|
||||
lock_guard<recursive_mutex> obj(recursive_mutex_);
|
||||
|
||||
// Idle fallback feature is supported only for video mode panel.
|
||||
if (hw_panel_info_.mode == kModeVideo) {
|
||||
hw_intf_->SetIdleTimeoutMs(timeout_ms);
|
||||
if (comp_manager_->SetIdleTimeoutMs(display_comp_ctx_, active_ms) == kErrorNone) {
|
||||
hw_intf_->SetIdleTimeoutMs(active_ms);
|
||||
}
|
||||
idle_timeout_ms_ = timeout_ms;
|
||||
}
|
||||
|
||||
DisplayError DisplayPrimary::SetDisplayMode(uint32_t mode) {
|
||||
lock_guard<recursive_mutex> obj(recursive_mutex_);
|
||||
DisplayError error = kErrorNone;
|
||||
|
||||
// Limit scope of mutex to this block
|
||||
{
|
||||
lock_guard<recursive_mutex> obj(recursive_mutex_);
|
||||
HWDisplayMode hw_display_mode = static_cast<HWDisplayMode>(mode);
|
||||
uint32_t pending = 0;
|
||||
|
||||
@@ -226,11 +222,16 @@ DisplayError DisplayPrimary::SetDisplayMode(uint32_t mode) {
|
||||
|
||||
if (mode == kModeVideo) {
|
||||
ControlPartialUpdate(false /* enable */, &pending);
|
||||
hw_intf_->SetIdleTimeoutMs(idle_timeout_ms_);
|
||||
} else if (mode == kModeCommand) {
|
||||
switch_to_cmd_ = true;
|
||||
// Flush idle timeout value currently set.
|
||||
hw_intf_->SetIdleTimeoutMs(0);
|
||||
switch_to_cmd_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Request for a new draw cycle. New display mode will get applied on next draw cycle.
|
||||
// New idle time will get configured as part of this.
|
||||
event_handler_->Refresh();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class DisplayPrimary : public DisplayBase, HWEventHandler {
|
||||
virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending);
|
||||
virtual DisplayError DisablePartialUpdateOneFrame();
|
||||
virtual DisplayError SetDisplayState(DisplayState state);
|
||||
virtual void SetIdleTimeoutMs(uint32_t timeout_ms);
|
||||
virtual void SetIdleTimeoutMs(uint32_t active_ms);
|
||||
virtual DisplayError SetDisplayMode(uint32_t mode);
|
||||
virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate);
|
||||
virtual DisplayError SetRefreshRate(uint32_t refresh_rate);
|
||||
@@ -63,7 +63,6 @@ class DisplayPrimary : public DisplayBase, HWEventHandler {
|
||||
private:
|
||||
bool NeedsAVREnable();
|
||||
|
||||
uint32_t idle_timeout_ms_ = 0;
|
||||
std::vector<HWEvent> event_list_ = { HWEvent::VSYNC, HWEvent::EXIT, HWEvent::IDLE_NOTIFY,
|
||||
HWEvent::SHOW_BLANK_EVENT, HWEvent::THERMAL_LEVEL, HWEvent::IDLE_POWER_COLLAPSE };
|
||||
bool avr_prop_disabled_ = false;
|
||||
|
||||
@@ -254,5 +254,12 @@ DisplayError Strategy::Purge() {
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
DisplayError Strategy::SetIdleTimeoutMs(uint32_t active_ms) {
|
||||
if (strategy_intf_) {
|
||||
return strategy_intf_->SetIdleTimeoutMs(active_ms);
|
||||
}
|
||||
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2014 - 2017, 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:
|
||||
@@ -52,6 +52,7 @@ class Strategy {
|
||||
const DisplayConfigVariableInfo &fb_config);
|
||||
DisplayError SetCompositionState(LayerComposition composition_type, bool enable);
|
||||
DisplayError Purge();
|
||||
DisplayError SetIdleTimeoutMs(uint32_t active_ms);
|
||||
|
||||
private:
|
||||
void GenerateROI();
|
||||
|
||||
@@ -54,11 +54,15 @@ int Debug::GetHDMIResolution() {
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t Debug::GetIdleTimeoutMs() {
|
||||
int value = IDLE_TIMEOUT_DEFAULT_MS;
|
||||
debug_.debug_handler_->GetProperty("sdm.idle_time", &value);
|
||||
void Debug::GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms) {
|
||||
int active_val = IDLE_TIMEOUT_ACTIVE_MS;
|
||||
int inactive_val = IDLE_TIMEOUT_INACTIVE_MS;
|
||||
|
||||
return UINT32(value);
|
||||
debug_.debug_handler_->GetProperty("sdm.idle_time", &active_val);
|
||||
debug_.debug_handler_->GetProperty("sdm.idle_time.inactive", &inactive_val);
|
||||
|
||||
*active_ms = UINT32(active_val);
|
||||
*inactive_ms = UINT32(inactive_val);
|
||||
}
|
||||
|
||||
int Debug::GetBootAnimLayerCount() {
|
||||
|
||||
Reference in New Issue
Block a user