• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 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_DISPLAY_HARDWARE_BASE_H
18 #define ANDROID_DISPLAY_HARDWARE_BASE_H
19 
20 #include <stdint.h>
21 #include <utils/RefBase.h>
22 #include <utils/StrongPointer.h>
23 #include <utils/threads.h>
24 
25 namespace android {
26 
27 class SurfaceFlinger;
28 
29 class DisplayHardwareBase
30 {
31 public:
32     DisplayHardwareBase(
33             const sp<SurfaceFlinger>& flinger,
34             uint32_t displayIndex);
35 
36     ~DisplayHardwareBase();
37 
38     void startSleepManagement() const;
39 
40     // console management
41     void releaseScreen() const;
42     void acquireScreen() const;
43     bool isScreenAcquired() const;
44 
45     bool canDraw() const;
46 
47 
48 private:
49     class DisplayEventThread : public Thread {
50         wp<SurfaceFlinger> mFlinger;
51         status_t waitForFbSleep();
52         status_t waitForFbWake();
53     public:
54         DisplayEventThread(const sp<SurfaceFlinger>& flinger);
55         virtual ~DisplayEventThread();
56         virtual bool threadLoop();
57         status_t initCheck() const;
58     };
59 
60     sp<DisplayEventThread>  mDisplayEventThread;
61     mutable int             mScreenAcquired;
62 };
63 
64 }; // namespace android
65 
66 #endif // ANDROID_DISPLAY_HARDWARE_BASE_H
67