diff options
| author | Gousemoodhin Nadaf <quic_gnadaf@quicinc.com> | 2018-07-10 12:06:01 -0700 |
|---|---|---|
| committer | Chris Lu <luchris@google.com> | 2019-06-12 11:17:14 +0800 |
| commit | cff085103df025e32f0c2294b24b601abea25e22 (patch) | |
| tree | 3c18dd16598eaa54a2f99d3593415971c0f1c490 | |
| parent | 37d5a75391fa26c1ed2e1983892de71f945f9c37 (diff) | |
sdm: Allow Skip Validate when Partial Update is disabled
Allow Skip Validate, if the Partial Update feature is not enabled
on Display and surface is getting updated on the updating layer(s).
Bug: 118713045
Test: run vts -m VtsHalGraphicsComposerV2_1Target
Change-Id: I0524818fb4cbb11dcc8fc993fa7ae536bd555709
| -rw-r--r-- | msm8996/sdm/include/core/display_interface.h | 3 | ||||
| -rw-r--r-- | msm8996/sdm/libs/core/display_base.cpp | 3 | ||||
| -rw-r--r-- | msm8996/sdm/libs/hwc2/hwc_display.cpp | 27 | ||||
| -rw-r--r-- | msm8996/sdm/libs/hwc2/hwc_display.h | 6 | ||||
| -rw-r--r-- | msm8996/sdm/libs/hwc2/hwc_layers.cpp | 34 | ||||
| -rw-r--r-- | msm8996/sdm/libs/hwc2/hwc_layers.h | 7 | ||||
| -rw-r--r-- | msm8998/sdm/include/core/display_interface.h | 3 | ||||
| -rw-r--r-- | msm8998/sdm/libs/core/display_base.cpp | 3 | ||||
| -rw-r--r-- | msm8998/sdm/libs/hwc2/hwc_display.cpp | 25 | ||||
| -rw-r--r-- | msm8998/sdm/libs/hwc2/hwc_display.h | 5 | ||||
| -rw-r--r-- | msm8998/sdm/libs/hwc2/hwc_layers.cpp | 34 | ||||
| -rw-r--r-- | msm8998/sdm/libs/hwc2/hwc_layers.h | 7 |
12 files changed, 107 insertions, 50 deletions
diff --git a/msm8996/sdm/include/core/display_interface.h b/msm8996/sdm/include/core/display_interface.h index bb89d1d7d..612918ab9 100644 --- a/msm8996/sdm/include/core/display_interface.h +++ b/msm8996/sdm/include/core/display_interface.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved. +* Copyright (c) 2014 - 2016, 2019, 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: @@ -126,6 +126,7 @@ enum ContentQuality { struct DisplayConfigFixedInfo { bool underscan = false; //!< If display support CE underscan. bool secure = false; //!< If this display is capable of handling secure content. + bool partial_update = false; //!< If display supports Partial Update. }; /*! @brief This structure defines configuration for variable properties of a display device. diff --git a/msm8996/sdm/libs/core/display_base.cpp b/msm8996/sdm/libs/core/display_base.cpp index 1df2614e3..fd7b0b00f 100644 --- a/msm8996/sdm/libs/core/display_base.cpp +++ b/msm8996/sdm/libs/core/display_base.cpp @@ -397,6 +397,9 @@ DisplayError DisplayBase::GetConfig(uint32_t index, DisplayConfigVariableInfo *v } DisplayError DisplayBase::GetConfig(DisplayConfigFixedInfo *fixed_info) { + lock_guard<recursive_mutex> obj(recursive_mutex_); + fixed_info->partial_update = hw_panel_info_.partial_update; + return kErrorNone; } diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp index c326074f6..0264b6d92 100644 --- a/msm8996/sdm/libs/hwc2/hwc_display.cpp +++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2016, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -251,6 +251,12 @@ int HWCDisplay::Init() { current_refresh_rate_ = max_refresh_rate_; GetUnderScanConfig(); + + DisplayConfigFixedInfo fixed_info = {}; + display_intf_->GetConfig(&fixed_info); + partial_update_enabled_ = fixed_info.partial_update; + client_target_->SetPartialUpdate(partial_update_enabled_); + DLOGI("Display created with id: %d", id_); return 0; } @@ -279,6 +285,8 @@ HWC2::Error HWCDisplay::CreateLayer(hwc2_layer_t *out_layer_id) { *out_layer_id = layer->GetId(); geometry_changes_ |= GeometryChanges::kAdded; validated_ = false; + layer->SetPartialUpdate(partial_update_enabled_); + return HWC2::Error::None; } @@ -393,7 +401,7 @@ void HWCDisplay::BuildLayerStack() { layer->flags.updating = true; if (layer_set_.size() <= kMaxLayerCount) { - layer->flags.updating = IsLayerUpdating(layer); + layer->flags.updating = IsLayerUpdating(hwc_layer); } layer_stack_.layers.push_back(layer); @@ -402,6 +410,8 @@ void HWCDisplay::BuildLayerStack() { layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0); // Append client target to the layer stack layer_stack_.layers.push_back(client_target_->GetSDMLayer()); + Layer *sdm_client_target = client_target_->GetSDMLayer(); + sdm_client_target->flags.updating = IsLayerUpdating(client_target_); } void HWCDisplay::BuildSolidFillStack() { @@ -1595,24 +1605,17 @@ bool HWCDisplay::SingleLayerUpdating(void) { return (updating_count == 1); } -bool HWCDisplay::IsLayerUpdating(const Layer *layer) { +bool HWCDisplay::IsLayerUpdating(HWCLayer *hwc_layer) { + auto layer = hwc_layer->GetSDMLayer(); // Layer should be considered updating if // a) layer is in single buffer mode, or // b) valid dirty_regions(android specific hint for updating status), or // c) layer stack geometry has changed (TODO(user): Remove when SDM accepts // geometry_changed as bit fields). - return (layer->flags.single_buffer || IsSurfaceUpdated(layer->dirty_regions) || + return (layer->flags.single_buffer || hwc_layer->IsSurfaceUpdated() || geometry_changes_); } -bool HWCDisplay::IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions) { - // based on dirty_regions determine if its updating - // dirty_rect count = 0 - whole layer - updating. - // dirty_rect count = 1 or more valid rects - updating. - // dirty_rect count = 1 with (0,0,0,0) - not updating. - return (dirty_regions.empty() || IsValid(dirty_regions.at(0))); -} - uint32_t HWCDisplay::SanitizeRefreshRate(uint32_t req_refresh_rate) { uint32_t refresh_rate = req_refresh_rate; diff --git a/msm8996/sdm/libs/hwc2/hwc_display.h b/msm8996/sdm/libs/hwc2/hwc_display.h index 8d6be1cc3..e9609e539 100644 --- a/msm8996/sdm/libs/hwc2/hwc_display.h +++ b/msm8996/sdm/libs/hwc2/hwc_display.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2016, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -216,8 +216,7 @@ class HWCDisplay : public DisplayEventHandler { void MarkLayersForClientComposition(void); virtual void ApplyScanAdjustment(hwc_rect_t *display_frame); bool SingleLayerUpdating(void); - bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions); - bool IsLayerUpdating(const Layer *layer); + bool IsLayerUpdating(HWCLayer *layer); uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate); virtual void CloseAcquireFds(); virtual void GetUnderScanConfig() { } @@ -272,6 +271,7 @@ class HWCDisplay : public DisplayEventHandler { bool CanSkipValidate(); qService::QService *qservice_ = NULL; DisplayClass display_class_; + bool partial_update_enabled_ = false; }; inline int HWCDisplay::Perform(uint32_t operation, ...) { diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.cpp b/msm8996/sdm/libs/hwc2/hwc_layers.cpp index 935845e73..c3cab1ad1 100644 --- a/msm8996/sdm/libs/hwc2/hwc_layers.cpp +++ b/msm8996/sdm/libs/hwc2/hwc_layers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -128,7 +128,21 @@ HWC2::Error HWCLayer::SetLayerBuffer(buffer_handle_t buffer, int32_t acquire_fen } HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) { - // Check if there is an update in SurfaceDamage rects + surface_updated_ = true; + if ((damage.numRects == 1) && (damage.rects[0].bottom == 0) && (damage.rects[0].right == 0)) { + surface_updated_ = false; + } + + if (!layer_->flags.updating && surface_updated_) { + needs_validate_ = true; + } + + if (!partial_update_enabled_) { + SetDirtyRegions(damage); + return HWC2::Error::None; + } + + // Check if there is an update in SurfaceDamage rects. if (layer_->dirty_regions.size() != damage.numRects) { needs_validate_ = true; } else { @@ -142,12 +156,7 @@ HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) { } } - layer_->dirty_regions.clear(); - for (uint32_t i = 0; i < damage.numRects; i++) { - LayerRect rect; - SetRect(damage.rects[i], &rect); - layer_->dirty_regions.push_back(rect); - } + SetDirtyRegions(damage); return HWC2::Error::None; } @@ -628,4 +637,13 @@ int32_t HWCLayer::PopReleaseFence(void) { return fence; } +void HWCLayer::SetDirtyRegions(hwc_region_t surface_damage) { + layer_->dirty_regions.clear(); + for (uint32_t i = 0; i < surface_damage.numRects; i++) { + LayerRect rect; + SetRect(surface_damage.rects[i], &rect); + layer_->dirty_regions.push_back(rect); + } +} + } // namespace sdm diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.h b/msm8996/sdm/libs/hwc2/hwc_layers.h index d77a3cab7..536132049 100644 --- a/msm8996/sdm/libs/hwc2/hwc_layers.h +++ b/msm8996/sdm/libs/hwc2/hwc_layers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -83,6 +83,8 @@ class HWCLayer { int32_t PopReleaseFence(void); void ResetValidation() { needs_validate_ = false; } bool NeedsValidation() { return (needs_validate_ || geometry_changes_); } + bool IsSurfaceUpdated() { return surface_updated_; } + void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; } private: Layer *layer_ = nullptr; @@ -95,6 +97,8 @@ class HWCLayer { int ion_fd_ = -1; HWCBufferAllocator *buffer_allocator_ = NULL; bool needs_validate_ = true; + bool partial_update_enabled_ = false; + bool surface_updated_ = true; // Composition requested by client(SF) HWC2::Composition client_requested_ = HWC2::Composition::Device; @@ -111,6 +115,7 @@ class HWCLayer { DisplayError SetCSC(ColorSpace_t source, LayerCSC *target); DisplayError SetIGC(IGC_t source, LayerIGC *target); uint32_t RoundToStandardFPS(float fps); + void SetDirtyRegions(hwc_region_t surface_damage); }; struct SortLayersByZ { diff --git a/msm8998/sdm/include/core/display_interface.h b/msm8998/sdm/include/core/display_interface.h index f4054bb55..a4defcf2f 100644 --- a/msm8998/sdm/include/core/display_interface.h +++ b/msm8998/sdm/include/core/display_interface.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved. +* Copyright (c) 2014 - 2017, 2019, 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: @@ -148,6 +148,7 @@ struct DisplayConfigFixedInfo { uint32_t max_luminance = 0; //!< From Panel's peak luminance uint32_t average_luminance = 0; //!< From Panel's average luminance uint32_t min_luminance = 0; //!< From Panel's blackness level + bool partial_update = false; //!< If display supports Partial Update. }; /*! @brief This structure defines configuration for variable properties of a display device. diff --git a/msm8998/sdm/libs/core/display_base.cpp b/msm8998/sdm/libs/core/display_base.cpp index 3fdab5642..6f2966f42 100644 --- a/msm8998/sdm/libs/core/display_base.cpp +++ b/msm8998/sdm/libs/core/display_base.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved. +* Copyright (c) 2014 - 2017, 2019, 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: @@ -392,6 +392,7 @@ DisplayError DisplayBase::GetConfig(DisplayConfigFixedInfo *fixed_info) { fixed_info->max_luminance = fixed_info->hdr_supported ? hw_panel_info_.peak_luminance: 0; fixed_info->average_luminance = fixed_info->hdr_supported ? hw_panel_info_.average_luminance : 0; fixed_info->min_luminance = fixed_info->hdr_supported ? hw_panel_info_.blackness_level: 0; + fixed_info->partial_update = hw_panel_info_.partial_update; return kErrorNone; } diff --git a/msm8998/sdm/libs/hwc2/hwc_display.cpp b/msm8998/sdm/libs/hwc2/hwc_display.cpp index 066dd6d67..083b3ab4a 100644 --- a/msm8998/sdm/libs/hwc2/hwc_display.cpp +++ b/msm8998/sdm/libs/hwc2/hwc_display.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -379,6 +379,12 @@ int HWCDisplay::Init() { current_refresh_rate_ = max_refresh_rate_; GetUnderScanConfig(); + + DisplayConfigFixedInfo fixed_info = {}; + display_intf_->GetConfig(&fixed_info); + partial_update_enabled_ = fixed_info.partial_update; + client_target_->SetPartialUpdate(partial_update_enabled_); + DLOGI("Display created with id: %d", id_); return 0; } @@ -410,6 +416,7 @@ HWC2::Error HWCDisplay::CreateLayer(hwc2_layer_t *out_layer_id) { *out_layer_id = layer->GetId(); geometry_changes_ |= GeometryChanges::kAdded; validated_ = false; + layer->SetPartialUpdate(partial_update_enabled_); return HWC2::Error::None; } @@ -552,7 +559,7 @@ void HWCDisplay::BuildLayerStack() { layer->flags.updating = true; if (layer_set_.size() <= kMaxLayerCount) { - layer->flags.updating = IsLayerUpdating(layer); + layer->flags.updating = IsLayerUpdating(hwc_layer); } layer_stack_.layers.push_back(layer); @@ -576,6 +583,7 @@ void HWCDisplay::BuildLayerStack() { layer_stack_.flags.geometry_changed = UINT32(geometry_changes_ > 0); // Append client target to the layer stack Layer *sdm_client_target = client_target_->GetSDMLayer(); + sdm_client_target->flags.updating = IsLayerUpdating(client_target_); layer_stack_.layers.push_back(sdm_client_target); // fall back frame composition to GPU when client target is 10bit // TODO(user): clarify the behaviour from Client(SF) and SDM Extn - @@ -1798,24 +1806,17 @@ bool HWCDisplay::SingleLayerUpdating(void) { return (updating_count == 1); } -bool HWCDisplay::IsLayerUpdating(const Layer *layer) { +bool HWCDisplay::IsLayerUpdating(HWCLayer *hwc_layer) { + auto layer = hwc_layer->GetSDMLayer(); // Layer should be considered updating if // a) layer is in single buffer mode, or // b) valid dirty_regions(android specific hint for updating status), or // c) layer stack geometry has changed (TODO(user): Remove when SDM accepts // geometry_changed as bit fields). - return (layer->flags.single_buffer || IsSurfaceUpdated(layer->dirty_regions) || + return (layer->flags.single_buffer || hwc_layer->IsSurfaceUpdated() || geometry_changes_); } -bool HWCDisplay::IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions) { - // based on dirty_regions determine if its updating - // dirty_rect count = 0 - whole layer - updating. - // dirty_rect count = 1 or more valid rects - updating. - // dirty_rect count = 1 with (0,0,0,0) - not updating. - return (dirty_regions.empty() || IsValid(dirty_regions.at(0))); -} - uint32_t HWCDisplay::SanitizeRefreshRate(uint32_t req_refresh_rate) { uint32_t refresh_rate = req_refresh_rate; diff --git a/msm8998/sdm/libs/hwc2/hwc_display.h b/msm8998/sdm/libs/hwc2/hwc_display.h index 571805612..7157859b9 100644 --- a/msm8998/sdm/libs/hwc2/hwc_display.h +++ b/msm8998/sdm/libs/hwc2/hwc_display.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -235,7 +235,7 @@ class HWCDisplay : public DisplayEventHandler { virtual void ApplyScanAdjustment(hwc_rect_t *display_frame); bool SingleLayerUpdating(void); bool IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions); - bool IsLayerUpdating(const Layer *layer); + bool IsLayerUpdating(HWCLayer *layer); uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate); virtual void GetUnderScanConfig() { } @@ -291,6 +291,7 @@ class HWCDisplay : public DisplayEventHandler { bool CanSkipValidate(); qService::QService *qservice_ = NULL; DisplayClass display_class_; + bool partial_update_enabled_ = false; }; inline int HWCDisplay::Perform(uint32_t operation, ...) { diff --git a/msm8998/sdm/libs/hwc2/hwc_layers.cpp b/msm8998/sdm/libs/hwc2/hwc_layers.cpp index 1ae05ef17..ea8841bdc 100644 --- a/msm8998/sdm/libs/hwc2/hwc_layers.cpp +++ b/msm8998/sdm/libs/hwc2/hwc_layers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -277,7 +277,21 @@ HWC2::Error HWCLayer::SetLayerBuffer(buffer_handle_t buffer, int32_t acquire_fen } HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) { - // Check if there is an update in SurfaceDamage rects + surface_updated_ = true; + if ((damage.numRects == 1) && (damage.rects[0].bottom == 0) && (damage.rects[0].right == 0)) { + surface_updated_ = false; + } + + if (!layer_->flags.updating && surface_updated_) { + needs_validate_ = true; + } + + if (!partial_update_enabled_) { + SetDirtyRegions(damage); + return HWC2::Error::None; + } + + // Check if there is an update in SurfaceDamage rects. if (layer_->dirty_regions.size() != damage.numRects) { needs_validate_ = true; } else { @@ -291,12 +305,7 @@ HWC2::Error HWCLayer::SetLayerSurfaceDamage(hwc_region_t damage) { } } - layer_->dirty_regions.clear(); - for (uint32_t i = 0; i < damage.numRects; i++) { - LayerRect rect; - SetRect(damage.rects[i], &rect); - layer_->dirty_regions.push_back(rect); - } + SetDirtyRegions(damage); return HWC2::Error::None; } @@ -820,4 +829,13 @@ int32_t HWCLayer::PopReleaseFence(void) { return fence; } +void HWCLayer::SetDirtyRegions(hwc_region_t surface_damage) { + layer_->dirty_regions.clear(); + for (uint32_t i = 0; i < surface_damage.numRects; i++) { + LayerRect rect; + SetRect(surface_damage.rects[i], &rect); + layer_->dirty_regions.push_back(rect); + } +} + } // namespace sdm diff --git a/msm8998/sdm/libs/hwc2/hwc_layers.h b/msm8998/sdm/libs/hwc2/hwc_layers.h index b7f5ddd0c..dbe33a9a2 100644 --- a/msm8998/sdm/libs/hwc2/hwc_layers.h +++ b/msm8998/sdm/libs/hwc2/hwc_layers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017, 2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -92,6 +92,8 @@ class HWCLayer { bool SupportLocalConversion(ColorPrimaries working_primaries); void ResetValidation() { needs_validate_ = false; } bool NeedsValidation() { return (needs_validate_ || geometry_changes_); } + bool IsSurfaceUpdated() { return surface_updated_; } + void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; } private: Layer *layer_ = nullptr; @@ -104,6 +106,8 @@ class HWCLayer { HWCBufferAllocator *buffer_allocator_ = NULL; int32_t dataspace_ = HAL_DATASPACE_UNKNOWN; bool needs_validate_ = true; + bool partial_update_enabled_ = false; + bool surface_updated_ = true; // Composition requested by client(SF) HWC2::Composition client_requested_ = HWC2::Composition::Device; @@ -119,6 +123,7 @@ class HWCLayer { DisplayError SetMetaData(const private_handle_t *pvt_handle, Layer *layer); DisplayError SetIGC(IGC_t source, LayerIGC *target); uint32_t RoundToStandardFPS(float fps); + void SetDirtyRegions(hwc_region_t surface_damage); }; struct SortLayersByZ { |
