blob: 27885abefb5d591fd676b994f504d13404dfe553 [file] [log] [blame]
Marissa Wall6bd8bfd2016-12-15 12:25:31 -08001/*
2 * Copyright (C) 2016 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 _HWC2_TEST_LAYER_H
18#define _HWC2_TEST_LAYER_H
19
Marissa Wall5a240aa2016-12-15 12:34:06 -080020#include <android-base/unique_fd.h>
21
22#include "Hwc2TestBuffer.h"
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080023#include "Hwc2TestProperties.h"
24
25#define HWC2_INCLUDE_STRINGIFICATION
26#define HWC2_USE_CPP11
27#include <hardware/hwcomposer2.h>
28#undef HWC2_INCLUDE_STRINGIFICATION
29#undef HWC2_USE_CPP11
30
31class Hwc2TestLayer {
32public:
Marissa Wall600a73b2016-12-15 12:30:39 -080033 Hwc2TestLayer(Hwc2TestCoverage coverage, const Area& displayArea,
34 uint32_t zOrder = 0);
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080035
36 std::string dump() const;
37
Marissa Wall5a240aa2016-12-15 12:34:06 -080038 int getBuffer(buffer_handle_t* outHandle,
39 android::base::unique_fd* outAcquireFence);
40
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080041 void reset();
42
Marissa Wallb72b5c92016-12-15 12:26:39 -080043 hwc2_blend_mode_t getBlendMode() const;
Marissa Wallee242782016-12-15 12:30:12 -080044 hwc_color_t getColor() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080045 hwc2_composition_t getComposition() const;
Marissa Wall2a0aaf92016-12-15 12:31:37 -080046 hwc_rect_t getCursorPosition() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080047 android_dataspace_t getDataspace() const;
Marissa Wall600a73b2016-12-15 12:30:39 -080048 hwc_rect_t getDisplayFrame() const;
Marissa Wall2b1f5302016-12-15 12:27:20 -080049 float getPlaneAlpha() const;
Marissa Wallc57468f2016-12-15 12:31:12 -080050 hwc_frect_t getSourceCrop() const;
Marissa Wallad761812016-12-15 12:32:24 -080051 hwc_region_t getSurfaceDamage() const;
Marissa Wallac108192016-12-15 12:27:48 -080052 hwc_transform_t getTransform() const;
Marissa Wall273b1df2016-12-15 12:28:47 -080053 uint32_t getZOrder() const;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080054
Marissa Wallffc67da2016-12-15 12:26:09 -080055 bool advanceBlendMode();
Marissa Wallc57468f2016-12-15 12:31:12 -080056 bool advanceBufferArea();
Marissa Wallee242782016-12-15 12:30:12 -080057 bool advanceColor();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080058 bool advanceComposition();
Marissa Wall2a0aaf92016-12-15 12:31:37 -080059 bool advanceCursorPosition();
Marissa Wallb72b5c92016-12-15 12:26:39 -080060 bool advanceDataspace();
Marissa Wall600a73b2016-12-15 12:30:39 -080061 bool advanceDisplayFrame();
Marissa Wall2b1f5302016-12-15 12:27:20 -080062 bool advancePlaneAlpha();
Marissa Wallc57468f2016-12-15 12:31:12 -080063 bool advanceSourceCrop();
Marissa Wallad761812016-12-15 12:32:24 -080064 bool advanceSurfaceDamage();
Marissa Wallac108192016-12-15 12:27:48 -080065 bool advanceTransform();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080066
67private:
Marissa Wallad761812016-12-15 12:32:24 -080068 std::array<Hwc2TestContainer*, 9> mProperties = {{
Marissa Wallee242782016-12-15 12:30:12 -080069 &mBlendMode, &mColor, &mComposition, &mDataspace, &mDisplayFrame,
Marissa Wallad761812016-12-15 12:32:24 -080070 &mPlaneAlpha, &mSourceCrop, &mSurfaceDamage, &mTransform
Marissa Wallffc67da2016-12-15 12:26:09 -080071 }};
72
Marissa Wall5a240aa2016-12-15 12:34:06 -080073 Hwc2TestBuffer mBuffer;
74
Marissa Wallffc67da2016-12-15 12:26:09 -080075 Hwc2TestBlendMode mBlendMode;
Marissa Wallc57468f2016-12-15 12:31:12 -080076 Hwc2TestBufferArea mBufferArea;
Marissa Wallee242782016-12-15 12:30:12 -080077 Hwc2TestColor mColor;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080078 Hwc2TestComposition mComposition;
Marissa Wallb72b5c92016-12-15 12:26:39 -080079 Hwc2TestDataspace mDataspace;
Marissa Wall600a73b2016-12-15 12:30:39 -080080 Hwc2TestDisplayFrame mDisplayFrame;
Marissa Wall2b1f5302016-12-15 12:27:20 -080081 Hwc2TestPlaneAlpha mPlaneAlpha;
Marissa Wallc57468f2016-12-15 12:31:12 -080082 Hwc2TestSourceCrop mSourceCrop;
Marissa Wallad761812016-12-15 12:32:24 -080083 Hwc2TestSurfaceDamage mSurfaceDamage;
Marissa Wallac108192016-12-15 12:27:48 -080084 Hwc2TestTransform mTransform;
Marissa Wall273b1df2016-12-15 12:28:47 -080085
86 uint32_t mZOrder;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080087};
88
89#endif /* ifndef _HWC2_TEST_LAYER_H */