ef57b7e653
The main meat of things is in SkThreadPool. We can now give SkThreadPool a type for each thread to create and destroy on its local stack. It's TLS without going through SkTLS. I've split the DM tasks into CpuTasks that run on threads with no TLS, and GpuTasks that run on threads with a thread local GrContextFactory. The old CpuTask and GpuTask have been renamed to CpuGMTask and GpuGMTask. Upshot: default run of out/Debug/dm goes from ~45 seconds to ~20 seconds. BUG=skia: R=bsalomon@google.com, mtklein@google.com, reed@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/179233005 git-svn-id: http://skia.googlecode.com/svn/trunk@13632 2bbb7eff-a529-9590-31e7-b0007b416f81
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#include "DMReplayTask.h"
|
|
#include "DMWriteTask.h"
|
|
#include "DMUtil.h"
|
|
|
|
#include "SkCommandLineFlags.h"
|
|
#include "SkPicture.h"
|
|
|
|
DEFINE_bool(replay, true, "If true, run picture replay tests.");
|
|
DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree.");
|
|
|
|
namespace DM {
|
|
|
|
ReplayTask::ReplayTask(const Task& parent,
|
|
skiagm::GM* gm,
|
|
SkBitmap reference,
|
|
bool useRTree)
|
|
: CpuTask(parent)
|
|
, fName(UnderJoin(parent.name().c_str(), useRTree ? "rtree" : "replay"))
|
|
, fGM(gm)
|
|
, fReference(reference)
|
|
, fUseRTree(useRTree)
|
|
{}
|
|
|
|
void ReplayTask::draw() {
|
|
SkPicture recorded;
|
|
const uint32_t flags = fUseRTree ? SkPicture::kOptimizeForClippedPlayback_RecordingFlag : 0;
|
|
RecordPicture(fGM.get(), &recorded, flags);
|
|
|
|
SkBitmap bitmap;
|
|
SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
|
|
DrawPicture(&recorded, &bitmap);
|
|
if (!BitmapsEqual(bitmap, fReference)) {
|
|
this->fail();
|
|
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
|
|
}
|
|
}
|
|
|
|
bool ReplayTask::shouldSkip() const {
|
|
if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
|
|
return true;
|
|
}
|
|
|
|
if (FLAGS_rtree && fUseRTree) {
|
|
return (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) != 0;
|
|
}
|
|
if (FLAGS_replay && !fUseRTree) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} // namespace DM
|