Bug 919987 - Replace mCurSurface, which was redundant state, by a saner mSurfaceOverride that does nothing when it's EGL_NO_SURFACE - r=jgilbert

This commit is contained in:
Benoit Jacob 2013-11-15 11:28:38 -05:00
Родитель d782fe1f99
Коммит 26b2b9594f
3 изменённых файлов: 21 добавлений и 16 удалений

Просмотреть файл

@ -2449,7 +2449,18 @@ public:
virtual EGLContext GetEGLContext() { return nullptr; }
virtual GLLibraryEGL* GetLibraryEGL() { return nullptr; }
virtual void MakeCurrent_EGLSurface(void* surf) {
/**
* Only on EGL.
*
* If surf is non-null, this sets it to temporarily override this context's
* primary surface. This makes this context current against this surface,
* and subsequent MakeCurrent calls will continue using this surface as long
* as this override is set.
*
* If surf is null, this removes any previously set override, and makes the
* context current again against its primary surface.
*/
virtual void SetEGLSurfaceOverride(void* surf) {
MOZ_CRASH("Must be called against a GLContextEGL.");
}

Просмотреть файл

@ -232,7 +232,7 @@ public:
: GLContext(caps, shareContext, isOffscreen)
, mConfig(config)
, mSurface(surface)
, mCurSurface(surface)
, mSurfaceOverride(EGL_NO_SURFACE)
, mContext(context)
, mThebesSurface(nullptr)
, mBound(false)
@ -405,15 +405,7 @@ public:
}
#endif
virtual void MakeCurrent_EGLSurface(void* surf) {
EGLSurface eglSurface = (EGLSurface)surf;
if (!eglSurface)
eglSurface = mSurface;
if (eglSurface == mCurSurface)
return;
// Else, surface changed...
virtual void SetEGLSurfaceOverride(void* surf) MOZ_OVERRIDE {
if (Screen()) {
/* Blit `draw` to `read` if we need to, before we potentially juggle
* `read` around. If we don't, we might attach a different `read`,
@ -423,7 +415,7 @@ public:
Screen()->AssureBlitted();
}
mCurSurface = eglSurface;
mSurfaceOverride = surf ? (EGLSurface) surf : mSurface;
MakeCurrent(true);
}
@ -434,10 +426,12 @@ public:
// where MakeCurrent with an already-current context is
// still expensive.
if (aForce || sEGLLibrary.fGetCurrentContext() != mContext) {
EGLSurface surface = mSurfaceOverride != EGL_NO_SURFACE
? mSurfaceOverride
: mSurface;
succeeded = sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
mCurSurface, mCurSurface,
surface, surface,
mContext);
int eglError = sEGLLibrary.fGetError();
if (!succeeded) {
if (eglError == LOCAL_EGL_CONTEXT_LOST) {
@ -577,7 +571,7 @@ protected:
EGLConfig mConfig;
EGLSurface mSurface;
EGLSurface mCurSurface;
EGLSurface mSurfaceOverride;
EGLContext mContext;
nsRefPtr<gfxASurface> mThebesSurface;
bool mBound;

Просмотреть файл

@ -45,7 +45,7 @@ SharedSurface_ANGLEShareHandle::~SharedSurface_ANGLEShareHandle()
void
SharedSurface_ANGLEShareHandle::LockProdImpl()
{
mGL->MakeCurrent_EGLSurface(mPBuffer);
mGL->SetEGLSurfaceOverride(mPBuffer);
}
void