Backed out changeset 15145a32cd19 (bug 1231042) for b2g reftest bustage. a=backout

This commit is contained in:
Wes Kocher 2016-01-13 12:57:45 -08:00
parent 4a3f2c043d
commit 888f160e67
4 changed files with 3 additions and 107 deletions

View File

@ -75,7 +75,6 @@
#ifdef MOZ_WIDGET_GONK
#include "GeckoTouchDispatcher.h"
#include "nsScreenManagerGonk.h"
#endif
#include "LayerScope.h"
@ -287,18 +286,13 @@ CompositorVsyncScheduler::Observer::Destroy()
CompositorVsyncScheduler::CompositorVsyncScheduler(CompositorParent* aCompositorParent, nsIWidget* aWidget)
: mCompositorParent(aCompositorParent)
, mLastCompose(TimeStamp::Now())
, mCurrentCompositeTask(nullptr)
, mIsObservingVsync(false)
, mNeedsComposite(0)
, mVsyncNotificationsSkipped(0)
, mCurrentCompositeTaskMonitor("CurrentCompositeTaskMonitor")
, mCurrentCompositeTask(nullptr)
, mSetNeedsCompositeMonitor("SetNeedsCompositeMonitor")
, mSetNeedsCompositeTask(nullptr)
#ifdef MOZ_WIDGET_GONK
, mDisplayEnabled(false)
, mSetDisplayMonitor("SetDisplayMonitor")
, mSetDisplayTask(nullptr)
#endif
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aWidget != nullptr);
@ -306,9 +300,6 @@ CompositorVsyncScheduler::CompositorVsyncScheduler(CompositorParent* aCompositor
mCompositorVsyncDispatcher = aWidget->GetCompositorVsyncDispatcher();
#ifdef MOZ_WIDGET_GONK
GeckoTouchDispatcher::GetInstance()->SetCompositorVsyncScheduler(this);
RefPtr<nsScreenManagerGonk> screenManager = nsScreenManagerGonk::GetInstance();
screenManager->SetCompositorVsyncScheduler(this);
#endif
// mAsapScheduling is set on the main thread during init,
@ -326,52 +317,6 @@ CompositorVsyncScheduler::~CompositorVsyncScheduler()
mCompositorVsyncDispatcher = nullptr;
}
#ifdef MOZ_WIDGET_GONK
void
CompositorVsyncScheduler::SetDisplay(bool aDisplayEnable)
{
// SetDisplay() is usually called from nsScreenManager at main thread. Post
// to compositor thread if needs.
if (!CompositorParent::IsInCompositorThread()) {
MOZ_ASSERT(NS_IsMainThread());
MonitorAutoLock lock(mSetDisplayMonitor);
mSetDisplayTask = NewRunnableMethod(this,
&CompositorVsyncScheduler::SetDisplay,
aDisplayEnable);
ScheduleTask(mSetDisplayTask, 0);
return;
} else {
MonitorAutoLock lock(mSetDisplayMonitor);
mSetDisplayTask = nullptr;
}
if (mDisplayEnabled == aDisplayEnable) {
return;
}
mDisplayEnabled = aDisplayEnable;
if (!mDisplayEnabled) {
CancelCurrentSetNeedsCompositeTask();
CancelCurrentCompositeTask();
}
}
void
CompositorVsyncScheduler::CancelSetDisplayTask()
{
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
MonitorAutoLock lock(mSetDisplayMonitor);
if (mSetDisplayTask) {
mSetDisplayTask->Cancel();
mSetDisplayTask = nullptr;
}
// CancelSetDisplayTask is only be called in clean-up process, so
// mDisplayEnabled could be false there.
mDisplayEnabled = false;
}
#endif //MOZ_WIDGET_GONK
void
CompositorVsyncScheduler::Destroy()
{
@ -379,10 +324,6 @@ CompositorVsyncScheduler::Destroy()
UnobserveVsync();
mVsyncObserver->Destroy();
mVsyncObserver = nullptr;
#ifdef MOZ_WIDGET_GONK
CancelSetDisplayTask();
#endif
CancelCurrentSetNeedsCompositeTask();
CancelCurrentCompositeTask();
}
@ -455,13 +396,6 @@ CompositorVsyncScheduler::SetNeedsComposite()
mSetNeedsCompositeTask = nullptr;
}
#ifdef MOZ_WIDGET_GONK
// Skip composition when display off.
if (!mDisplayEnabled) {
return;
}
#endif
mNeedsComposite++;
if (!mIsObservingVsync && mNeedsComposite) {
ObserveVsync();

View File

@ -100,15 +100,6 @@ class CompositorVsyncScheduler
public:
explicit CompositorVsyncScheduler(CompositorParent* aCompositorParent, nsIWidget* aWidget);
#ifdef MOZ_WIDGET_GONK
// SetDisplay() and CancelSetDisplayTask() are used for the display on/off.
// It will clear all composition related task and flag, and skip another
// composition task during the display off. That could prevent the problem
// that compositor might show the old content at the first frame of display on.
void SetDisplay(bool aDisplayEnable);
#endif
bool NotifyVsync(TimeStamp aVsyncTimestamp);
void SetNeedsComposite();
void OnForceComposeToTarget();
@ -135,7 +126,7 @@ public:
return mExpectedComposeStartTime;
}
#endif
private:
virtual ~CompositorVsyncScheduler();
@ -145,9 +136,6 @@ private:
void DispatchTouchEvents(TimeStamp aVsyncTimestamp);
void DispatchVREvents(TimeStamp aVsyncTimestamp);
void CancelCurrentSetNeedsCompositeTask();
#ifdef MOZ_WIDGET_GONK
void CancelSetDisplayTask();
#endif
class Observer final : public VsyncObserver
{
@ -165,6 +153,7 @@ private:
CompositorParent* mCompositorParent;
TimeStamp mLastCompose;
CancelableTask* mCurrentCompositeTask;
#ifdef COMPOSITOR_PERFORMANCE_WARNING
TimeStamp mExpectedComposeStartTime;
@ -178,16 +167,9 @@ private:
RefPtr<CompositorVsyncScheduler::Observer> mVsyncObserver;
mozilla::Monitor mCurrentCompositeTaskMonitor;
CancelableTask* mCurrentCompositeTask;
mozilla::Monitor mSetNeedsCompositeMonitor;
CancelableTask* mSetNeedsCompositeTask;
#ifdef MOZ_WIDGET_GONK
bool mDisplayEnabled;
mozilla::Monitor mSetDisplayMonitor;
CancelableTask* mSetDisplayTask;
#endif
};
class CompositorUpdateObserver

