blob: 785a6d7fbe045d8082fee790b789ee9645da14ea [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 {
Lloyd Pique07e33212018-12-18 16:33:37 -080039 // TODO(lpique): b/121291683 Remove this one we are sure we don't need the
40 // value recomputed / set every frame.
41 Region geomVisibleRegion;
42
Lloyd Pique0b785d82018-12-04 17:25:27 -080043 /*
44 * Presentation
45 */
46
47 // The blend mode for this layer
48 Hwc2::IComposerClient::BlendMode blendMode{Hwc2::IComposerClient::BlendMode::INVALID};
49
50 // The alpha value for this layer
51 float alpha{1.f};
52
53 /*
54 * Extra metadata
55 */
56
57 // The type for this layer
58 int type{0};
59
60 // The appId for this layer
61 int appId{0};
62
63 /*
64 * Per-frame content
65 */
66
67 // The type of composition for this layer
68 Hwc2::IComposerClient::Composition compositionType{Hwc2::IComposerClient::Composition::INVALID};
69
70 // The buffer and related state
71 sp<GraphicBuffer> buffer;
72 int bufferSlot{BufferQueue::INVALID_BUFFER_SLOT};
73 sp<Fence> acquireFence;
74 Region surfaceDamage;
75
76 // The handle to use for a sideband stream for this layer
77 sp<NativeHandle> sidebandStream;
78
79 // The color for this layer
80 Hwc2::IComposerClient::Color color;
81
82 /*
83 * Per-frame presentation state
84 */
85
86 // The dataspace for this layer
87 ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
88
89 // The metadata for this layer
90 HdrMetadata hdrMetadata;
91
92 // The color transform
93 mat4 colorTransform;
94};
95
96} // namespace android::compositionengine