Changyeon Jo | 2400b69 | 2019-07-18 21:32:48 -0700 | [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_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H |
| 18 | #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H |
| 19 | |
| 20 | #include <android/hardware/automotive/evs/1.0/IEvsDisplay.h> |
| 21 | #include <ui/GraphicBuffer.h> |
| 22 | |
| 23 | using ::android::hardware::automotive::evs::V1_0::IEvsDisplay; |
| 24 | using ::android::hardware::automotive::evs::V1_0::DisplayDesc; |
| 25 | using ::android::hardware::automotive::evs::V1_0::DisplayState; |
| 26 | using ::android::hardware::automotive::evs::V1_0::EvsResult; |
| 27 | using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc; |
| 28 | |
| 29 | namespace android { |
| 30 | namespace hardware { |
| 31 | namespace automotive { |
| 32 | namespace evs { |
| 33 | namespace V1_1 { |
| 34 | namespace implementation { |
| 35 | |
| 36 | |
| 37 | class EvsDisplay : public IEvsDisplay { |
| 38 | public: |
| 39 | // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow. |
| 40 | Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; |
| 41 | Return<EvsResult> setDisplayState(DisplayState state) override; |
| 42 | Return<DisplayState> getDisplayState() override; |
| 43 | Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; |
| 44 | Return<EvsResult> returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) override; |
| 45 | |
| 46 | |
| 47 | // Implementation details |
| 48 | EvsDisplay(); |
| 49 | virtual ~EvsDisplay() override; |
| 50 | |
| 51 | void forceShutdown(); // This gets called if another caller "steals" ownership of the display |
| 52 | Return<EvsResult> returnTargetBufferForDisplayImpl(const uint32_t bufferId, |
| 53 | const buffer_handle_t memHandle); |
| 54 | |
| 55 | private: |
| 56 | DisplayDesc mInfo = {}; |
| 57 | BufferDesc_1_0 mBuffer = {}; // A graphics buffer into which we'll store images |
| 58 | |
| 59 | bool mFrameBusy = false; // A flag telling us our buffer is in use |
| 60 | DisplayState mRequestedState = DisplayState::NOT_VISIBLE; |
| 61 | |
| 62 | std::mutex mAccessLock; |
| 63 | }; |
| 64 | |
| 65 | } // namespace implementation |
| 66 | } // namespace V1_1 |
| 67 | } // namespace evs |
| 68 | } // namespace automotive |
| 69 | } // namespace hardware |
| 70 | } // namespace android |
| 71 | |
| 72 | #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H |