Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 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 <android-base/stringprintf.h> |
| 18 | #include <compositionengine/impl/DumpHelpers.h> |
| 19 | #include <compositionengine/impl/LayerCompositionState.h> |
| 20 | |
| 21 | namespace android::compositionengine::impl { |
| 22 | |
| 23 | namespace { |
| 24 | |
| 25 | using android::compositionengine::impl::dumpVal; |
| 26 | |
Lloyd Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame^] | 27 | void dumpVal(std::string& out, const char* name, half4 value) { |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 28 | using android::base::StringAppendF; |
Lloyd Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame^] | 29 | StringAppendF(&out, "%s=[%f %f %f] ", name, static_cast<float>(value.r), |
| 30 | static_cast<float>(value.g), static_cast<float>(value.b)); |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | void dumpFrontEnd(std::string& out, const LayerFECompositionState& state) { |
| 34 | out.append(" "); |
Lloyd Pique | a83776c | 2019-01-29 18:42:32 -0800 | [diff] [blame] | 35 | 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 Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 54 | 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 Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame^] | 64 | dumpVal(out, "bufferSlot", state.bufferSlot); |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 65 | dumpVal(out, "buffer", state.buffer.get()); |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 66 | |
| 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 Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame^] | 74 | dumpVal(out, "isColorspaceAgnostic", state.isColorspaceAgnostic); |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 75 | 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 | |
| 84 | void LayerCompositionState::dump(std::string& out) const { |
Lloyd Pique | a83776c | 2019-01-29 18:42:32 -0800 | [diff] [blame] | 85 | out.append(" frontend:\n"); |
Lloyd Pique | 0b785d8 | 2018-12-04 17:25:27 -0800 | [diff] [blame] | 86 | dumpFrontEnd(out, frontEnd); |
| 87 | } |
| 88 | |
| 89 | } // namespace android::compositionengine::impl |