blob: 2201bdd6d22d53df8ea816c8d4314ff384848149 [file] [log] [blame]
Lloyd Pique0b785d82018-12-04 17:25:27 -08001/*
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 <cstdint>
20
21#include <gui/BufferQueue.h>
22#include <gui/HdrMetadata.h>
23#include <math/mat4.h>
24#include <ui/FloatRect.h>
25#include <ui/GraphicBuffer.h>
26#include <ui/GraphicTypes.h>
27#include <ui/Rect.h>
28#include <ui/Region.h>
29#include <ui/Transform.h>
30
31#include "DisplayHardware/ComposerHal.h"
32
33namespace android::compositionengine {
34
35/*
36 * Used by LayerFE::getCompositionState
37 */
38struct LayerFECompositionState {
39 /*
40 * Presentation
41 */
42
43 // The blend mode for this layer
44 Hwc2::IComposerClient::BlendMode blendMode{Hwc2::IComposerClient::BlendMode::INVALID};
45
46 // The alpha value for this layer
47 float alpha{1.f};
48
49 /*
50 * Extra metadata
51 */
52
53 // The type for this layer
54 int type{0};
55
56 // The appId for this layer
57 int appId{0};
58
59 /*
60 * Per-frame content
61 */
62
63 // The type of composition for this layer
64 Hwc2::IComposerClient::Composition compositionType{Hwc2::IComposerClient::Composition::INVALID};
65
66 // The buffer and related state
67 sp<GraphicBuffer> buffer;
68 int bufferSlot{BufferQueue::INVALID_BUFFER_SLOT};
69 sp<Fence> acquireFence;
70 Region surfaceDamage;
71
72 // The handle to use for a sideband stream for this layer
73 sp<NativeHandle> sidebandStream;
74
75 // The color for this layer
76 Hwc2::IComposerClient::Color color;
77
78 /*
79 * Per-frame presentation state
80 */
81
82 // The dataspace for this layer
83 ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
84
85 // The metadata for this layer
86 HdrMetadata hdrMetadata;
87
88 // The color transform
89 mat4 colorTransform;
90};
91
92} // namespace android::compositionengine