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