Bug 1384869 - Fix ImageCompositeNotification when WebRender is enabled r=nical

This commit is contained in:
sotaro 2017-07-31 13:00:06 +09:00
Родитель 54070eee06
Коммит 45948ad968
4 изменённых файлов: 38 добавлений и 13 удалений

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

@ -8,6 +8,7 @@
#include <queue>
#include "CompositableHost.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/layers/TextureHost.h"
#include "mozilla/Maybe.h"
@ -79,6 +80,16 @@ public:
const wr::MixBlendMode& aMixBlendMode);
void ApplyAsyncImages(wr::WebRenderAPI* aApi);
void AppendImageCompositeNotification(const ImageCompositeNotificationInfo& aNotification)
{
mImageCompositeNotifications.AppendElement(aNotification);
}
void FlushImageNotifications(nsTArray<ImageCompositeNotificationInfo>* aNotifications)
{
aNotifications->AppendElements(Move(mImageCompositeNotifications));
}
private:
void DeleteOldAsyncImages(wr::WebRenderAPI* aApi);
@ -146,6 +157,8 @@ private:
// change its rendering at this time. In order not to miss it, we composite
// on every vsync until this time occurs (this is the latest such time).
TimeStamp mCompositeUntilTime;
nsTArray<ImageCompositeNotificationInfo> mImageCompositeNotifications;
};
} // namespace layers

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

@ -1441,5 +1441,12 @@ WebRenderBridgeParent::GetNextWrEpoch()
return ++mWrEpoch;
}
void
WebRenderBridgeParent::ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotificationInfo>* aNotifications)
{
MOZ_ASSERT(mWidget);
mAsyncImageManager->FlushImageNotifications(aNotifications);
}
} // namespace layers
} // namespace mozilla

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

@ -176,17 +176,7 @@ public:
TextureFactoryIdentifier GetTextureFactoryIdentifier();
void AppendImageCompositeNotification(const ImageCompositeNotificationInfo& aNotification)
{
MOZ_ASSERT(mWidget);
mImageCompositeNotifications.AppendElement(aNotification);
}
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotificationInfo>* aNotifications)
{
MOZ_ASSERT(mWidget);
aNotifications->AppendElements(Move(mImageCompositeNotifications));
}
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotificationInfo>* aNotifications);
uint32_t GetIdNameSpace()
{
@ -286,7 +276,6 @@ private:
std::unordered_set<uint64_t> mActiveAnimations;
nsDataHashtable<nsUint64HashKey, RefPtr<WebRenderImageHost>> mAsyncCompositables;
nsDataHashtable<nsUint64HashKey, RefPtr<WebRenderImageHost>> mExternalImageIds;
nsTArray<ImageCompositeNotificationInfo> mImageCompositeNotifications;
TimeStamp mPreviousFrameTimeStamp;
// These fields keep track of the latest layer observer epoch values in the child and the

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

@ -143,13 +143,17 @@ WebRenderImageHost::GetAsTextureHost(IntRect* aPictureRect)
TextureHost*
WebRenderImageHost::GetAsTextureHostForComposite()
{
if (!mWrBridge) {
return nullptr;
}
int imageIndex = ChooseImageIndex();
if (imageIndex < 0) {
SetCurrentTextureHost(nullptr);
return nullptr;
}
if (mWrBridge && uint32_t(imageIndex) + 1 < mImages.Length()) {
if (uint32_t(imageIndex) + 1 < mImages.Length()) {
MOZ_ASSERT(mWrBridge->AsyncImageManager());
mWrBridge->AsyncImageManager()->CompositeUntil(mImages[imageIndex + 1].mTimeStamp + TimeDuration::FromMilliseconds(BIAS_TIME_MS));
}
@ -157,10 +161,22 @@ WebRenderImageHost::GetAsTextureHostForComposite()
TimedImage* img = &mImages[imageIndex];
if (mLastFrameID != img->mFrameID || mLastProducerID != img->mProducerID) {
if (mAsyncRef) {
ImageCompositeNotificationInfo info;
info.mImageBridgeProcessId = mAsyncRef.mProcessId;
info.mNotification = ImageCompositeNotification(
mAsyncRef.mHandle,
img->mTimeStamp, mWrBridge->AsyncImageManager()->GetCompositionTime(),
img->mFrameID, img->mProducerID);
mWrBridge->AsyncImageManager()->AppendImageCompositeNotification(info);
}
mLastFrameID = img->mFrameID;
mLastProducerID = img->mProducerID;
}
SetCurrentTextureHost(img->mTextureHost);
// XXX Add UpdateBias()
return mCurrentTextureHost;
}