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 <memory>
20 
21 #include <compositionengine/Display.h>
22 #include <compositionengine/impl/Output.h>
23 
24 #include "DisplayHardware/DisplayIdentification.h"
25 
26 namespace android::compositionengine {
27 
28 class CompositionEngine;
29 
30 struct DisplayCreationArgs;
31 
32 namespace impl {
33 
34 class Display : public compositionengine::impl::Output, public compositionengine::Display {
35 public:
36     Display(const CompositionEngine&, compositionengine::DisplayCreationArgs&&);
37     virtual ~Display();
38 
39     // compositionengine::Output overrides
40     void dump(std::string&) const override;
41     void setColorTransform(const mat4&) override;
42     void setColorMode(ui::ColorMode, ui::Dataspace, ui::RenderIntent) override;
43 
44     // compositionengine::Display overrides
45     const std::optional<DisplayId>& getId() const override;
46     bool isSecure() const override;
47     bool isVirtual() const override;
48     void disconnect() override;
49     void createDisplayColorProfile(compositionengine::DisplayColorProfileCreationArgs&&) override;
50     void createRenderSurface(compositionengine::RenderSurfaceCreationArgs&&) override;
51 
52 private:
53     const bool mIsVirtual;
54     std::optional<DisplayId> mId;
55 };
56 
57 std::shared_ptr<compositionengine::Display> createDisplay(
58         const compositionengine::CompositionEngine&, compositionengine::DisplayCreationArgs&&);
59 } // namespace impl
60 } // namespace android::compositionengine
61