From dce3654d919012925f4c0973ca712b74e9f0c7ac Mon Sep 17 00:00:00 2001 From: Sushil Chauhan Date: Fri, 3 Mar 2017 18:17:31 -0800 Subject: [PATCH] sdm: Reset the H/W layers of display SDM does not reset the H/W layers for the use case, when there are no App layers present in the draw cycle. It leads to crash in SF dumpsys. Hence, reset the H/W layers of display in all the use cases. Add SDM error type which indicates the use case, when there are no App layers in the draw cycle. CRs-Fixed: 2008789 Change-Id: Ia0c0d237e6e4033993b8d2e46b6a792ff5f18340 --- sdm/include/core/sdm_types.h | 3 ++- sdm/libs/core/display_base.cpp | 4 ++-- sdm/libs/hwc/hwc_display.cpp | 4 ++-- sdm/libs/hwc/hwc_display_primary.cpp | 12 +++--------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sdm/include/core/sdm_types.h b/sdm/include/core/sdm_types.h index 367ab380..fae11531 100644 --- a/sdm/include/core/sdm_types.h +++ b/sdm/include/core/sdm_types.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014 - 2015, 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 @@ -54,6 +54,7 @@ enum DisplayError { kErrorTimeOut, //!< The operation has timed out to prevent client from waiting forever. kErrorShutDown, //!< Driver is processing shutdown sequence kErrorPerfValidation, //!< Bandwidth or Clock requirement validation failure. + kErrorNoAppLayers, //!< No App layer(s) in the draw cycle. }; /*! @brief This structure is defined for client and library compatibility check purpose only. This diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp index 33785599..c6501bf9 100644 --- a/sdm/libs/core/display_base.cpp +++ b/sdm/libs/core/display_base.cpp @@ -156,8 +156,8 @@ DisplayError DisplayBase::BuildLayerStackStats(LayerStack *layer_stack) { hw_layers_info.gpu_target_index, display_type_); if (!hw_layers_info.app_layer_count) { - DLOGE("Layer count is zero"); - return kErrorParameters; + DLOGW("Layer count is zero"); + return kErrorNoAppLayers; } if (hw_layers_info.gpu_target_index) { diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp index c1e41345..3437dcda 100644 --- a/sdm/libs/hwc/hwc_display.cpp +++ b/sdm/libs/hwc/hwc_display.cpp @@ -716,13 +716,13 @@ int HWCDisplay::PrepareLayerStack(hwc_display_contents_1_t *content_list) { if (error != kErrorNone) { if (error == kErrorShutDown) { shutdown_pending_ = true; - } else if (error != kErrorPermission) { + } else if ((error != kErrorPermission) && (error != kErrorNoAppLayers)) { 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; } else { - DLOGI("Prepare failed for Display = %d Error = %d", type_, error); + DLOGV("Prepare failed for Display = %d Error = %d", type_, error); } return 0; } diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp index 8b0a6f2b..ba351b5b 100644 --- a/sdm/libs/hwc/hwc_display_primary.cpp +++ b/sdm/libs/hwc/hwc_display_primary.cpp @@ -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 @@ -208,14 +208,7 @@ int HWCDisplayPrimary::Prepare(hwc_display_contents_1_t *content_list) { } if (content_list->numHwLayers <= 1) { - DisplayConfigFixedInfo display_config; - display_intf_->GetConfig(&display_config); - if (display_config.is_cmdmode) { - DLOGV("Skipping null commit on cmd mode panel"); - } else { - flush_ = true; - } - return 0; + flush_ = true; } status = PrepareLayerStack(content_list); @@ -233,6 +226,7 @@ int HWCDisplayPrimary::Commit(hwc_display_contents_1_t *content_list) { display_intf_->GetConfig(&display_config); if (content_list->numHwLayers <= 1 && display_config.is_cmdmode) { DLOGV("Skipping null commit on cmd mode panel"); + flush_ = false; return 0; }