Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 | #include <ui/Fence.h> |
| 21 | #include <ui/FloatRect.h> |
| 22 | #include <ui/GraphicBuffer.h> |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 23 | #include <ui/Rect.h> |
| 24 | #include <ui/Region.h> |
| 25 | #include <ui/Transform.h> |
| 26 | |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 27 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 28 | #pragma clang diagnostic push |
| 29 | #pragma clang diagnostic ignored "-Wconversion" |
Marin Shalamanov | bed7fd3 | 2020-12-21 20:02:20 +0100 | [diff] [blame] | 30 | #pragma clang diagnostic ignored "-Wextra" |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 31 | |
| 32 | #include <ui/GraphicTypes.h> |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 33 | #include "DisplayHardware/HWC2.h" |
| 34 | |
Leon Scroggins III | 2e1aa18 | 2021-12-01 17:33:12 -0500 | [diff] [blame] | 35 | #include <aidl/android/hardware/graphics/composer3/Composition.h> |
| 36 | |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 37 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
Marin Shalamanov | bed7fd3 | 2020-12-21 20:02:20 +0100 | [diff] [blame] | 38 | #pragma clang diagnostic pop // ignored "-Wconversion -Wextra" |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 39 | |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 40 | namespace android { |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 41 | namespace HWC2 { |
| 42 | namespace mock { |
| 43 | |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 44 | namespace hal = android::hardware::graphics::composer::hal; |
| 45 | |
| 46 | using Error = hal::Error; |
| 47 | |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 48 | class Layer : public HWC2::Layer { |
| 49 | public: |
| 50 | Layer(); |
| 51 | ~Layer() override; |
| 52 | |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 53 | MOCK_CONST_METHOD0(getId, hal::HWLayerId()); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 54 | |
| 55 | MOCK_METHOD2(setCursorPosition, Error(int32_t, int32_t)); |
| 56 | MOCK_METHOD3(setBuffer, |
| 57 | Error(uint32_t, const android::sp<android::GraphicBuffer>&, |
| 58 | const android::sp<android::Fence>&)); |
Brian Lindahl | b158a5c | 2022-12-15 15:21:13 -0700 | [diff] [blame] | 59 | MOCK_METHOD2(setBufferSlotsToClear, Error(const std::vector<uint32_t>&, uint32_t)); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 60 | MOCK_METHOD1(setSurfaceDamage, Error(const android::Region&)); |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 61 | MOCK_METHOD1(setBlendMode, Error(hal::BlendMode)); |
Ady Abraham | 6e60b14 | 2022-01-06 18:10:35 -0800 | [diff] [blame] | 62 | MOCK_METHOD1(setColor, Error(aidl::android::hardware::graphics::composer3::Color)); |
Leon Scroggins III | 2e1aa18 | 2021-12-01 17:33:12 -0500 | [diff] [blame] | 63 | MOCK_METHOD1(setCompositionType, |
| 64 | Error(aidl::android::hardware::graphics::composer3::Composition)); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 65 | MOCK_METHOD1(setDataspace, Error(android::ui::Dataspace)); |
| 66 | MOCK_METHOD2(setPerFrameMetadata, Error(const int32_t, const android::HdrMetadata&)); |
| 67 | MOCK_METHOD1(setDisplayFrame, Error(const android::Rect&)); |
| 68 | MOCK_METHOD1(setPlaneAlpha, Error(float)); |
| 69 | MOCK_METHOD1(setSidebandStream, Error(const native_handle_t*)); |
| 70 | MOCK_METHOD1(setSourceCrop, Error(const android::FloatRect&)); |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 71 | MOCK_METHOD1(setTransform, Error(hal::Transform)); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 72 | MOCK_METHOD1(setVisibleRegion, Error(const android::Region&)); |
| 73 | MOCK_METHOD1(setZOrder, Error(uint32_t)); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 74 | |
| 75 | MOCK_METHOD1(setColorTransform, Error(const android::mat4&)); |
Lloyd Pique | 4603f3c | 2020-02-11 12:06:56 -0800 | [diff] [blame] | 76 | MOCK_METHOD3(setLayerGenericMetadata, |
| 77 | Error(const std::string&, bool, const std::vector<uint8_t>&)); |
Alec Mouri | 6da0e27 | 2022-02-07 12:45:57 -0800 | [diff] [blame] | 78 | MOCK_METHOD1(setBrightness, Error(float)); |
Leon Scroggins III | d77d316 | 2022-01-05 10:42:28 -0500 | [diff] [blame] | 79 | MOCK_METHOD1(setBlockingRegion, Error(const android::Region&)); |
Lloyd Pique | 35d5824 | 2018-12-18 16:33:25 -0800 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | } // namespace mock |
| 83 | } // namespace HWC2 |
Peiyong Lin | e9d809e | 2020-04-14 13:10:48 -0700 | [diff] [blame] | 84 | } // namespace android |