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 | |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSDISPLAY_H |
| 18 | #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSDISPLAY_H |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 19 | |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 20 | #include <android/hardware/automotive/evs/1.0/IEvsDisplay.h> |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 21 | #include <ui/GraphicBuffer.h> |
| 22 | |
| 23 | namespace android { |
| 24 | namespace hardware { |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 25 | namespace automotive { |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 26 | namespace evs { |
| 27 | namespace V1_0 { |
| 28 | namespace implementation { |
| 29 | |
Scott Randolph | de9880e | 2017-03-30 14:04:12 -0700 | [diff] [blame] | 30 | |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 31 | class EvsDisplay : public IEvsDisplay { |
| 32 | public: |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 33 | // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow. |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 34 | Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; |
| 35 | Return<EvsResult> setDisplayState(DisplayState state) override; |
| 36 | Return<DisplayState> getDisplayState() override; |
| 37 | Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; |
Scott Randolph | db5a598 | 2017-01-23 12:35:05 -0800 | [diff] [blame] | 38 | Return<EvsResult> returnTargetBufferForDisplay(const BufferDesc& buffer) override; |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 39 | |
| 40 | // Implementation details |
| 41 | EvsDisplay(); |
| 42 | virtual ~EvsDisplay() override; |
| 43 | |
Scott Randolph | de9880e | 2017-03-30 14:04:12 -0700 | [diff] [blame] | 44 | void forceShutdown(); // This gets called if another caller "steals" ownership of the display |
| 45 | |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 46 | private: |
| 47 | DisplayDesc mInfo = {}; |
Scott Randolph | db5a598 | 2017-01-23 12:35:05 -0800 | [diff] [blame] | 48 | BufferDesc mBuffer = {}; // A graphics buffer into which we'll store images |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 49 | |
Scott Randolph | db5a598 | 2017-01-23 12:35:05 -0800 | [diff] [blame] | 50 | bool mFrameBusy = false; // A flag telling us our buffer is in use |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 51 | DisplayState mRequestedState = DisplayState::NOT_VISIBLE; |
| 52 | |
| 53 | std::mutex mAccessLock; |
| 54 | }; |
| 55 | |
| 56 | } // namespace implementation |
| 57 | } // namespace V1_0 |
| 58 | } // namespace evs |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 59 | } // namespace automotive |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 60 | } // namespace hardware |
| 61 | } // namespace android |
| 62 | |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 63 | #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSDISPLAY_H |