blob: bbe508f620ad999e3d719769c8f1d36b242292a9 [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 <math/half.h>
19#include <math/vec3.h>
20#include <renderengine/ExternalTexture.h>
21#include <renderengine/RenderEngine.h>
22#include <ui/GraphicBuffer.h>
ramindanibab8ba92021-11-18 01:24:11 +000023#include <ui/PixelFormat.h>
24#include <ui/Rect.h>
25#include <ui/Region.h>
ramindaniedf3ef92022-01-07 00:04:23 +000026#include "ReadbackVts.h"
Ram Indani22884ac2022-01-29 02:00:21 +000027
ramindanibab8ba92021-11-18 01:24:11 +000028namespace aidl::android::hardware::graphics::composer3::vts {
29
ramindanibab8ba92021-11-18 01:24:11 +000030using ::android::renderengine::DisplaySettings;
31using ::android::renderengine::ExternalTexture;
32using ::android::renderengine::RenderEngineCreationArgs;
33
34class 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);
43 void setDisplaySettings(DisplaySettings& displaySettings) {
44 mDisplaySettings = displaySettings;
45 };
46 void drawLayers();
Alec Mouri3e037cf2022-01-24 08:58:28 -080047 void checkColorBuffer(const std::vector<Color>& expectedColors);
Alec Mourif6c039a2023-10-06 23:02:17 +000048 void checkColorBuffer(const ::android::sp<::android::GraphicBuffer>& buffer);
ramindanibab8ba92021-11-18 01:24:11 +000049
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
Ady Abraham3192f3d2021-12-03 16:08:56 -080062} // namespace aidl::android::hardware::graphics::composer3::vts