blob: b2ec3e82c4db3a3d96f6ca3d4593a542413e67d3 [file] [log] [blame]
Changyeon Jo2400b692019-07-18 21:32:48 -07001/*
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 Jo33ba66b2022-01-16 16:33:52 -080020#include "GlWrapper.h"
21
Changyeon Jo043a7a02020-01-02 17:55:55 -080022#include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
Changyeon Jo33ba66b2022-01-16 16:33:52 -080023#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
Changyeon Jo2400b692019-07-18 21:32:48 -070024#include <ui/GraphicBuffer.h>
25
Changyeon Jo33ba66b2022-01-16 16:33:52 -080026namespace android::hardware::automotive::evs::V1_1::implementation {
Changyeon Jo2400b692019-07-18 21:32:48 -070027
28class EvsDisplay : public IEvsDisplay {
Changyeon Jo33ba66b2022-01-16 16:33:52 -080029 public:
Changyeon Jo2400b692019-07-18 21:32:48 -070030 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
Changyeon Jo33ba66b2022-01-16 16:33:52 -080031 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 Jo2400b692019-07-18 21:32:48 -070036
Changyeon Jo043a7a02020-01-02 17:55:55 -080037 // Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow.
Changyeon Jo33ba66b2022-01-16 16:33:52 -080038 Return<void> getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override;
Changyeon Jo2400b692019-07-18 21:32:48 -070039
40 // Implementation details
41 EvsDisplay();
Changyeon Jo33ba66b2022-01-16 16:33:52 -080042 EvsDisplay(
43 sp<frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService> pDisplayProxy,
44 uint64_t displayId);
Changyeon Jo2400b692019-07-18 21:32:48 -070045 virtual ~EvsDisplay() override;
46
Changyeon Jo33ba66b2022-01-16 16:33:52 -080047 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 Jo2400b692019-07-18 21:32:48 -070050
Changyeon Jo33ba66b2022-01-16 16:33:52 -080051 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 Jo2400b692019-07-18 21:32:48 -070060};
61
Changyeon Jo33ba66b2022-01-16 16:33:52 -080062} // namespace android::hardware::automotive::evs::V1_1::implementation
Changyeon Jo2400b692019-07-18 21:32:48 -070063
64#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H