Bug 930884 - Handle cancelBuffer. r=mwu
authorJerry Shih <hshih@mozilla.com>
Sat, 15 Mar 2014 17:07:48 -0400
changeset 192000 55a2f006e3aa6c88b97cf6448e8ebf3a50787a89
parent 191999 664df0574f11d23bc221e8ef2eb12010ef5e6728
child 192001 82ac69ed8a52467dd69b8836013bc0a17963484d
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs930884
milestone30.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 930884 - Handle cancelBuffer. r=mwu
widget/gonk/libdisplay/GonkDisplayICS.cpp
--- a/widget/gonk/libdisplay/GonkDisplayICS.cpp
+++ b/widget/gonk/libdisplay/GonkDisplayICS.cpp
@@ -71,16 +71,23 @@ frameBufferWatcher(void *)
 
 } // anonymous namespace
 
 
 namespace mozilla {
 
 static GonkDisplayICS* sGonkDisplay = nullptr;
 
+static int
+FramebufferNativeWindowCancelBufferNoop(ANativeWindow* aWindow,
+    android_native_buffer_t* aBuffer)
+{
+    return 0;
+}
+
 GonkDisplayICS::GonkDisplayICS()
     : mModule(nullptr)
     , mHwc(nullptr)
 {
     // Some gralloc HALs need this in order to open the
     // framebuffer device after we restart with the screen off.
     //
     // this *must* run BEFORE allocating the
@@ -99,16 +106,23 @@ GonkDisplayICS::GonkDisplayICS()
         } while (len < 0 && errno == EINTR);
         if (len < 0) {
             LOGE("BootAnimation: wait_for_fb_sleep failed errno: %d", errno);
         }
     }
 
     mFBSurface = new FramebufferNativeWindow();
 
+    // ICS FramebufferNativeWindow doesn't set the |cancelBuffer|
+    // function pointer.
+    // It will crash when deleting the EGL window surface.
+    if (!mFBSurface->cancelBuffer) {
+        mFBSurface->cancelBuffer = FramebufferNativeWindowCancelBufferNoop;
+    }
+
     int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule);
     LOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID);
     if (!err) {
         err = hwc_open(mModule, &mHwc);
         LOGE_IF(err, "%s device failed to initialize (%s)",
                  HWC_HARDWARE_COMPOSER, strerror(-err));
     }