Bug 1579794 - [Wayland] Explicitly enable/disable direct rendering to wl_buffer, r=jhorak

Recently direct wl_buffer rendering is kept enabled until we have wl_buffer available which
produces rendering artifacts when screen damage rects overlaps.

Let's enable/disable it explicitly at every rendering cycle start to avoid
screen flickering.

Depends on D45166

Differential Revision: https://phabricator.services.mozilla.com/D45167

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-09-09 13:04:26 +00:00
Родитель 2ba6437bbb
Коммит 6dbfafeb2f
1 изменённых файлов: 2 добавлений и 18 удалений

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

@ -813,10 +813,8 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::Lock(
mBufferScreenRect = lockedScreenRect;
}
if (mWholeWindowBufferDamage || mRenderingCacheMode != CACHE_ALL) {
// We can lock/commit entire buffer direcly.
mDrawToWaylandBufferDirectly = true;
}
mDrawToWaylandBufferDirectly =
(mWholeWindowBufferDamage || mRenderingCacheMode != CACHE_ALL);
if (mDrawToWaylandBufferDirectly) {
// If there's any pending image commit scratch them as we're going
@ -826,20 +824,6 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::Lock(
RefPtr<gfx::DrawTarget> dt = LockWaylandBuffer(
/* aCanSwitchBuffer */ mWholeWindowBufferDamage);
if (dt) {
// TODO: Try to set clip regions according to given area provided by
// compositor, not sure it has any effect. Also disable when drawing
// without any cache to speed up rendering.
if (!mWholeWindowBufferDamage && mRenderingCacheMode != CACHE_NONE) {
uint32_t numRects = aRegion.GetNumRects();
if (numRects != 1) {
AutoTArray<IntRect, 32> rects;
rects.SetCapacity(numRects);
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
rects.AppendElement(iter.Get().ToUnknownRect());
}
dt->PushDeviceSpaceClipRects(rects.Elements(), rects.Length());
}
}
return dt.forget();
}
}