Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -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 | #ifndef ANDROID_HARDWARE_EVS_V1_0_EVSDISPLAY_H |
| 18 | #define ANDROID_HARDWARE_EVS_V1_0_EVSDISPLAY_H |
| 19 | |
| 20 | #include <android/hardware/evs/1.0/IEvsDisplay.h> |
| 21 | #include <ui/GraphicBuffer.h> |
| 22 | |
| 23 | namespace android { |
| 24 | namespace hardware { |
| 25 | namespace evs { |
| 26 | namespace V1_0 { |
| 27 | namespace implementation { |
| 28 | |
| 29 | class EvsDisplay : public IEvsDisplay { |
| 30 | public: |
| 31 | // Methods from ::android::hardware::evs::V1_0::IEvsDisplay follow. |
| 32 | Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; |
| 33 | Return<EvsResult> setDisplayState(DisplayState state) override; |
| 34 | Return<DisplayState> getDisplayState() override; |
| 35 | Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; |
| 36 | Return<EvsResult> returnTargetBufferForDisplay(const hidl_handle& bufferHandle) override; |
| 37 | |
| 38 | // Implementation details |
| 39 | EvsDisplay(); |
| 40 | virtual ~EvsDisplay() override; |
| 41 | |
| 42 | private: |
| 43 | DisplayDesc mInfo = {}; |
| 44 | buffer_handle_t mBuffer = nullptr; // A graphics buffer into which we'll store images |
| 45 | uint32_t mStride = 0; // Bytes per line in the buffer |
| 46 | |
| 47 | bool mFrameBusy = false; // A flag telling us our buffer is in use |
| 48 | DisplayState mRequestedState = DisplayState::NOT_VISIBLE; |
| 49 | |
| 50 | std::mutex mAccessLock; |
| 51 | }; |
| 52 | |
| 53 | } // namespace implementation |
| 54 | } // namespace V1_0 |
| 55 | } // namespace evs |
| 56 | } // namespace hardware |
| 57 | } // namespace android |
| 58 | |
| 59 | #endif // ANDROID_HARDWARE_EVS_V1_0_EVSDISPLAY_H |