Bug 1180657 - Use hwc directly on GonkDisplayICS. r=sotaro
authorBoris Chiou <boris.chiou@gmail.com>
Mon, 03 Aug 2015 19:43:00 +0200
changeset 288004 fec4e3434c44156033c2523fcd46f0fd5ff5e759
parent 288003 1f6f47627dbd8ad7533f6ad86b5b305015af740a
child 288005 31a59a60e1566364372aebb1bf086a9377e1bd54
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1180657
milestone42.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 1180657 - Use hwc directly on GonkDisplayICS. r=sotaro
widget/gonk/HwcComposer2D.cpp
widget/gonk/libdisplay/GonkDisplayICS.cpp
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -835,24 +835,17 @@ HwcComposer2D::TryHwComposition(nsScreen
     mHal->SetEGLInfo(aScreen->GetEGLDisplay(), aScreen->GetEGLSurface());
     return !mHal->Set(mList, aScreen->GetDisplayType());
 }
 
 bool
 HwcComposer2D::Render(nsIWidget* aWidget)
 {
     nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen();
-    GetGonkDisplay()->SwapBuffers(screen->GetEGLDisplay(), screen->GetEGLSurface());
-
-    if (!mHal->HasHwc()) {
-        return true;
-    }
-
-    mHal->Prepare(nullptr, screen->GetDisplayType(), nullptr, -1);
-    return !mHal->Set(nullptr, screen->GetDisplayType());
+    return GetGonkDisplay()->SwapBuffers(screen->GetEGLDisplay(), screen->GetEGLSurface());
 }
 #endif
 
 bool
 HwcComposer2D::TryRenderWithHwc(Layer* aRoot,
                                 nsIWidget* aWidget,
                                 bool aGeometryChanged)
 {
--- a/widget/gonk/libdisplay/GonkDisplayICS.cpp
+++ b/widget/gonk/libdisplay/GonkDisplayICS.cpp
@@ -163,17 +163,24 @@ GonkDisplayICS::GetHWCDevice()
     return mHwc;
 }
 
 bool
 GonkDisplayICS::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
 {
     // Should be called when composition rendering is complete for a frame.
     // Only HWC v1.0 needs this call. ICS gonk always needs the call.
-    return !mFBSurface->compositionComplete();
+    mFBSurface->compositionComplete();
+
+    if (!mHwc) {
+        return true;
+    }
+
+    mHwc->prepare(mHwc, nullptr);
+    return !mHwc->set(mHwc, dpy, sur, 0);
 }
 
 ANativeWindowBuffer*
 GonkDisplayICS::DequeueBuffer()
 {
     ANativeWindow *window = static_cast<ANativeWindow *>(mFBSurface.get());
     ANativeWindowBuffer *buf = nullptr;
     window->dequeueBuffer(window, &buf);