better tracing

Change-Id: I778703ae91df56ba4b7dd768637ac774010c4e08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481197
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2021-12-07 11:41:36 -05:00 committed by SkCQ
parent 58a768b68f
commit 1c4cf27965
10 changed files with 39 additions and 13 deletions

View File

@ -101,6 +101,14 @@ struct SkPackedGlyphID {
return str;
}
SkString shortDump() const {
SkString str;
str.appendf("0x%x|%1d|%1d", this->glyphID(),
this->subPixelField(kSubPixelX),
this->subPixelField(kSubPixelY));
return str;
}
private:
static constexpr uint32_t PackIDSubXSubY(SkGlyphID glyphID, uint32_t x, uint32_t y) {
SkASSERT(x < (1u << kSubPixelPosLen));
@ -164,8 +172,12 @@ private:
return ((uint32_t)n >> kFixedPointSubPixelPosBits) & kSubPixelPosMask;
}
constexpr uint32_t subPixelField(uint32_t subPixelPosBit) const {
return (fID >> subPixelPosBit) & kSubPixelPosMask;
}
constexpr SkFixed subToFixed(uint32_t subPixelPosBit) const {
uint32_t subPixelPosition = (fID >> subPixelPosBit) & kSubPixelPosMask;
uint32_t subPixelPosition = this->subPixelField(subPixelPosBit);
return subPixelPosition << kFixedPointSubPixelPosBits;
}

View File

@ -104,7 +104,7 @@ SkString SkDrawableGlyphBuffer::dumpInput() const {
SkString msg;
for (auto [packedGlyphID, pos]
: SkZip<SkGlyphVariant, SkPoint>{fInputSize, fMultiBuffer.get(), fPositions.get()}) {
msg.appendf("0x%x:(%a,%a), ", packedGlyphID.packedID().value(), pos.x(), pos.y());
msg.appendf("%s:(%a,%a), ", packedGlyphID.packedID().shortDump().c_str(), pos.x(), pos.y());
}
return msg;
}

View File

@ -74,8 +74,6 @@ public:
SkGlyphRunList(const SkGlyphRun& glyphRun, const SkRect& bounds, SkPoint origin);
uint64_t uniqueID() const;
bool anyRunsLCD() const;
void temporaryShuntBlobNotifyAddedToCache(uint32_t cacheID) const;

View File

@ -35,6 +35,7 @@
#include "src/core/SkStrikeSpec.h"
#include "src/core/SkTraceEvent.h"
#include <cinttypes>
#include <climits>
// -- SkGlyphRunListPainter ------------------------------------------------------------------------
@ -229,14 +230,21 @@ void SkGlyphRunListPainter::processGlyphRun(const SkGlyphRun& glyphRun,
const SkPaint& runPaint,
const GrSDFTControl& control,
SkGlyphRunPainterInterface* process,
const char* tag) {
const char* tag,
uint64_t uniqueID) {
#if defined(SK_TRACE_GLYPH_RUN_PROCESS)
SkString msg;
msg.appendf("\nStart glyph run processing");
if (tag != nullptr) {
msg.appendf(" for %s ", tag);
if (uniqueID != SK_InvalidUniqueID) {
msg.appendf(" uniqueID: %" PRIu64, uniqueID);
}
}
msg.appendf("\n");
msg.appendf("\n matrix\n");
msg.appendf(" %7.3g %7.3g %7.3g\n %7.3g %7.3g %7.3g\n",
drawMatrix[0], drawMatrix[1], drawMatrix[2],
drawMatrix[3], drawMatrix[4], drawMatrix[5]);
#endif
ScopedBuffers _ = this->ensureBuffers(glyphRun);
fRejects.setSource(glyphRun.source());

View File

@ -92,7 +92,8 @@ public:
const SkPaint& drawPaint,
const GrSDFTControl& control,
SkGlyphRunPainterInterface* process,
const char* tag = nullptr);
const char* tag = nullptr,
uint64_t blobID = SK_InvalidUniqueID);
#endif // SK_SUPPORT_GPU
private:

View File

@ -808,13 +808,15 @@ protected:
SkMatrix drawMatrix = this->localToDevice();
drawMatrix.preTranslate(glyphRunList.origin().x(), glyphRunList.origin().y());
const uint64_t uniqueID = glyphRunList.uniqueID();
for (auto& glyphRun : glyphRunList) {
fPainter.processGlyphRun(glyphRun,
drawMatrix,
paint,
control,
nullptr,
"Cache Diff");
"Cache Diff",
uniqueID);
}
#endif // SK_SUPPORT_GPU
}

View File

@ -141,7 +141,7 @@ public:
fFrameWidth, fMiterLimit, fMaskFormat, fStrokeJoin, fStrokeCap, fFlags);
msg.appendf(" lum bits %x, device gamma %d, paint gamma %d contrast %d\n", fLumBits,
fDeviceGamma, fPaintGamma, fContrast);
msg.appendf(" foreground color %x", fForegroundColor);
msg.appendf(" foreground color %x\n", fForegroundColor);
return msg;
}

View File

@ -63,7 +63,7 @@ void SkStrikeCache::Dump() {
auto visitor = [&counter](const SkStrike& strike) {
const SkScalerContextRec& rec = strike.fScalerCache.getScalerContext()->getRec();
SkDebugf("index %d\n", counter);
SkDebugf("index %d checksum: %x\n", counter, strike.getDescriptor().getChecksum());
SkDebugf("%s", rec.dump().c_str());
counter += 1;
};

View File

@ -26,7 +26,8 @@ bool SkScalerContextProxy::generateAdvance(SkGlyph* glyph) {
void SkScalerContextProxy::generateMetrics(SkGlyph* glyph, SkArenaAlloc*) {
TRACE_EVENT1("skia", "generateMetrics", "rec", TRACE_STR_COPY(this->getRec().dump().c_str()));
if (this->getProxyTypeface()->isLogging()) {
SkDebugf("GlyphCacheMiss generateMetrics: %s\n", this->getRec().dump().c_str());
SkDebugf("GlyphCacheMiss generateMetrics looking for glyph: %x\n generateMetrics: %s\n",
glyph->getPackedID().value(), this->getRec().dump().c_str());
}
glyph->fMaskFormat = fRec.fMaskFormat;

View File

@ -1551,13 +1551,15 @@ sk_sp<GrTextBlob> GrTextBlob::Make(const SkGlyphRunList& glyphRunList,
sk_sp<GrTextBlob> blob{new (allocation)
GrTextBlob(bytesNeededForSubRun, positionMatrix, initialLuminance)};
const uint64_t uniqueID = glyphRunList.uniqueID();
for (auto& glyphRun : glyphRunList) {
painter->processGlyphRun(glyphRun,
positionMatrix,
paint,
control,
blob.get(),
"GrTextBlob");
"GrTextBlob",
uniqueID);
}
return blob;
@ -3080,13 +3082,15 @@ sk_sp<Slug> Slug::Make(const SkMatrixProvider& viewMatrix,
glyphRunList.origin(),
bytesNeededForSubRun)};
const uint64_t uniqueID = glyphRunList.uniqueID();
for (auto& glyphRun : glyphRunList) {
painter->processGlyphRun(glyphRun,
positionMatrix,
paint,
control,
slug.get(),
"Slug");
"Slug",
uniqueID);
}
return slug;