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 #pragma once 18 19 #include <optional> 20 #include <string> 21 22 #include <utils/StrongPointer.h> 23 24 #include "DisplayHardware/DisplayIdentification.h" 25 26 namespace android { 27 28 namespace compositionengine { 29 30 class CompositionEngine; 31 class Output; 32 class Layer; 33 class LayerFE; 34 35 namespace impl { 36 struct OutputLayerCompositionState; 37 } // namespace impl 38 39 /** 40 * An output layer contains the output-dependent composition state for a layer 41 */ 42 class OutputLayer { 43 public: 44 virtual ~OutputLayer(); 45 46 // Gets the output which owns this output layer 47 virtual const Output& getOutput() const = 0; 48 49 // Gets the display-independent layer which this output layer represents 50 virtual Layer& getLayer() const = 0; 51 52 // Gets the front-end layer interface this output layer represents 53 virtual LayerFE& getLayerFE() const = 0; 54 55 using CompositionState = compositionengine::impl::OutputLayerCompositionState; 56 57 // Gets the raw composition state data for the layer 58 // TODO(lpique): Make this protected once it is only internally called. 59 virtual const CompositionState& getState() const = 0; 60 61 // Allows mutable access to the raw composition state data for the layer. 62 // This is meant to be used by the various functions that are part of the 63 // composition process. 64 // TODO(lpique): Make this protected once it is only internally called. 65 virtual CompositionState& editState() = 0; 66 67 // Recalculates the state of the output layer from the output-independent 68 // layer. If includeGeometry is false, the geometry state can be skipped. 69 virtual void updateCompositionState(bool includeGeometry) = 0; 70 71 // Writes the geometry state to the HWC, or does nothing if this layer does 72 // not use the HWC. If includeGeometry is false, the geometry state can be 73 // skipped. 74 virtual void writeStateToHWC(bool includeGeometry) const = 0; 75 76 // Debugging 77 virtual void dump(std::string& result) const = 0; 78 }; 79 80 } // namespace compositionengine 81 } // namespace android 82