1 /*
2  * Copyright 2019 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 #include <compositionengine/impl/DumpHelpers.h>
18 #include <compositionengine/impl/OutputLayerCompositionState.h>
19 
20 // TODO(b/129481165): remove the #pragma below and fix conversion issues
21 #pragma clang diagnostic push
22 #pragma clang diagnostic ignored "-Wconversion"
23 
24 #include "DisplayHardware/HWC2.h"
25 
26 // TODO(b/129481165): remove the #pragma below and fix conversion issues
27 #pragma clang diagnostic pop // ignored "-Wconversion"
28 
29 namespace android::compositionengine::impl {
30 
31 namespace {
32 
dumpHwc(const OutputLayerCompositionState::Hwc & hwc,std::string & out)33 void dumpHwc(const OutputLayerCompositionState::Hwc& hwc, std::string& out) {
34     out.append("\n      hwc: ");
35 
36     if (hwc.hwcLayer == nullptr) {
37         out.append("No layer ");
38     } else {
39         dumpHex(out, "layer", hwc.hwcLayer->getId());
40     }
41 
42     dumpVal(out, "composition", toString(hwc.hwcCompositionType), hwc.hwcCompositionType);
43 }
44 
45 } // namespace
46 
dump(std::string & out) const47 void OutputLayerCompositionState::dump(std::string& out) const {
48     out.append("      ");
49     dumpVal(out, "visibleRegion", visibleRegion);
50 
51     out.append("      ");
52     dumpVal(out, "visibleNonTransparentRegion", visibleNonTransparentRegion);
53 
54     out.append("      ");
55     dumpVal(out, "coveredRegion", coveredRegion);
56 
57     out.append("      ");
58     dumpVal(out, "output visibleRegion", outputSpaceVisibleRegion);
59 
60     out.append("      ");
61     dumpVal(out, "shadowRegion", shadowRegion);
62 
63     out.append("      ");
64     dumpVal(out, "forceClientComposition", forceClientComposition);
65     dumpVal(out, "clearClientTarget", clearClientTarget);
66     dumpVal(out, "displayFrame", displayFrame);
67     dumpVal(out, "sourceCrop", sourceCrop);
68     dumpVal(out, "bufferTransform", toString(bufferTransform), bufferTransform);
69     dumpVal(out, "dataspace", toString(dataspace), dataspace);
70     dumpVal(out, "z-index", z);
71 
72     if (hwc) {
73         dumpHwc(*hwc, out);
74     }
75 
76     out.append("\n");
77 }
78 
79 } // namespace android::compositionengine::impl
80