The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 2 | * Copyright (C) 2012 The Android Open Source Project |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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/threads.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | #include "Barrier.h" |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | class SurfaceFlinger; |
| 28 | |
| 29 | class DisplayHardwareBase |
| 30 | { |
| 31 | public: |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 32 | DisplayHardwareBase( |
| 33 | const sp<SurfaceFlinger>& flinger, |
| 34 | uint32_t displayIndex); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 36 | ~DisplayHardwareBase(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 38 | // console management |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | void releaseScreen() const; |
| 40 | void acquireScreen() const; |
Mathias Agopian | 59119e6 | 2010-10-11 12:37:43 -0700 | [diff] [blame] | 41 | bool isScreenAcquired() const; |
| 42 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | bool canDraw() const; |
Mathias Agopian | 59119e6 | 2010-10-11 12:37:43 -0700 | [diff] [blame] | 44 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | |
| 46 | private: |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 47 | class DisplayEventThread : public Thread { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | wp<SurfaceFlinger> mFlinger; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | mutable Barrier mBarrier; |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 50 | status_t waitForFbSleep(); |
| 51 | status_t waitForFbWake(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | public: |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 53 | DisplayEventThread(const sp<SurfaceFlinger>& flinger); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | virtual ~DisplayEventThread(); |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 55 | virtual void onFirstRef(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | virtual bool threadLoop(); |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 57 | status_t releaseScreen() const; |
| 58 | status_t initCheck() const; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | }; |
| 60 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame^] | 61 | sp<DisplayEventThread> mDisplayEventThread; |
| 62 | mutable int mScreenAcquired; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | }; // namespace android |
| 66 | |
| 67 | #endif // ANDROID_DISPLAY_HARDWARE_BASE_H |