diff options
| author | 2022-03-31 23:19:05 +0000 | |
|---|---|---|
| committer | 2022-03-31 23:19:05 +0000 | |
| commit | d7590c4ad67981c141a7801ac0535100b97cfaf9 (patch) | |
| tree | 7ea9104b1abc3daae229047a761f4fec8552ea84 /libs | |
| parent | 840bc7c8dc65a258dd295a5c3c5bc388f5175327 (diff) | |
| parent | 81d95e6534106159210a768268fd77f21139e7a9 (diff) | |
Merge "[SurfaceFlinger] Disable HDR dimming when screen rotates." into tm-dev
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/gui/LayerState.cpp | 6 | ||||
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 14 | ||||
| -rw-r--r-- | libs/gui/include/gui/LayerState.h | 6 | ||||
| -rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 1 |
4 files changed, 25 insertions, 2 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 34db5b1626..304fc17e07 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -134,6 +134,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); SAFE_PARCEL(output.writeUint32, fixedTransformHint); SAFE_PARCEL(output.writeBool, autoRefresh); + SAFE_PARCEL(output.writeBool, dimmingEnabled); SAFE_PARCEL(output.writeUint32, blurRegions.size()); for (auto region : blurRegions) { @@ -243,6 +244,7 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readUint32, &tmpUint32); fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); SAFE_PARCEL(input.readBool, &autoRefresh); + SAFE_PARCEL(input.readBool, &dimmingEnabled); uint32_t numRegions = 0; SAFE_PARCEL(input.readUint32, &numRegions); @@ -598,6 +600,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eColorSpaceAgnosticChanged; colorSpaceAgnostic = other.colorSpaceAgnostic; } + if (other.what & eDimmingEnabledChanged) { + what |= eDimmingEnabledChanged; + dimmingEnabled = other.dimmingEnabled; + } if ((other.what & what) != other.what) { ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? " "other.what=0x%" PRIX64 " what=0x%" PRIX64 " unmerged flags=0x%" PRIX64, diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 52a22a77fd..6c197c457c 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1195,6 +1195,20 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setTrans return *this; } +SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDimmingEnabled( + const sp<SurfaceControl>& sc, bool dimmingEnabled) { + layer_state_t* s = getLayerState(sc); + if (!s) { + mStatus = BAD_INDEX; + return *this; + } + s->what |= layer_state_t::eDimmingEnabledChanged; + s->dimmingEnabled = dimmingEnabled; + + registerSurfaceControlForCallback(sc); + return *this; +} + SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setAlpha( const sp<SurfaceControl>& sc, float alpha) { layer_state_t* s = getLayerState(sc); diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index 0f37dab53c..4ca8d68142 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -150,7 +150,7 @@ struct layer_state_t { eTransparentRegionChanged = 0x00000020, eFlagsChanged = 0x00000040, eLayerStackChanged = 0x00000080, - /* unused 0x00000400, */ + eDimmingEnabledChanged = 0x00000400, eShadowRadiusChanged = 0x00000800, /* unused 0x00001000, */ eBufferCropChanged = 0x00002000, @@ -187,7 +187,7 @@ struct layer_state_t { eAutoRefreshChanged = 0x1000'00000000, eStretchChanged = 0x2000'00000000, eTrustedOverlayChanged = 0x4000'00000000, - eDropInputModeChanged = 0x8000'00000000, + eDropInputModeChanged = 0x8000'00000000 }; layer_state_t(); @@ -298,6 +298,8 @@ struct layer_state_t { // Force inputflinger to drop all input events for the layer and its children. gui::DropInputMode dropInputMode; + + bool dimmingEnabled; }; struct ComposerState { diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 9d03f58aa5..0cc43d85bf 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -491,6 +491,7 @@ public: uint32_t flags, uint32_t mask); Transaction& setTransparentRegionHint(const sp<SurfaceControl>& sc, const Region& transparentRegion); + Transaction& setDimmingEnabled(const sp<SurfaceControl>& sc, bool dimmingEnabled); Transaction& setAlpha(const sp<SurfaceControl>& sc, float alpha); Transaction& setMatrix(const sp<SurfaceControl>& sc, |