X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=services%2Fsurfaceflinger%2FSurfaceFlinger.h;h=0e9955c537ea9dc953ce9ab97ae51bee0448387a;hb=93573e91c22ba8329222c69cd7f099f5703fb444;hp=e7745b8caa9c026320a0a459e952b1ca8938c987;hpb=ddd466abc1efa8a603eb96b27c1109965254b61b;p=android-x86%2Fframeworks-native.git diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index e7745b8caa..0e9955c537 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -21,7 +21,10 @@ #include #include -#include + +/* + * NOTE: Make sure this file doesn't include anything from or + */ #include @@ -32,7 +35,6 @@ #include #include -#include #include #include @@ -50,6 +52,7 @@ #include "MessageQueue.h" #include "DisplayHardware/HWComposer.h" +#include "Effects/Daltonizer.h" namespace android { @@ -62,6 +65,7 @@ class IGraphicBufferAlloc; class Layer; class LayerDim; class Surface; +class RenderEngine; // --------------------------------------------------------------------------- @@ -72,10 +76,8 @@ enum { eTransactionMask = 0x07 }; -class SurfaceFlinger : public BinderService, - public BnSurfaceComposer, +class SurfaceFlinger : public BnSurfaceComposer, private IBinder::DeathRecipient, - private Thread, private HWComposer::EventHandler { public: @@ -85,17 +87,21 @@ public: SurfaceFlinger() ANDROID_API; + // must be called before clients can connect + void init() ANDROID_API; + + // starts SurfaceFlinger main loop in the current thread + void run() ANDROID_API; + enum { EVENT_VSYNC = HWC_EVENT_VSYNC }; // post an asynchronous message to the main thread - status_t postMessageAsync(const sp& msg, nsecs_t reltime = 0, - uint32_t flags = 0); + status_t postMessageAsync(const sp& msg, nsecs_t reltime = 0, uint32_t flags = 0); // post a synchronous message to the main thread - status_t postMessageSync(const sp& msg, nsecs_t reltime = 0, - uint32_t flags = 0); + status_t postMessageSync(const sp& msg, nsecs_t reltime = 0, uint32_t flags = 0); // force full composition on all displays void repaintEverything(); @@ -106,7 +112,7 @@ public: } // utility function to delete a texture on the main thread - void deleteTextureAsync(GLuint texture); + void deleteTextureAsync(uint32_t texture); // enable/disable h/w composer event // TODO: this should be made accessible only to EventThread @@ -121,12 +127,20 @@ public: // TODO: this should be made accessible only to HWComposer const Vector< sp >& getLayerSortedByZForHwcDisplay(int id); + RenderEngine& getRenderEngine() const { + return *mRenderEngine; + } + private: friend class Client; friend class DisplayEventConnection; friend class Layer; friend class SurfaceTextureLayer; + // This value is specified in number of frames. Log frame stats at most + // every half hour. + enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; + // We're reference counted, never destroy SurfaceFlinger directly virtual ~SurfaceFlinger(); @@ -175,6 +189,7 @@ private: virtual sp createConnection(); virtual sp createGraphicBufferAlloc(); virtual sp createDisplay(const String8& displayName, bool secure); + virtual void destroyDisplay(const sp& display); virtual sp getBuiltInDisplay(int32_t id); virtual void setTransactionState(const Vector& state, const Vector& displays, uint32_t flags); @@ -185,7 +200,7 @@ private: virtual status_t captureScreen(const sp& display, const sp& producer, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, bool isCpuConsumer); + uint32_t minLayerZ, uint32_t maxLayerZ); // called when screen needs to turn off virtual void blank(const sp& display); // called when screen is turning back on @@ -198,10 +213,8 @@ private: virtual void binderDied(const wp& who); /* ------------------------------------------------------------------------ - * Thread interface + * RefBase interface */ - virtual bool threadLoop(); - virtual status_t readyToRun(); virtual void onFirstRef(); /* ------------------------------------------------------------------------ @@ -244,8 +257,7 @@ private: uint32_t peekTransactionFlags(uint32_t flags); uint32_t setTransactionFlags(uint32_t flags); void commitTransaction(); - uint32_t setClientStateLocked(const sp& client, - const layer_state_t& s); + uint32_t setClientStateLocked(const sp& client, const layer_state_t& s); uint32_t setDisplayStateLocked(const DisplayState& s); /* ------------------------------------------------------------------------ @@ -298,19 +310,17 @@ private: const sp& hw, const sp& producer, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useReadPixels); + uint32_t minLayerZ, uint32_t maxLayerZ); /* ------------------------------------------------------------------------ * EGL */ static status_t selectConfigForAttribute(EGLDisplay dpy, EGLint const* attrs, EGLint attribute, EGLint value, EGLConfig* outConfig); - static EGLConfig selectEGLConfig(EGLDisplay disp, EGLint visualId); - static EGLContext createGLContext(EGLDisplay disp, EGLConfig config); - void initializeGL(EGLDisplay display); - uint32_t getMaxTextureSize() const; - uint32_t getMaxViewportDims() const; + static status_t selectEGLConfig(EGLDisplay disp, EGLint visualId, + EGLint renderableType, EGLConfig* config); + size_t getMaxTextureSize() const; + size_t getMaxViewportDims() const; /* ------------------------------------------------------------------------ * Display and layer stack management @@ -358,17 +368,11 @@ private: void setUpHWComposer(); void doComposition(); void doDebugFlashRegions(); - void doDisplayComposition(const sp& hw, - const Region& dirtyRegion); - void doComposeSurfaces(const sp& hw, - const Region& dirty); + void doDisplayComposition(const sp& hw, const Region& dirtyRegion); + void doComposeSurfaces(const sp& hw, const Region& dirty); void postFramebuffer(); - void drawWormhole(const sp& hw, - const Region& region) const; - GLuint getProtectedTexName() const { - return mProtectedTexName; - } + void drawWormhole(const sp& hw, const Region& region) const; /* ------------------------------------------------------------------------ * Display management @@ -378,16 +382,17 @@ private: /* ------------------------------------------------------------------------ * Debugging & dumpsys */ - void listLayersLocked(const Vector& args, size_t& index, - String8& result) const; - void dumpStatsLocked(const Vector& args, size_t& index, - String8& result) const; - void clearStatsLocked(const Vector& args, size_t& index, - String8& result); - void dumpAllLocked(const Vector& args, size_t& index, - String8& result) const; + void listLayersLocked(const Vector& args, size_t& index, String8& result) const; + void dumpStatsLocked(const Vector& args, size_t& index, String8& result) const; + void clearStatsLocked(const Vector& args, size_t& index, String8& result); + void dumpAllLocked(const Vector& args, size_t& index, String8& result) const; bool startDdmConnection(); static void appendSfConfigString(String8& result); + void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr, + const sp& hw, + uint32_t minLayerZ, uint32_t maxLayerZ); + + void logFrameStats(); /* ------------------------------------------------------------------------ * Attributes @@ -411,17 +416,15 @@ private: // constant members (no synchronization needed for access) HWComposer* mHwc; - GLuint mProtectedTexName; + RenderEngine* mRenderEngine; nsecs_t mBootTime; bool mGpuToCpuSupported; sp mEventThread; - GLint mMaxViewportDims[2]; - GLint mMaxTextureSize; EGLContext mEGLContext; EGLConfig mEGLConfig; EGLDisplay mEGLDisplay; EGLint mEGLNativeVisualId; - sp mBuiltinDisplays[DisplayDevice::NUM_DISPLAY_TYPES]; + sp mBuiltinDisplays[DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES]; // Can only accessed from the main thread, these members // don't need synchronization @@ -447,7 +450,6 @@ private: // these are thread safe mutable MessageQueue mEventQueue; - mutable Barrier mReadyToRunBarrier; FrameTracker mAnimFrameTracker; // protected by mDestroyedLayerLock; @@ -458,7 +460,8 @@ private: * Feature prototyping */ - sp mExtDisplayToken; + Daltonizer mDaltonizer; + bool mDaltonize; }; // ---------------------------------------------------------------------------