• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EVSGLDISPLAY_H
18 #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSGLDISPLAY_H
19 
20 #include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
21 #include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
22 #include <ui/GraphicBuffer.h>
23 
24 #include "GlWrapper.h"
25 
26 using ::android::hardware::automotive::evs::V1_0::EvsResult;
27 using ::android::hardware::automotive::evs::V1_0::DisplayDesc;
28 using ::android::hardware::automotive::evs::V1_0::DisplayState;
29 using ::android::hardware::automotive::evs::V1_1::IEvsDisplay;
30 using EvsResult   = ::android::hardware::automotive::evs::V1_0::EvsResult;
31 using BufferDesc_1_0  = ::android::hardware::automotive::evs::V1_0::BufferDesc;
32 using EvsDisplayState = ::android::hardware::automotive::evs::V1_0::DisplayState;
33 using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService;
34 
35 namespace android {
36 namespace hardware {
37 namespace automotive {
38 namespace evs {
39 namespace V1_1 {
40 namespace implementation {
41 
42 
43 class EvsGlDisplay : public IEvsDisplay {
44 public:
45     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
46     Return<void>            getDisplayInfo(getDisplayInfo_cb _hidl_cb)  override;
47     Return<EvsResult>       setDisplayState(EvsDisplayState state)  override;
48     Return<EvsDisplayState> getDisplayState()  override;
49     Return<void>            getTargetBuffer(getTargetBuffer_cb _hidl_cb)  override;
50     Return<EvsResult>       returnTargetBufferForDisplay(const BufferDesc_1_0& buffer)  override;
51 
52     // Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow.
53     Return<void>            getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override;
54 
55     // Implementation details
56     EvsGlDisplay(sp<IAutomotiveDisplayProxyService> pWindowService, uint64_t displayId);
57     virtual ~EvsGlDisplay() override;
58 
59     void forceShutdown();   // This gets called if another caller "steals" ownership of the display
60 
61 private:
62     DisplayDesc     mInfo           = {};
63     BufferDesc_1_0  mBuffer         = {};       // A graphics buffer into which we'll store images
64 
65     bool            mFrameBusy      = false;    // A flag telling us our buffer is in use
66     EvsDisplayState mRequestedState = EvsDisplayState::NOT_VISIBLE;
67 
68     GlWrapper       mGlWrapper;
69 
70     std::mutex      mAccessLock;
71 
72     sp<IAutomotiveDisplayProxyService> mDisplayProxy;
73     uint64_t                           mDisplayId;
74 };
75 
76 } // namespace implementation
77 } // namespace V1_0
78 } // namespace evs
79 } // namespace automotive
80 } // namespace hardware
81 } // namespace android
82 
83 #endif  // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSGLDISPLAY_H
84