mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 1670014 - Delay querying buffer age until it is actually needed. r=sotaro
Currently we query the backbuffer age in RenderCompositor::BeginFrame(). Querying the age on android requires the driver to dequeue a new backbuffer. By doing this right at the start of the frame, we may cause the driver to block until a buffer is ready. We don't actually need the buffer age until part way through rendering, in Renderer::composite_simple(), by which point there is a better chance the buffer is available. So move the query to there instead. Differential Revision: https://phabricator.services.mozilla.com/D92950
This commit is contained in:
parent
bac7ca64e9
commit
788a554a66
@ -59,9 +59,7 @@ EGLSurface RenderCompositorEGL::CreateEGLSurface() {
|
|||||||
|
|
||||||
RenderCompositorEGL::RenderCompositorEGL(
|
RenderCompositorEGL::RenderCompositorEGL(
|
||||||
RefPtr<widget::CompositorWidget> aWidget)
|
RefPtr<widget::CompositorWidget> aWidget)
|
||||||
: RenderCompositor(std::move(aWidget)),
|
: RenderCompositor(std::move(aWidget)), mEGLSurface(EGL_NO_SURFACE) {}
|
||||||
mEGLSurface(EGL_NO_SURFACE),
|
|
||||||
mBufferAge(0) {}
|
|
||||||
|
|
||||||
RenderCompositorEGL::~RenderCompositorEGL() {
|
RenderCompositorEGL::~RenderCompositorEGL() {
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
@ -91,9 +89,6 @@ bool RenderCompositorEGL::BeginFrame() {
|
|||||||
gl()->MakeCurrent(); // DestroyUnused can change the current context!
|
gl()->MakeCurrent(); // DestroyUnused can change the current context!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// sets 0 if buffer_age is not supported
|
|
||||||
mBufferAge = gl::GLContextEGL::Cast(gl())->GetBufferAge();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +233,7 @@ bool RenderCompositorEGL::UsePartialPresent() {
|
|||||||
return gfx::gfxVars::WebRenderMaxPartialPresentRects() > 0;
|
return gfx::gfxVars::WebRenderMaxPartialPresentRects() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderCompositorEGL::RequestFullRender() { return mBufferAge == 0; }
|
bool RenderCompositorEGL::RequestFullRender() { return false; }
|
||||||
|
|
||||||
uint32_t RenderCompositorEGL::GetMaxPartialPresentRects() {
|
uint32_t RenderCompositorEGL::GetMaxPartialPresentRects() {
|
||||||
return gfx::gfxVars::WebRenderMaxPartialPresentRects();
|
return gfx::gfxVars::WebRenderMaxPartialPresentRects();
|
||||||
@ -248,7 +243,9 @@ bool RenderCompositorEGL::ShouldDrawPreviousPartialPresentRegions() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RenderCompositorEGL::GetBufferAge() const { return mBufferAge; }
|
size_t RenderCompositorEGL::GetBufferAge() const {
|
||||||
|
return gl::GLContextEGL::Cast(gl())->GetBufferAge();
|
||||||
|
}
|
||||||
|
|
||||||
void RenderCompositorEGL::SetBufferDamageRegion(const wr::DeviceIntRect* aRects,
|
void RenderCompositorEGL::SetBufferDamageRegion(const wr::DeviceIntRect* aRects,
|
||||||
size_t aNumRects) {
|
size_t aNumRects) {
|
||||||
|
@ -59,8 +59,6 @@ class RenderCompositorEGL : public RenderCompositor {
|
|||||||
LayoutDeviceIntSize mEGLSurfaceSize;
|
LayoutDeviceIntSize mEGLSurfaceSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EGLint mBufferAge;
|
|
||||||
|
|
||||||
// FileDescriptor of release fence.
|
// FileDescriptor of release fence.
|
||||||
// Release fence is a fence that is used for waiting until usage/composite of
|
// Release fence is a fence that is used for waiting until usage/composite of
|
||||||
// AHardwareBuffer is ended. The fence is delivered to client side via
|
// AHardwareBuffer is ended. The fence is delivered to client side via
|
||||||
|
@ -34,7 +34,7 @@ UniquePtr<RenderCompositor> RenderCompositorOGL::Create(
|
|||||||
|
|
||||||
RenderCompositorOGL::RenderCompositorOGL(
|
RenderCompositorOGL::RenderCompositorOGL(
|
||||||
RefPtr<gl::GLContext>&& aGL, RefPtr<widget::CompositorWidget>&& aWidget)
|
RefPtr<gl::GLContext>&& aGL, RefPtr<widget::CompositorWidget>&& aWidget)
|
||||||
: RenderCompositor(std::move(aWidget)), mGL(aGL), mBufferAge(0) {
|
: RenderCompositor(std::move(aWidget)), mGL(aGL) {
|
||||||
MOZ_ASSERT(mGL);
|
MOZ_ASSERT(mGL);
|
||||||
|
|
||||||
mIsEGL = aGL->GetContextType() == mozilla::gl::GLContextType::EGL;
|
mIsEGL = aGL->GetContextType() == mozilla::gl::GLContextType::EGL;
|
||||||
@ -57,11 +57,6 @@ bool RenderCompositorOGL::BeginFrame() {
|
|||||||
|
|
||||||
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mGL->GetDefaultFramebuffer());
|
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mGL->GetDefaultFramebuffer());
|
||||||
|
|
||||||
if (mIsEGL) {
|
|
||||||
// sets 0 if buffer_age is not supported
|
|
||||||
mBufferAge = gl::GLContextEGL::Cast(gl())->GetBufferAge();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,9 +107,7 @@ uint32_t RenderCompositorOGL::GetMaxPartialPresentRects() {
|
|||||||
return mIsEGL ? gfx::gfxVars::WebRenderMaxPartialPresentRects() : 0;
|
return mIsEGL ? gfx::gfxVars::WebRenderMaxPartialPresentRects() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderCompositorOGL::RequestFullRender() {
|
bool RenderCompositorOGL::RequestFullRender() { return false; }
|
||||||
return mIsEGL && (mBufferAge == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RenderCompositorOGL::UsePartialPresent() {
|
bool RenderCompositorOGL::UsePartialPresent() {
|
||||||
return mIsEGL && gfx::gfxVars::WebRenderMaxPartialPresentRects() > 0;
|
return mIsEGL && gfx::gfxVars::WebRenderMaxPartialPresentRects() > 0;
|
||||||
@ -126,7 +119,7 @@ bool RenderCompositorOGL::ShouldDrawPreviousPartialPresentRegions() {
|
|||||||
|
|
||||||
size_t RenderCompositorOGL::GetBufferAge() const {
|
size_t RenderCompositorOGL::GetBufferAge() const {
|
||||||
if (mIsEGL) {
|
if (mIsEGL) {
|
||||||
return mBufferAge;
|
return gl::GLContextEGL::Cast(gl())->GetBufferAge();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ class RenderCompositorOGL : public RenderCompositor {
|
|||||||
protected:
|
protected:
|
||||||
RefPtr<gl::GLContext> mGL;
|
RefPtr<gl::GLContext> mGL;
|
||||||
bool mIsEGL;
|
bool mIsEGL;
|
||||||
EGLint mBufferAge;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wr
|
} // namespace wr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user