#include <utils/SortedVector.h>
#include <utils/threads.h>
-#include <binder/BinderService.h>
#include <binder/IMemory.h>
#include <ui/PixelFormat.h>
#include "Barrier.h"
#include "DisplayDevice.h"
+#include "DispSync.h"
#include "FrameTracker.h"
#include "MessageQueue.h"
#include "DisplayHardware/HWComposer.h"
+#include "Effects/Daltonizer.h"
namespace android {
class LayerDim;
class Surface;
class RenderEngine;
+class EventControlThread;
// ---------------------------------------------------------------------------
eTransactionMask = 0x07
};
-class SurfaceFlinger : public BinderService<SurfaceFlinger>,
- public BnSurfaceComposer,
+class SurfaceFlinger : public BnSurfaceComposer,
private IBinder::DeathRecipient,
- private Thread,
private HWComposer::EventHandler
{
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
};
virtual void binderDied(const wp<IBinder>& who);
/* ------------------------------------------------------------------------
- * Thread interface
+ * RefBase interface
*/
- virtual bool threadLoop();
- virtual status_t readyToRun();
virtual void onFirstRef();
/* ------------------------------------------------------------------------
*/
static status_t selectConfigForAttribute(EGLDisplay dpy,
EGLint const* attrs, EGLint attribute, EGLint value, EGLConfig* outConfig);
- static EGLConfig selectEGLConfig(EGLDisplay disp, EGLint visualId);
+ static status_t selectEGLConfig(EGLDisplay disp, EGLint visualId,
+ EGLint renderableType, EGLConfig* config);
size_t getMaxTextureSize() const;
size_t getMaxViewportDims() const;
* Display management
*/
+ /* ------------------------------------------------------------------------
+ * VSync
+ */
+ void enableHardwareVsync();
+ void disableHardwareVsync(bool makeUnavailable);
+ void resyncToHardwareVsync(bool makeAvailable);
/* ------------------------------------------------------------------------
* Debugging & dumpsys
void dumpAllLocked(const Vector<String16>& args, size_t& index, String8& result) const;
bool startDdmConnection();
static void appendSfConfigString(String8& result);
- void checkScreenshot(const sp<GraphicBuffer>& buf, void const* vaddr,
+ void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr,
const sp<const DisplayDevice>& hw,
uint32_t minLayerZ, uint32_t maxLayerZ);
nsecs_t mBootTime;
bool mGpuToCpuSupported;
sp<EventThread> mEventThread;
+ sp<EventThread> mSFEventThread;
+ sp<EventControlThread> mEventControlThread;
EGLContext mEGLContext;
EGLConfig mEGLConfig;
EGLDisplay mEGLDisplay;
// these are thread safe
mutable MessageQueue mEventQueue;
- mutable Barrier mReadyToRunBarrier;
FrameTracker mAnimFrameTracker;
+ DispSync mPrimaryDispSync;
// protected by mDestroyedLayerLock;
mutable Mutex mDestroyedLayerLock;
Vector<Layer const *> mDestroyedLayers;
+ // protected by mHWVsyncLock
+ Mutex mHWVsyncLock;
+ bool mPrimaryHWVsyncEnabled;
+ bool mHWVsyncAvailable;
+
/* ------------------------------------------------------------------------
* Feature prototyping
*/
- sp<IBinder> mExtDisplayToken;
+ Daltonizer mDaltonizer;
+ bool mDaltonize;
};
-// ---------------------------------------------------------------------------
}; // namespace android
#endif // ANDROID_SURFACE_FLINGER_H