| Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [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/LayerFECompositionState.h> | 
|  | 19 | #include <compositionengine/impl/DumpHelpers.h> | 
|  | 20 |  | 
|  | 21 | namespace android::compositionengine { | 
|  | 22 |  | 
|  | 23 | namespace { | 
|  | 24 |  | 
|  | 25 | using android::compositionengine::impl::dumpVal; | 
|  | 26 |  | 
|  | 27 | void 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 Pique | 8d9f836 | 2020-02-11 19:13:09 -0800 | [diff] [blame] | 35 | std::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 Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 49 | LayerFECompositionState::~LayerFECompositionState() = default; | 
|  | 50 |  | 
| Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 51 | void 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 Nair | a483b4a | 2019-12-12 15:07:52 -0800 | [diff] [blame] | 70 | out.append("      "); | 
|  | 71 | dumpVal(out, "shadowRadius", shadowRadius); | 
|  | 72 |  | 
| Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 73 | out.append("\n      "); | 
|  | 74 | dumpVal(out, "blend", toString(blendMode), blendMode); | 
|  | 75 | dumpVal(out, "alpha", alpha); | 
| Lucas Dupin | 19c8f0e | 2019-11-25 17:55:44 -0800 | [diff] [blame] | 76 | dumpVal(out, "backgroundBlurRadius", backgroundBlurRadius); | 
| Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 77 |  | 
| Lloyd Pique | 8d9f836 | 2020-02-11 19:13:09 -0800 | [diff] [blame] | 78 | if (!metadata.empty()) { | 
|  | 79 | out.append("\n      metadata {"); | 
|  | 80 | for (const auto& [key, entry] : metadata) { | 
|  | 81 | out.append("\n           "); | 
|  | 82 | out.append(key); | 
|  | 83 | out.append("="); | 
|  | 84 | out.append(entry.dumpAsString()); | 
|  | 85 | } | 
|  | 86 | out.append("\n      }\n      "); | 
|  | 87 | } | 
|  | 88 |  | 
| Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 89 | dumpVal(out, "composition type", toString(compositionType), compositionType); | 
|  | 90 |  | 
|  | 91 | out.append("\n      buffer: "); | 
|  | 92 | dumpVal(out, "slot", bufferSlot); | 
|  | 93 | dumpVal(out, "buffer", buffer.get()); | 
|  | 94 |  | 
|  | 95 | out.append("\n      "); | 
|  | 96 | dumpVal(out, "sideband stream", sidebandStream.get()); | 
|  | 97 |  | 
|  | 98 | out.append("\n      "); | 
|  | 99 | dumpVal(out, "color", color); | 
|  | 100 |  | 
|  | 101 | out.append("\n      "); | 
|  | 102 | dumpVal(out, "isOpaque", isOpaque); | 
|  | 103 | dumpVal(out, "hasProtectedContent", hasProtectedContent); | 
|  | 104 | dumpVal(out, "isColorspaceAgnostic", isColorspaceAgnostic); | 
|  | 105 | dumpVal(out, "dataspace", toString(dataspace), dataspace); | 
|  | 106 | dumpVal(out, "hdr metadata types", hdrMetadata.validTypes); | 
|  | 107 | dumpVal(out, "colorTransform", colorTransform); | 
|  | 108 |  | 
|  | 109 | out.append("\n"); | 
|  | 110 | } | 
|  | 111 |  | 
|  | 112 | } // namespace android::compositionengine |