Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 1 | /* |
| 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_PROPERTIES_H |
| 18 | #define _HWC2_TEST_PROPERTIES_H |
| 19 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 20 | #include <array> |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 21 | #include <vector> |
| 22 | |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 23 | #include <ui/GraphicTypes.h> |
Marissa Wall | f7618ed | 2016-12-15 12:34:39 -0800 | [diff] [blame] | 24 | #include <ui/Region.h> |
| 25 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 26 | #define HWC2_INCLUDE_STRINGIFICATION |
| 27 | #define HWC2_USE_CPP11 |
| 28 | #include <hardware/hwcomposer2.h> |
| 29 | #undef HWC2_INCLUDE_STRINGIFICATION |
| 30 | #undef HWC2_USE_CPP11 |
| 31 | |
| 32 | enum class Hwc2TestCoverage { |
| 33 | Default = 0, |
| 34 | Basic, |
| 35 | Complete, |
| 36 | }; |
| 37 | |
Marissa Wall | 563030b | 2017-02-21 14:01:05 -0800 | [diff] [blame] | 38 | enum class Hwc2TestPropertyName { |
| 39 | BlendMode = 1, |
| 40 | BufferArea, |
| 41 | Color, |
| 42 | Composition, |
| 43 | CursorPosition, |
| 44 | Dataspace, |
| 45 | DisplayFrame, |
| 46 | PlaneAlpha, |
| 47 | SourceCrop, |
| 48 | SurfaceDamage, |
| 49 | Transform, |
| 50 | }; |
| 51 | |
Marissa Wall | 600a73b | 2016-12-15 12:30:39 -0800 | [diff] [blame] | 52 | typedef struct { |
| 53 | int32_t width; |
| 54 | int32_t height; |
| 55 | } Area; |
| 56 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 57 | |
Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 58 | typedef struct { |
| 59 | uint32_t width; |
| 60 | uint32_t height; |
| 61 | } UnsignedArea; |
| 62 | |
| 63 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 64 | class Hwc2TestContainer { |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 65 | public: |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 66 | virtual ~Hwc2TestContainer() = default; |
| 67 | |
| 68 | /* Resets the container */ |
| 69 | virtual void reset() = 0; |
| 70 | |
| 71 | /* Attempts to advance to the next valid value. Returns true if one can be |
| 72 | * found */ |
| 73 | virtual bool advance() = 0; |
| 74 | |
| 75 | virtual std::string dump() const = 0; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 76 | |
| 77 | /* Returns true if the container supports the given composition type */ |
| 78 | virtual bool isSupported(hwc2_composition_t composition) = 0; |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | |
| 82 | template <class T> |
| 83 | class Hwc2TestProperty : public Hwc2TestContainer { |
| 84 | public: |
| 85 | Hwc2TestProperty(Hwc2TestCoverage coverage, |
| 86 | const std::vector<T>& completeList, const std::vector<T>& basicList, |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 87 | const std::vector<T>& defaultList, |
| 88 | const std::array<bool, 6>& compositionSupport) |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 89 | : Hwc2TestProperty((coverage == Hwc2TestCoverage::Complete)? completeList: |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 90 | (coverage == Hwc2TestCoverage::Basic)? basicList : defaultList, |
| 91 | compositionSupport) { } |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 92 | |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 93 | Hwc2TestProperty(const std::vector<T>& list, |
| 94 | const std::array<bool, 6>& compositionSupport) |
| 95 | : mList(list), |
| 96 | mCompositionSupport(compositionSupport) { } |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 97 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 98 | void reset() override |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 99 | { |
| 100 | mListIdx = 0; |
| 101 | } |
| 102 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 103 | bool advance() override |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 104 | { |
| 105 | if (mListIdx + 1 < mList.size()) { |
| 106 | mListIdx++; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 107 | updateDependents(); |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 108 | return true; |
| 109 | } |
| 110 | reset(); |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 111 | updateDependents(); |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 112 | return false; |
| 113 | } |
| 114 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 115 | T get() const |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 116 | { |
| 117 | return mList.at(mListIdx); |
| 118 | } |
| 119 | |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 120 | virtual bool isSupported(hwc2_composition_t composition) |
| 121 | { |
| 122 | return mCompositionSupport.at(composition); |
| 123 | } |
| 124 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 125 | protected: |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 126 | /* If a derived class has dependents, override this function */ |
| 127 | virtual void updateDependents() { } |
| 128 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 129 | const std::vector<T>& mList; |
| 130 | size_t mListIdx = 0; |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 131 | |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 132 | const std::array<bool, 6>& mCompositionSupport; |
| 133 | }; |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 134 | |
Marissa Wall | 5a240aa | 2016-12-15 12:34:06 -0800 | [diff] [blame] | 135 | class Hwc2TestBuffer; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 136 | class Hwc2TestSourceCrop; |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 137 | class Hwc2TestSurfaceDamage; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 138 | |
| 139 | class Hwc2TestBufferArea : public Hwc2TestProperty<Area> { |
| 140 | public: |
| 141 | Hwc2TestBufferArea(Hwc2TestCoverage coverage, const Area& displayArea); |
| 142 | |
| 143 | std::string dump() const override; |
| 144 | |
Marissa Wall | 5a240aa | 2016-12-15 12:34:06 -0800 | [diff] [blame] | 145 | void setDependent(Hwc2TestBuffer* buffer); |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 146 | void setDependent(Hwc2TestSourceCrop* sourceCrop); |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 147 | void setDependent(Hwc2TestSurfaceDamage* surfaceDamage); |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 148 | |
| 149 | protected: |
| 150 | void update(); |
| 151 | void updateDependents() override; |
| 152 | |
| 153 | const std::vector<float>& mScalars; |
| 154 | static const std::vector<float> mDefaultScalars; |
| 155 | static const std::vector<float> mBasicScalars; |
| 156 | static const std::vector<float> mCompleteScalars; |
| 157 | |
| 158 | Area mDisplayArea; |
| 159 | |
Marissa Wall | 5a240aa | 2016-12-15 12:34:06 -0800 | [diff] [blame] | 160 | Hwc2TestBuffer* mBuffer = nullptr; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 161 | Hwc2TestSourceCrop* mSourceCrop = nullptr; |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 162 | Hwc2TestSurfaceDamage* mSurfaceDamage = nullptr; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 163 | |
| 164 | std::vector<Area> mBufferAreas; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 165 | |
| 166 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 170 | class Hwc2TestColor; |
| 171 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 172 | class Hwc2TestBlendMode : public Hwc2TestProperty<hwc2_blend_mode_t> { |
| 173 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 174 | explicit Hwc2TestBlendMode(Hwc2TestCoverage coverage); |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 175 | |
| 176 | std::string dump() const override; |
| 177 | |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 178 | void setDependent(Hwc2TestColor* color); |
| 179 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 180 | protected: |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 181 | void updateDependents() override; |
| 182 | |
| 183 | Hwc2TestColor* mColor = nullptr; |
| 184 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 185 | static const std::vector<hwc2_blend_mode_t> mDefaultBlendModes; |
| 186 | static const std::vector<hwc2_blend_mode_t> mBasicBlendModes; |
| 187 | static const std::vector<hwc2_blend_mode_t> mCompleteBlendModes; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 188 | |
| 189 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 193 | class Hwc2TestColor : public Hwc2TestProperty<hwc_color_t> { |
| 194 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 195 | explicit Hwc2TestColor(Hwc2TestCoverage coverage, |
| 196 | hwc2_blend_mode_t blendMode = HWC2_BLEND_MODE_NONE); |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 197 | |
| 198 | std::string dump() const override; |
| 199 | |
| 200 | void updateBlendMode(hwc2_blend_mode_t blendMode); |
| 201 | |
| 202 | protected: |
| 203 | void update(); |
| 204 | |
| 205 | std::vector<hwc_color_t> mBaseColors; |
| 206 | static const std::vector<hwc_color_t> mDefaultBaseColors; |
| 207 | static const std::vector<hwc_color_t> mBasicBaseColors; |
| 208 | static const std::vector<hwc_color_t> mCompleteBaseColors; |
| 209 | |
| 210 | hwc2_blend_mode_t mBlendMode; |
| 211 | |
| 212 | std::vector<hwc_color_t> mColors; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 213 | |
| 214 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | ee24278 | 2016-12-15 12:30:12 -0800 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 218 | class Hwc2TestComposition : public Hwc2TestProperty<hwc2_composition_t> { |
| 219 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 220 | explicit Hwc2TestComposition(Hwc2TestCoverage coverage); |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 221 | |
| 222 | std::string dump() const override; |
| 223 | |
| 224 | protected: |
| 225 | static const std::vector<hwc2_composition_t> mDefaultCompositions; |
| 226 | static const std::vector<hwc2_composition_t> mBasicCompositions; |
| 227 | static const std::vector<hwc2_composition_t> mCompleteCompositions; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 228 | |
| 229 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 230 | }; |
| 231 | |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 232 | |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 233 | class Hwc2TestDataspace : public Hwc2TestProperty<android::ui::Dataspace> { |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 234 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 235 | explicit Hwc2TestDataspace(Hwc2TestCoverage coverage); |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 236 | |
| 237 | std::string dump() const override; |
| 238 | |
| 239 | protected: |
Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 240 | static const std::vector<android::ui::Dataspace> defaultDataspaces; |
| 241 | static const std::vector<android::ui::Dataspace> basicDataspaces; |
| 242 | static const std::vector<android::ui::Dataspace> completeDataspaces; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 243 | |
| 244 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 245 | }; |
| 246 | |
David Hanna Jr | 3f05602 | 2017-07-27 19:19:15 -0700 | [diff] [blame] | 247 | class Hwc2TestVirtualBuffer; |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame] | 248 | |
Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 249 | class Hwc2TestDisplayDimension : public Hwc2TestProperty<UnsignedArea> { |
| 250 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 251 | explicit Hwc2TestDisplayDimension(Hwc2TestCoverage coverage); |
Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 252 | |
| 253 | std::string dump() const; |
| 254 | |
David Hanna Jr | 3f05602 | 2017-07-27 19:19:15 -0700 | [diff] [blame] | 255 | void setDependent(Hwc2TestVirtualBuffer* buffer); |
Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 256 | |
| 257 | private: |
| 258 | void updateDependents(); |
| 259 | |
David Hanna Jr | 3f05602 | 2017-07-27 19:19:15 -0700 | [diff] [blame] | 260 | std::set<Hwc2TestVirtualBuffer*> mBuffers; |
Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 261 | |
| 262 | static const std::vector<UnsignedArea> mDefaultDisplayDimensions; |
| 263 | static const std::vector<UnsignedArea> mBasicDisplayDimensions; |
| 264 | static const std::vector<UnsignedArea> mCompleteDisplayDimensions; |
| 265 | |
| 266 | static const std::array<bool, 6> mCompositionSupport; |
| 267 | }; |
| 268 | |
| 269 | |
Marissa Wall | 600a73b | 2016-12-15 12:30:39 -0800 | [diff] [blame] | 270 | class Hwc2TestDisplayFrame : public Hwc2TestProperty<hwc_rect_t> { |
| 271 | public: |
| 272 | Hwc2TestDisplayFrame(Hwc2TestCoverage coverage, const Area& displayArea); |
| 273 | |
| 274 | std::string dump() const override; |
| 275 | |
| 276 | protected: |
| 277 | void update(); |
| 278 | |
| 279 | const std::vector<hwc_frect_t>& mFrectScalars; |
| 280 | const static std::vector<hwc_frect_t> mDefaultFrectScalars; |
| 281 | const static std::vector<hwc_frect_t> mBasicFrectScalars; |
| 282 | const static std::vector<hwc_frect_t> mCompleteFrectScalars; |
| 283 | |
| 284 | Area mDisplayArea; |
| 285 | |
| 286 | std::vector<hwc_rect_t> mDisplayFrames; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 287 | |
| 288 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | 600a73b | 2016-12-15 12:30:39 -0800 | [diff] [blame] | 289 | }; |
| 290 | |
| 291 | |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame] | 292 | class Hwc2TestPlaneAlpha : public Hwc2TestProperty<float> { |
| 293 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 294 | explicit Hwc2TestPlaneAlpha(Hwc2TestCoverage coverage); |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame] | 295 | |
| 296 | std::string dump() const override; |
| 297 | |
| 298 | protected: |
| 299 | static const std::vector<float> mDefaultPlaneAlphas; |
| 300 | static const std::vector<float> mBasicPlaneAlphas; |
| 301 | static const std::vector<float> mCompletePlaneAlphas; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 302 | |
| 303 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame] | 304 | }; |
| 305 | |
Marissa Wall | ac10819 | 2016-12-15 12:27:48 -0800 | [diff] [blame] | 306 | |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 307 | class Hwc2TestSourceCrop : public Hwc2TestProperty<hwc_frect_t> { |
| 308 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 309 | explicit Hwc2TestSourceCrop(Hwc2TestCoverage coverage, const Area& bufferArea = {0, 0}); |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 310 | |
| 311 | std::string dump() const override; |
| 312 | |
| 313 | void updateBufferArea(const Area& bufferArea); |
| 314 | |
| 315 | protected: |
| 316 | void update(); |
| 317 | |
| 318 | const std::vector<hwc_frect_t>& mFrectScalars; |
| 319 | const static std::vector<hwc_frect_t> mDefaultFrectScalars; |
| 320 | const static std::vector<hwc_frect_t> mBasicFrectScalars; |
| 321 | const static std::vector<hwc_frect_t> mCompleteFrectScalars; |
| 322 | |
| 323 | Area mBufferArea; |
| 324 | |
| 325 | std::vector<hwc_frect_t> mSourceCrops; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 326 | |
| 327 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | c57468f | 2016-12-15 12:31:12 -0800 | [diff] [blame] | 328 | }; |
| 329 | |
| 330 | |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 331 | class Hwc2TestSurfaceDamage : public Hwc2TestProperty<hwc_region_t> { |
| 332 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 333 | explicit Hwc2TestSurfaceDamage(Hwc2TestCoverage coverage); |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 334 | ~Hwc2TestSurfaceDamage(); |
| 335 | |
| 336 | std::string dump() const override; |
| 337 | |
| 338 | void updateBufferArea(const Area& bufferArea); |
| 339 | |
| 340 | protected: |
| 341 | void update(); |
| 342 | void freeSurfaceDamages(); |
| 343 | |
| 344 | const std::vector<std::vector<hwc_frect_t>> &mRegionScalars; |
| 345 | const static std::vector<std::vector<hwc_frect_t>> mDefaultRegionScalars; |
| 346 | const static std::vector<std::vector<hwc_frect_t>> mBasicRegionScalars; |
| 347 | const static std::vector<std::vector<hwc_frect_t>> mCompleteRegionScalars; |
| 348 | |
| 349 | Area mBufferArea = {0, 0}; |
| 350 | |
| 351 | std::vector<hwc_region_t> mSurfaceDamages; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 352 | |
| 353 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | ad76181 | 2016-12-15 12:32:24 -0800 | [diff] [blame] | 354 | }; |
| 355 | |
| 356 | |
Marissa Wall | ac10819 | 2016-12-15 12:27:48 -0800 | [diff] [blame] | 357 | class Hwc2TestTransform : public Hwc2TestProperty<hwc_transform_t> { |
| 358 | public: |
Chih-Hung Hsieh | 2274904 | 2018-12-20 15:50:39 -0800 | [diff] [blame] | 359 | explicit Hwc2TestTransform(Hwc2TestCoverage coverage); |
Marissa Wall | ac10819 | 2016-12-15 12:27:48 -0800 | [diff] [blame] | 360 | |
| 361 | std::string dump() const override; |
| 362 | |
| 363 | protected: |
| 364 | static const std::vector<hwc_transform_t> mDefaultTransforms; |
| 365 | static const std::vector<hwc_transform_t> mBasicTransforms; |
| 366 | static const std::vector<hwc_transform_t> mCompleteTransforms; |
Marissa Wall | 1cd789c | 2017-01-27 12:55:36 -0800 | [diff] [blame] | 367 | |
| 368 | static const std::array<bool, 6> mCompositionSupport; |
Marissa Wall | ac10819 | 2016-12-15 12:27:48 -0800 | [diff] [blame] | 369 | }; |
| 370 | |
Marissa Wall | f7618ed | 2016-12-15 12:34:39 -0800 | [diff] [blame] | 371 | |
| 372 | class Hwc2TestVisibleRegion { |
| 373 | public: |
| 374 | ~Hwc2TestVisibleRegion(); |
| 375 | |
| 376 | std::string dump() const; |
| 377 | |
| 378 | void set(const android::Region& visibleRegion); |
| 379 | hwc_region_t get() const; |
| 380 | void release(); |
| 381 | |
| 382 | protected: |
| 383 | hwc_region_t mVisibleRegion = {0, nullptr}; |
| 384 | }; |
| 385 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 386 | #endif /* ifndef _HWC2_TEST_PROPERTIES_H */ |