blob: 8be277915ed8e462f028cfff9a224d71908ce42c [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
Lloyd Piqued0094aa2017-12-20 16:43:28 -080030using android::hardware::graphics::common::V1_0::ColorTransform;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080031using android::hardware::graphics::common::V1_0::Hdr;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080032using android::hardware::graphics::common::V1_0::Transform;
Peiyong Lin0e7a7912018-04-05 14:36:36 -070033using android::hardware::graphics::common::V1_1::ColorMode;
Peiyong Lin34beb7a2018-03-28 11:57:12 -070034using android::hardware::graphics::common::V1_1::Dataspace;
35using android::hardware::graphics::common::V1_1::PixelFormat;
Peiyong Lin0e7a7912018-04-05 14:36:36 -070036using android::hardware::graphics::common::V1_1::RenderIntent;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080037
38using android::hardware::graphics::composer::V2_1::Config;
39using android::hardware::graphics::composer::V2_1::Display;
40using android::hardware::graphics::composer::V2_1::Error;
41using android::hardware::graphics::composer::V2_1::IComposer;
42using android::hardware::graphics::composer::V2_1::IComposerCallback;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080043using android::hardware::graphics::composer::V2_1::Layer;
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -070044using android::hardware::graphics::composer::V2_2::IComposerClient;
Lloyd Piqued0094aa2017-12-20 16:43:28 -080045
46class Composer : public Hwc2::Composer {
47public:
48 Composer();
49 ~Composer() override;
50
51 MOCK_METHOD0(getCapabilities, std::vector<IComposer::Capability>());
52 MOCK_METHOD0(dumpDebugInfo, std::string());
53 MOCK_METHOD1(registerCallback, void(const sp<IComposerCallback>&));
54 MOCK_METHOD0(isRemote, bool());
55 MOCK_METHOD0(resetCommands, void());
56 MOCK_METHOD0(executeCommands, Error());
57 MOCK_METHOD0(getMaxVirtualDisplayCount, uint32_t());
58 MOCK_CONST_METHOD0(isUsingVrComposer, bool());
59 MOCK_METHOD4(createVirtualDisplay, Error(uint32_t, uint32_t, PixelFormat*, Display*));
60 MOCK_METHOD1(destroyVirtualDisplay, Error(Display));
61 MOCK_METHOD1(acceptDisplayChanges, Error(Display));
62 MOCK_METHOD2(createLayer, Error(Display, Layer* outLayer));
63 MOCK_METHOD2(destroyLayer, Error(Display, Layer));
64 MOCK_METHOD2(getActiveConfig, Error(Display, Config*));
65 MOCK_METHOD3(getChangedCompositionTypes,
66 Error(Display, std::vector<Layer>*, std::vector<IComposerClient::Composition>*));
67 MOCK_METHOD2(getColorModes, Error(Display, std::vector<ColorMode>*));
68 MOCK_METHOD4(getDisplayAttribute,
69 Error(Display, Config config, IComposerClient::Attribute, int32_t*));
70 MOCK_METHOD2(getDisplayConfigs, Error(Display, std::vector<Config>*));
71 MOCK_METHOD2(getDisplayName, Error(Display, std::string*));
72 MOCK_METHOD4(getDisplayRequests,
73 Error(Display, uint32_t*, std::vector<Layer>*, std::vector<uint32_t>*));
74 MOCK_METHOD2(getDisplayType, Error(Display, IComposerClient::DisplayType*));
75 MOCK_METHOD2(getDozeSupport, Error(Display, bool*));
76 MOCK_METHOD5(getHdrCapabilities, Error(Display, std::vector<Hdr>*, float*, float*, float*));
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -070077 MOCK_METHOD2(getPerFrameMetadataKeys,
78 Error(Display, std::vector<IComposerClient::PerFrameMetadataKey>*));
Peiyong Lin0e7a7912018-04-05 14:36:36 -070079 MOCK_METHOD2(getDataspaceSaturationMatrix, Error(Dataspace, mat4*));
Lloyd Piqued0094aa2017-12-20 16:43:28 -080080 MOCK_METHOD3(getReleaseFences, Error(Display, std::vector<Layer>*, std::vector<int>*));
81 MOCK_METHOD2(presentDisplay, Error(Display, int*));
82 MOCK_METHOD2(setActiveConfig, Error(Display, Config));
83 MOCK_METHOD6(setClientTarget,
84 Error(Display, uint32_t, const sp<GraphicBuffer>&, int, Dataspace,
85 const std::vector<IComposerClient::Rect>&));
Peiyong Lin0e7a7912018-04-05 14:36:36 -070086 MOCK_METHOD3(setColorMode, Error(Display, ColorMode, RenderIntent));
Lloyd Piqued0094aa2017-12-20 16:43:28 -080087 MOCK_METHOD3(setColorTransform, Error(Display, const float*, ColorTransform));
88 MOCK_METHOD3(setOutputBuffer, Error(Display, const native_handle_t*, int));
89 MOCK_METHOD2(setPowerMode, Error(Display, IComposerClient::PowerMode));
90 MOCK_METHOD2(setVsyncEnabled, Error(Display, IComposerClient::Vsync));
91 MOCK_METHOD1(setClientTargetSlotCount, Error(Display));
92 MOCK_METHOD3(validateDisplay, Error(Display, uint32_t*, uint32_t*));
93 MOCK_METHOD5(presentOrValidateDisplay, Error(Display, uint32_t*, uint32_t*, int*, uint32_t*));
94 MOCK_METHOD4(setCursorPosition, Error(Display, Layer, int32_t, int32_t));
95 MOCK_METHOD5(setLayerBuffer, Error(Display, Layer, uint32_t, const sp<GraphicBuffer>&, int));
96 MOCK_METHOD3(setLayerSurfaceDamage,
97 Error(Display, Layer, const std::vector<IComposerClient::Rect>&));
98 MOCK_METHOD3(setLayerBlendMode, Error(Display, Layer, IComposerClient::BlendMode));
99 MOCK_METHOD3(setLayerColor, Error(Display, Layer, const IComposerClient::Color&));
100 MOCK_METHOD3(setLayerCompositionType, Error(Display, Layer, IComposerClient::Composition));
101 MOCK_METHOD3(setLayerDataspace, Error(Display, Layer, Dataspace));
Courtney Goeltzenleuchterf9c98e52018-02-12 07:23:17 -0700102 MOCK_METHOD3(setLayerHdrMetadata, Error(Display, Layer, const HdrMetadata&));
Lloyd Piqued0094aa2017-12-20 16:43:28 -0800103 MOCK_METHOD3(setLayerDisplayFrame, Error(Display, Layer, const IComposerClient::Rect&));
104 MOCK_METHOD3(setLayerPlaneAlpha, Error(Display, Layer, float));
105 MOCK_METHOD3(setLayerSidebandStream, Error(Display, Layer, const native_handle_t*));
106 MOCK_METHOD3(setLayerSourceCrop, Error(Display, Layer, const IComposerClient::FRect&));
107 MOCK_METHOD3(setLayerTransform, Error(Display, Layer, Transform));
108 MOCK_METHOD3(setLayerVisibleRegion,
109 Error(Display, Layer, const std::vector<IComposerClient::Rect>&));
110 MOCK_METHOD3(setLayerZOrder, Error(Display, Layer, uint32_t));
111 MOCK_METHOD4(setLayerInfo, Error(Display, Layer, uint32_t, uint32_t));
Peiyong Lin0e7a7912018-04-05 14:36:36 -0700112 MOCK_METHOD3(getRenderIntents, Error(Display, ColorMode, std::vector<RenderIntent>*));
Lloyd Piqued0094aa2017-12-20 16:43:28 -0800113};
114
115} // namespace mock
116} // namespace Hwc2
117} // namespace android