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