Home | History | Annotate | Download | only in src
      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 
     27 void dumpVal(std::string& out, const char* name, Hwc2::IComposerClient::Color value) {
     28     using android::base::StringAppendF;
     29     StringAppendF(&out, "%s=[%d %d %d] ", name, value.r, value.g, value.b);
     30 }
     31 
     32 void dumpFrontEnd(std::string& out, const LayerFECompositionState& state) {
     33     out.append("      ");
     34     dumpVal(out, "isSecure", state.isSecure);
     35     dumpVal(out, "geomUsesSourceCrop", state.geomUsesSourceCrop);
     36     dumpVal(out, "geomBufferUsesDisplayInverseTransform",
     37             state.geomBufferUsesDisplayInverseTransform);
     38     dumpVal(out, "geomLayerTransform", state.geomLayerTransform);
     39 
     40     out.append("\n      ");
     41     dumpVal(out, "geomBufferSize", state.geomBufferSize);
     42     dumpVal(out, "geomContentCrop", state.geomContentCrop);
     43     dumpVal(out, "geomCrop", state.geomCrop);
     44     dumpVal(out, "geomBufferTransform", state.geomBufferTransform);
     45 
     46     out.append("\n      ");
     47     dumpVal(out, "geomActiveTransparentRegion", state.geomActiveTransparentRegion);
     48 
     49     out.append("      ");
     50     dumpVal(out, "geomLayerBounds", state.geomLayerBounds);
     51 
     52     out.append("\n      ");
     53     dumpVal(out, "blend", toString(state.blendMode), state.blendMode);
     54     dumpVal(out, "alpha", state.alpha);
     55 
     56     out.append("\n      ");
     57     dumpVal(out, "type", state.type);
     58     dumpVal(out, "appId", state.appId);
     59 
     60     dumpVal(out, "composition type", toString(state.compositionType), state.compositionType);
     61 
     62     out.append("\n      buffer: ");
     63     dumpVal(out, "buffer", state.buffer.get());
     64     dumpVal(out, "slot", state.bufferSlot);
     65 
     66     out.append("\n      ");
     67     dumpVal(out, "sideband stream", state.sidebandStream.get());
     68 
     69     out.append("\n      ");
     70     dumpVal(out, "color", state.color);
     71 
     72     out.append("\n      ");
     73     dumpVal(out, "dataspace", toString(state.dataspace), state.dataspace);
     74     dumpVal(out, "hdr metadata types", state.hdrMetadata.validTypes);
     75     dumpVal(out, "colorTransform", state.colorTransform);
     76 
     77     out.append("\n");
     78 }
     79 
     80 } // namespace
     81 
     82 void LayerCompositionState::dump(std::string& out) const {
     83     out.append("    frontend:\n");
     84     dumpFrontEnd(out, frontEnd);
     85 }
     86 
     87 } // namespace android::compositionengine::impl
     88