From 88cde07df05c275da4e6d5746d79847eea723855 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 20 Sep 2011 17:21:56 -0700 Subject: fix transition from full overlays to fb we need to clear the whole framebuffer in that situation because we can't trust the content of the FB when partial (fb preserving) updates are used. Bug: 5318492 Change-Id: I3f0e01b0fb665a34e44d88ad9f0f54a5d990060b --- .../DisplayHardware/DisplayHardware.h | 3 +- .../surfaceflinger/DisplayHardware/HWComposer.cpp | 32 ++++++++++++++++++++++ .../surfaceflinger/DisplayHardware/HWComposer.h | 5 ++++ 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'services/surfaceflinger/DisplayHardware') diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h index 40a6f1e..f02c954 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h @@ -84,9 +84,10 @@ public: status_t compositionComplete() const; - Rect bounds() const { + Rect getBounds() const { return Rect(mWidth, mHeight); } + inline Rect bounds() const { return getBounds(); } // only for debugging int getCurrentBufferIndex() const; diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index daefd5e..e707bdc 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -40,6 +40,7 @@ namespace android { HWComposer::HWComposer(const sp& flinger) : mFlinger(flinger), mModule(0), mHwc(0), mList(0), mCapacity(0), + mNumOVLayers(0), mNumFBLayers(0), mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE) { int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule); @@ -98,9 +99,40 @@ status_t HWComposer::createWorkList(size_t numLayers) { status_t HWComposer::prepare() const { int err = mHwc->prepare(mHwc, mList); + if (err == NO_ERROR) { + size_t numOVLayers = 0; + size_t numFBLayers = 0; + size_t count = mList->numHwLayers; + for (size_t i=0 ; ihwLayers[i]); + if (l.flags & HWC_SKIP_LAYER) { + l.compositionType = HWC_FRAMEBUFFER; + } + switch (l.compositionType) { + case HWC_OVERLAY: + numOVLayers++; + break; + case HWC_FRAMEBUFFER: + numFBLayers++; + break; + } + } + mNumOVLayers = numOVLayers; + mNumFBLayers = numFBLayers; + } return (status_t)err; } +size_t HWComposer::getLayerCount(int type) const { + switch (type) { + case HWC_OVERLAY: + return mNumOVLayers; + case HWC_FRAMEBUFFER: + return mNumFBLayers; + } + return 0; +} + status_t HWComposer::commit() const { int err = mHwc->set(mHwc, mDpy, mSur, mList); if (mList) { diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 8758a80..aa8ebe1 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -64,6 +64,9 @@ public: size_t getNumLayers() const; hwc_layer_t* getLayers() const; + // updated in preapre() + size_t getLayerCount(int type) const; + // for debugging void dump(String8& out, char* scratch, size_t SIZE, const Vector< sp >& visibleLayersSortedByZ) const; @@ -81,6 +84,8 @@ private: hwc_composer_device_t* mHwc; hwc_layer_list_t* mList; size_t mCapacity; + mutable size_t mNumOVLayers; + mutable size_t mNumFBLayers; hwc_display_t mDpy; hwc_surface_t mSur; cb_context mCBContext; -- cgit v1.1