summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/LayerBase.h
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/LayerBase.h')
-rw-r--r--services/surfaceflinger/LayerBase.h111
1 files changed, 53 insertions, 58 deletions
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index c547a40..6394542 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -25,6 +25,7 @@
#include <GLES/gl.h>
#include <utils/RefBase.h>
+#include <utils/String8.h>
#include <ui/Region.h>
@@ -32,19 +33,16 @@
#include <private/gui/LayerState.h>
-#include <hardware/hwcomposer.h>
-
-#include "DisplayHardware/DisplayHardware.h"
#include "Transform.h"
+#include "DisplayHardware/HWComposer.h"
namespace android {
// ---------------------------------------------------------------------------
class Client;
-class DisplayHardware;
+class DisplayDevice;
class GraphicBuffer;
-class GraphicPlane;
class Layer;
class LayerBaseClient;
class SurfaceFlinger;
@@ -60,9 +58,9 @@ public:
DisplayID dpy;
mutable bool contentDirty;
- Region visibleRegionScreen;
- Region transparentRegionScreen;
- Region coveredRegionScreen;
+ // regions below are in window-manager space
+ Region visibleRegion;
+ Region coveredRegion;
int32_t sequence;
struct Geometry {
@@ -81,6 +79,7 @@ public:
Geometry active;
Geometry requested;
uint32_t z;
+ uint32_t layerStack;
uint8_t alpha;
uint8_t flags;
uint8_t reserved[2];
@@ -89,6 +88,20 @@ public:
Region transparentRegion;
};
+ class LayerMesh {
+ friend class LayerBase;
+ GLfloat mVertices[4][2];
+ size_t mNumVertices;
+ public:
+ LayerMesh() : mNumVertices(4) { }
+ GLfloat const* getVertices() const {
+ return &mVertices[0][0];
+ }
+ size_t getVertexCount() const {
+ return mNumVertices;
+ }
+ };
+
virtual void setName(const String8& name);
String8 getName() const;
@@ -101,24 +114,30 @@ public:
bool setTransparentRegionHint(const Region& opaque);
bool setFlags(uint8_t flags, uint8_t mask);
bool setCrop(const Rect& crop);
-
+ bool setLayerStack(uint32_t layerStack);
+
void commitTransaction();
bool requestTransaction();
void forceVisibilityTransaction();
uint32_t getTransactionFlags(uint32_t flags);
uint32_t setTransactionFlags(uint32_t flags);
-
- Rect visibleBounds() const;
- virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; }
- virtual sp<Layer> getLayer() const { return 0; }
+ void computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* mesh) const;
+ Rect computeBounds() const;
- virtual const char* getTypeId() const { return "LayerBase"; }
- virtual void setGeometry(hwc_layer_t* hwcl);
- virtual void setPerFrameData(hwc_layer_t* hwcl);
+ virtual sp<LayerBaseClient> getLayerBaseClient() const;
+ virtual sp<Layer> getLayer() const;
+
+ virtual const char* getTypeId() const { return "LayerBase"; }
+ virtual void setGeometry(const sp<const DisplayDevice>& hw,
+ HWComposer::HWCLayerInterface& layer);
+ virtual void setPerFrameData(const sp<const DisplayDevice>& hw,
+ HWComposer::HWCLayerInterface& layer);
+ virtual void setAcquireFence(const sp<const DisplayDevice>& hw,
+ HWComposer::HWCLayerInterface& layer);
/**
* draw - performs some global clipping optimizations
@@ -126,13 +145,13 @@ public:
* Typically this method is not overridden, instead implement onDraw()
* to perform the actual drawing.
*/
- virtual void draw(const Region& clip) const;
- virtual void drawForSreenShot();
+ virtual void draw(const sp<const DisplayDevice>& hw, const Region& clip) const;
+ virtual void draw(const sp<const DisplayDevice>& hw);
/**
* onDraw - draws the surface.
*/
- virtual void onDraw(const Region& clip) const = 0;
+ virtual void onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const = 0;
/**
* initStates - called just after construction
@@ -159,26 +178,13 @@ public:
virtual void setCoveredRegion(const Region& coveredRegion);
/**
- * validateVisibility - cache a bunch of things
- */
- virtual void validateVisibility(const Transform& globalTransform);
-
- /**
- * lockPageFlip - called each time the screen is redrawn and returns whether
+ * latchBuffer - called each time the screen is redrawn and returns whether
* the visible regions need to be recomputed (this is a fairly heavy
* operation, so this should be set only if needed). Typically this is used
* to figure out if the content or size of a surface has changed.
*/
- virtual void lockPageFlip(bool& recomputeVisibleRegions);
-
- /**
- * unlockPageFlip - called each time the screen is redrawn. updates the
- * final dirty region wrt the planeTransform.
- * At this point, all visible regions, surface position and size, etc... are
- * correct.
- */
- virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion);
-
+ virtual Region latchBuffer(bool& recomputeVisibleRegions);
+
/**
* isOpaque - true if this surface is opaque
*/
@@ -212,13 +218,18 @@ public:
/** called after page-flip
*/
- virtual void onLayerDisplayed() { }
+ virtual void onLayerDisplayed(const sp<const DisplayDevice>& hw,
+ HWComposer::HWCLayerInterface* layer) { }
/** called before composition.
* returns true if the layer has pending updates.
*/
virtual bool onPreComposition() { return false; }
+ /** called before composition.
+ */
+ virtual void onPostComposition() { }
+
/** always call base class first */
virtual void dump(String8& result, char* scratch, size_t size) const;
virtual void shortDump(String8& result, char* scratch, size_t size) const;
@@ -236,43 +247,27 @@ public:
inline const State& currentState() const { return mCurrentState; }
inline State& currentState() { return mCurrentState; }
- int32_t getOrientation() const { return mOrientation; }
- int32_t getPlaneOrientation() const { return mPlaneOrientation; }
+ void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const;
- void clearWithOpenGL(const Region& clip) const;
+ void setFiltering(bool filtering);
+ bool getFiltering() const;
protected:
- const GraphicPlane& graphicPlane(int dpy) const;
- GraphicPlane& graphicPlane(int dpy);
-
- void clearWithOpenGL(const Region& clip, GLclampf r, GLclampf g,
- GLclampf b, GLclampf alpha) const;
- void drawWithOpenGL(const Region& clip) const;
-
- void setFiltering(bool filtering);
- bool getFiltering() const;
+ void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
+ GLclampf r, GLclampf g, GLclampf b, GLclampf alpha) const;
+ void drawWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const;
sp<SurfaceFlinger> mFlinger;
- uint32_t mFlags;
private:
// accessed only in the main thread
// Whether filtering is forced on or not
bool mFiltering;
- // cached during validateVisibility()
// Whether filtering is needed b/c of the drawingstate
bool mNeedsFiltering;
protected:
- // cached during validateVisibility()
- int32_t mOrientation;
- int32_t mPlaneOrientation;
- Transform mTransform;
- GLfloat mVertices[4][2];
- size_t mNumVertices;
- Rect mTransformedBounds;
-
// these are protected by an external lock
State mCurrentState;
State mDrawingState;