View File

@ -621,10 +621,6 @@ nsScreenManagerGonk::Initialize()
void
nsScreenManagerGonk::DisplayEnabled(bool aEnabled)
{
if (mCompositorVsyncScheduler) {
mCompositorVsyncScheduler->SetDisplay(aEnabled);
}
VsyncControl(aEnabled);
NS_DispatchToMainThread(aEnabled ? mScreenOnEvent : mScreenOffEvent);
}
@ -857,13 +853,3 @@ nsScreenManagerGonk::RemoveScreen(GonkDisplay::DisplayType aDisplayType)
}
return NS_OK;
}
void
nsScreenManagerGonk::SetCompositorVsyncScheduler(mozilla::layers::CompositorVsyncScheduler *aObserver)
{
MOZ_ASSERT(NS_IsMainThread());
// We assume on b2g that there is only 1 CompositorParent
MOZ_ASSERT(mCompositorVsyncScheduler == nullptr);
mCompositorVsyncScheduler = aObserver;
}

View File

@ -42,9 +42,6 @@ namespace mozilla {
namespace gl {
class GLContext;
}
namespace layers {
class CompositorVsyncScheduler;
}
}
enum class NotifyDisplayChangedEvent : int8_t {
@ -173,8 +170,6 @@ public:
nsresult RemoveScreen(GonkDisplay::DisplayType aDisplayType);
void SetCompositorVsyncScheduler(mozilla::layers::CompositorVsyncScheduler* aObserver);
protected:
~nsScreenManagerGonk();
void VsyncControl(bool aEnabled);
@ -185,7 +180,6 @@ protected:
nsTArray<RefPtr<nsScreenGonk>> mScreens;
RefPtr<nsRunnable> mScreenOnEvent;
RefPtr<nsRunnable> mScreenOffEvent;
RefPtr<mozilla::layers::CompositorVsyncScheduler> mCompositorVsyncScheduler;
};
#endif /* nsScreenManagerGonk_h___ */