|
21 | 21 | #include <android/gui/ISurfaceComposerClient.h> |
22 | 22 | #include <android/native_window.h> |
23 | 23 | #include <binder/Parcel.h> |
| 24 | +#include <com_android_graphics_libgui_flags.h> |
24 | 25 | #include <gui/FrameRateUtils.h> |
25 | 26 | #include <gui/IGraphicBufferProducer.h> |
26 | 27 | #include <gui/LayerState.h> |
@@ -91,7 +92,9 @@ layer_state_t::layer_state_t() |
91 | 92 | trustedOverlay(gui::TrustedOverlay::UNSET), |
92 | 93 | bufferCrop(Rect::INVALID_RECT), |
93 | 94 | destinationFrame(Rect::INVALID_RECT), |
94 | | - dropInputMode(gui::DropInputMode::NONE) { |
| 95 | + dropInputMode(gui::DropInputMode::NONE), |
| 96 | + pictureProfileHandle(PictureProfileHandle::NONE), |
| 97 | + appContentPriority(0) { |
95 | 98 | matrix.dsdx = matrix.dtdy = 1.0f; |
96 | 99 | matrix.dsdy = matrix.dtdx = 0.0f; |
97 | 100 | hdrMetadata.validTypes = 0; |
@@ -202,6 +205,10 @@ status_t layer_state_t::write(Parcel& output) const |
202 | 205 | if (hasBufferReleaseChannel) { |
203 | 206 | SAFE_PARCEL(output.writeParcelable, *bufferReleaseChannel); |
204 | 207 | } |
| 208 | +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS_APPLY_PICTURE_PROFILES |
| 209 | + SAFE_PARCEL(output.writeInt64, pictureProfileHandle.getId()); |
| 210 | + SAFE_PARCEL(output.writeInt32, appContentPriority); |
| 211 | +#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS_APPLY_PICTURE_PROFILES |
205 | 212 |
|
206 | 213 | const bool hasLuts = (luts != nullptr); |
207 | 214 | SAFE_PARCEL(output.writeBool, hasLuts); |
@@ -363,6 +370,12 @@ status_t layer_state_t::read(const Parcel& input) |
363 | 370 | bufferReleaseChannel = std::make_shared<gui::BufferReleaseChannel::ProducerEndpoint>(); |
364 | 371 | SAFE_PARCEL(input.readParcelable, bufferReleaseChannel.get()); |
365 | 372 | } |
| 373 | +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS_APPLY_PICTURE_PROFILES |
| 374 | + int64_t pictureProfileId; |
| 375 | + SAFE_PARCEL(input.readInt64, &pictureProfileId); |
| 376 | + pictureProfileHandle = PictureProfileHandle(pictureProfileId); |
| 377 | + SAFE_PARCEL(input.readInt32, &appContentPriority); |
| 378 | +#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS_APPLY_PICTURE_PROFILES |
366 | 379 |
|
367 | 380 | bool hasLuts; |
368 | 381 | SAFE_PARCEL(input.readBool, &hasLuts); |
@@ -760,6 +773,16 @@ void layer_state_t::merge(const layer_state_t& other) { |
760 | 773 | what |= eBufferReleaseChannelChanged; |
761 | 774 | bufferReleaseChannel = other.bufferReleaseChannel; |
762 | 775 | } |
| 776 | + if (com_android_graphics_libgui_flags_apply_picture_profiles()) { |
| 777 | + if (other.what & ePictureProfileHandleChanged) { |
| 778 | + what |= ePictureProfileHandleChanged; |
| 779 | + pictureProfileHandle = other.pictureProfileHandle; |
| 780 | + } |
| 781 | + if (other.what & eAppContentPriorityChanged) { |
| 782 | + what |= eAppContentPriorityChanged; |
| 783 | + appContentPriority = other.appContentPriority; |
| 784 | + } |
| 785 | + } |
763 | 786 | if ((other.what & what) != other.what) { |
764 | 787 | ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? " |
765 | 788 | "other.what=0x%" PRIX64 " what=0x%" PRIX64 " unmerged flags=0x%" PRIX64, |
@@ -841,6 +864,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { |
841 | 864 | CHECK_DIFF(diff, eDimmingEnabledChanged, other, dimmingEnabled); |
842 | 865 | if (other.what & eBufferReleaseChannelChanged) diff |= eBufferReleaseChannelChanged; |
843 | 866 | if (other.what & eLutsChanged) diff |= eLutsChanged; |
| 867 | + CHECK_DIFF(diff, ePictureProfileHandleChanged, other, pictureProfileHandle); |
| 868 | + CHECK_DIFF(diff, eAppContentPriorityChanged, other, appContentPriority); |
844 | 869 |
|
845 | 870 | return diff; |
846 | 871 | } |
|
0 commit comments