LayerFECompositionState.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 <cstdint>
  18. #include <gui/BufferQueue.h>
  19. #include <gui/HdrMetadata.h>
  20. #include <math/mat4.h>
  21. #include <ui/FloatRect.h>
  22. #include <ui/GraphicBuffer.h>
  23. #include <ui/GraphicTypes.h>
  24. #include <ui/Rect.h>
  25. #include <ui/Region.h>
  26. #include <ui/Transform.h>
  27. #include "DisplayHardware/ComposerHal.h"
  28. namespace android::compositionengine {
  29. /*
  30. * Used by LayerFE::getCompositionState
  31. */
  32. struct LayerFECompositionState {
  33. // TODO(lpique): b/121291683 Remove this one we are sure we don't need the
  34. // value recomputed / set every frame.
  35. Region geomVisibleRegion;
  36. /*
  37. * Geometry state
  38. */
  39. bool isSecure{false};
  40. bool geomUsesSourceCrop{false};
  41. bool geomBufferUsesDisplayInverseTransform{false};
  42. uint32_t geomBufferTransform{0};
  43. ui::Transform geomLayerTransform;
  44. ui::Transform geomInverseLayerTransform;
  45. Rect geomBufferSize;
  46. Rect geomContentCrop;
  47. Rect geomCrop;
  48. Region geomActiveTransparentRegion;
  49. FloatRect geomLayerBounds;
  50. /*
  51. * Presentation
  52. */
  53. // The blend mode for this layer
  54. Hwc2::IComposerClient::BlendMode blendMode{Hwc2::IComposerClient::BlendMode::INVALID};
  55. // The alpha value for this layer
  56. float alpha{1.f};
  57. /*
  58. * Extra metadata
  59. */
  60. // The type for this layer
  61. int type{0};
  62. // The appId for this layer
  63. int appId{0};
  64. /*
  65. * Per-frame content
  66. */
  67. // The type of composition for this layer
  68. Hwc2::IComposerClient::Composition compositionType{Hwc2::IComposerClient::Composition::INVALID};
  69. // The buffer and related state
  70. sp<GraphicBuffer> buffer;
  71. int bufferSlot{BufferQueue::INVALID_BUFFER_SLOT};
  72. sp<Fence> acquireFence;
  73. Region surfaceDamage;
  74. // The handle to use for a sideband stream for this layer
  75. sp<NativeHandle> sidebandStream;
  76. // The color for this layer
  77. Hwc2::IComposerClient::Color color;
  78. /*
  79. * Per-frame presentation state
  80. */
  81. // The dataspace for this layer
  82. ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
  83. // The metadata for this layer
  84. HdrMetadata hdrMetadata;
  85. // The color transform
  86. mat4 colorTransform;
  87. };
  88. } // namespace android::compositionengine