@@ -38,26 +38,25 @@ static inline constexpr T to64(const uint32_t lo, const uint32_t hi) {
3838 return static_cast <T>(static_cast <uint64_t >(hi)<<32 | lo);
3939}
4040
41- BufferItem::BufferItem () :
42- mGraphicBuffer (nullptr ),
43- mFence (nullptr ),
44- mCrop (Rect::INVALID_RECT),
45- mTransform (0 ),
46- mScalingMode (NATIVE_WINDOW_SCALING_MODE_FREEZE),
47- mTimestamp (0 ),
48- mIsAutoTimestamp (false ),
49- mDataSpace (HAL_DATASPACE_UNKNOWN),
50- mFrameNumber (0 ),
51- mSlot (INVALID_BUFFER_SLOT),
52- mIsDroppable (false ),
53- mAcquireCalled (false ),
54- mTransformToDisplayInverse (false ),
55- mSurfaceDamage (),
56- mAutoRefresh (false ),
57- mQueuedBuffer (true ),
58- mIsStale (false ),
59- mApi (0 ) {
60- }
41+ BufferItem::BufferItem ()
42+ : mGraphicBuffer (nullptr ),
43+ mFence (nullptr ),
44+ mCrop(Rect::INVALID_RECT),
45+ mTransform(0 ),
46+ mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
47+ mTimestamp(0 ),
48+ mIsAutoTimestamp(false ),
49+ mDataSpace(HAL_DATASPACE_UNKNOWN),
50+ mFrameNumber(0 ),
51+ mSlot(INVALID_BUFFER_SLOT),
52+ mIsDroppable(false ),
53+ mAcquireCalled(false ),
54+ mTransformToDisplayInverse(false ),
55+ mSurfaceDamage(),
56+ mAutoRefresh(false ),
57+ mQueuedBuffer(true ),
58+ mIsStale(false ),
59+ mApi(0 ) {}
6160
6261BufferItem::~BufferItem () {}
6362
@@ -76,6 +75,11 @@ size_t BufferItem::getPodSize() const {
7675 addAligned (size, high32 (mTimestamp ));
7776 addAligned (size, mIsAutoTimestamp );
7877 addAligned (size, mDataSpace );
78+ #if COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
79+ addAligned (size, mPictureProfileHandle .has_value ());
80+ addAligned (size, low32 (PictureProfileHandle::NONE.getId ()));
81+ addAligned (size, high32 (PictureProfileHandle::NONE.getId ()));
82+ #endif // COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
7983 addAligned (size, low32 (mFrameNumber ));
8084 addAligned (size, high32 (mFrameNumber ));
8185 addAligned (size, mSlot );
@@ -170,6 +174,16 @@ status_t BufferItem::flatten(
170174 writeAligned (buffer, size, high32 (mTimestamp ));
171175 writeAligned (buffer, size, mIsAutoTimestamp );
172176 writeAligned (buffer, size, mDataSpace );
177+ #if COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
178+ writeAligned (buffer, size, mPictureProfileHandle .has_value ());
179+ if (mPictureProfileHandle .has_value ()) {
180+ writeAligned (buffer, size, low32 (mPictureProfileHandle ->getId ()));
181+ writeAligned (buffer, size, high32 (mPictureProfileHandle ->getId ()));
182+ } else {
183+ writeAligned (buffer, size, low32 (PictureProfileHandle::NONE.getId ()));
184+ writeAligned (buffer, size, high32 (PictureProfileHandle::NONE.getId ()));
185+ }
186+ #endif // COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
173187 writeAligned (buffer, size, low32 (mFrameNumber ));
174188 writeAligned (buffer, size, high32 (mFrameNumber ));
175189 writeAligned (buffer, size, mSlot );
@@ -231,6 +245,7 @@ status_t BufferItem::unflatten(
231245
232246 uint32_t timestampLo = 0 , timestampHi = 0 ;
233247 uint32_t frameNumberLo = 0 , frameNumberHi = 0 ;
248+ int32_t pictureProfileIdLo = 0 , pictureProfileIdHi = 0 ;
234249
235250 readAligned (buffer, size, mCrop );
236251 readAligned (buffer, size, mTransform );
@@ -240,6 +255,16 @@ status_t BufferItem::unflatten(
240255 mTimestamp = to64<int64_t >(timestampLo, timestampHi);
241256 readAligned (buffer, size, mIsAutoTimestamp );
242257 readAligned (buffer, size, mDataSpace );
258+ #if COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
259+ bool hasPictureProfileHandle;
260+ readAligned (buffer, size, hasPictureProfileHandle);
261+ readAligned (buffer, size, pictureProfileIdLo);
262+ readAligned (buffer, size, pictureProfileIdHi);
263+ mPictureProfileHandle = hasPictureProfileHandle
264+ ? std::optional (PictureProfileHandle (
265+ to64<PictureProfileId>(pictureProfileIdLo, pictureProfileIdHi)))
266+ : std::nullopt ;
267+ #endif // COM_ANDROID_GRAPHICS_LIBUI_FLAGS_APPLY_PICTURE_PROFILES
243268 readAligned (buffer, size, frameNumberLo);
244269 readAligned (buffer, size, frameNumberHi);
245270 mFrameNumber = to64<uint64_t >(frameNumberLo, frameNumberHi);
0 commit comments