blob: 86c36496c7c6c8b4e0c7b42e360d27d06fb94426 [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 Wallf7618ed2016-12-15 12:34:39 -080033 Hwc2TestLayer(Hwc2TestCoverage coverage, const Area& displayArea);
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080034
35 std::string dump() const;
36
Marissa Wall5a240aa2016-12-15 12:34:06 -080037 int getBuffer(buffer_handle_t* outHandle,
38 android::base::unique_fd* outAcquireFence);
39
Marissa Wallf7618ed2016-12-15 12:34:39 -080040 void setZOrder(uint32_t zOrder);
41 void setVisibleRegion(const android::Region& region);
42
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080043 void reset();
44
Marissa Wallb72b5c92016-12-15 12:26:39 -080045 hwc2_blend_mode_t getBlendMode() const;
Marissa Wallf7618ed2016-12-15 12:34:39 -080046 Area getBufferArea() const;
Marissa Wallee242782016-12-15 12:30:12 -080047 hwc_color_t getColor() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080048 hwc2_composition_t getComposition() const;
Marissa Wall2a0aaf92016-12-15 12:31:37 -080049 hwc_rect_t getCursorPosition() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080050 android_dataspace_t getDataspace() const;
Marissa Wall600a73b2016-12-15 12:30:39 -080051 hwc_rect_t getDisplayFrame() const;
Marissa Wall2b1f5302016-12-15 12:27:20 -080052 float getPlaneAlpha() const;
Marissa Wallc57468f2016-12-15 12:31:12 -080053 hwc_frect_t getSourceCrop() const;
Marissa Wallad761812016-12-15 12:32:24 -080054 hwc_region_t getSurfaceDamage() const;
Marissa Wallac108192016-12-15 12:27:48 -080055 hwc_transform_t getTransform() const;
Marissa Wallf7618ed2016-12-15 12:34:39 -080056 hwc_region_t getVisibleRegion() const;
Marissa Wall273b1df2016-12-15 12:28:47 -080057 uint32_t getZOrder() const;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080058
Marissa Wallffc67da2016-12-15 12:26:09 -080059 bool advanceBlendMode();
Marissa Wallc57468f2016-12-15 12:31:12 -080060 bool advanceBufferArea();
Marissa Wallee242782016-12-15 12:30:12 -080061 bool advanceColor();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080062 bool advanceComposition();
Marissa Wall2a0aaf92016-12-15 12:31:37 -080063 bool advanceCursorPosition();
Marissa Wallb72b5c92016-12-15 12:26:39 -080064 bool advanceDataspace();
Marissa Wall600a73b2016-12-15 12:30:39 -080065 bool advanceDisplayFrame();
Marissa Wall2b1f5302016-12-15 12:27:20 -080066 bool advancePlaneAlpha();
Marissa Wallc57468f2016-12-15 12:31:12 -080067 bool advanceSourceCrop();
Marissa Wallad761812016-12-15 12:32:24 -080068 bool advanceSurfaceDamage();
Marissa Wallac108192016-12-15 12:27:48 -080069 bool advanceTransform();
Marissa Wallf7618ed2016-12-15 12:34:39 -080070 bool advanceVisibleRegion();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080071
72private:
Marissa Wallf7618ed2016-12-15 12:34:39 -080073 std::array<Hwc2TestContainer*, 10> mProperties = {{
74 &mBlendMode, &mBufferArea, &mColor, &mComposition, &mDataspace,
75 &mDisplayFrame, &mPlaneAlpha, &mSourceCrop, &mSurfaceDamage, &mTransform
Marissa Wallffc67da2016-12-15 12:26:09 -080076 }};
77
Marissa Wall5a240aa2016-12-15 12:34:06 -080078 Hwc2TestBuffer mBuffer;
79
Marissa Wallffc67da2016-12-15 12:26:09 -080080 Hwc2TestBlendMode mBlendMode;
Marissa Wallc57468f2016-12-15 12:31:12 -080081 Hwc2TestBufferArea mBufferArea;
Marissa Wallee242782016-12-15 12:30:12 -080082 Hwc2TestColor mColor;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080083 Hwc2TestComposition mComposition;
Marissa Wallb72b5c92016-12-15 12:26:39 -080084 Hwc2TestDataspace mDataspace;
Marissa Wall600a73b2016-12-15 12:30:39 -080085 Hwc2TestDisplayFrame mDisplayFrame;
Marissa Wall2b1f5302016-12-15 12:27:20 -080086 Hwc2TestPlaneAlpha mPlaneAlpha;
Marissa Wallc57468f2016-12-15 12:31:12 -080087 Hwc2TestSourceCrop mSourceCrop;
Marissa Wallad761812016-12-15 12:32:24 -080088 Hwc2TestSurfaceDamage mSurfaceDamage;
Marissa Wallac108192016-12-15 12:27:48 -080089 Hwc2TestTransform mTransform;
Marissa Wallf7618ed2016-12-15 12:34:39 -080090 Hwc2TestVisibleRegion mVisibleRegion;
Marissa Wall273b1df2016-12-15 12:28:47 -080091
Marissa Wallf7618ed2016-12-15 12:34:39 -080092 uint32_t mZOrder = UINT32_MAX;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080093};
94
95#endif /* ifndef _HWC2_TEST_LAYER_H */