blob: 17f50790dbd697f6b16a31a1605d5821f4419668 [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);
Marissa Wall1cd789c2017-01-27 12:55:36 -080039 int getBuffer(buffer_handle_t* outHandle, int32_t* outAcquireFence);
Marissa Wall5a240aa2016-12-15 12:34:06 -080040
Marissa Wallf7618ed2016-12-15 12:34:39 -080041 void setZOrder(uint32_t zOrder);
42 void setVisibleRegion(const android::Region& region);
43
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080044 void reset();
Marissa Wall1cd789c2017-01-27 12:55:36 -080045 bool advance();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080046
Marissa Wallb72b5c92016-12-15 12:26:39 -080047 hwc2_blend_mode_t getBlendMode() const;
Marissa Wallf7618ed2016-12-15 12:34:39 -080048 Area getBufferArea() const;
Marissa Wallee242782016-12-15 12:30:12 -080049 hwc_color_t getColor() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080050 hwc2_composition_t getComposition() const;
Marissa Wall2a0aaf92016-12-15 12:31:37 -080051 hwc_rect_t getCursorPosition() const;
Marissa Wallb72b5c92016-12-15 12:26:39 -080052 android_dataspace_t getDataspace() const;
Marissa Wall600a73b2016-12-15 12:30:39 -080053 hwc_rect_t getDisplayFrame() const;
Marissa Wall2b1f5302016-12-15 12:27:20 -080054 float getPlaneAlpha() const;
Marissa Wallc57468f2016-12-15 12:31:12 -080055 hwc_frect_t getSourceCrop() const;
Marissa Wallad761812016-12-15 12:32:24 -080056 hwc_region_t getSurfaceDamage() const;
Marissa Wallac108192016-12-15 12:27:48 -080057 hwc_transform_t getTransform() const;
Marissa Wallf7618ed2016-12-15 12:34:39 -080058 hwc_region_t getVisibleRegion() const;
Marissa Wall273b1df2016-12-15 12:28:47 -080059 uint32_t getZOrder() const;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080060
Marissa Wallffc67da2016-12-15 12:26:09 -080061 bool advanceBlendMode();
Marissa Wallc57468f2016-12-15 12:31:12 -080062 bool advanceBufferArea();
Marissa Wallee242782016-12-15 12:30:12 -080063 bool advanceColor();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080064 bool advanceComposition();
Marissa Wall2a0aaf92016-12-15 12:31:37 -080065 bool advanceCursorPosition();
Marissa Wallb72b5c92016-12-15 12:26:39 -080066 bool advanceDataspace();
Marissa Wall600a73b2016-12-15 12:30:39 -080067 bool advanceDisplayFrame();
Marissa Wall2b1f5302016-12-15 12:27:20 -080068 bool advancePlaneAlpha();
Marissa Wallc57468f2016-12-15 12:31:12 -080069 bool advanceSourceCrop();
Marissa Wallad761812016-12-15 12:32:24 -080070 bool advanceSurfaceDamage();
Marissa Wallac108192016-12-15 12:27:48 -080071 bool advanceTransform();
Marissa Wallf7618ed2016-12-15 12:34:39 -080072 bool advanceVisibleRegion();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080073
74private:
Marissa Wallf7618ed2016-12-15 12:34:39 -080075 std::array<Hwc2TestContainer*, 10> mProperties = {{
Marissa Wall1cd789c2017-01-27 12:55:36 -080076 &mTransform, &mColor, &mDataspace, &mPlaneAlpha, &mSourceCrop,
77 &mSurfaceDamage, &mBlendMode, &mBufferArea, &mDisplayFrame,
78 &mComposition
Marissa Wallffc67da2016-12-15 12:26:09 -080079 }};
80
Marissa Wall5a240aa2016-12-15 12:34:06 -080081 Hwc2TestBuffer mBuffer;
82
Marissa Wallffc67da2016-12-15 12:26:09 -080083 Hwc2TestBlendMode mBlendMode;
Marissa Wallc57468f2016-12-15 12:31:12 -080084 Hwc2TestBufferArea mBufferArea;
Marissa Wallee242782016-12-15 12:30:12 -080085 Hwc2TestColor mColor;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080086 Hwc2TestComposition mComposition;
Marissa Wallb72b5c92016-12-15 12:26:39 -080087 Hwc2TestDataspace mDataspace;
Marissa Wall600a73b2016-12-15 12:30:39 -080088 Hwc2TestDisplayFrame mDisplayFrame;
Marissa Wall2b1f5302016-12-15 12:27:20 -080089 Hwc2TestPlaneAlpha mPlaneAlpha;
Marissa Wallc57468f2016-12-15 12:31:12 -080090 Hwc2TestSourceCrop mSourceCrop;
Marissa Wallad761812016-12-15 12:32:24 -080091 Hwc2TestSurfaceDamage mSurfaceDamage;
Marissa Wallac108192016-12-15 12:27:48 -080092 Hwc2TestTransform mTransform;
Marissa Wallf7618ed2016-12-15 12:34:39 -080093 Hwc2TestVisibleRegion mVisibleRegion;
Marissa Wall273b1df2016-12-15 12:28:47 -080094
Marissa Wallf7618ed2016-12-15 12:34:39 -080095 uint32_t mZOrder = UINT32_MAX;
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080096};
97
98#endif /* ifndef _HWC2_TEST_LAYER_H */