1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <binder/Parcelable.h>
20 
21 #include <ui/PixelFormat.h>
22 #include <ui/Region.h>
23 
24 #include <string>
25 #include <math/vec4.h>
26 
27 namespace android {
28 
29 /* Class for transporting debug info from SurfaceFlinger to authorized
30  * recipients.  The class is intended to be a data container. There are
31  * no getters or setters.
32  */
33 class LayerDebugInfo : public Parcelable {
34 public:
35     LayerDebugInfo() = default;
36     LayerDebugInfo(const LayerDebugInfo&) = default;
37     virtual ~LayerDebugInfo() = default;
38 
39     virtual status_t writeToParcel(Parcel* parcel) const;
40     virtual status_t readFromParcel(const Parcel* parcel);
41 
42     std::string mName = std::string("NOT FILLED");
43     std::string mParentName = std::string("NOT FILLED");
44     std::string mType = std::string("NOT FILLED");
45     Region mTransparentRegion = Region::INVALID_REGION;
46     Region mVisibleRegion = Region::INVALID_REGION;
47     Region mSurfaceDamageRegion = Region::INVALID_REGION;
48     uint32_t mLayerStack = 0;
49     float mX = 0.f;
50     float mY = 0.f;
51     uint32_t mZ = 0 ;
52     int32_t mWidth = -1;
53     int32_t mHeight = -1;
54     Rect mCrop = Rect::INVALID_RECT;
55     half4 mColor = half4(1.0_hf, 1.0_hf, 1.0_hf, 0.0_hf);
56     uint32_t mFlags = 0;
57     PixelFormat mPixelFormat = PIXEL_FORMAT_NONE;
58     android_dataspace mDataSpace = HAL_DATASPACE_UNKNOWN;
59     // Row-major transform matrix (SurfaceControl::setMatrix())
60     float mMatrix[2][2] = {{0.f, 0.f}, {0.f, 0.f}};
61     int32_t mActiveBufferWidth = -1;
62     int32_t mActiveBufferHeight = -1;
63     int32_t mActiveBufferStride = 0;
64     PixelFormat mActiveBufferFormat = PIXEL_FORMAT_NONE;
65     int32_t mNumQueuedFrames = -1;
66     bool mRefreshPending = false;
67     bool mIsOpaque = false;
68     bool mContentDirty = false;
69 };
70 
71 std::string to_string(const LayerDebugInfo& info);
72 
73 } // namespace android
74