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