The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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_EGL_DISPLAY_SURFACE_H |
| 18 | #define ANDROID_EGL_DISPLAY_SURFACE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Timers.h> |
| 24 | |
| 25 | #include <ui/EGLNativeSurface.h> |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 26 | |
| 27 | #include <pixelflinger/pixelflinger.h> |
| 28 | #include <linux/fb.h> |
| 29 | |
The Android Open Source Project | e09fd9e | 2008-12-17 18:05:43 -0800 | [diff] [blame^] | 30 | struct copybit_device_t; |
| 31 | |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 32 | // --------------------------------------------------------------------------- |
| 33 | namespace android { |
| 34 | // --------------------------------------------------------------------------- |
| 35 | |
| 36 | class Region; |
| 37 | class Rect; |
| 38 | |
| 39 | class EGLDisplaySurface : public EGLNativeSurface<EGLDisplaySurface> |
| 40 | { |
| 41 | public: |
| 42 | EGLDisplaySurface(); |
| 43 | ~EGLDisplaySurface(); |
| 44 | |
| 45 | int32_t getPageFlipCount() const; |
| 46 | void copyFrontToBack(const Region& copyback); |
| 47 | |
| 48 | private: |
| 49 | static void hook_incRef(NativeWindowType window); |
| 50 | static void hook_decRef(NativeWindowType window); |
| 51 | static uint32_t hook_swapBuffers(NativeWindowType window); |
| 52 | static void hook_setSwapRectangle(NativeWindowType window, int l, int t, int w, int h); |
| 53 | static uint32_t hook_nextBuffer(NativeWindowType window); |
| 54 | |
| 55 | uint32_t swapBuffers(); |
| 56 | uint32_t nextBuffer(); |
| 57 | void setSwapRectangle(int l, int t, int w, int h); |
| 58 | |
| 59 | status_t mapFrameBuffer(); |
| 60 | |
| 61 | enum { |
| 62 | PAGE_FLIP = 0x00000001 |
| 63 | }; |
| 64 | GGLSurface mFb[2]; |
| 65 | int mIndex; |
| 66 | uint32_t mFlags; |
| 67 | size_t mSize; |
| 68 | fb_var_screeninfo mInfo; |
| 69 | fb_fix_screeninfo mFinfo; |
| 70 | int32_t mPageFlipCount; |
| 71 | nsecs_t mTime; |
| 72 | int32_t mSwapCount; |
| 73 | nsecs_t mSleep; |
| 74 | uint32_t mFeatureFlags; |
The Android Open Source Project | e09fd9e | 2008-12-17 18:05:43 -0800 | [diff] [blame^] | 75 | copybit_device_t* mBlitEngine; |
The Android Open Source Project | 7c1b96a | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | // --------------------------------------------------------------------------- |
| 79 | }; // namespace android |
| 80 | // --------------------------------------------------------------------------- |
| 81 | |
| 82 | #endif // ANDROID_EGL_DISPLAY_SURFACE_H |
| 83 | |