Bug 1444387 - Part 1. Avoid using fallback if an image is not ready. r=jrmuizel

If an image container is empty, it will not produce an image key for use
with WebRender. This is generally not a sign of failure because the
producer likely has yet to populate the container with data. As such, we
should not immediately attempt to fallback. In fact, fallback can make
things worse in this situation, as we will create an image client to
send over the data, but then find that there is no data to share (or
find that there is, due to a race with the producer thread, and use
image clients when we could use shared surfaces).
This commit is contained in:
Andrew Osmond 2018-03-13 09:16:04 -04:00
Родитель c6c197da1e
Коммит fcec47e7bd
3 изменённых файлов: 15 добавлений и 3 удалений

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

@ -1744,7 +1744,11 @@ nsDisplayImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
return false;
}
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect);
// If the image container is empty, we don't want to fallback. Any other
// failure will be due to resource constraints and fallback is unlikely to
// help us. Hence we can ignore the return value from PushImage.
aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect);
return true;
}
ImgDrawResult

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

@ -1442,8 +1442,12 @@ nsPluginFrame::CreateWebRenderCommands(nsDisplayItem* aItem,
}
lm->AddDidCompositeObserver(mDidCompositeObserver.get());
// If the image container is empty, we don't want to fallback. Any other
// failure will be due to resource constraints and fallback is unlikely to
// help us. Hence we can ignore the return value from PushImage.
LayoutDeviceRect dest(r.x, r.y, size.width, size.height);
return aManager->CommandBuilder().PushImage(aItem, container, aBuilder, aResources, aSc, dest);
aManager->CommandBuilder().PushImage(aItem, container, aBuilder, aResources, aSc, dest);
return true;
}

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

@ -494,8 +494,12 @@ public:
SwapScaleWidthHeightForRotation(scaleHint, rotationDeg);
container->SetScaleHint(scaleHint);
// If the image container is empty, we don't want to fallback. Any other
// failure will be due to resource constraints and fallback is unlikely to
// help us. Hence we can ignore the return value from PushImage.
LayoutDeviceRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width, destGFXRect.height);
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, rect);
aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, rect);
return true;
}
// It would be great if we could override GetOpaqueRegion to return nonempty here,