Loading libs/gui/LayerState.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -664,6 +664,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eShadowRadiusChanged; shadowRadius = other.shadowRadius; } if (other.what & eLutsChanged) { what |= eLutsChanged; luts = other.luts; } if (other.what & eDefaultFrameRateCompatibilityChanged) { what |= eDefaultFrameRateCompatibilityChanged; defaultFrameRateCompatibility = other.defaultFrameRateCompatibility; Loading Loading @@ -821,6 +825,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eColorSpaceAgnosticChanged, other, colorSpaceAgnostic); CHECK_DIFF(diff, eDimmingEnabledChanged, other, dimmingEnabled); if (other.what & eBufferReleaseChannelChanged) diff |= eBufferReleaseChannelChanged; if (other.what & eLutsChanged) diff |= eLutsChanged; return diff; } Loading libs/gui/SurfaceComposerClient.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <android/gui/IWindowInfosListener.h> #include <android/gui/TrustedPresentationThresholds.h> #include <android/os/IInputConstants.h> #include <gui/DisplayLuts.h> #include <gui/FrameRateUtils.h> #include <gui/TraceUtils.h> #include <utils/Errors.h> Loading Loading @@ -1940,15 +1941,19 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesir } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setLuts( const sp<SurfaceControl>& sc, const base::unique_fd& /*lutFd*/, const std::vector<int32_t>& /*offsets*/, const std::vector<int32_t>& /*dimensions*/, const std::vector<int32_t>& /*sizes*/, const std::vector<int32_t>& /*samplingKeys*/) { const sp<SurfaceControl>& sc, const base::unique_fd& lutFd, const std::vector<int32_t>& offsets, const std::vector<int32_t>& dimensions, const std::vector<int32_t>& sizes, const std::vector<int32_t>& samplingKeys) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } // TODO (b/329472856): update layer_state_t for lut(s) s->luts = std::make_shared<gui::DisplayLuts>(base::unique_fd(dup(lutFd.get())), offsets, dimensions, sizes, samplingKeys); s->what |= layer_state_t::eLutsChanged; registerSurfaceControlForCallback(sc); return *this; } Loading libs/gui/aidl/android/gui/LutProperties.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ parcelable LutProperties { enum Dimension { ONE_D = 1, THREE_D = 3 } Dimension dimension; long size; int size; @Backing(type="int") enum SamplingKey { RGB, MAX_RGB } SamplingKey[] samplingKeys; Loading libs/gui/aidl/android/gui/Lut.aidl→libs/gui/include/gui/DisplayLuts.h +54 −0 Original line number Diff line number Diff line Loading @@ -13,18 +13,42 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once package android.gui; #include <android-base/unique_fd.h> #include <vector> import android.gui.LutProperties; import android.os.ParcelFileDescriptor; namespace android::gui { /** * This mirrors aidl::android::hardware::graphics::composer3::Lut definition * @hide */ parcelable Lut { @nullable ParcelFileDescriptor pfd; struct DisplayLuts { public: struct Entry { int32_t dimension; int32_t size; int32_t samplingKey; }; DisplayLuts() {} LutProperties lutProperties; DisplayLuts(base::unique_fd lutfd, std::vector<int32_t> lutoffsets, std::vector<int32_t> lutdimensions, std::vector<int32_t> lutsizes, std::vector<int32_t> lutsamplingKeys) { fd = std::move(lutfd); offsets = lutoffsets; lutProperties.reserve(offsets.size()); for (size_t i = 0; i < lutoffsets.size(); i++) { Entry entry{lutdimensions[i], lutsizes[i], lutsamplingKeys[i]}; lutProperties.emplace_back(entry); } } base::unique_fd& getLutFileDescriptor() { return fd; } std::vector<Entry> lutProperties; std::vector<int32_t> offsets; private: base::unique_fd fd; }; // struct DisplayLuts } // namespace android::gui No newline at end of file libs/gui/include/gui/LayerState.h +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <android/gui/LayerCaptureArgs.h> #include <android/gui/TrustedPresentationThresholds.h> #include <android/native_window.h> #include <gui/DisplayLuts.h> #include <gui/IGraphicBufferProducer.h> #include <gui/ITransactionCompletedListener.h> #include <math/mat4.h> Loading Loading @@ -184,6 +185,7 @@ struct layer_state_t { eCachingHintChanged = 0x00000200, eDimmingEnabledChanged = 0x00000400, eShadowRadiusChanged = 0x00000800, eLutsChanged = 0x00001000, eBufferCropChanged = 0x00002000, eRelativeLayerChanged = 0x00004000, eReparent = 0x00008000, Loading Loading @@ -255,7 +257,7 @@ struct layer_state_t { layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eTransparentRegionChanged | layer_state_t::eExtendedRangeBrightnessChanged | layer_state_t::eDesiredHdrHeadroomChanged; layer_state_t::eDesiredHdrHeadroomChanged | layer_state_t::eLutsChanged; // Content updates. static constexpr uint64_t CONTENT_CHANGES = layer_state_t::BUFFER_CHANGES | Loading Loading @@ -416,6 +418,8 @@ struct layer_state_t { TrustedPresentationListener trustedPresentationListener; std::shared_ptr<gui::BufferReleaseChannel::ProducerEndpoint> bufferReleaseChannel; std::shared_ptr<gui::DisplayLuts> luts; }; class ComposerState { Loading Loading
libs/gui/LayerState.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -664,6 +664,10 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eShadowRadiusChanged; shadowRadius = other.shadowRadius; } if (other.what & eLutsChanged) { what |= eLutsChanged; luts = other.luts; } if (other.what & eDefaultFrameRateCompatibilityChanged) { what |= eDefaultFrameRateCompatibilityChanged; defaultFrameRateCompatibility = other.defaultFrameRateCompatibility; Loading Loading @@ -821,6 +825,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eColorSpaceAgnosticChanged, other, colorSpaceAgnostic); CHECK_DIFF(diff, eDimmingEnabledChanged, other, dimmingEnabled); if (other.what & eBufferReleaseChannelChanged) diff |= eBufferReleaseChannelChanged; if (other.what & eLutsChanged) diff |= eLutsChanged; return diff; } Loading
libs/gui/SurfaceComposerClient.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <android/gui/IWindowInfosListener.h> #include <android/gui/TrustedPresentationThresholds.h> #include <android/os/IInputConstants.h> #include <gui/DisplayLuts.h> #include <gui/FrameRateUtils.h> #include <gui/TraceUtils.h> #include <utils/Errors.h> Loading Loading @@ -1940,15 +1941,19 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDesir } SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setLuts( const sp<SurfaceControl>& sc, const base::unique_fd& /*lutFd*/, const std::vector<int32_t>& /*offsets*/, const std::vector<int32_t>& /*dimensions*/, const std::vector<int32_t>& /*sizes*/, const std::vector<int32_t>& /*samplingKeys*/) { const sp<SurfaceControl>& sc, const base::unique_fd& lutFd, const std::vector<int32_t>& offsets, const std::vector<int32_t>& dimensions, const std::vector<int32_t>& sizes, const std::vector<int32_t>& samplingKeys) { layer_state_t* s = getLayerState(sc); if (!s) { mStatus = BAD_INDEX; return *this; } // TODO (b/329472856): update layer_state_t for lut(s) s->luts = std::make_shared<gui::DisplayLuts>(base::unique_fd(dup(lutFd.get())), offsets, dimensions, sizes, samplingKeys); s->what |= layer_state_t::eLutsChanged; registerSurfaceControlForCallback(sc); return *this; } Loading
libs/gui/aidl/android/gui/LutProperties.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ parcelable LutProperties { enum Dimension { ONE_D = 1, THREE_D = 3 } Dimension dimension; long size; int size; @Backing(type="int") enum SamplingKey { RGB, MAX_RGB } SamplingKey[] samplingKeys; Loading
libs/gui/aidl/android/gui/Lut.aidl→libs/gui/include/gui/DisplayLuts.h +54 −0 Original line number Diff line number Diff line Loading @@ -13,18 +13,42 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once package android.gui; #include <android-base/unique_fd.h> #include <vector> import android.gui.LutProperties; import android.os.ParcelFileDescriptor; namespace android::gui { /** * This mirrors aidl::android::hardware::graphics::composer3::Lut definition * @hide */ parcelable Lut { @nullable ParcelFileDescriptor pfd; struct DisplayLuts { public: struct Entry { int32_t dimension; int32_t size; int32_t samplingKey; }; DisplayLuts() {} LutProperties lutProperties; DisplayLuts(base::unique_fd lutfd, std::vector<int32_t> lutoffsets, std::vector<int32_t> lutdimensions, std::vector<int32_t> lutsizes, std::vector<int32_t> lutsamplingKeys) { fd = std::move(lutfd); offsets = lutoffsets; lutProperties.reserve(offsets.size()); for (size_t i = 0; i < lutoffsets.size(); i++) { Entry entry{lutdimensions[i], lutsizes[i], lutsamplingKeys[i]}; lutProperties.emplace_back(entry); } } base::unique_fd& getLutFileDescriptor() { return fd; } std::vector<Entry> lutProperties; std::vector<int32_t> offsets; private: base::unique_fd fd; }; // struct DisplayLuts } // namespace android::gui No newline at end of file
libs/gui/include/gui/LayerState.h +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <android/gui/LayerCaptureArgs.h> #include <android/gui/TrustedPresentationThresholds.h> #include <android/native_window.h> #include <gui/DisplayLuts.h> #include <gui/IGraphicBufferProducer.h> #include <gui/ITransactionCompletedListener.h> #include <math/mat4.h> Loading Loading @@ -184,6 +185,7 @@ struct layer_state_t { eCachingHintChanged = 0x00000200, eDimmingEnabledChanged = 0x00000400, eShadowRadiusChanged = 0x00000800, eLutsChanged = 0x00001000, eBufferCropChanged = 0x00002000, eRelativeLayerChanged = 0x00004000, eReparent = 0x00008000, Loading Loading @@ -255,7 +257,7 @@ struct layer_state_t { layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eTransparentRegionChanged | layer_state_t::eExtendedRangeBrightnessChanged | layer_state_t::eDesiredHdrHeadroomChanged; layer_state_t::eDesiredHdrHeadroomChanged | layer_state_t::eLutsChanged; // Content updates. static constexpr uint64_t CONTENT_CHANGES = layer_state_t::BUFFER_CHANGES | Loading Loading @@ -416,6 +418,8 @@ struct layer_state_t { TrustedPresentationListener trustedPresentationListener; std::shared_ptr<gui::BufferReleaseChannel::ProducerEndpoint> bufferReleaseChannel; std::shared_ptr<gui::DisplayLuts> luts; }; class ComposerState { Loading