blob: 6631a2772cb177bae8ec16e88fd42835c2b6f542 [file] [log] [blame]
Lloyd Pique9755fb72019-03-26 14:44:40 -07001/*
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 <android-base/stringprintf.h>
18#include <compositionengine/LayerFECompositionState.h>
19#include <compositionengine/impl/DumpHelpers.h>
20
21namespace android::compositionengine {
22
23namespace {
24
25using android::compositionengine::impl::dumpVal;
26
27void dumpVal(std::string& out, const char* name, half4 value) {
28 using android::base::StringAppendF;
29 StringAppendF(&out, "%s=[%f %f %f] ", name, static_cast<float>(value.r),
30 static_cast<float>(value.g), static_cast<float>(value.b));
31}
32
33} // namespace
34
Lloyd Pique8d9f8362020-02-11 19:13:09 -080035std::string GenericLayerMetadataEntry::dumpAsString() const {
36 using android::base::StringAppendF;
37 std::string out;
38
39 out.append("GenericLayerMetadataEntry{mandatory: ");
40 StringAppendF(&out, "%d", mandatory);
41 out.append(" value: ");
42 for (uint8_t byte : value) {
43 StringAppendF(&out, "0x08%" PRIx8 " ", byte);
44 }
45 out.append("]}");
46 return out;
47}
48
Lloyd Piquede196652020-01-22 17:29:58 -080049LayerFECompositionState::~LayerFECompositionState() = default;
50
Lloyd Pique9755fb72019-03-26 14:44:40 -070051void LayerFECompositionState::dump(std::string& out) const {
52 out.append(" ");
53 dumpVal(out, "isSecure", isSecure);
54 dumpVal(out, "geomUsesSourceCrop", geomUsesSourceCrop);
55 dumpVal(out, "geomBufferUsesDisplayInverseTransform", geomBufferUsesDisplayInverseTransform);
56 dumpVal(out, "geomLayerTransform", geomLayerTransform);
57
58 out.append("\n ");
59 dumpVal(out, "geomBufferSize", geomBufferSize);
60 dumpVal(out, "geomContentCrop", geomContentCrop);
61 dumpVal(out, "geomCrop", geomCrop);
62 dumpVal(out, "geomBufferTransform", geomBufferTransform);
63
64 out.append("\n ");
65 dumpVal(out, "transparentRegionHint", transparentRegionHint);
66
67 out.append(" ");
68 dumpVal(out, "geomLayerBounds", geomLayerBounds);
69
Vishnu Naira483b4a2019-12-12 15:07:52 -080070 out.append(" ");
71 dumpVal(out, "shadowRadius", shadowRadius);
72
Lloyd Pique9755fb72019-03-26 14:44:40 -070073 out.append("\n ");
74 dumpVal(out, "blend", toString(blendMode), blendMode);
75 dumpVal(out, "alpha", alpha);
Lucas Dupin19c8f0e2019-11-25 17:55:44 -080076 dumpVal(out, "backgroundBlurRadius", backgroundBlurRadius);
John Reckc00c6692021-02-16 11:37:33 -050077 if (stretchEffect.hasEffect()) {
78 dumpVal(out, "stretchEffect", stretchEffect);
79 }
Lloyd Pique9755fb72019-03-26 14:44:40 -070080
Alec Mouri07e2dc82021-04-23 17:30:47 -070081 if (!blurRegions.empty()) {
82 out.append("\n blurRegions {");
83 for (const auto& region : blurRegions) {
84 out.append("\n ");
85 base::StringAppendF(&out,
86 "{radius=%du, cornerRadii=[%f, %f, %f, %f], alpha=%f, rect=[%d, "
87 "%d, %d, %d]",
88 region.blurRadius, region.cornerRadiusTL, region.cornerRadiusTR,
89 region.cornerRadiusBL, region.cornerRadiusBR, region.alpha,
90 region.left, region.top, region.right, region.bottom);
91 }
92 out.append("\n }\n ");
93 }
94
Lloyd Pique8d9f8362020-02-11 19:13:09 -080095 if (!metadata.empty()) {
96 out.append("\n metadata {");
97 for (const auto& [key, entry] : metadata) {
98 out.append("\n ");
99 out.append(key);
100 out.append("=");
101 out.append(entry.dumpAsString());
102 }
103 out.append("\n }\n ");
104 }
105
Lloyd Pique9755fb72019-03-26 14:44:40 -0700106 dumpVal(out, "composition type", toString(compositionType), compositionType);
107
108 out.append("\n buffer: ");
109 dumpVal(out, "slot", bufferSlot);
110 dumpVal(out, "buffer", buffer.get());
111
112 out.append("\n ");
113 dumpVal(out, "sideband stream", sidebandStream.get());
114
115 out.append("\n ");
116 dumpVal(out, "color", color);
117
118 out.append("\n ");
119 dumpVal(out, "isOpaque", isOpaque);
120 dumpVal(out, "hasProtectedContent", hasProtectedContent);
121 dumpVal(out, "isColorspaceAgnostic", isColorspaceAgnostic);
122 dumpVal(out, "dataspace", toString(dataspace), dataspace);
123 dumpVal(out, "hdr metadata types", hdrMetadata.validTypes);
Sally Qi421ffb02022-03-21 19:41:33 -0700124 dumpVal(out, "dimming enabled", dimmingEnabled);
Lloyd Pique9755fb72019-03-26 14:44:40 -0700125 dumpVal(out, "colorTransform", colorTransform);
126
127 out.append("\n");
128}
129
130} // namespace android::compositionengine