1 /*
2  * Copyright 2022 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 #ifndef ANDROID_HWC_NOOPFRAMECOMPOSER_H
18 #define ANDROID_HWC_NOOPFRAMECOMPOSER_H
19 
20 #include "Common.h"
21 #include "Display.h"
22 #include "DrmClient.h"
23 #include "FrameComposer.h"
24 #include "Gralloc.h"
25 #include "Layer.h"
26 
27 namespace aidl::android::hardware::graphics::composer3::impl {
28 
29 class NoOpFrameComposer : public FrameComposer {
30    public:
31     NoOpFrameComposer() = default;
32 
33     NoOpFrameComposer(const NoOpFrameComposer&) = delete;
34     NoOpFrameComposer& operator=(const NoOpFrameComposer&) = delete;
35 
36     NoOpFrameComposer(NoOpFrameComposer&&) = delete;
37     NoOpFrameComposer& operator=(NoOpFrameComposer&&) = delete;
38 
39     HWC3::Error init() override;
40 
41     HWC3::Error registerOnHotplugCallback(const HotplugCallback& cb) override;
42 
43     HWC3::Error unregisterOnHotplugCallback() override;
44 
45     HWC3::Error onDisplayCreate(Display*) override;
46 
47     HWC3::Error onDisplayDestroy(Display*) override;
48 
49     HWC3::Error onDisplayClientTargetSet(Display*) override;
50 
51     // Determines if this composer can compose the given layers on the given
52     // display and requests changes for layers that can't not be composed.
53     HWC3::Error validateDisplay(Display* display, DisplayChanges* outChanges) override;
54 
55     // Performs the actual composition of layers and presents the composed result
56     // to the display.
57     HWC3::Error presentDisplay(
58         Display* display, ::android::base::unique_fd* outDisplayFence,
59         std::unordered_map<int64_t, ::android::base::unique_fd>* outLayerFences) override;
60 
61     HWC3::Error onActiveConfigChange(Display* /*display*/) override;
62 };
63 
64 }  // namespace aidl::android::hardware::graphics::composer3::impl
65 
66 #endif
67