| Marissa Wall | bad1bc7 | 2017-02-21 14:33:46 -0800 | [diff] [blame] | 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 | #include <sstream> | 
|  | 18 |  | 
|  | 19 | #include "Hwc2TestVirtualDisplay.h" | 
|  | 20 |  | 
|  | 21 | Hwc2TestVirtualDisplay::Hwc2TestVirtualDisplay( | 
|  | 22 | Hwc2TestCoverage coverage) | 
|  | 23 | : mDisplayDimension(coverage) | 
|  | 24 | { | 
|  | 25 | mDisplayDimension.setDependent(&mBuffer); | 
|  | 26 | } | 
|  | 27 |  | 
|  | 28 | std::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 |  | 
|  | 39 | int 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 |  | 
|  | 48 | void Hwc2TestVirtualDisplay::reset() | 
|  | 49 | { | 
|  | 50 | return mDisplayDimension.reset(); | 
|  | 51 | } | 
|  | 52 |  | 
|  | 53 | bool Hwc2TestVirtualDisplay::advance() | 
|  | 54 | { | 
|  | 55 | return mDisplayDimension.advance(); | 
|  | 56 | } | 
|  | 57 |  | 
|  | 58 | UnsignedArea Hwc2TestVirtualDisplay::getDisplayDimension() const | 
|  | 59 | { | 
|  | 60 | return mDisplayDimension.get(); | 
|  | 61 | } |