blob: d0fbc0b5adaa63a8bf8b405ef75776fca5306e50 [file] [log] [blame]
Marissa Wallbad1bc72017-02-21 14:33:46 -08001/*
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#include <sstream>
18
19#include "Hwc2TestVirtualDisplay.h"
20
21Hwc2TestVirtualDisplay::Hwc2TestVirtualDisplay(
22 Hwc2TestCoverage coverage)
23 : mDisplayDimension(coverage)
24{
25 mDisplayDimension.setDependent(&mBuffer);
26}
27
28std::string Hwc2TestVirtualDisplay::dump() const
29{
30 std::stringstream dmp;
31
32 dmp << "virtual display: \n";
33
34 mDisplayDimension.dump();
35
36 return dmp.str();
37}
38
39int Hwc2TestVirtualDisplay::getBuffer(buffer_handle_t* outHandle,
40 android::base::unique_fd* outAcquireFence)
41{
42 int32_t acquireFence;
43 int ret = mBuffer.get(outHandle, &acquireFence);
44 outAcquireFence->reset(acquireFence);
45 return ret;
46}
47
48void Hwc2TestVirtualDisplay::reset()
49{
50 return mDisplayDimension.reset();
51}
52
53bool Hwc2TestVirtualDisplay::advance()
54{
55 return mDisplayDimension.advance();
56}
57
58UnsignedArea Hwc2TestVirtualDisplay::getDisplayDimension() const
59{
60 return mDisplayDimension.get();
61}