blob: acd9b3099a1604b92af807dcce9444560a5f2e87 [file] [log] [blame]
Lloyd Piqued0094aa2017-12-20 16:43:28 -08001/*
2 * Copyright (C) 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 <gmock/gmock.h>
20
21#include "DisplayHardware/ComposerHal.h"
22
23namespace android {
24
25class GraphicBuffer;
26
27namespace Hwc2 {
28namespace mock {
29
30using android::hardware::graphics::common::V1_0::ColorMode;
31using android::hardware::graphics::common::V1_0::ColorTransform;
32using android::hardware::graphics::common::V1_0::Dataspace;
33using android::hardware::graphics::common::V1_0::Hdr;
34using android::hardware::graphics::common::V1_0::PixelFormat;
35using android::hardware::graphics::common::V1_0::Transform;
36
37using android::hardware::graphics::composer::V2_1::Config;
38using android::hardware::graphics::composer::V2_1::Display;
39using android::hardware::graphics::composer::V2_1::Error;
40using android::hardware::graphics::composer::V2_1::IComposer;
41using android::hardware::graphics::composer::V2_1::IComposerCallback;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080042using android::hardware::graphics::composer::V2_1::Layer;
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -070043using android::hardware::graphics::composer::V2_2::IComposerClient;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080044
45class Composer : public Hwc2::Composer {
46public:
47 Composer();
48 ~Composer() override;
49
50 MOCK_METHOD0(getCapabilities, std::vector<IComposer::Capability>());
51 MOCK_METHOD0(dumpDebugInfo, std::string());
52 MOCK_METHOD1(registerCallback, void(const sp<IComposerCallback>&));
53 MOCK_METHOD0(isRemote, bool());
54 MOCK_METHOD0(resetCommands, void());
55 MOCK_METHOD0(executeCommands, Error());
56 MOCK_METHOD0(getMaxVirtualDisplayCount, uint32_t());
57 MOCK_CONST_METHOD0(isUsingVrComposer, bool());
58 MOCK_METHOD4(createVirtualDisplay, Error(uint32_t, uint32_t, PixelFormat*, Display*));
59 MOCK_METHOD1(destroyVirtualDisplay, Error(Display));
60 MOCK_METHOD1(acceptDisplayChanges, Error(Display));
61 MOCK_METHOD2(createLayer, Error(Display, Layer* outLayer));
62 MOCK_METHOD2(destroyLayer, Error(Display, Layer));
63 MOCK_METHOD2(getActiveConfig, Error(Display, Config*));
64 MOCK_METHOD3(getChangedCompositionTypes,
65 Error(Display, std::vector<Layer>*, std::vector<IComposerClient::Composition>*));
66 MOCK_METHOD2(getColorModes, Error(Display, std::vector<ColorMode>*));
67 MOCK_METHOD4(getDisplayAttribute,
68 Error(Display, Config config, IComposerClient::Attribute, int32_t*));
69 MOCK_METHOD2(getDisplayConfigs, Error(Display, std::vector<Config>*));
70 MOCK_METHOD2(getDisplayName, Error(Display, std::string*));
71 MOCK_METHOD4(getDisplayRequests,
72 Error(Display, uint32_t*, std::vector<Layer>*, std::vector<uint32_t>*));
73 MOCK_METHOD2(getDisplayType, Error(Display, IComposerClient::DisplayType*));
74 MOCK_METHOD2(getDozeSupport, Error(Display, bool*));
75 MOCK_METHOD5(getHdrCapabilities, Error(Display, std::vector<Hdr>*, float*, float*, float*));
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -070076 MOCK_METHOD2(getPerFrameMetadataKeys,
77 Error(Display, std::vector<IComposerClient::PerFrameMetadataKey>*));
Lloyd Piqued0094aa2017-12-20 16:43:28 -080078 MOCK_METHOD3(getReleaseFences, Error(Display, std::vector<Layer>*, std::vector<int>*));
79 MOCK_METHOD2(presentDisplay, Error(Display, int*));
80 MOCK_METHOD2(setActiveConfig, Error(Display, Config));
81 MOCK_METHOD6(setClientTarget,
82 Error(Display, uint32_t, const sp<GraphicBuffer>&, int, Dataspace,
83 const std::vector<IComposerClient::Rect>&));
84 MOCK_METHOD2(setColorMode, Error(Display, ColorMode));
85 MOCK_METHOD3(setColorTransform, Error(Display, const float*, ColorTransform));
86 MOCK_METHOD3(setOutputBuffer, Error(Display, const native_handle_t*, int));
87 MOCK_METHOD2(setPowerMode, Error(Display, IComposerClient::PowerMode));
88 MOCK_METHOD2(setVsyncEnabled, Error(Display, IComposerClient::Vsync));
89 MOCK_METHOD1(setClientTargetSlotCount, Error(Display));
90 MOCK_METHOD3(validateDisplay, Error(Display, uint32_t*, uint32_t*));
91 MOCK_METHOD5(presentOrValidateDisplay, Error(Display, uint32_t*, uint32_t*, int*, uint32_t*));
92 MOCK_METHOD4(setCursorPosition, Error(Display, Layer, int32_t, int32_t));
93 MOCK_METHOD5(setLayerBuffer, Error(Display, Layer, uint32_t, const sp<GraphicBuffer>&, int));
94 MOCK_METHOD3(setLayerSurfaceDamage,
95 Error(Display, Layer, const std::vector<IComposerClient::Rect>&));
96 MOCK_METHOD3(setLayerBlendMode, Error(Display, Layer, IComposerClient::BlendMode));
97 MOCK_METHOD3(setLayerColor, Error(Display, Layer, const IComposerClient::Color&));
98 MOCK_METHOD3(setLayerCompositionType, Error(Display, Layer, IComposerClient::Composition));
99 MOCK_METHOD3(setLayerDataspace, Error(Display, Layer, Dataspace));
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -0700100 MOCK_METHOD3(setLayerHdrMetadata, Error(Display, Layer, const HdrMetadata&));
Lloyd Piqued0094aa2017-12-20 16:43:28 -0800101 MOCK_METHOD3(setLayerDisplayFrame, Error(Display, Layer, const IComposerClient::Rect&));
102 MOCK_METHOD3(setLayerPlaneAlpha, Error(Display, Layer, float));
103 MOCK_METHOD3(setLayerSidebandStream, Error(Display, Layer, const native_handle_t*));
104 MOCK_METHOD3(setLayerSourceCrop, Error(Display, Layer, const IComposerClient::FRect&));
105 MOCK_METHOD3(setLayerTransform, Error(Display, Layer, Transform));
106 MOCK_METHOD3(setLayerVisibleRegion,
107 Error(Display, Layer, const std::vector<IComposerClient::Rect>&));
108 MOCK_METHOD3(setLayerZOrder, Error(Display, Layer, uint32_t));
109 MOCK_METHOD4(setLayerInfo, Error(Display, Layer, uint32_t, uint32_t));
110};
111
112} // namespace mock
113} // namespace Hwc2
114} // namespace android