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