2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_DISPLAY_HARDWARE_H
18 #define ANDROID_DISPLAY_HARDWARE_H
22 #include <ui/PixelFormat.h>
23 #include <ui/Region.h>
26 #include <GLES/glext.h>
28 #include <EGL/eglext.h>
30 #include <pixelflinger/pixelflinger.h>
32 #include "GLExtensions.h"
34 #include "DisplayHardware/DisplayHardwareBase.h"
36 struct overlay_control_device_t;
37 struct framebuffer_device_t;
38 struct copybit_image_t;
42 class FramebufferNativeWindow;
44 class DisplayHardware : public DisplayHardwareBase
48 COPY_BITS_EXTENSION = 0x00000008,
49 BUFFER_PRESERVED = 0x00010000,
50 PARTIAL_UPDATES = 0x00020000, // video driver feature
51 SLOW_CONFIG = 0x00040000, // software
52 SWAP_RECTANGLE = 0x00080000,
56 const sp<SurfaceFlinger>& flinger,
57 uint32_t displayIndex);
61 void releaseScreen() const;
62 void acquireScreen() const;
64 // Flip the front and back buffers if the back buffer is "dirty". Might
65 // be instantaneous, might involve copying the frame buffer around.
66 void flip(const Region& dirty) const;
67 status_t postBypassBuffer(const native_handle_t* handle) const;
69 float getDpiX() const;
70 float getDpiY() const;
71 float getRefreshRate() const;
72 float getDensity() const;
74 int getHeight() const;
75 PixelFormat getFormat() const;
76 uint32_t getFlags() const;
77 void makeCurrent() const;
78 uint32_t getMaxTextureSize() const;
79 uint32_t getMaxViewportDims() const;
81 uint32_t getPageFlipCount() const;
82 EGLDisplay getEGLDisplay() const { return mDisplay; }
83 overlay_control_device_t* getOverlayEngine() const { return mOverlayEngine; }
85 status_t compositionComplete() const;
88 return Rect(mWidth, mHeight);
92 int getCurrentBufferIndex() const;
95 void init(uint32_t displayIndex) __attribute__((noinline));
96 void fini() __attribute__((noinline));
110 mutable uint32_t mPageFlipCount;
111 GLint mMaxViewportDims;
112 GLint mMaxTextureSize;
114 sp<FramebufferNativeWindow> mNativeWindow;
115 overlay_control_device_t* mOverlayEngine;
118 }; // namespace android
120 #endif // ANDROID_DISPLAY_HARDWARE_H