blob: a8b58539d192d0b893cd33726848189db77b8853 [file] [log] [blame]
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -07001/*
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 Project54b6cfa2008-10-21 07:00:00 -070026
27#include <pixelflinger/pixelflinger.h>
28#include <linux/fb.h>
29
The Android Open Source Projectd24b8182009-02-10 15:44:00 -080030#include <EGL/egl.h>
31
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -080032struct copybit_device_t;
The Android Open Source Projectd24b8182009-02-10 15:44:00 -080033struct copybit_image_t;
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -080034
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070035// ---------------------------------------------------------------------------
36namespace android {
37// ---------------------------------------------------------------------------
38
39class Region;
40class Rect;
41
42class EGLDisplaySurface : public EGLNativeSurface<EGLDisplaySurface>
43{
44public:
45 EGLDisplaySurface();
46 ~EGLDisplaySurface();
47
48 int32_t getPageFlipCount() const;
49 void copyFrontToBack(const Region& copyback);
The Android Open Source Projectd24b8182009-02-10 15:44:00 -080050 void copyFrontToImage(const copybit_image_t& dst);
51 void copyBackToImage(const copybit_image_t& dst);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070052
The Android Open Source Projectd24b8182009-02-10 15:44:00 -080053 void setSwapRectangle(int l, int t, int w, int h);
54
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070055private:
56 static void hook_incRef(NativeWindowType window);
57 static void hook_decRef(NativeWindowType window);
58 static uint32_t hook_swapBuffers(NativeWindowType window);
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070059
60 uint32_t swapBuffers();
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070061
62 status_t mapFrameBuffer();
63
64 enum {
65 PAGE_FLIP = 0x00000001
66 };
67 GGLSurface mFb[2];
68 int mIndex;
69 uint32_t mFlags;
70 size_t mSize;
71 fb_var_screeninfo mInfo;
72 fb_fix_screeninfo mFinfo;
73 int32_t mPageFlipCount;
74 nsecs_t mTime;
75 int32_t mSwapCount;
76 nsecs_t mSleep;
77 uint32_t mFeatureFlags;
The Android Open Source Projectf013e1a2008-12-17 18:05:43 -080078 copybit_device_t* mBlitEngine;
The Android Open Source Project54b6cfa2008-10-21 07:00:00 -070079};
80
81// ---------------------------------------------------------------------------
82}; // namespace android
83// ---------------------------------------------------------------------------
84
85#endif // ANDROID_EGL_DISPLAY_SURFACE_H
86