Bug 1642839 - Implement WebRenderLayerManager::SendInvalidRegion() r=jrmuizel

When DWM is disabled, each window does not have own back buffer. They would paint directly to a buffer that was to be displayed by the video card. WM_PAINT via SendInvalidRegion() requests necessary re-paint. With it, RenderCompositorANGLE does not need to disable partial present.

Differential Revision: https://phabricator.services.mozilla.com/D77989
This commit is contained in:
sotaro 2020-06-05 05:03:40 +00:00
Родитель 6ff074dacc
Коммит 650f64603f
3 изменённых файлов: 13 добавлений и 17 удалений

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

@ -671,6 +671,18 @@ void WebRenderLayerManager::WaitOnTransactionProcessed() {
void WebRenderLayerManager::SendInvalidRegion(const nsIntRegion& aRegion) {
// XXX Webrender does not support invalid region yet.
#ifdef XP_WIN
// When DWM is disabled, each window does not have own back buffer. They would
// paint directly to a buffer that was to be displayed by the video card.
// WM_PAINT via SendInvalidRegion() requests necessary re-paint.
const bool needsInvalidate = !gfx::gfxVars::DwmCompositionEnabled();
#else
const bool needsInvalidate = true;
#endif
if (needsInvalidate && WrBridge()) {
WrBridge()->SendInvalidateRenderedFrame();
}
}
void WebRenderLayerManager::ScheduleComposite() {

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

@ -928,17 +928,7 @@ void RenderCompositorANGLE::InitializeUsePartialPresent() {
bool RenderCompositorANGLE::UsePartialPresent() { return mUsePartialPresent; }
bool RenderCompositorANGLE::RequestFullRender() {
if (!gfx::gfxVars::DwmCompositionEnabled()) {
// When DWM is disabled, background window needs to repaint its visible
// region with WM_PAINT. But invalid region is not supported yet by
// WebRenderLayerManager::SendInvalidRegion(). When partial present is
// enabled, there is a case that updated rectangle does not cover the
// invalid region. Then requests full render for now.
mFullRender = true;
}
return mFullRender;
}
bool RenderCompositorANGLE::RequestFullRender() { return mFullRender; }
uint32_t RenderCompositorANGLE::GetMaxPartialPresentRects() {
if (!mUsePartialPresent) {

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

@ -2657,12 +2657,6 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) {
// don't have a compositing window manager, our pixels could be stale.
GetLayerManager()->SetNeedsComposite(true);
GetLayerManager()->SendInvalidRegion(region.ToUnknownRegion());
if (WebRenderLayerManager* wrlm =
GetLayerManager()->AsWebRenderLayerManager()) {
if (WebRenderBridgeChild* bridge = wrlm->WrBridge()) {
bridge->SendInvalidateRenderedFrame();
}
}
}
RefPtr<nsWindow> strongThis(this);