• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cstdint>
20 #include <optional>
21 
22 #include <ui/DisplayIdentification.h>
23 
24 #include <compositionengine/Output.h>
25 
26 namespace android::compositionengine {
27 
28 struct RenderSurfaceCreationArgs;
29 struct DisplayColorProfileCreationArgs;
30 
31 /**
32  * A display is a composition target which may be backed by a hardware composer
33  * display device
34  */
35 class Display : public virtual Output {
36 public:
37     // Gets the DisplayId for the display
38     virtual DisplayId getId() const = 0;
39 
40     // True if the display is secure
41     virtual bool isSecure() const = 0;
42 
43     // True if the display is virtual
44     virtual bool isVirtual() const = 0;
45 
46     // Releases the use of the HWC display, if any
47     virtual void disconnect() = 0;
48 
49     // Creates a render color mode for the display
50     virtual void createDisplayColorProfile(const DisplayColorProfileCreationArgs&) = 0;
51 
52     // Creates a render surface for the display
53     virtual void createRenderSurface(const RenderSurfaceCreationArgs&) = 0;
54 
55     // Creates a cache to cache duplicate client composition requests and skip
56     // similar requests if needed.
57     virtual void createClientCompositionCache(uint32_t cacheSize) = 0;
58 
59     // Sends the brightness setting to HWC
60     virtual void applyDisplayBrightness(const bool applyImmediately) = 0;
61 
62 protected:
63     ~Display() = default;
64 };
65 
66 } // namespace android::compositionengine
67