зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1676862 - ensure wr_notifier_wake_up passes through UpdateAndRender. r=mstange
wr_notifier_wake_up uses RenderThread::WakeUp, which in turn just directly calls Renderer::Update. As a side-effect, this can queue a composite to the main framebuffer deep inside the renderer, but without having gone through the normal pathway of Renderer::UpdateAndRender. UpdateAndRender ensures that any RenderCompositor is properly prepared for the frame by calling BeginFrame and other hooks as appropriate. But since we went through just Update instead, there is never any call to BeginFrame and the SWGL framebuffer never gets a chance to be properly set up in the RenderCompositor. In such cases that we actually need to composite to the framebuffer, it seems more appropriate to call UpdateAndRender, which also supports a boolean indicating whether or not we actually intend to render something. To further simplify, we just reuse the existing HandleFrameOneDoc handler to avoid needing separate entry-points into UpdateAndRender. Differential Revision: https://phabricator.services.mozilla.com/D99733
This commit is contained in:
Родитель
ca2705c27c
Коммит
656be1724e
|
@ -356,32 +356,6 @@ void RenderThread::HandleFrameOneDoc(wr::WindowId aWindowId, bool aRender) {
|
|||
frame.mStartTime);
|
||||
}
|
||||
|
||||
void RenderThread::WakeUp(wr::WindowId aWindowId) {
|
||||
if (mHasShutdown) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsInRenderThread()) {
|
||||
Loop()->PostTask(NewRunnableMethod<wr::WindowId>(
|
||||
"wr::RenderThread::WakeUp", this, &RenderThread::WakeUp, aWindowId));
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsDestroyed(aWindowId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mHandlingDeviceReset) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = mRenderers.find(aWindowId);
|
||||
MOZ_ASSERT(it != mRenderers.end());
|
||||
if (it != mRenderers.end()) {
|
||||
it->second->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderThread::SetClearColor(wr::WindowId aWindowId, wr::ColorF aColor) {
|
||||
if (mHasShutdown) {
|
||||
return;
|
||||
|
@ -530,11 +504,11 @@ void RenderThread::UpdateAndRender(
|
|||
// and for avoiding GPU queue is filled with too much tasks.
|
||||
// WaitForGPU's implementation is different for each platform.
|
||||
renderer->WaitForGPU();
|
||||
}
|
||||
|
||||
if (!aRender) {
|
||||
} else {
|
||||
// Update frame id for NotifyPipelinesUpdated() when rendering does not
|
||||
// happen.
|
||||
// happen, either because rendering was not requested or the frame was
|
||||
// canceled. Rendering can sometimes be canceled if UpdateAndRender is
|
||||
// called when the window is not yet ready (not mapped or 0 size).
|
||||
latestFrameId = renderer->UpdateFrameId();
|
||||
}
|
||||
|
||||
|
@ -1170,8 +1144,13 @@ static already_AddRefed<gl::GLContext> CreateGLContext(nsACString& aError) {
|
|||
|
||||
extern "C" {
|
||||
|
||||
void wr_notifier_wake_up(mozilla::wr::WrWindowId aWindowId) {
|
||||
mozilla::wr::RenderThread::Get()->WakeUp(aWindowId);
|
||||
void wr_notifier_wake_up(mozilla::wr::WrWindowId aWindowId,
|
||||
bool aCompositeNeeded) {
|
||||
mozilla::wr::RenderThread::Get()->IncPendingFrameCount(aWindowId, VsyncId(),
|
||||
TimeStamp::Now());
|
||||
mozilla::wr::RenderThread::Get()->DecPendingFrameBuildCount(aWindowId);
|
||||
mozilla::wr::RenderThread::Get()->HandleFrameOneDoc(aWindowId,
|
||||
aCompositeNeeded);
|
||||
}
|
||||
|
||||
void wr_notifier_new_frame_ready(mozilla::wr::WrWindowId aWindowId) {
|
||||
|
|
|
@ -170,12 +170,9 @@ class RenderThread final {
|
|||
|
||||
/// Automatically forwarded to the render thread. Will trigger a render for
|
||||
/// the current pending frame once one call per document in that pending
|
||||
// frame has been received.
|
||||
/// frame has been received.
|
||||
void HandleFrameOneDoc(wr::WindowId aWindowId, bool aRender);
|
||||
|
||||
/// Automatically forwarded to the render thread.
|
||||
void WakeUp(wr::WindowId aWindowId);
|
||||
|
||||
/// Automatically forwarded to the render thread.
|
||||
void SetClearColor(wr::WindowId aWindowId, wr::ColorF aColor);
|
||||
|
||||
|
|
|
@ -542,7 +542,7 @@ struct CppNotifier {
|
|||
unsafe impl Send for CppNotifier {}
|
||||
|
||||
extern "C" {
|
||||
fn wr_notifier_wake_up(window_id: WrWindowId);
|
||||
fn wr_notifier_wake_up(window_id: WrWindowId, composite_needed: bool);
|
||||
fn wr_notifier_new_frame_ready(window_id: WrWindowId);
|
||||
fn wr_notifier_nop_frame_done(window_id: WrWindowId);
|
||||
fn wr_notifier_external_event(window_id: WrWindowId, raw_event: usize);
|
||||
|
@ -560,9 +560,9 @@ impl RenderNotifier for CppNotifier {
|
|||
})
|
||||
}
|
||||
|
||||
fn wake_up(&self, _composite_needed: bool) {
|
||||
fn wake_up(&self, composite_needed: bool) {
|
||||
unsafe {
|
||||
wr_notifier_wake_up(self.window_id);
|
||||
wr_notifier_wake_up(self.window_id, composite_needed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче