From 9ded89a4f9b018565a1624d1bbcb63110c36ea49 Mon Sep 17 00:00:00 2001 From: Baldev Sahu Date: Wed, 4 Apr 2018 11:39:20 +0530 Subject: [PATCH] hwc2: Allow commit to go through if flush_ flag is set Allow commit to go through if flush_ flag is set even if display is not validated Change-Id: Ic87f87342a72de541fe79ba514915dd5e6e13c86 CRs-Fixed: 2218342 --- sdm/libs/hwc2/hwc_display.cpp | 61 ++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp index dd049de8..6f59b4c9 100644 --- a/sdm/libs/hwc2/hwc_display.cpp +++ b/sdm/libs/hwc2/hwc_display.cpp @@ -1250,6 +1250,10 @@ HWC2::Error HWCDisplay::GetHdrCapabilities(uint32_t *out_num_types, int32_t *out HWC2::Error HWCDisplay::CommitLayerStack(void) { + if (flush_) { + return HWC2::Error::None; + } + if (skip_validate_ && !CanSkipValidate()) { validated_ = false; } @@ -1265,37 +1269,36 @@ HWC2::Error HWCDisplay::CommitLayerStack(void) { DumpInputBuffers(); - if (!flush_) { - DisplayError error = kErrorUndefined; - int status = 0; - if (tone_mapper_) { - if (layer_stack_.flags.hdr_present) { - status = tone_mapper_->HandleToneMap(&layer_stack_); - if (status != 0) { - DLOGE("Error handling HDR in ToneMapper"); - } - } else { - tone_mapper_->Terminate(); + DisplayError error = kErrorUndefined; + int status = 0; + if (tone_mapper_) { + if (layer_stack_.flags.hdr_present) { + status = tone_mapper_->HandleToneMap(&layer_stack_); + if (status != 0) { + DLOGE("Error handling HDR in ToneMapper"); } - } - error = display_intf_->Commit(&layer_stack_); - - if (error == kErrorNone) { - // A commit is successfully submitted, start flushing on failure now onwards. - flush_on_error_ = true; } else { - if (error == kErrorShutDown) { - shutdown_pending_ = true; - return HWC2::Error::Unsupported; - } else if (error == kErrorNotValidated) { - validated_ = false; - return HWC2::Error::NotValidated; - } 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; - } + tone_mapper_->Terminate(); + } + } + + error = display_intf_->Commit(&layer_stack_); + + if (error == kErrorNone) { + // A commit is successfully submitted, start flushing on failure now onwards. + flush_on_error_ = true; + } else { + if (error == kErrorShutDown) { + shutdown_pending_ = true; + return HWC2::Error::Unsupported; + } else if (error == kErrorNotValidated) { + validated_ = false; + return HWC2::Error::NotValidated; + } 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; } }