Merge "sdm: Allow draw cycle in doze state." into dev-1.0
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
efd6a35316
@@ -41,6 +41,7 @@ enum DisplayError {
|
|||||||
kErrorNone, //!< Call executed successfully.
|
kErrorNone, //!< Call executed successfully.
|
||||||
kErrorUndefined, //!< An unspecified error has occured.
|
kErrorUndefined, //!< An unspecified error has occured.
|
||||||
kErrorNotSupported, //!< Requested operation is not supported.
|
kErrorNotSupported, //!< Requested operation is not supported.
|
||||||
|
kErrorPermission, //!< Operation is not permitted in current state.
|
||||||
kErrorVersion, //!< Client is using advanced version of interfaces and calling into an
|
kErrorVersion, //!< Client is using advanced version of interfaces and calling into an
|
||||||
//!< older version of display library.
|
//!< older version of display library.
|
||||||
kErrorDataAlignment, //!< Client data structures are not aligned on naturual boundaries.
|
kErrorDataAlignment, //!< Client data structures are not aligned on naturual boundaries.
|
||||||
|
|||||||
@@ -175,57 +175,58 @@ DisplayError DisplayBase::Prepare(LayerStack *layer_stack) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state_ == kStateOn) {
|
if (!active_) {
|
||||||
if (color_mgr_) {
|
return kErrorPermission;
|
||||||
disable_partial_update = color_mgr_->NeedsPartialUpdateDisable();
|
}
|
||||||
if (disable_partial_update) {
|
|
||||||
ControlPartialUpdate(false, &pending);
|
if (color_mgr_) {
|
||||||
|
disable_partial_update = color_mgr_->NeedsPartialUpdateDisable();
|
||||||
|
if (disable_partial_update) {
|
||||||
|
ControlPartialUpdate(false, &pending);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean hw layers for reuse.
|
||||||
|
hw_layers_.info = HWLayersInfo();
|
||||||
|
hw_layers_.info.stack = layer_stack;
|
||||||
|
hw_layers_.output_compression = 1.0f;
|
||||||
|
|
||||||
|
comp_manager_->PrePrepare(display_comp_ctx_, &hw_layers_);
|
||||||
|
while (true) {
|
||||||
|
error = comp_manager_->Prepare(display_comp_ctx_, &hw_layers_);
|
||||||
|
if (error != kErrorNone) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsRotationRequired(&hw_layers_)) {
|
||||||
|
if (!rotator_intf_) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
error = rotator_intf_->Prepare(display_rotator_ctx_, &hw_layers_);
|
||||||
|
} else {
|
||||||
|
// Release all the previous rotator sessions.
|
||||||
|
if (rotator_intf_) {
|
||||||
|
error = rotator_intf_->Purge(display_rotator_ctx_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean hw layers for reuse.
|
if (error == kErrorNone) {
|
||||||
hw_layers_.info = HWLayersInfo();
|
error = hw_intf_->Validate(&hw_layers_);
|
||||||
hw_layers_.info.stack = layer_stack;
|
if (error == kErrorNone) {
|
||||||
hw_layers_.output_compression = 1.0f;
|
// Strategy is successful now, wait for Commit().
|
||||||
|
pending_commit_ = true;
|
||||||
comp_manager_->PrePrepare(display_comp_ctx_, &hw_layers_);
|
|
||||||
while (true) {
|
|
||||||
error = comp_manager_->Prepare(display_comp_ctx_, &hw_layers_);
|
|
||||||
if (error != kErrorNone) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (error == kErrorShutDown) {
|
||||||
if (IsRotationRequired(&hw_layers_)) {
|
comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
|
||||||
if (!rotator_intf_) {
|
return error;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
error = rotator_intf_->Prepare(display_rotator_ctx_, &hw_layers_);
|
|
||||||
} else {
|
|
||||||
// Release all the previous rotator sessions.
|
|
||||||
if (rotator_intf_) {
|
|
||||||
error = rotator_intf_->Purge(display_rotator_ctx_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error == kErrorNone) {
|
|
||||||
error = hw_intf_->Validate(&hw_layers_);
|
|
||||||
if (error == kErrorNone) {
|
|
||||||
// Strategy is successful now, wait for Commit().
|
|
||||||
pending_commit_ = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (error == kErrorShutDown) {
|
|
||||||
comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
|
}
|
||||||
if (disable_partial_update) {
|
|
||||||
ControlPartialUpdate(true, &pending);
|
comp_manager_->PostPrepare(display_comp_ctx_, &hw_layers_);
|
||||||
}
|
if (disable_partial_update) {
|
||||||
} else {
|
ControlPartialUpdate(true, &pending);
|
||||||
return kErrorNotSupported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
@@ -238,8 +239,8 @@ DisplayError DisplayBase::Commit(LayerStack *layer_stack) {
|
|||||||
return kErrorParameters;
|
return kErrorParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state_ != kStateOn) {
|
if (!active_) {
|
||||||
return kErrorNotSupported;
|
return kErrorPermission;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pending_commit_) {
|
if (!pending_commit_) {
|
||||||
@@ -300,8 +301,8 @@ DisplayError DisplayBase::Commit(LayerStack *layer_stack) {
|
|||||||
DisplayError DisplayBase::Flush() {
|
DisplayError DisplayBase::Flush() {
|
||||||
DisplayError error = kErrorNone;
|
DisplayError error = kErrorNone;
|
||||||
|
|
||||||
if (state_ != kStateOn) {
|
if (!active_) {
|
||||||
return kErrorNone;
|
return kErrorPermission;
|
||||||
}
|
}
|
||||||
|
|
||||||
hw_layers_.info.count = 0;
|
hw_layers_.info.count = 0;
|
||||||
@@ -369,6 +370,7 @@ bool DisplayBase::IsUnderscanSupported() {
|
|||||||
|
|
||||||
DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
||||||
DisplayError error = kErrorNone;
|
DisplayError error = kErrorNone;
|
||||||
|
bool active = false;
|
||||||
|
|
||||||
DLOGI("Set state = %d, display %d", state, display_type_);
|
DLOGI("Set state = %d, display %d", state, display_type_);
|
||||||
|
|
||||||
@@ -399,10 +401,12 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
|||||||
|
|
||||||
case kStateOn:
|
case kStateOn:
|
||||||
error = hw_intf_->PowerOn();
|
error = hw_intf_->PowerOn();
|
||||||
|
active = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kStateDoze:
|
case kStateDoze:
|
||||||
error = hw_intf_->Doze();
|
error = hw_intf_->Doze();
|
||||||
|
active = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kStateDozeSuspend:
|
case kStateDozeSuspend:
|
||||||
@@ -419,6 +423,7 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error == kErrorNone) {
|
if (error == kErrorNone) {
|
||||||
|
active_ = active;
|
||||||
state_ = state;
|
state_ = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class DisplayBase : public DisplayInterface {
|
|||||||
CompManager *comp_manager_ = NULL;
|
CompManager *comp_manager_ = NULL;
|
||||||
RotatorInterface *rotator_intf_ = NULL;
|
RotatorInterface *rotator_intf_ = NULL;
|
||||||
DisplayState state_ = kStateOff;
|
DisplayState state_ = kStateOff;
|
||||||
|
bool active_ = false;
|
||||||
Handle hw_device_ = 0;
|
Handle hw_device_ = 0;
|
||||||
Handle display_comp_ctx_ = 0;
|
Handle display_comp_ctx_ = 0;
|
||||||
Handle display_rotator_ctx_ = 0;
|
Handle display_rotator_ctx_ = 0;
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ DisplayError DisplayPrimary::SetDisplayMode(uint32_t mode) {
|
|||||||
DisplayError error = kErrorNone;
|
DisplayError error = kErrorNone;
|
||||||
HWDisplayMode hw_display_mode = kModeDefault;
|
HWDisplayMode hw_display_mode = kModeDefault;
|
||||||
|
|
||||||
if (state_ != kStateOn) {
|
if (!active_) {
|
||||||
DLOGW("Invalid display state = %d. Panel must be on.", state_);
|
DLOGW("Invalid display state = %d. Panel must be on.", state_);
|
||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ DisplayError DisplayPrimary::GetRefreshRateRange(uint32_t *min_refresh_rate,
|
|||||||
DisplayError DisplayPrimary::SetRefreshRate(uint32_t refresh_rate) {
|
DisplayError DisplayPrimary::SetRefreshRate(uint32_t refresh_rate) {
|
||||||
SCOPE_LOCK(locker_);
|
SCOPE_LOCK(locker_);
|
||||||
|
|
||||||
if (state_ != kStateOn || !hw_panel_info_.dynamic_fps) {
|
if (!active_ || !hw_panel_info_.dynamic_fps) {
|
||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,5 +74,9 @@ DisplayError HWVirtual::Validate(HWLayers *hw_layers) {
|
|||||||
return HWDevice::Validate(hw_layers);
|
return HWDevice::Validate(hw_layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisplayError HWVirtual::Flush() {
|
||||||
|
return kErrorNone;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class HWVirtual : public HWDevice {
|
|||||||
HWVirtual(BufferSyncHandler *buffer_sync_handler, HWInfoInterface *hw_info_intf);
|
HWVirtual(BufferSyncHandler *buffer_sync_handler, HWInfoInterface *hw_info_intf);
|
||||||
virtual DisplayError Init(HWEventHandler *eventhandler);
|
virtual DisplayError Init(HWEventHandler *eventhandler);
|
||||||
virtual DisplayError Validate(HWLayers *hw_layers);
|
virtual DisplayError Validate(HWLayers *hw_layers);
|
||||||
|
virtual DisplayError Flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ int HWCDisplay::EventControl(int event, int enable) {
|
|||||||
int HWCDisplay::SetPowerMode(int mode) {
|
int HWCDisplay::SetPowerMode(int mode) {
|
||||||
DLOGI("display = %d, mode = %d", id_, mode);
|
DLOGI("display = %d, mode = %d", id_, mode);
|
||||||
DisplayState state = kStateOff;
|
DisplayState state = kStateOff;
|
||||||
|
bool flush_on_error = flush_on_error_;
|
||||||
|
|
||||||
if (shutdown_pending_) {
|
if (shutdown_pending_) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -170,26 +171,35 @@ int HWCDisplay::SetPowerMode(int mode) {
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case HWC_POWER_MODE_OFF:
|
case HWC_POWER_MODE_OFF:
|
||||||
|
// During power off, all of the buffers are released.
|
||||||
|
// Do not flush until a buffer is successfully submitted again.
|
||||||
|
flush_on_error = false;
|
||||||
state = kStateOff;
|
state = kStateOff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HWC_POWER_MODE_NORMAL:
|
case HWC_POWER_MODE_NORMAL:
|
||||||
state = kStateOn;
|
state = kStateOn;
|
||||||
last_power_mode_ = HWC_POWER_MODE_NORMAL;
|
last_power_mode_ = HWC_POWER_MODE_NORMAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HWC_POWER_MODE_DOZE:
|
case HWC_POWER_MODE_DOZE:
|
||||||
state = kStateDoze;
|
state = kStateDoze;
|
||||||
last_power_mode_ = HWC_POWER_MODE_DOZE;
|
last_power_mode_ = HWC_POWER_MODE_DOZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HWC_POWER_MODE_DOZE_SUSPEND:
|
case HWC_POWER_MODE_DOZE_SUSPEND:
|
||||||
state = kStateDozeSuspend;
|
state = kStateDozeSuspend;
|
||||||
last_power_mode_ = HWC_POWER_MODE_DOZE_SUSPEND;
|
last_power_mode_ = HWC_POWER_MODE_DOZE_SUSPEND;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError error = display_intf_->SetDisplayState(state);
|
DisplayError error = display_intf_->SetDisplayState(state);
|
||||||
if (error != kErrorNone) {
|
if (error == kErrorNone) {
|
||||||
|
flush_on_error_ = flush_on_error;
|
||||||
|
} else {
|
||||||
if (error == kErrorShutDown) {
|
if (error == kErrorShutDown) {
|
||||||
shutdown_pending_ = true;
|
shutdown_pending_ = true;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -593,6 +603,7 @@ int HWCDisplay::PrepareLayerStack(hwc_display_contents_1_t *content_list) {
|
|||||||
if (shutdown_pending_) {
|
if (shutdown_pending_) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t num_hw_layers = content_list->numHwLayers;
|
size_t num_hw_layers = content_list->numHwLayers;
|
||||||
|
|
||||||
if (!skip_prepare_) {
|
if (!skip_prepare_) {
|
||||||
@@ -600,12 +611,12 @@ int HWCDisplay::PrepareLayerStack(hwc_display_contents_1_t *content_list) {
|
|||||||
if (error != kErrorNone) {
|
if (error != kErrorNone) {
|
||||||
if (error == kErrorShutDown) {
|
if (error == kErrorShutDown) {
|
||||||
shutdown_pending_ = true;
|
shutdown_pending_ = true;
|
||||||
return 0;
|
} else if (error != kErrorPermission) {
|
||||||
|
DLOGE("Prepare failed. Error = %d", error);
|
||||||
|
// To prevent surfaceflinger infinite wait, flush the previous frame during Commit()
|
||||||
|
// so that previous buffer and fences are released, and override the error.
|
||||||
|
flush_ = true;
|
||||||
}
|
}
|
||||||
DLOGE("Prepare failed. Error = %d", error);
|
|
||||||
// To prevent surfaceflinger infinite wait, flush the previous frame during Commit() so that
|
|
||||||
// previous buffer and fences are released, and override the error.
|
|
||||||
flush_ = true;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -685,17 +696,18 @@ int HWCDisplay::CommitLayerStack(hwc_display_contents_1_t *content_list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error == kErrorNone) {
|
if (error == kErrorNone) {
|
||||||
// Do no call flush on errors, if a successful buffer is never submitted.
|
// A commit is successfully submitted, start flushing on failure now onwards.
|
||||||
flush_on_error_ = true;
|
flush_on_error_ = true;
|
||||||
} else {
|
} else {
|
||||||
if (error == kErrorShutDown) {
|
if (error == kErrorShutDown) {
|
||||||
shutdown_pending_ = true;
|
shutdown_pending_ = true;
|
||||||
return status;
|
return status;
|
||||||
|
} else if (error != kErrorPermission) {
|
||||||
|
DLOGE("Commit failed. Error = %d", error);
|
||||||
|
// To prevent surfaceflinger infinite wait, flush the previous frame during Commit()
|
||||||
|
// so that previous buffer and fences are released, and override the error.
|
||||||
|
flush_ = true;
|
||||||
}
|
}
|
||||||
DLOGE("Commit failed. Error = %d", error);
|
|
||||||
// To prevent surfaceflinger infinite wait, flush the previous frame during Commit() so that
|
|
||||||
// previous buffer and fences are released, and override the error.
|
|
||||||
flush_ = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,11 +718,9 @@ int HWCDisplay::PostCommitLayerStack(hwc_display_contents_1_t *content_list) {
|
|||||||
size_t num_hw_layers = content_list->numHwLayers;
|
size_t num_hw_layers = content_list->numHwLayers;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
|
// Do no call flush on errors, if a successful buffer is never submitted.
|
||||||
if (flush_ && flush_on_error_) {
|
if (flush_ && flush_on_error_) {
|
||||||
DisplayError error = display_intf_->Flush();
|
display_intf_->Flush();
|
||||||
if (error != kErrorNone) {
|
|
||||||
DLOGE("Flush failed. Error = %d", error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the release fence fd to the blit engine
|
// Set the release fence fd to the blit engine
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ class HWCDisplay : public DisplayEventHandler {
|
|||||||
bool use_blit_comp_ = false;
|
bool use_blit_comp_ = false;
|
||||||
bool secure_display_active_ = false;
|
bool secure_display_active_ = false;
|
||||||
bool skip_prepare_ = false;
|
bool skip_prepare_ = false;
|
||||||
|
|
||||||
bool solid_fill_enable_ = false;
|
bool solid_fill_enable_ = false;
|
||||||
uint32_t solid_fill_color_ = 0;
|
uint32_t solid_fill_color_ = 0;
|
||||||
LayerRect display_rect_;
|
LayerRect display_rect_;
|
||||||
|
|||||||
6
sdm/libs/hwc/hwc_display_external.cpp
Normal file → Executable file
6
sdm/libs/hwc/hwc_display_external.cpp
Normal file → Executable file
@@ -92,12 +92,6 @@ int HWCDisplayExternal::Prepare(hwc_display_contents_1_t *content_list) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t num_hw_layers = content_list->numHwLayers;
|
|
||||||
if (num_hw_layers <= 1) {
|
|
||||||
flush_ = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = PrePrepareLayerStack(content_list);
|
status = PrePrepareLayerStack(content_list);
|
||||||
if (status) {
|
if (status) {
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
6
sdm/libs/hwc/hwc_display_primary.cpp
Normal file → Executable file
6
sdm/libs/hwc/hwc_display_primary.cpp
Normal file → Executable file
@@ -127,12 +127,6 @@ int HWCDisplayPrimary::Prepare(hwc_display_contents_1_t *content_list) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t num_hw_layers = content_list->numHwLayers;
|
|
||||||
if (num_hw_layers <= 1) {
|
|
||||||
flush_ = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = PrePrepareLayerStack(content_list);
|
status = PrePrepareLayerStack(content_list);
|
||||||
if (status) {
|
if (status) {
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user