blob: 02e3a45acd1d0ae557fa3e4a6b6aa949a59c1fc8 [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);
Lloyd Pique9755fb72019-03-26 14:44:40 -070077
78 out.append("\n ");
79 dumpVal(out, "type", type);
80 dumpVal(out, "appId", appId);
81
Lloyd Pique8d9f8362020-02-11 19:13:09 -080082 if (!metadata.empty()) {
83 out.append("\n metadata {");
84 for (const auto& [key, entry] : metadata) {
85 out.append("\n ");
86 out.append(key);
87 out.append("=");
88 out.append(entry.dumpAsString());
89 }
90 out.append("\n }\n ");
91 }
92
Lloyd Pique9755fb72019-03-26 14:44:40 -070093 dumpVal(out, "composition type", toString(compositionType), compositionType);
94
95 out.append("\n buffer: ");
96 dumpVal(out, "slot", bufferSlot);
97 dumpVal(out, "buffer", buffer.get());
98
99 out.append("\n ");
100 dumpVal(out, "sideband stream", sidebandStream.get());
101
102 out.append("\n ");
103 dumpVal(out, "color", color);
104
105 out.append("\n ");
106 dumpVal(out, "isOpaque", isOpaque);
107 dumpVal(out, "hasProtectedContent", hasProtectedContent);
108 dumpVal(out, "isColorspaceAgnostic", isColorspaceAgnostic);
109 dumpVal(out, "dataspace", toString(dataspace), dataspace);
110 dumpVal(out, "hdr metadata types", hdrMetadata.validTypes);
111 dumpVal(out, "colorTransform", colorTransform);
112
113 out.append("\n");
114}
115
116} // namespace android::compositionengine