1/*
2 * Copyright (C) 2016 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#ifndef _HWC2_TEST_VIRTUAL_DISPLAY_H
18#define _HWC2_TEST_VIRTUAL_DISPLAY_H
19
20#include "Hwc2TestBuffer.h"
21#include "Hwc2TestPixelComparator.h"
22#include "Hwc2TestProperties.h"
23
24#define HWC2_INCLUDE_STRINGIFICATION
25#define HWC2_USE_CPP11
26#include <hardware/hwcomposer2.h>
27#undef HWC2_INCLUDE_STRINGIFICATION
28#undef HWC2_USE_CPP11
29
30class Hwc2TestVirtualDisplay {
31public:
32    Hwc2TestVirtualDisplay(Hwc2TestCoverage coverage);
33
34    std::string dump() const;
35
36    int getOutputBuffer(buffer_handle_t* outHandle,
37            android::base::unique_fd* outAcquireFence);
38
39    int verifyOutputBuffer(const Hwc2TestLayers* testLayers,
40            const std::vector<hwc2_layer_t>* allLayers,
41            const std::set<hwc2_layer_t>* clearLayers);
42
43    int writeBuffersToFile(std::string name);
44    void reset();
45    bool advance();
46
47    UnsignedArea getDisplayDimension() const;
48
49private:
50    Hwc2TestOutputBuffer mOutputBuffer;
51    Hwc2TestExpectedBuffer mExpectedBuffer;
52    Hwc2TestDisplayDimension mDisplayDimension;
53};
54
55#endif /* ifndef _HWC2_TEST_VIRTUAL_DISPLAY_H */
56