Skip to content

Commit d3147f9

Browse files
cairno-googleAndroid (Google) Code Review
authored andcommitted
Merge "Don't force client composition when rounded corners are cached" into main
2 parents 7006a0e + c7e3e0c commit d3147f9

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class OutputLayer : public virtual compositionengine::OutputLayer {
104104
void detectDisallowedCompositionTypeChange(
105105
aidl::android::hardware::graphics::composer3::Composition from,
106106
aidl::android::hardware::graphics::composer3::Composition to) const;
107-
bool isClientCompositionForced(bool isPeekingThrough) const;
107+
bool isClientCompositionForced(bool isPeekingThrough, bool isCached) const;
108108
void updateLuts(const LayerFECompositionState&,
109109
const std::optional<std::vector<std::optional<LutProperties>>>& properties);
110110
};

services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer,
865865
bool isPeekingThrough, bool skipLayer) {
866866
auto& outputDependentState = editState();
867867

868-
if (isClientCompositionForced(isPeekingThrough)) {
868+
bool isCached = !skipLayer && outputDependentState.overrideInfo.buffer;
869+
if (isClientCompositionForced(isPeekingThrough, isCached)) {
869870
// If we are forcing client composition, we need to tell the HWC
870871
requestedCompositionType = Composition::CLIENT;
871872
}
@@ -955,9 +956,12 @@ void OutputLayer::detectDisallowedCompositionTypeChange(Composition from, Compos
955956
}
956957
}
957958

958-
bool OutputLayer::isClientCompositionForced(bool isPeekingThrough) const {
959+
bool OutputLayer::isClientCompositionForced(bool isPeekingThrough, bool isCached) const {
960+
// If this layer was flattened into a CachedSet then it is not necessary for
961+
// the GPU to compose it.
962+
bool requiresClientDrawnRoundedCorners = !isCached && getLayerFE().hasRoundedCorners();
959963
return getState().forceClientComposition ||
960-
(!isPeekingThrough && getLayerFE().hasRoundedCorners());
964+
(!isPeekingThrough && requiresClientDrawnRoundedCorners);
961965
}
962966

963967
void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) {

services/surfaceflinger/FrontEnd/LayerSnapshot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,15 +544,15 @@ char LayerSnapshot::classifyCompositionForDebug(
544544
case Composition::INVALID:
545545
return 'i';
546546
case Composition::SOLID_COLOR:
547-
return 'c';
547+
return 'e';
548548
case Composition::CURSOR:
549549
return 'u';
550550
case Composition::SIDEBAND:
551551
return 'd';
552552
case Composition::DISPLAY_DECORATION:
553553
return 'a';
554554
case Composition::REFRESH_RATE_INDICATOR:
555-
return 'r';
555+
return 'f';
556556
case Composition::CLIENT:
557557
case Composition::DEVICE:
558558
break;

0 commit comments

Comments
 (0)