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); |
John Reck | c00c669 | 2021-02-16 11:37:33 -0500 | [diff] [blame] | 77 | if (stretchEffect.hasEffect()) { |
| 78 | dumpVal(out, "stretchEffect", stretchEffect); |
| 79 | } |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 80 | |
Alec Mouri | 07e2dc8 | 2021-04-23 17:30:47 -0700 | [diff] [blame] | 81 | 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 Pique | 8d9f836 | 2020-02-11 19:13:09 -0800 | [diff] [blame] | 95 | 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 Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 106 | 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 Qi | 421ffb0 | 2022-03-21 19:41:33 -0700 | [diff] [blame] | 124 | dumpVal(out, "dimming enabled", dimmingEnabled); |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 125 | dumpVal(out, "colorTransform", colorTransform); |
| 126 | |
| 127 | out.append("\n"); |
| 128 | } |
| 129 | |
| 130 | } // namespace android::compositionengine |