Backed out changeset 8665af6e62a6 (bug 1600793) on jcristau's request CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-02-24 15:49:47 +02:00
Родитель 96fb7127ec
Коммит 3053d61c49
12 изменённых файлов: 29 добавлений и 169 удалений

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

@ -58,15 +58,13 @@ class APZSampler {
* which thread it is.
*/
static void SetSamplerThread(const wr::WrWindowId& aWindowId);
static void SampleForWebRender(
const wr::WrWindowId& aWindowId, wr::Transaction* aTxn,
const wr::DocumentId& aRenderRootId,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered);
static void SampleForWebRender(const wr::WrWindowId& aWindowId,
wr::Transaction* aTxn,
const wr::DocumentId& aRenderRootId);
void SetSampleTime(const TimeStamp& aSampleTime);
void SampleForWebRender(wr::TransactionWrapper& aTxn,
wr::RenderRoot aRenderRoot,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered);
wr::RenderRoot aRenderRoot);
bool SampleAnimations(const LayerMetricsWrapper& aLayer,
const TimeStamp& aSampleTime);

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

@ -680,10 +680,9 @@ void APZCTreeManager::UpdateHitTestingTree(
aPaintSequenceNumber);
}
void APZCTreeManager::SampleForWebRender(
wr::TransactionWrapper& aTxn, const TimeStamp& aSampleTime,
wr::RenderRoot aRenderRoot,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered) {
void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
const TimeStamp& aSampleTime,
wr::RenderRoot aRenderRoot) {
AssertOnSamplerThread();
MutexAutoLock lock(mMapLock);
@ -706,27 +705,6 @@ void APZCTreeManager::SampleForWebRender(
asyncTransformComponents)
.mTranslation;
if (Maybe<CompositionPayload> payload = apzc->NotifyScrollSampling()) {
RefPtr<WebRenderBridgeParent> wrBridgeParent;
LayersId layersId = apzc->GetGuid().mLayersId;
CompositorBridgeParent::CallWithIndirectShadowTree(
layersId, [&](LayerTreeState& aState) -> void {
wrBridgeParent = aState.mWrBridge;
});
if (wrBridgeParent) {
wr::PipelineId pipelineId = wr::AsPipelineId(layersId);
for (size_t i = 0; i < aEpochsBeingRendered->Length(); i++) {
if ((*aEpochsBeingRendered)[i].pipeline_id == pipelineId) {
auto& epoch = (*aEpochsBeingRendered)[i].epoch;
wrBridgeParent->AddPendingScrollPayload(
*payload, std::make_pair(pipelineId, epoch));
break;
}
}
}
}
if (Maybe<uint64_t> zoomAnimationId = apzc->GetZoomAnimationId()) {
// for now we only support zooming on root content APZCs
MOZ_ASSERT(apzc->IsRootContent());

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

@ -202,8 +202,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
*/
void SampleForWebRender(wr::TransactionWrapper& aTxn,
const TimeStamp& aSampleTime,
wr::RenderRoot aRenderRoot,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered);
wr::RenderRoot aRenderRoot);
/**
* Refer to the documentation of APZInputBridge::ReceiveInputEvent() and

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

@ -65,14 +65,12 @@ void APZSampler::SetSamplerThread(const wr::WrWindowId& aWindowId) {
}
/*static*/
void APZSampler::SampleForWebRender(
const wr::WrWindowId& aWindowId, wr::Transaction* aTransaction,
const wr::DocumentId& aRenderRootId,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered) {
void APZSampler::SampleForWebRender(const wr::WrWindowId& aWindowId,
wr::Transaction* aTransaction,
const wr::DocumentId& aRenderRootId) {
if (RefPtr<APZSampler> sampler = GetSampler(aWindowId)) {
wr::TransactionWrapper txn(aTransaction);
sampler->SampleForWebRender(txn, wr::RenderRootFromId(aRenderRootId),
aEpochsBeingRendered);
sampler->SampleForWebRender(txn, wr::RenderRootFromId(aRenderRootId));
}
}
@ -82,9 +80,8 @@ void APZSampler::SetSampleTime(const TimeStamp& aSampleTime) {
mSampleTime = aSampleTime;
}
void APZSampler::SampleForWebRender(
wr::TransactionWrapper& aTxn, wr::RenderRoot aRenderRoot,
const wr::WrPipelineIdEpochs* aEpochsBeingRendered) {
void APZSampler::SampleForWebRender(wr::TransactionWrapper& aTxn,
wr::RenderRoot aRenderRoot) {
AssertOnSamplerThread();
TimeStamp sampleTime;
{ // scope lock
@ -96,7 +93,7 @@ void APZSampler::SampleForWebRender(
// anyway, so using Timestamp::Now() should be fine.
sampleTime = mSampleTime.IsNull() ? TimeStamp::Now() : mSampleTime;
}
mApz->SampleForWebRender(aTxn, sampleTime, aRenderRoot, aEpochsBeingRendered);
mApz->SampleForWebRender(aTxn, sampleTime, aRenderRoot);
}
bool APZSampler::SampleAnimations(const LayerMetricsWrapper& aLayer,
@ -269,12 +266,11 @@ void apz_register_sampler(mozilla::wr::WrWindowId aWindowId) {
mozilla::layers::APZSampler::SetSamplerThread(aWindowId);
}
void apz_sample_transforms(
mozilla::wr::WrWindowId aWindowId, mozilla::wr::Transaction* aTransaction,
mozilla::wr::DocumentId aDocumentId,
const mozilla::wr::WrPipelineIdEpochs* aEpochsBeingRendered) {
mozilla::layers::APZSampler::SampleForWebRender(
aWindowId, aTransaction, aDocumentId, aEpochsBeingRendered);
void apz_sample_transforms(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::Transaction* aTransaction,
mozilla::wr::DocumentId aDocumentId) {
mozilla::layers::APZSampler::SampleForWebRender(aWindowId, aTransaction,
aDocumentId);
}
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId) {}

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

@ -2352,13 +2352,6 @@ void CompositorBridgeParent::NotifyPipelineRendered(
mIsForcedFirstPaint = false;
}
std::pair<wr::PipelineId, wr::Epoch> key(aPipelineId, aEpoch);
if (nsTArray<CompositionPayload>* payloads =
mWrBridge->GetPendingScrollPayload(key)) {
RecordCompositionPayloadsPresented(*payloads);
mWrBridge->RemovePendingScrollPayload(key);
}
TransactionId transactionId = mWrBridge->FlushTransactionIdsForEpoch(
aEpoch, aCompositeStartId, aCompositeStart, aRenderStart,
aCompositeEnd, uiController);
@ -2379,13 +2372,6 @@ void CompositorBridgeParent::NotifyPipelineRendered(
MOZ_ASSERT(!wrBridge->IsRootWebRenderBridgeParent());
wrBridge->RemoveEpochDataPriorTo(aEpoch);
if (!mPaused) {
std::pair<wr::PipelineId, wr::Epoch> key(aPipelineId, aEpoch);
if (nsTArray<CompositionPayload>* payloads =
wrBridge->GetPendingScrollPayload(key)) {
RecordCompositionPayloadsPresented(*payloads);
wrBridge->RemovePendingScrollPayload(key);
}
TransactionId transactionId = wrBridge->FlushTransactionIdsForEpoch(
aEpoch, aCompositeStartId, aCompositeStart, aRenderStart,
aCompositeEnd, uiController, aStats, &stats);

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

@ -1047,24 +1047,6 @@ WebRenderBridgeParent::GetCollectedFrames() {
return Api(wr::RenderRoot::Default)->GetCollectedFrames();
}
void WebRenderBridgeParent::AddPendingScrollPayload(
CompositionPayload& aPayload,
const std::pair<wr::PipelineId, wr::Epoch>& aKey) {
nsTArray<CompositionPayload>* payloads =
mPendingScrollPayloads.LookupOrAdd(aKey);
payloads->AppendElement(aPayload);
}
nsTArray<CompositionPayload>* WebRenderBridgeParent::GetPendingScrollPayload(
const std::pair<wr::PipelineId, wr::Epoch>& aKey) const {
return mPendingScrollPayloads.Get(aKey);
}
bool WebRenderBridgeParent::RemovePendingScrollPayload(
const std::pair<wr::PipelineId, wr::Epoch>& aKey) {
return mPendingScrollPayloads.Remove(aKey);
}
CompositorBridgeParent* WebRenderBridgeParent::GetRootCompositorBridgeParent()
const {
if (!mCompositorBridge) {

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

@ -52,42 +52,6 @@ class CompositorVsyncScheduler;
class AsyncImagePipelineManager;
class WebRenderImageHost;
class PipelineIdAndEpochHashEntry : public PLDHashEntryHdr {
public:
typedef const std::pair<wr::PipelineId, wr::Epoch>& KeyType;
typedef const std::pair<wr::PipelineId, wr::Epoch>* KeyTypePointer;
enum { ALLOW_MEMMOVE = true };
explicit PipelineIdAndEpochHashEntry(wr::PipelineId aPipelineId,
wr::Epoch aEpoch)
: mValue(aPipelineId, aEpoch) {}
PipelineIdAndEpochHashEntry(PipelineIdAndEpochHashEntry&& aOther) = default;
explicit PipelineIdAndEpochHashEntry(KeyTypePointer aKey)
: mValue(aKey->first, aKey->second) {}
~PipelineIdAndEpochHashEntry() {}
KeyType GetKey() const { return mValue; }
bool KeyEquals(KeyTypePointer aKey) const {
return mValue.first.mHandle == aKey->first.mHandle &&
mValue.first.mNamespace == aKey->first.mNamespace &&
mValue.second.mHandle == aKey->second.mHandle;
};
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
static PLDHashNumber HashKey(KeyTypePointer aKey) {
return mozilla::HashGeneric(aKey->first.mHandle, aKey->first.mNamespace,
aKey->second.mHandle);
}
private:
std::pair<wr::PipelineId, wr::Epoch> mValue;
};
class WebRenderBridgeParent final
: public PWebRenderBridgeParent,
public CompositorVsyncSchedulerOwner,
@ -356,15 +320,6 @@ class WebRenderBridgeParent final
RefPtr<wr::WebRenderAPI::GetCollectedFramesPromise> GetCollectedFrames();
void DisableNativeCompositor();
void AddPendingScrollPayload(
CompositionPayload& aPayload,
const std::pair<wr::PipelineId, wr::Epoch>& aKey);
nsTArray<CompositionPayload>* GetPendingScrollPayload(
const std::pair<wr::PipelineId, wr::Epoch>& aKey) const;
bool RemovePendingScrollPayload(
const std::pair<wr::PipelineId, wr::Epoch>& aKey);
private:
class ScheduleSharedSurfaceRelease;
@ -603,10 +558,6 @@ class WebRenderBridgeParent final
LayersObserverEpoch mParentLayersObserverEpoch;
std::deque<PendingTransactionId> mPendingTransactionIds;
// These payloads are being used for SCROLL_PRESENT_LATENCY telemetry
nsClassHashtable<PipelineIdAndEpochHashEntry, nsTArray<CompositionPayload>>
mPendingScrollPayloads;
std::queue<CompositorAnimationIdsForEpoch> mCompositorAnimationsToDelete;
wr::Epoch mWrEpoch;
wr::IdNamespace mIdNamespace;

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

@ -30,7 +30,7 @@ use webrender::{
BinaryRecorder, Compositor, DebugFlags, Device,
NativeSurfaceId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, VertexUsageHint,
WrShaders, set_profiler_hooks, CompositorConfig, NativeSurfaceInfo, NativeTileId, FastHashMap
WrShaders, set_profiler_hooks, CompositorConfig, NativeSurfaceInfo, NativeTileId
};
use thread_profiler::register_thread_with_profiler;
use moz2d_renderer::Moz2dBlobImageHandler;
@ -766,23 +766,6 @@ impl<'a> From<(&'a(WrPipelineId, WrDocumentId), &'a WrEpoch)> for WrPipelineEpoc
}
}
#[repr(C)]
pub struct WrPipelineIdAndEpoch {
pipeline_id: WrPipelineId,
epoch: WrEpoch
}
impl<'a> From<(&WrPipelineId, &WrEpoch)> for WrPipelineIdAndEpoch {
fn from(tuple: (&WrPipelineId, &WrEpoch)) -> WrPipelineIdAndEpoch {
WrPipelineIdAndEpoch {
pipeline_id: *tuple.0,
epoch: *tuple.1,
}
}
}
type WrPipelineIdEpochs = ThinVec<WrPipelineIdAndEpoch>;
#[repr(C)]
pub struct WrRemovedPipeline {
pipeline_id: WrPipelineId,
@ -887,8 +870,7 @@ extern "C" {
// sampler thread)
fn apz_register_sampler(window_id: WrWindowId);
fn apz_sample_transforms(window_id: WrWindowId, transaction: &mut Transaction,
document_id: WrDocumentId,
epochs_being_rendered: &WrPipelineIdEpochs);
document_id: WrDocumentId);
fn apz_deregister_sampler(window_id: WrWindowId);
}
@ -969,14 +951,9 @@ impl AsyncPropertySampler for SamplerCallback {
unsafe { apz_register_sampler(self.window_id) }
}
fn sample(&self, document_id: DocumentId,
epochs_being_rendered: &FastHashMap<PipelineId, Epoch>) -> Vec<FrameMsg> {
fn sample(&self, document_id: DocumentId) -> Vec<FrameMsg> {
let mut transaction = Transaction::new();
unsafe { apz_sample_transforms(
self.window_id, &mut transaction,
document_id, &epochs_being_rendered.iter()
.map(WrPipelineIdAndEpoch::from).collect()
)};
unsafe { apz_sample_transforms(self.window_id, &mut transaction, document_id) };
// TODO: also omta_sample_transforms(...)
transaction.get_frame_ops()
}

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

@ -73,9 +73,6 @@ struct WrWindowId;
struct DocumentId;
struct WrPipelineInfo;
struct WrPipelineIdAndEpoch;
using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
const uint64_t ROOT_CLIP_CHAIN = ~0;
} // namespace wr
@ -91,8 +88,7 @@ void apz_deregister_updater(mozilla::wr::WrWindowId aWindowId);
void apz_register_sampler(mozilla::wr::WrWindowId aWindowId);
void apz_sample_transforms(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::Transaction* aTransaction,
mozilla::wr::DocumentId aRenderRootId,
const mozilla::wr::WrPipelineIdEpochs* aPipelineEpochs);
mozilla::wr::DocumentId aRenderRootId);
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId);
} // extern "C"

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

@ -217,7 +217,6 @@ pub use crate::renderer::{
RendererStats, SceneBuilderHooks, ThreadListener, ShaderPrecacheFlags,
MAX_VERTEX_TEXTURE_WIDTH,
};
pub use crate::internal_types::FastHashMap;
pub use crate::screen_capture::{AsyncScreenshotHandle, RecordedFrameHandle};
pub use crate::shade::{Shaders, WrShaders};
pub use api as webrender_api;

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

@ -1489,8 +1489,6 @@ impl RenderBackend {
) {
let requested_frame = render_frame;
let requires_frame_build = self.requires_frame_build();
let doc = self.documents.get_mut(&document_id).unwrap();
// If we have a sampler, get more frame ops from it and add them
// to the transaction. This is a hook to allow the WR user code to
// fiddle with things after a potentially long scene build, but just
@ -1498,11 +1496,12 @@ impl RenderBackend {
// async transforms.
if requested_frame || has_built_scene {
if let Some(ref sampler) = self.sampler {
frame_ops.append(&mut sampler.sample(document_id,
&doc.scene.pipeline_epochs));
frame_ops.append(&mut sampler.sample(document_id));
}
}
let requires_frame_build = self.requires_frame_build();
let doc = self.documents.get_mut(&document_id).unwrap();
doc.has_built_scene |= has_built_scene;
// If there are any additions or removals of clip modes

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

@ -6231,8 +6231,7 @@ pub trait AsyncPropertySampler {
/// This is called for each transaction with the generate_frame flag set
/// (i.e. that will trigger a render). The list of frame messages returned
/// are processed as though they were part of the original transaction.
fn sample(&self, document_id: DocumentId,
doc: &FastHashMap<PipelineId, Epoch>) -> Vec<FrameMsg>;
fn sample(&self, document_id: DocumentId) -> Vec<FrameMsg>;
/// This is called exactly once, when the render backend thread is about to
/// terminate.
fn deregister(&self);