mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1037704 - Add polling support to ShSurf. - r=mattwoodrow
This commit is contained in:
parent
5fc8008878
commit
45ca81fe4b
@ -80,6 +80,7 @@ protected:
|
||||
public:
|
||||
virtual void Fence() = 0;
|
||||
virtual bool WaitSync() = 0;
|
||||
virtual bool PollSync() = 0;
|
||||
|
||||
// This function waits until the buffer is no longer being used.
|
||||
// To optimize the performance, some implementaions recycle SharedSurfaces
|
||||
|
@ -51,20 +51,12 @@ SharedSurface_ANGLEShareHandle::UnlockProdImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SharedSurface_ANGLEShareHandle::Fence()
|
||||
{
|
||||
mGL->fFinish();
|
||||
}
|
||||
|
||||
bool
|
||||
SharedSurface_ANGLEShareHandle::WaitSync()
|
||||
{
|
||||
// Since we glFinish in Fence(), we're always going to be resolved here.
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
FillPBufferAttribs_ByBits(nsTArray<EGLint>& aAttrs,
|
||||
int redBits, int greenBits,
|
||||
|
@ -64,7 +64,8 @@ public:
|
||||
virtual void UnlockProdImpl() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Fence() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE { return true; } // Fence is glFinish.
|
||||
virtual bool PollSync() MOZ_OVERRIDE { return true; }
|
||||
|
||||
// Implementation-specific functions below:
|
||||
HANDLE GetShareHandle() {
|
||||
|
@ -162,6 +162,30 @@ SharedSurface_EGLImage::WaitSync()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedSurface_EGLImage::PollSync()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (!mSync) {
|
||||
// We must not be needed.
|
||||
return true;
|
||||
}
|
||||
MOZ_ASSERT(mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync));
|
||||
|
||||
EGLint status = 0;
|
||||
MOZ_ALWAYS_TRUE( mEGL->fGetSyncAttrib(mEGL->Display(),
|
||||
mSync,
|
||||
LOCAL_EGL_SYNC_STATUS_KHR,
|
||||
&status) );
|
||||
if (status != LOCAL_EGL_SIGNALED_KHR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE( mEGL->fDestroySync(mEGL->Display(), mSync) );
|
||||
mSync = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
SharedSurface_EGLImage::Display() const
|
||||
|
@ -64,9 +64,9 @@ public:
|
||||
virtual void LockProdImpl() MOZ_OVERRIDE {}
|
||||
virtual void UnlockProdImpl() MOZ_OVERRIDE {}
|
||||
|
||||
|
||||
virtual void Fence() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE;
|
||||
virtual bool PollSync() MOZ_OVERRIDE;
|
||||
|
||||
virtual GLuint ProdTexture() MOZ_OVERRIDE {
|
||||
return mProdTex;
|
||||
|
@ -169,7 +169,8 @@ SharedSurface_GLTexture::WaitSync()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (!mSync) {
|
||||
// We must have used glFinish instead of glFenceSync.
|
||||
// We either used glFinish, or we passed this fence already.
|
||||
// (PollSync/WaitSync returned true previously)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -185,6 +186,34 @@ SharedSurface_GLTexture::WaitSync()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedSurface_GLTexture::PollSync()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (!mSync) {
|
||||
// We either used glFinish, or we passed this fence already.
|
||||
// (PollSync/WaitSync returned true previously)
|
||||
return true;
|
||||
}
|
||||
|
||||
mConsGL->MakeCurrent();
|
||||
MOZ_ASSERT(mConsGL->IsExtensionSupported(GLContext::ARB_sync));
|
||||
|
||||
GLint status = 0;
|
||||
mConsGL->fGetSynciv(mSync,
|
||||
LOCAL_GL_SYNC_STATUS,
|
||||
1,
|
||||
nullptr,
|
||||
&status);
|
||||
if (status != LOCAL_GL_SIGNALED)
|
||||
return false;
|
||||
|
||||
mConsGL->fDeleteSync(mSync);
|
||||
mSync = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GLuint
|
||||
SharedSurface_GLTexture::ConsTexture(GLContext* consGL)
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
// Since we already store the data in Fence, we're always done already.
|
||||
return true;
|
||||
}
|
||||
virtual bool PollSync() MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual GLuint ProdTexture() MOZ_OVERRIDE {
|
||||
return mTex;
|
||||
@ -146,10 +147,9 @@ public:
|
||||
virtual void LockProdImpl() MOZ_OVERRIDE {}
|
||||
virtual void UnlockProdImpl() MOZ_OVERRIDE {}
|
||||
|
||||
|
||||
virtual void Fence() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool PollSync() MOZ_OVERRIDE;
|
||||
|
||||
virtual GLuint ProdTexture() MOZ_OVERRIDE {
|
||||
return mTex;
|
||||
|
@ -251,6 +251,30 @@ SharedSurface_Gralloc::WaitSync()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedSurface_Gralloc::PollSync()
|
||||
{
|
||||
if (!mSync) {
|
||||
// We must not be needed.
|
||||
return true;
|
||||
}
|
||||
MOZ_ASSERT(mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync));
|
||||
|
||||
EGLint status = 0;
|
||||
MOZ_ALWAYS_TRUE( mEGL->fGetSyncAttrib(mEGL->Display(),
|
||||
mSync,
|
||||
LOCAL_EGL_SYNC_STATUS_KHR,
|
||||
&status) );
|
||||
if (status != LOCAL_EGL_SIGNALED_KHR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE( mEGL->fDestroySync(mEGL->Display(), mSync) );
|
||||
mSync = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
SharedSurface_Gralloc::WaitForBufferOwnership()
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
|
||||
virtual void Fence() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE;
|
||||
virtual bool PollSync() MOZ_OVERRIDE;
|
||||
|
||||
virtual void WaitForBufferOwnership() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
|
||||
virtual void Fence() MOZ_OVERRIDE;
|
||||
virtual bool WaitSync() MOZ_OVERRIDE { return true; }
|
||||
virtual bool PollSync() MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual bool ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, GLvoid *pixels) MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user