1 /*
2  * Copyright 2018 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 <android/hardware/graphics/composer/2.4/types.h>
20 #include <composer-hal/2.3/ComposerHal.h>
21 
22 namespace android {
23 namespace hardware {
24 namespace graphics {
25 namespace composer {
26 namespace V2_4 {
27 namespace hal {
28 
29 using common::V1_1::RenderIntent;
30 using common::V1_2::ColorMode;
31 using common::V1_2::Dataspace;
32 using common::V1_2::Hdr;
33 using common::V1_2::PixelFormat;
34 using V2_1::Config;
35 using V2_1::Display;
36 using V2_1::Layer;
37 using V2_4::Error;
38 using V2_4::VsyncPeriodNanos;
39 
40 class ComposerHal : public V2_3::hal::ComposerHal {
41   public:
42     class EventCallback_2_4 {
43       public:
44         virtual ~EventCallback_2_4() = default;
45         virtual void onHotplug(Display display, IComposerCallback::Connection connected) = 0;
46         virtual void onRefresh(Display display) = 0;
47         virtual void onVsync(Display display, int64_t timestamp) = 0;
48         virtual void onVsync_2_4(Display display, int64_t timestamp,
49                                  VsyncPeriodNanos vsyncPeriodNanos) = 0;
50         virtual void onVsyncPeriodTimingChanged(Display display,
51                                                 const VsyncPeriodChangeTimeline& timeline) = 0;
52         virtual void onSeamlessPossible(Display display) = 0;
53     };
54 
55     virtual void registerEventCallback_2_4(EventCallback_2_4* callback) = 0;
56 
57     virtual void unregisterEventCallback_2_4() = 0;
58 
59     virtual Error getDisplayCapabilities_2_4(
60             Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) = 0;
61     virtual Error getDisplayConnectionType(Display display,
62                                            IComposerClient::DisplayConnectionType* outType) = 0;
63     virtual Error getDisplayAttribute_2_4(Display display, Config config,
64                                           IComposerClient::Attribute attribute,
65                                           int32_t* outValue) = 0;
66     virtual Error getDisplayVsyncPeriod(Display display, VsyncPeriodNanos* outVsyncPeriod) = 0;
67     virtual Error setActiveConfigWithConstraints(
68             Display display, Config config,
69             const IComposerClient::VsyncPeriodChangeConstraints& vsyncPeriodChangeConstraints,
70             VsyncPeriodChangeTimeline* timeline) = 0;
71     virtual Error setAutoLowLatencyMode(Display display, bool on) = 0;
72     virtual Error getSupportedContentTypes(
73             Display display,
74             std::vector<IComposerClient::ContentType>* outSupportedContentTypes) = 0;
75     virtual Error setContentType(Display display, IComposerClient::ContentType contentType) = 0;
76     virtual Error validateDisplay_2_4(
77             Display display, std::vector<Layer>* outChangedLayers,
78             std::vector<IComposerClient::Composition>* outCompositionTypes,
79             uint32_t* outDisplayRequestMask, std::vector<Layer>* outRequestedLayers,
80             std::vector<uint32_t>* outRequestMasks,
81             IComposerClient::ClientTargetProperty* outClientTargetProperty) = 0;
82     virtual Error setLayerGenericMetadata(Display display, Layer layer, const std::string& key,
83                                           bool mandatory, const std::vector<uint8_t>& value) = 0;
84     virtual Error getLayerGenericMetadataKeys(
85             std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) = 0;
86 };
87 
88 }  // namespace hal
89 }  // namespace V2_4
90 }  // namespace composer
91 }  // namespace graphics
92 }  // namespace hardware
93 }  // namespace android
94