blob: 37d6eaa2f26d9cd3be1eb2cdbe03b9a8d0a80426 [file] [log] [blame]
Lloyd Pique0b785d82018-12-04 17:25:27 -08001/*
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/impl/DumpHelpers.h>
19#include <compositionengine/impl/LayerCompositionState.h>
20
21namespace android::compositionengine::impl {
22
23namespace {
24
25using android::compositionengine::impl::dumpVal;
26
Lloyd Piquef5275482019-01-29 18:42:42 -080027void dumpVal(std::string& out, const char* name, half4 value) {
Lloyd Pique0b785d82018-12-04 17:25:27 -080028 using android::base::StringAppendF;
Lloyd Piquef5275482019-01-29 18:42:42 -080029 StringAppendF(&out, "%s=[%f %f %f] ", name, static_cast<float>(value.r),
30 static_cast<float>(value.g), static_cast<float>(value.b));
Lloyd Pique0b785d82018-12-04 17:25:27 -080031}
32
33void dumpFrontEnd(std::string& out, const LayerFECompositionState& state) {
34 out.append(" ");
Lloyd Piquea83776c2019-01-29 18:42:32 -080035 dumpVal(out, "isSecure", state.isSecure);
36 dumpVal(out, "geomUsesSourceCrop", state.geomUsesSourceCrop);
37 dumpVal(out, "geomBufferUsesDisplayInverseTransform",
38 state.geomBufferUsesDisplayInverseTransform);
39 dumpVal(out, "geomLayerTransform", state.geomLayerTransform);
40
41 out.append("\n ");
42 dumpVal(out, "geomBufferSize", state.geomBufferSize);
43 dumpVal(out, "geomContentCrop", state.geomContentCrop);
44 dumpVal(out, "geomCrop", state.geomCrop);
45 dumpVal(out, "geomBufferTransform", state.geomBufferTransform);
46
47 out.append("\n ");
48 dumpVal(out, "geomActiveTransparentRegion", state.geomActiveTransparentRegion);
49
50 out.append(" ");
51 dumpVal(out, "geomLayerBounds", state.geomLayerBounds);
52
53 out.append("\n ");
Lloyd Pique0b785d82018-12-04 17:25:27 -080054 dumpVal(out, "blend", toString(state.blendMode), state.blendMode);
55 dumpVal(out, "alpha", state.alpha);
56
57 out.append("\n ");
58 dumpVal(out, "type", state.type);
59 dumpVal(out, "appId", state.appId);
60
61 dumpVal(out, "composition type", toString(state.compositionType), state.compositionType);
62
63 out.append("\n buffer: ");
Lloyd Piquef5275482019-01-29 18:42:42 -080064 dumpVal(out, "bufferSlot", state.bufferSlot);
Lloyd Pique0b785d82018-12-04 17:25:27 -080065 dumpVal(out, "buffer", state.buffer.get());
Lloyd Pique0b785d82018-12-04 17:25:27 -080066
67 out.append("\n ");
68 dumpVal(out, "sideband stream", state.sidebandStream.get());
69
70 out.append("\n ");
71 dumpVal(out, "color", state.color);
72
73 out.append("\n ");
Lloyd Piquef5275482019-01-29 18:42:42 -080074 dumpVal(out, "isColorspaceAgnostic", state.isColorspaceAgnostic);
Lloyd Pique0b785d82018-12-04 17:25:27 -080075 dumpVal(out, "dataspace", toString(state.dataspace), state.dataspace);
76 dumpVal(out, "hdr metadata types", state.hdrMetadata.validTypes);
77 dumpVal(out, "colorTransform", state.colorTransform);
78
79 out.append("\n");
80}
81
82} // namespace
83
84void LayerCompositionState::dump(std::string& out) const {
Lloyd Piquea83776c2019-01-29 18:42:32 -080085 out.append(" frontend:\n");
Lloyd Pique0b785d82018-12-04 17:25:27 -080086 dumpFrontEnd(out, frontEnd);
87}
88
89} // namespace android::compositionengine::impl