#include "DisplayHardware/HWComposer.h"
#include "Effects/Daltonizer.h"
+#include "FrameRateHelper.h"
+
namespace android {
// ---------------------------------------------------------------------------
class IGraphicBufferAlloc;
class Layer;
class LayerDim;
+class LayerBlur;
class Surface;
class RenderEngine;
class EventControlThread;
private HWComposer::EventHandler
{
public:
+#ifdef QTI_BSP
+ friend class ExSurfaceFlinger;
+#endif
+
static char const* getServiceName() ANDROID_API {
return "SurfaceFlinger";
}
friend class Client;
friend class DisplayEventConnection;
friend class Layer;
+ friend class LayerDim;
friend class MonitoredProducer;
+ friend class LayerBlur;
// This value is specified in number of frames. Log frame stats at most
// every half hour.
const sp<IGraphicBufferProducer>& producer,
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
uint32_t minLayerZ, uint32_t maxLayerZ,
- bool useIdentityTransform, ISurfaceComposer::Rotation rotation);
+ bool useIdentityTransform, ISurfaceComposer::Rotation rotation,
+ bool isCpuConsumer);
virtual status_t getDisplayStats(const sp<IBinder>& display,
DisplayStatInfo* stats);
virtual status_t getDisplayConfigs(const sp<IBinder>& display,
virtual status_t setActiveConfig(const sp<IBinder>& display, int id);
virtual status_t clearAnimationFrameStats();
virtual status_t getAnimationFrameStats(FrameStats* outStats) const;
+ virtual status_t getHdrCapabilities(const sp<IBinder>& display,
+ HdrCapabilities* outCapabilities) const;
/* ------------------------------------------------------------------------
* DeathRecipient interface
virtual void onHotplugReceived(int disp, bool connected);
/* ------------------------------------------------------------------------
+ * Extensions
+ */
+ virtual void updateExtendedMode() { }
+
+ virtual void getIndexLOI(size_t /*dpy*/,
+ const LayerVector& /*currentLayers*/,
+ bool& /*bIgnoreLayers*/,
+ int& /*indexLOI*/) { }
+
+ virtual bool updateLayerVisibleNonTransparentRegion(
+ const int& dpy, const sp<Layer>& layer,
+ bool& bIgnoreLayers, int& indexLOI,
+ uint32_t layerStack, const int& i);
+
+ virtual void delayDPTransactionIfNeeded(
+ const Vector<DisplayState>& /*displays*/) { }
+
+ virtual bool canDrawLayerinScreenShot(
+ const sp<const DisplayDevice>& hw,
+ const sp<Layer>& layer);
+
+ virtual void isfreezeSurfacePresent(
+ bool& freezeSurfacePresent,
+ const sp<const DisplayDevice>& /*hw*/,
+ const int32_t& /*id*/) { freezeSurfacePresent = false; }
+
+ virtual void setOrientationEventControl(
+ bool& /*freezeSurfacePresent*/,
+ const int32_t& /*id*/) { }
+
+ virtual void updateVisibleRegionsDirty() { }
+ virtual void drawWormHoleIfRequired(HWComposer::LayerListIterator &cur,
+ const HWComposer::LayerListIterator &end,
+ const sp<const DisplayDevice>& hw,
+ const Region& region);
+ /* ------------------------------------------------------------------------
* Message handling
*/
void waitForEvent();
uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle,
sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer);
+ status_t createBlurLayer(const sp<Client>& client, const String8& name,
+ uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle,
+ sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer);
+
// called in response to the window-manager calling
// ISurfaceComposerClient::destroySurface()
status_t onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle);
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
uint32_t minLayerZ, uint32_t maxLayerZ,
bool useIdentityTransform, Transform::orientation_flags rotation,
- bool isLocalScreenshot);
+ bool isLocalScreenshot, bool useReadPixels);
/* ------------------------------------------------------------------------
* EGL
* Compositing
*/
void invalidateHwcGeometry();
- static void computeVisibleRegions(
+ void computeVisibleRegions(size_t dpy,
const LayerVector& currentLayers, uint32_t layerStack,
Region& dirtyRegion, Region& opaqueRegion);
* VSync
*/
void enableHardwareVsync();
- void disableHardwareVsync(bool makeUnavailable);
void resyncToHardwareVsync(bool makeAvailable);
+ void disableHardwareVsync(bool makeUnavailable);
+public:
+ void resyncWithRateLimit();
+private:
/* ------------------------------------------------------------------------
* Debugging & dumpsys
void logFrameStats();
void dumpStaticScreenStats(String8& result) const;
+ virtual void dumpDrawCycle(bool /* prePrepare */ ) { }
/* ------------------------------------------------------------------------
* Attributes
mat4 mColorMatrix;
bool mHasColorMatrix;
+ mat4 mSecondaryColorMatrix;
+ bool mHasSecondaryColorMatrix;
+
// Static screen stats
bool mHasPoweredOff;
static const size_t NUM_BUCKETS = 8; // < 1-7, 7+
nsecs_t mFrameBuckets[NUM_BUCKETS];
nsecs_t mTotalTime;
- nsecs_t mLastSwapTime;
+ std::atomic<nsecs_t> mLastSwapTime;
+
+ FrameRateHelper mFrameRateHelper;
+
+ /*
+ * A number that increases on every new frame composition and screen capture.
+ * LayerBlur can speed up it's drawing by caching texture using this variable
+ * if multiple LayerBlur objects draw in one frame composition.
+ * In case of display mirroring, this variable should be increased on every display.
+ */
+ uint32_t mActiveFrameSequence;
+
};
}; // namespace android