Bug 1675409 - Migrated LayerTranslationMarkerPayload to Markers 2.0 API - r=gregtatum

Differential Revision: https://phabricator.services.mozilla.com/D96033
This commit is contained in:
Gerald Squelart 2020-11-18 21:44:53 +00:00
Родитель a8f0aede3a
Коммит e172777c88
2 изменённых файлов: 31 добавлений и 35 удалений

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

@ -40,10 +40,6 @@
#include <vector>
#include "GeckoProfiler.h" // for GeckoProfiler
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h" // for LayerTranslationMarkerPayload
#endif
static mozilla::LazyLogModule sGfxCullLog("gfx.culling");
#define CULLING_LOG(...) MOZ_LOG(sGfxCullLog, LogLevel::Debug, (__VA_ARGS__))
@ -103,9 +99,37 @@ static void PrintUniformityInfo(Layer* aLayer) {
}
Point translation = transform.As2D().GetTranslation();
PROFILER_ADD_MARKER_WITH_PAYLOAD("LayerTranslation", GRAPHICS,
LayerTranslationMarkerPayload,
(aLayer, translation, TimeStamp::Now()));
// Contains the translation applied to a 2d layer so we can track the layer
// position at each frame.
struct LayerTranslationMarker {
static constexpr Span<const char> MarkerTypeName() {
return MakeStringSpan("LayerTranslation");
}
static void StreamJSONMarkerData(
baseprofiler::SpliceableJSONWriter& aWriter,
ProfileBufferRawPointer<layers::Layer> aLayer, gfx::Point aPoint) {
const size_t bufferSize = 32;
char buffer[bufferSize];
SprintfLiteral(buffer, "%p", aLayer.mRawPointer);
aWriter.StringProperty("layer", buffer);
aWriter.IntProperty("x", aPoint.x);
aWriter.IntProperty("y", aPoint.y);
}
static MarkerSchema MarkerTypeDisplay() {
using MS = MarkerSchema;
MS schema{MS::Location::markerChart, MS::Location::markerTable};
schema.AddKeyLabelFormat("layer", "Layer", MS::Format::string);
schema.AddKeyLabelFormat("x", "X", MS::Format::integer);
schema.AddKeyLabelFormat("y", "Y", MS::Format::integer);
return schema;
}
};
profiler_add_marker("LayerTranslation", geckoprofiler::category::GRAPHICS, {},
LayerTranslationMarker{},
WrapProfileBufferRawPointer(aLayer), translation);
#endif
}

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

@ -27,7 +27,6 @@
# include "js/AllocationRecording.h"
# include "js/ProfilingFrameIterator.h"
# include "js/Utility.h"
# include "Layers.h"
# include "mozilla/ipc/ProtocolUtils.h"
# include "mozilla/net/HttpBaseChannel.h"
# include "mozilla/Preferences.h"
@ -44,33 +43,6 @@ using LongTask = mozilla::baseprofiler::markers::LongTask;
using Log = mozilla::baseprofiler::markers::Log;
using MediaSample = mozilla::baseprofiler::markers::MediaSample;
// Contains the translation applied to a 2d layer so we can track the layer
// position at each frame.
struct LayerTranslation {
static constexpr mozilla::Span<const char> MarkerTypeName() {
return mozilla::MakeStringSpan("LayerTranslation");
}
static void StreamJSONMarkerData(
mozilla::baseprofiler::SpliceableJSONWriter& aWriter,
mozilla::layers::Layer* aLayer, mozilla::gfx::Point aPoint) {
const size_t bufferSize = 32;
char buffer[bufferSize];
SprintfLiteral(buffer, "%p", aLayer);
aWriter.StringProperty("layer", buffer);
aWriter.IntProperty("x", aPoint.x);
aWriter.IntProperty("y", aPoint.y);
}
static mozilla::MarkerSchema MarkerTypeDisplay() {
using MS = mozilla::MarkerSchema;
MS schema{MS::Location::markerChart, MS::Location::markerTable};
schema.AddKeyLabelFormat("layer", "Layer", MS::Format::string);
schema.AddKeyLabelFormat("x", "X", MS::Format::integer);
schema.AddKeyLabelFormat("y", "Y", MS::Format::integer);
return schema;
}
};
// Tracks when a vsync occurs according to the HardwareComposer.
struct Vsync {
static constexpr mozilla::Span<const char> MarkerTypeName() {