1 /** 2 * Copyright (c) 2021, 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 #pragma once 17 18 #include <mapper-vts/2.1/MapperVts.h> 19 #include <math/half.h> 20 #include <math/vec3.h> 21 #include <renderengine/ExternalTexture.h> 22 #include <renderengine/RenderEngine.h> 23 #include <ui/GraphicBuffer.h> 24 #include <ui/GraphicBufferAllocator.h> 25 #include <ui/PixelFormat.h> 26 #include <ui/Rect.h> 27 #include <ui/Region.h> 28 #include "ReadbackVts.h" 29 30 namespace aidl::android::hardware::graphics::composer3::vts { 31 32 using ::android::hardware::graphics::mapper::V2_1::IMapper; 33 using ::android::renderengine::DisplaySettings; 34 using ::android::renderengine::ExternalTexture; 35 using ::android::renderengine::RenderEngineCreationArgs; 36 37 class TestRenderEngine { 38 public: 39 static constexpr uint32_t sMaxFrameBufferAcquireBuffers = 2; 40 41 TestRenderEngine(const RenderEngineCreationArgs& args); 42 ~TestRenderEngine(); 43 44 void setRenderLayers(std::vector<std::shared_ptr<TestLayer>> layers); 45 void initGraphicBuffer(uint32_t width, uint32_t height, uint32_t layerCount, uint64_t usage); setDisplaySettings(DisplaySettings & displaySettings)46 void setDisplaySettings(DisplaySettings& displaySettings) { 47 mDisplaySettings = displaySettings; 48 }; 49 void drawLayers(); 50 void checkColorBuffer(const std::vector<Color>& expectedColors); 51 getInternalRenderEngine()52 ::android::renderengine::RenderEngine& getInternalRenderEngine() { return *mRenderEngine; } 53 54 private: 55 common::PixelFormat mFormat; 56 std::vector<::android::renderengine::LayerSettings> mCompositionLayers; 57 std::unique_ptr<::android::renderengine::RenderEngine> mRenderEngine; 58 std::vector<::android::renderengine::LayerSettings> mRenderLayers; 59 ::android::sp<::android::GraphicBuffer> mGraphicBuffer; 60 61 DisplaySettings mDisplaySettings; 62 }; 63 64 } // namespace aidl::android::hardware::graphics::composer3::vts 65