Bug 1029856 - Call glClear() before blit composition r= Sushil

This commit is contained in:
Sotaro Ikeda 2014-06-30 13:01:24 -07:00
parent 91d2d6b03c
commit 8e0f02b8a0
3 changed files with 17 additions and 3 deletions

View File

@ -246,7 +246,7 @@ GLContextEGL::GLContextEGL(
mHwc = HwcComposer2D::GetInstance();
MOZ_ASSERT(!mHwc->Initialized());
if (mHwc->Init(EGL_DISPLAY(), mSurface)) {
if (mHwc->Init(EGL_DISPLAY(), mSurface, this)) {
NS_WARNING("HWComposer initialization failed!");
mHwc = nullptr;
}

View File

@ -69,6 +69,7 @@ static StaticRefPtr<HwcComposer2D> sInstance;
HwcComposer2D::HwcComposer2D()
: mHwc(nullptr)
, mList(nullptr)
, mGLContext(nullptr)
, mMaxLayerCount(0)
, mColorFill(false)
, mRBSwapSupport(false)
@ -85,7 +86,7 @@ HwcComposer2D::~HwcComposer2D() {
}
int
HwcComposer2D::Init(hwc_display_t dpy, hwc_surface_t sur)
HwcComposer2D::Init(hwc_display_t dpy, hwc_surface_t sur, gl::GLContext* aGLContext)
{
MOZ_ASSERT(!Initialized());
@ -123,6 +124,7 @@ HwcComposer2D::Init(hwc_display_t dpy, hwc_surface_t sur)
mDpy = dpy;
mSur = sur;
mGLContext = aGLContext;
return 0;
}
@ -583,6 +585,13 @@ HwcComposer2D::TryHwComposition()
// GPU or partial OVERLAY Composition
return false;
} else if (blitComposite) {
// Some EGLSurface implementations require glClear() on blit composition.
// See bug 1029856.
if (mGLContext) {
mGLContext->MakeCurrent();
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
}
// BLIT Composition, flip FB target
GetGonkDisplay()->UpdateFBSurface(mDpy, mSur);
FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());

View File

@ -29,6 +29,10 @@
namespace mozilla {
namespace gl {
class GLContext;
}
namespace layers {
class ContainerLayer;
class Layer;
@ -69,7 +73,7 @@ public:
HwcComposer2D();
virtual ~HwcComposer2D();
int Init(hwc_display_t aDisplay, hwc_surface_t aSurface);
int Init(hwc_display_t aDisplay, hwc_surface_t aSurface, gl::GLContext* aGLContext);
bool Initialized() const { return mHwc; }
@ -98,6 +102,7 @@ private:
HwcList* mList;
hwc_display_t mDpy;
hwc_surface_t mSur;
gl::GLContext* mGLContext;
nsIntRect mScreenRect;
int mMaxLayerCount;
bool mColorFill;