blob: 43d3a42808ee53bd89480393170b3233b8b77d52 [file] [log] [blame]
ramindanibab8ba92021-11-18 01:24:11 +00001/**
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
ramindanibab8ba92021-11-18 01:24:11 +000018#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>
ramindaniedf3ef92022-01-07 00:04:23 +000028#include "ReadbackVts.h"
Ram Indani22884ac2022-01-29 02:00:21 +000029
ramindanibab8ba92021-11-18 01:24:11 +000030namespace aidl::android::hardware::graphics::composer3::vts {
31
32using ::android::hardware::graphics::mapper::V2_1::IMapper;
33using ::android::renderengine::DisplaySettings;
34using ::android::renderengine::ExternalTexture;
35using ::android::renderengine::RenderEngineCreationArgs;
36
37class 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);
46 void setDisplaySettings(DisplaySettings& displaySettings) {
47 mDisplaySettings = displaySettings;
48 };
49 void drawLayers();
Alec Mouri3e037cf2022-01-24 08:58:28 -080050 void checkColorBuffer(const std::vector<Color>& expectedColors);
ramindanibab8ba92021-11-18 01:24:11 +000051
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
Ady Abraham3192f3d2021-12-03 16:08:56 -080064} // namespace aidl::android::hardware::graphics::composer3::vts