Bug 1160877 - Fix gonkDisplay stop anim condition. r=mwu, a=me
authorJerryShih <hshih@mozilla.com>
Tue, 05 May 2015 10:32:00 -0400
changeset 242636 0df9e0c692a3afd096fa931911ea4c1d6dc4e0e7
parent 242635 5e13fa41d549c6c99bac590fa2369d06e0138287
child 242663 6c8b6e1d328fe23812697eeaae4c7df8076e1b65
push id28704
push userryanvm@gmail.com
push dateThu, 07 May 2015 13:27:19 +0000
treeherdermozilla-central@0df9e0c692a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu, me
bugs1160877
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1160877 - Fix gonkDisplay stop anim condition. r=mwu, a=me
widget/gonk/libdisplay/GonkDisplayJB.cpp
widget/gonk/libdisplay/GonkDisplayJB.h
--- a/widget/gonk/libdisplay/GonkDisplayJB.cpp
+++ b/widget/gonk/libdisplay/GonkDisplayJB.cpp
@@ -162,19 +162,18 @@ GonkDisplayJB::~GonkDisplayJB()
     if (mFBDevice)
         framebuffer_close(mFBDevice);
     free(mList);
 }
 
 ANativeWindow*
 GonkDisplayJB::GetNativeWindow()
 {
-    if (!mBootAnimBuffer.get()) {
-        StopBootAnimation();
-    }
+    StopBootAnim();
+
     return mSTClient.get();
 }
 
 void
 GonkDisplayJB::SetEnabled(bool enabled)
 {
     if (enabled) {
         autosuspend_disable();
@@ -230,20 +229,17 @@ void*
 GonkDisplayJB::GetDispSurface()
 {
     return mDispSurface.get();
 }
 
 bool
 GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
 {
-    if (mBootAnimBuffer.get()) {
-        StopBootAnimation();
-        mBootAnimBuffer = nullptr;
-    }
+    StopBootAnim();
 
     // Should be called when composition rendering is complete for a frame.
     // Only HWC v1.0 needs this call.
     // HWC > v1.0 case, do not call compositionComplete().
     // mFBDevice is present only when HWC is v1.0.
     if (mFBDevice && mFBDevice->compositionComplete) {
         mFBDevice->compositionComplete(mFBDevice);
     }
@@ -332,35 +328,42 @@ GonkDisplayJB::QueueBuffer(ANativeWindow
         error = mSTClient->queueBuffer(mSTClient.get(), buf, mFence);
     }
     return error == 0 && success;
 }
 
 void
 GonkDisplayJB::UpdateDispSurface(EGLDisplay dpy, EGLSurface sur)
 {
-    if (mBootAnimBuffer.get()) {
-        StopBootAnimation();
-        mBootAnimBuffer = nullptr;
-    }
+    StopBootAnim();
+
     eglSwapBuffers(dpy, sur);
 }
 
 void
 GonkDisplayJB::SetDispReleaseFd(int fd)
 {
     mDispSurface->setReleaseFenceFd(fd);
 }
 
 int
 GonkDisplayJB::GetPrevDispAcquireFd()
 {
     return mDispSurface->GetPrevDispAcquireFd();
 }
 
+void
+GonkDisplayJB::StopBootAnim()
+{
+    StopBootAnimation();
+    if (mBootAnimBuffer.get()) {
+        mBootAnimBuffer = nullptr;
+    }
+}
+
 __attribute__ ((visibility ("default")))
 GonkDisplay*
 GetGonkDisplay()
 {
     if (!sGonkDisplay)
         sGonkDisplay = new GonkDisplayJB();
     return sGonkDisplay;
 }
--- a/widget/gonk/libdisplay/GonkDisplayJB.h
+++ b/widget/gonk/libdisplay/GonkDisplayJB.h
@@ -50,16 +50,18 @@ public:
 
     virtual void SetDispReleaseFd(int fd);
 
     virtual int GetPrevDispAcquireFd();
 
     bool Post(buffer_handle_t buf, int fence);
 
 private:
+    void StopBootAnim();
+
     hw_module_t const*        mModule;
     hw_module_t const*        mFBModule;
     hwc_composer_device_1_t*  mHwc;
     framebuffer_device_t*     mFBDevice;
     power_module_t*           mPowerModule;
     android::sp<android::DisplaySurface> mDispSurface;
     android::sp<ANativeWindow> mSTClient;
     android::sp<android::IGraphicBufferAlloc> mAlloc;