OutputLayer.h 2.6 KB

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