namespace android {
class DisplayInfo;
-class FramebufferSurface;
-class LayerBase;
+class DisplaySurface;
+class Layer;
class SurfaceFlinger;
+class HWComposer;
class DisplayDevice : public LightRefBase<DisplayDevice>
{
SWAP_RECTANGLE = 0x00080000,
};
+ enum {
+ NO_LAYER_STACK = 0xFFFFFFFF,
+ };
+
DisplayDevice(
const sp<SurfaceFlinger>& flinger,
- DisplayType type, const wp<IBinder>& displayToken,
- const sp<ANativeWindow>& nativeWindow,
- const sp<FramebufferSurface>& framebufferSurface,
+ DisplayType type,
+ bool isSecure,
+ const wp<IBinder>& displayToken,
+ const sp<DisplaySurface>& displaySurface,
EGLConfig config);
~DisplayDevice();
// when an non existing id is requested
bool isValid() const;
+ // isSecure indicates whether this display can be trusted to display
+ // secure surfaces.
+ bool isSecure() const { return mIsSecure; }
+
// Flip the front and back buffers if the back buffer is "dirty". Might
// be instantaneous, might involve copying the frame buffer around.
void flip(const Region& dirty) const;
EGLSurface getEGLSurface() const;
- void setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers);
- const Vector< sp<LayerBase> >& getVisibleLayersSortedByZ() const;
+ void setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers);
+ const Vector< sp<Layer> >& getVisibleLayersSortedByZ() const;
bool getSecureLayerVisible() const;
Region getDirtyRegion(bool repaintEverything) const;
int getOrientation() const { return mOrientation; }
const Transform& getTransform() const { return mGlobalTransform; }
- const Rect& getViewport() const { return mViewport; }
- const Rect& getFrame() const { return mFrame; }
+ const Rect getViewport() const { return mViewport; }
+ const Rect getFrame() const { return mFrame; }
+ const Rect& getScissor() const { return mScissor; }
+ bool needsFiltering() const { return mNeedsFiltering; }
uint32_t getLayerStack() const { return mLayerStack; }
int32_t getDisplayType() const { return mType; }
int32_t getHwcDisplayId() const { return mHwcDisplayId; }
const wp<IBinder>& getDisplayToken() const { return mDisplayToken; }
+ void swapBuffers(HWComposer& hwc) const;
status_t compositionComplete() const;
-
+
+ // called after h/w composer has completed its set() call
+ void onSwapBuffersCompleted(HWComposer& hwc) const;
+
Rect getBounds() const {
return Rect(mDisplayWidth, mDisplayHeight);
}
inline Rect bounds() const { return getBounds(); }
+ void setDisplayName(const String8& displayName);
+ const String8& getDisplayName() const { return mDisplayName; }
+
static EGLBoolean makeCurrent(EGLDisplay dpy,
const sp<const DisplayDevice>& hw, EGLContext ctx);
+ static void setViewportAndProjection(const sp<const DisplayDevice>& hw);
+
/* ------------------------------------------------------------------------
- * blank / unplank management
+ * blank / unblank management
*/
void releaseScreen() const;
void acquireScreen() const;
* Debugging
*/
uint32_t getPageFlipCount() const;
- void dump(String8& res) const;
+ void dump(String8& result, char* buffer, size_t SIZE) const;
private:
void init(EGLConfig config);
// ANativeWindow this display is rendering into
sp<ANativeWindow> mNativeWindow;
-
- // set if mNativeWindow is a FramebufferSurface
- sp<FramebufferSurface> mFramebufferSurface;
+ sp<DisplaySurface> mDisplaySurface;
EGLDisplay mDisplay;
EGLSurface mSurface;
PixelFormat mFormat;
uint32_t mFlags;
mutable uint32_t mPageFlipCount;
+ String8 mDisplayName;
+ bool mIsSecure;
/*
* Can only accessed from the main thread, these members
*/
// list of visible layers on that display
- Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
+ Vector< sp<Layer> > mVisibleLayersSortedByZ;
// Whether we have a visible secure layer on this display
bool mSecureLayerVisible;
static status_t orientationToTransfrom(int orientation,
int w, int h, Transform* tr);
- void updateGeometryTransform();
-
uint32_t mLayerStack;
int mOrientation;
+ // user-provided visible area of the layer stack
Rect mViewport;
+ // user-provided rectangle where mViewport gets mapped to
Rect mFrame;
+ // pre-computed scissor to apply to the display
+ Rect mScissor;
Transform mGlobalTransform;
+ bool mNeedsFiltering;
};
}; // namespace android